:root {
    --black: #0a0a0a;
    --white: #ffffff;
    --gray: #6e6e73;
    --gray-lighter: #f5f5f7;
    --gray-light: #e3e3e3;
    --blue: #1d4ed8;
    --max-width: 1000px;
    --side-padding: 3rem;
    --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Helvetica, Arial, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--black);
    background: var(--white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

section {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 3.5rem var(--side-padding);
}

section + section {
    border-top: 1px solid var(--gray-light);
}

section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 0.5rem;
}

.section-intro {
    color: var(--gray);
    margin: 0 0 2rem;
    max-width: 46ch;
}

/* Header */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem var(--side-padding);
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.site-header .logo {
    position: relative;
    display: inline-block;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--black);
}

.site-header .logo .nav-underline {
    color: var(--gray);
}

.nav-underline-mobile {
    display: none;
}

.site-header .logo.is-active .nav-underline {
    opacity: 1;
}

.site-header .logo.is-active .nav-underline path {
    animation: draw-underline 0.8s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

.site-header .logo .logo-secondary {
    color: var(--gray);
    font-weight: 500;
}

.site-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}

.site-header nav a {
    position: relative;
    display: inline-block;
    font-size: 0.95rem;
    color: var(--gray);
    padding-bottom: 8px;
    transition: color 0.2s ease;
}

.nav-label {
    position: relative;
    display: inline-block;
}

.site-header nav a:hover {
    color: var(--black);
}

.site-header nav a.is-active {
    color: var(--black);
    font-weight: 500;
}

.nav-underline {
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 100%;
    height: 9px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.nav-underline path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
}

@keyframes draw-underline {
    to {
        stroke-dashoffset: 0;
    }
}

.site-header nav a.is-active .nav-underline {
    opacity: 1;
}

.site-header nav a.is-active .nav-underline path {
    animation: draw-underline 0.8s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

.site-header nav a[data-menu="0"] .nav-underline { color: #ef6f6f; }
.site-header nav a[data-menu="1"] .nav-underline { color: #5b9bf0; }
.site-header nav a[data-menu="2"] .nav-underline { color: #6bc190; }
.site-header nav a[data-menu="3"] .nav-underline { color: #b481e0; }
.site-header nav a[data-menu="4"] .nav-underline { color: #f0a955; }
.site-header nav a[data-menu="5"] .nav-underline { color: #4fc4c4; }

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 20;
}

.menu-toggle-bar {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--black);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Hero */
.hero {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.hero-portrait {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1.5rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 0.9rem;
}

.hero .tagline {
    font-size: 1.1rem;
    color: var(--gray);
    margin: 0;
    max-width: 52ch;
}

.hero-pixels {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-top: 1.5rem;
}

.pixel-icon {
    display: block;
    width: 20px;
    height: 20px;
    shape-rendering: crispEdges;
    transition: transform 0.2s ease;
}

.pixel-icon rect {
    fill: currentColor;
}

.pixel-icon-wrap {
    position: relative;
    display: inline-flex;
    cursor: default;
}

.pixel-icon-wrap:hover .pixel-icon {
    transform: scale(1.3) rotate(-4deg);
}

.pixel-icon-wrap::after,
.pixel-icon-wrap::before {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.pixel-icon-wrap::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 11px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--black);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    padding: 0.45rem 0.7rem;
    border-radius: 6px;
    z-index: 5;
}

.pixel-icon-wrap::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border: 5px solid transparent;
    border-top-color: var(--black);
    z-index: 5;
}

.pixel-icon-wrap:hover::after,
.pixel-icon-wrap:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Keep the bubble on-screen for the icons closest to the edges */
.hero-pixels .pixel-icon-wrap:first-child::after {
    left: 0;
    transform: translateX(0) translateY(4px);
}

.hero-pixels .pixel-icon-wrap:first-child:hover::after {
    transform: translateX(0) translateY(0);
}

.hero-pixels .pixel-icon-wrap:last-child::after {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(4px);
}

.hero-pixels .pixel-icon-wrap:last-child:hover::after {
    transform: translateX(0) translateY(0);
}

/* Expertise */
.expertise-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem 2rem;
}

.expertise-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 0.6rem;
}

.expertise-card p {
    font-size: 0.95rem;
    color: var(--gray);
    margin: 0;
}

.expertise-grid > .reveal:nth-child(1) { transition-delay: 0ms; }
.expertise-grid > .reveal:nth-child(2) { transition-delay: 80ms; }
.expertise-grid > .reveal:nth-child(3) { transition-delay: 160ms; }
.expertise-grid > .reveal:nth-child(4) { transition-delay: 240ms; }

/* Work */
.work-columns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem 2rem;
}

.work-block h3 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 1.1rem;
}

.work-item {
    margin: 0 0 1.1rem;
    color: var(--gray);
}

.work-item:last-child {
    margin-bottom: 0;
}

.work-item a {
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: var(--gray-light);
    transition: text-decoration-color 0.2s ease;
}

.work-item a:hover {
    text-decoration-color: var(--black);
}

.work-columns > .reveal:nth-child(1) { transition-delay: 0ms; }
.work-columns > .reveal:nth-child(2) { transition-delay: 80ms; }

/* Notes */
.notes-list {
    display: flex;
    flex-direction: column;
}

.note-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.25rem 0;
    border-top: 1px solid var(--gray-light);
    transition: opacity 0.2s ease;
}

.note-item:first-child {
    border-top: none;
}

.note-item:hover {
    opacity: 0.6;
}

.note-thumb {
    flex-shrink: 0;
    width: 96px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    order: 2;
}

.note-body {
    flex: 1;
    min-width: 0;
    order: 1;
}

.note-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.note-title {
    font-weight: 500;
    font-size: 1.05rem;
}

.note-title:hover {
    text-decoration: underline;
}

.note-category {
    font-size: 0.8rem;
    color: var(--gray);
    white-space: nowrap;
}

.note-meta-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.lang-pill {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--gray);
    border: 1px solid var(--gray-light);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    white-space: nowrap;
}

.note-summary {
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
    color: var(--gray);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty-state {
    color: var(--gray);
}

.notes-view-all {
    margin: 2rem 0 0;
}

/* Notes: filters */
.notes-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0 0 2.5rem;
}

.filter-pill {
    font: inherit;
    font-size: 0.85rem;
    color: var(--gray);
    background: none;
    border: 1px solid var(--gray-light);
    border-radius: 8px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.filter-pill:hover {
    border-color: var(--black);
    color: var(--black);
}

.filter-pill.is-active {
    background: var(--black);
    border-color: var(--black);
    color: var(--white);
}

/* Notes: grouped by year */
.notes-year + .notes-year {
    margin-top: 2.5rem;
}

.notes-year-heading {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray);
    margin: 0 0 0.5rem;
}

.is-hidden {
    display: none !important;
}

/* Projects */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.project-card {
    display: block;
    padding: 1.5rem;
    border: 1px solid var(--gray-light);
    border-radius: 12px;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

a.project-card:hover {
    border-color: var(--black);
    transform: translateY(-2px);
}

.project-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.4rem;
    letter-spacing: -0.01em;
}

.project-card p {
    font-size: 0.95rem;
    color: var(--gray);
    margin: 0;
}

/* Academic */
.academic-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2.5rem;
}

.academic-card {
    display: block;
    padding: 1.5rem;
    border: 1px solid var(--gray-light);
    border-radius: 12px;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

a.academic-card:hover {
    border-color: var(--black);
    transform: translateY(-2px);
}

.academic-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 0.5rem;
}

.academic-program {
    font-size: 0.95rem;
    color: var(--gray);
    margin: 0 0 0.5rem;
}

.academic-meta {
    font-size: 0.85rem;
    color: var(--gray);
    margin: 0 0 0.2rem;
}

.academic-entry header .academic-program {
    font-size: 1rem;
    margin-top: 0.75rem;
}

.academic-figure {
    margin: 0 0 2.5rem;
}

.academic-figure img {
    width: 100%;
    border-radius: 12px;
    display: block;
}

.academic-figure figcaption {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--gray);
}

.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 1.4rem;
}

.keyword-pill {
    font-size: 0.8rem;
    color: var(--gray);
    background: var(--gray-light);
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
}

.button {
    display: inline-block;
    padding: 0.7rem 1.4rem;
    background: #E3E3E3;
    color: var(--black);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.button:hover {
    opacity: 0.9;
}

.button-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.button-with-icon svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Contact */
.contact-icons {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    margin-top: 1.5rem;
}

.contact-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--gray);
    transition: color 0.2s ease, transform 0.2s ease;
}

.contact-icon svg {
    width: 22px;
    height: 22px;
}

.contact-icon:hover {
    color: var(--black);
    transform: translateY(-2px);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Single article / page */
.single {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 3rem var(--side-padding) 5rem;
}

.single .back-link {
    display: inline-block;
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 2.5rem;
    transition: color 0.2s ease;
}

.single .back-link:hover {
    color: var(--black);
}

.single header {
    max-width: 680px;
    margin: 0 0 2.5rem;
}

.single header .meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.single header time {
    font-size: 0.85rem;
    color: var(--gray);
}

.single .category-pill {
    font-size: 0.75rem;
    color: var(--gray);
    background: var(--gray-light);
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
}

.single header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0;
}

.article-summary {
    font-size: 1.1rem;
    color: var(--gray);
    margin: 0.9rem 0 0;
}

.article-figure {
    margin: 0 0 2.5rem;
}

.article-figure img {
    width: 100%;
    border-radius: 12px;
    display: block;
}

.article-body {
    display: flex;
    align-items: flex-start;
    gap: 3.5rem;
}

.single .content {
    min-width: 0;
    max-width: 680px;
    font-size: 1.05rem;
    line-height: 1.75;
}

.single .content h2,
.single .content h3 {
    scroll-margin-top: 2rem;
}

/* Table of contents (wide screens only, appears once you start scrolling) */
.article-toc {
    display: none;
    position: sticky;
    top: 2.5rem;
    flex-shrink: 0;
    width: 190px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

@media (min-width: 1150px) {
    .article-toc.has-items {
        display: block;
    }
}

.article-toc.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.article-toc-top {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--gray);
    margin: 0 0 1.1rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--gray-light);
    width: 100%;
    transition: color 0.2s ease;
}

.article-toc-top:hover {
    color: var(--black);
}

.article-toc-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray);
    margin: 0 0 0.9rem;
}

.article-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid var(--gray-light);
}

.article-toc li {
    margin: 0;
}

.article-toc a {
    display: block;
    padding: 0.35rem 0 0.35rem 0.9rem;
    margin-left: -1px;
    border-left: 1px solid transparent;
    font-size: 0.85rem;
    color: var(--gray);
    line-height: 1.4;
    transition: color 0.25s ease, border-color 0.25s ease;
}

.article-toc li.article-toc-sub a {
    padding-left: 1.7rem;
    font-size: 0.8rem;
}

.article-toc a:hover {
    color: var(--black);
}

.article-toc a.is-active {
    color: var(--black);
    font-weight: 500;
    border-left-color: var(--black);
}

/* End-of-article divider + "Read more" */
.section-divider {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin: 4rem 0 3rem;
}

.section-divider::before,
.section-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--gray-light);
}

.section-divider-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(10, 10, 10, 0.07);
    color: var(--gray);
    transform: rotate(-4deg);
}

.section-divider-icon svg {
    width: 20px;
    height: 20px;
}

.read-more {
    margin-bottom: 1.5rem;
}

.read-more h2 {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 1.5rem;
}

.single .content > *:first-child {
    margin-top: 0;
}

.single .content p {
    margin: 0 0 1.4rem;
}

.single .content h2 {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 2.5rem 0 1rem;
}

.single .content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 2rem 0 0.75rem;
}

.single .content ul,
.single .content ol {
    margin: 0 0 1.4rem;
    padding-left: 1.25rem;
}

.single .content li {
    margin-bottom: 0.5rem;
}

.single .content .checklist {
    list-style: none;
    padding-left: 0;
    margin: 0 0 1.4rem;
}

.single .content .checklist li {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    margin-bottom: 0.65rem;
}

.single .content .checklist input[type="checkbox"] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: var(--black);
    transform: translateY(1px);
}

.single .content .icon-list {
    list-style: none;
    padding-left: 0;
    margin: 0 0 1.4rem;
}

.single .content .icon-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 0.9rem;
}

.single .content .icon-list svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 0.1rem;
    color: var(--gray);
}

.single .content .checklist li:has(input:checked) {
    color: var(--gray);
    text-decoration: line-through;
    text-decoration-color: var(--gray-light);
}

.single .content a {
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: var(--blue);
    text-decoration-thickness: 2px;
    transition: text-decoration-color 0.2s ease;
    font-weight: 600;
}

.single .content a:hover {
    text-decoration-color: var(--black);
}

.single .content a.button {
    text-decoration: none;
}

.single .content strong {
    font-weight: 600;
}

/* Medium/Notion-style link preview card — a bare URL alone on its own line */
.single .content a.link-preview-card {
    display: flex;
    align-items: stretch;
    text-decoration: none;
    color: var(--black);
    border: 1px solid var(--gray-light);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.single .content a.link-preview-card:hover {
    border-color: var(--gray);
}

.link-preview-body {
    flex: 1;
    min-width: 0;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
}

.link-preview-title {
    font-weight: 600;
    font-size: 0.98rem;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.link-preview-desc {
    font-size: 0.85rem;
    color: var(--gray);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.link-preview-domain {
    font-size: 0.75rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0.2rem 0 0;
}

.link-preview-image {
    flex-shrink: 0;
    width: 180px;
    min-height: 120px;
}

.link-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 480px) {
    .single .content a.link-preview-card {
        flex-direction: column-reverse;
    }

    .link-preview-image {
        width: 100%;
        height: 140px;
    }
}

.single .content blockquote {
    margin: 0 0 1.4rem;
    padding-left: 1.25rem;
    border-left: 2px solid var(--black);
    color: var(--gray);
    font-style: italic;
}

/* GitHub-style callouts: > [!NOTE] / [!TIP] / [!IMPORTANT] / [!WARNING] / [!CAUTION] */
.single .content blockquote.callout {
    padding: 1rem 1.25rem;
    background: var(--gray-lighter);
    border-left-width: 3px;
    border-radius: 6px;
    color: var(--black);
    font-style: normal;
}

.single .content blockquote.callout p {
    margin: 0;
}

.single .content blockquote.callout p + p {
    margin-top: 0.75rem;
}

.single .content .callout-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.single .content .callout-title svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.single .content blockquote.callout-note {
    border-left-color: #5b9bf0;
}

.single .content .callout-note .callout-title {
    color: #5b9bf0;
}

.single .content blockquote.callout-tip {
    border-left-color: #6bc190;
}

.single .content .callout-tip .callout-title {
    color: #6bc190;
}

.single .content blockquote.callout-important {
    border-left-color: #b481e0;
}

.single .content .callout-important .callout-title {
    color: #b481e0;
}

.single .content blockquote.callout-warning {
    border-left-color: #f0a955;
}

.single .content .callout-warning .callout-title {
    color: #f0a955;
}

.single .content blockquote.callout-caution {
    border-left-color: #ef6f6f;
}

.single .content .callout-caution .callout-title {
    color: #ef6f6f;
}

.single .content code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--gray-light);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.single .content pre {
    position: relative;
    margin: 0 0 1.4rem;
    padding: 1.25rem;
    padding-top: 2.6rem;
    background: #1a1a1a;
    color: #e3e3e3;
    border-radius: 8px;
    overflow-x: auto;
}

.single .content pre code {
    background: none;
    padding: 0;
}

/* Pygments token colors, reusing the site's accent palette */
.single .content .highlight .c,
.single .content .highlight .c1,
.single .content .highlight .cm,
.single .content .highlight .cs {
    color: #8a8a8a;
    font-style: italic;
}

.single .content .highlight .k,
.single .content .highlight .kc,
.single .content .highlight .kd,
.single .content .highlight .kn,
.single .content .highlight .kp,
.single .content .highlight .kr,
.single .content .highlight .kt {
    color: #ef6f6f;
}

.single .content .highlight .s,
.single .content .highlight .s1,
.single .content .highlight .s2,
.single .content .highlight .sb,
.single .content .highlight .sc,
.single .content .highlight .sd,
.single .content .highlight .se,
.single .content .highlight .sh,
.single .content .highlight .si,
.single .content .highlight .sx,
.single .content .highlight .sr,
.single .content .highlight .ss {
    color: #6bc190;
}

.single .content .highlight .na,
.single .content .highlight .nb,
.single .content .highlight .nf {
    color: #5b9bf0;
}

.single .content .highlight .nc,
.single .content .highlight .no,
.single .content .highlight .m,
.single .content .highlight .mi,
.single .content .highlight .mf,
.single .content .highlight .mh,
.single .content .highlight .mo {
    color: #f0a955;
}

.single .content .highlight .nv,
.single .content .highlight .vc,
.single .content .highlight .vg,
.single .content .highlight .vi {
    color: #b481e0;
}

.single .content .highlight .gd {
    color: #ef6f6f;
}

.single .content .highlight .gi {
    color: #6bc190;
}

.code-copy-btn {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: #a0a0a0;
    background: transparent;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    padding: 0.3rem 0.55rem;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.code-copy-btn svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.code-copy-btn:hover {
    color: #ffffff;
    border-color: #5a5a5a;
}

.code-copy-btn.is-copied {
    color: #6bc190;
    border-color: #6bc190;
}

.single .content hr {
    border: none;
    border-top: 1px solid var(--gray-light);
    margin: 2.5rem 0;
}

.single .content .table-scroll {
    overflow-x: auto;
    margin: 0 0 1.4rem;
    /* Wider than the 680px text column, up to the page width */
    width: min(calc(100vw - 2 * var(--side-padding)), calc(var(--max-width) - 2 * var(--side-padding)));
    max-width: none;
}

/* Pages with a sticky table of contents: keep tables in the text column
   (the breakout above would slide under the TOC) and tighten them to fit */
@media (min-width: 1150px) {
    .article-body:has(.article-toc.has-items) .table-scroll {
        width: 100%;
    }

    .article-body:has(.article-toc.has-items) .content table {
        font-size: 0.88rem;
    }

    .article-body:has(.article-toc.has-items) .content th,
    .article-body:has(.article-toc.has-items) .content td {
        padding: 0.6rem 0.7rem;
    }

    .article-body:has(.article-toc.has-items) .content thead th {
        font-size: 0.72rem;
        white-space: normal;
    }
}

/* Small screens: each row becomes a stacked card, no horizontal scroll */
@media (max-width: 700px) {
    .single .content .table-scroll {
        width: 100%;
        overflow-x: visible;
    }

    .single .content table,
    .single .content tbody,
    .single .content tr,
    .single .content td {
        display: block;
        width: 100%;
    }

    .single .content thead {
        display: none;
    }

    .single .content tbody tr {
        padding: 0.9rem 0;
        border-bottom: 2px solid var(--black);
    }

    .single .content tbody tr:last-child {
        border-bottom: none;
    }

    .single .content td {
        padding: 0.35rem 0 !important;
        border: none !important;
    }

    .single .content td:first-child {
        font-size: 1.05rem;
        padding-bottom: 0.5rem !important;
    }

    .single .content td[data-label]:not(:first-child)::before {
        content: attr(data-label);
        display: block;
        font-size: 0.72rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--gray);
    }
}

.single .content table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.single .content th,
.single .content td {
    padding: 0.7rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-light);
    border-right: 1px solid var(--gray-light);
}

.single .content th:last-child,
.single .content td:last-child {
    border-right: none;
}

.single .content th:first-child,
.single .content td:first-child {
    padding-left: 0;
}

.single .content th:last-child,
.single .content td:last-child {
    padding-right: 0;
}

.single .content thead th {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--gray);
    white-space: nowrap;
    border-bottom: 2px solid var(--black);
}

.single .content tbody tr:last-child td {
    border-bottom: none;
}

.single .content tbody tr:hover {
    background: var(--gray-lighter);
}

.single .content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 0.5rem 0 1.4rem;
}

.single .content .badge-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 1.4rem;
}

.single .content .badge-group img.badge {
    max-width: none;
    height: 24px;
    margin: 0;
    border-radius: 4px;
}

/* 404 */
.error-404 {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 5rem;
    padding-bottom: 6rem;
}

.error-404-digits {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.error-404-digit {
    width: 52px;
    height: auto;
    shape-rendering: crispEdges;
    color: var(--black);
}

.error-404-digit rect {
    fill: currentColor;
}

.error-404-ghost {
    width: 64px;
    height: auto;
    margin-bottom: 2rem;
    shape-rendering: crispEdges;
    color: var(--gray-light);
    animation: float-ghost 3s ease-in-out infinite;
}

.error-404-ghost rect {
    fill: currentColor;
}

@keyframes float-ghost {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@media (prefers-reduced-motion: reduce) {
    .error-404-ghost {
        animation: none;
    }
}

.error-404 h1 {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 0.75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.error-404 p {
    color: var(--gray);
    max-width: 46ch;
    margin: 0 0 2rem;
}

/* Footer */
.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem var(--side-padding) 3rem;
    border-top: 1px solid var(--gray-light);
    font-size: 0.85rem;
    color: var(--gray);
}

.site-footer p {
    margin: 0 0 0.3rem;
}

.footer-social {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-shrink: 0;
}

.footer-social a {
    display: flex;
    color: var(--gray);
    transition: color 0.2s ease;
}

.footer-social svg {
    width: 17px;
    height: 17px;
}

.footer-social a:hover {
    color: var(--black);
}

/* Animations d'apparition (au chargement et au défilement) */
.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.notes-list > .reveal:nth-child(1) { transition-delay: 0ms; }
.notes-list > .reveal:nth-child(2) { transition-delay: 60ms; }
.notes-list > .reveal:nth-child(3) { transition-delay: 120ms; }
.notes-list > .reveal:nth-child(4) { transition-delay: 180ms; }
.notes-list > .reveal:nth-child(5) { transition-delay: 240ms; }
.notes-list > .reveal:nth-child(6) { transition-delay: 300ms; }
.notes-list > .reveal:nth-child(7) { transition-delay: 360ms; }
.notes-list > .reveal:nth-child(8) { transition-delay: 420ms; }

.projects-grid > .reveal:nth-child(1) { transition-delay: 0ms; }
.projects-grid > .reveal:nth-child(2) { transition-delay: 80ms; }
.projects-grid > .reveal:nth-child(3) { transition-delay: 160ms; }
.projects-grid > .reveal:nth-child(4) { transition-delay: 240ms; }
.projects-grid > .reveal:nth-child(5) { transition-delay: 320ms; }
.projects-grid > .reveal:nth-child(6) { transition-delay: 400ms; }

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* Responsive */
@media (max-width: 700px) {
    :root {
        --side-padding: 1.5rem;
    }

    .site-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
    }

    .menu-toggle {
        display: flex;
    }

    .site-header {
        position: relative;
        align-items: flex-start;
    }

    .site-header .logo .logo-secondary {
        position: relative;
        display: block;
        width: fit-content;
    }

    .nav-underline-desktop {
        display: none;
    }

    .nav-underline-mobile {
        display: block;
    }

    .site-header nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: var(--white);
        border-top: 1px solid var(--gray-light);
        border-bottom: 1px solid var(--gray-light);
        box-shadow: 0 12px 24px rgba(10, 10, 10, 0.06);
        z-index: 15;
    }

    .site-header nav.is-open {
        display: flex;
    }

    .site-header nav a {
        padding: 1rem var(--side-padding);
        border-top: 1px solid var(--gray-light);
    }

    .site-header nav a:first-child {
        border-top: none;
    }

    body.nav-open {
        overflow: hidden;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .single header h1 {
        font-size: 2rem;
    }

    .projects-grid,
    .expertise-grid,
    .work-columns {
        grid-template-columns: 1fr;
    }

    .work-block + .work-block {
        margin-top: 2rem;
    }

    .note-thumb {
        width: 72px;
        height: 72px;
    }
}

@media (max-width: 480px) {
    .note-item {
        flex-wrap: wrap;
    }

    .note-thumb {
        order: 0;
        width: 100%;
        height: 160px;
    }

    .note-body {
        order: 1;
        width: 100%;
    }

    .note-heading {
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .notes-year-heading {
        font-size: 1rem;
    }

    .academic-card,
    .project-card {
        padding: 1.25rem;
    }

    .contact-icons {
        gap: 1rem;
    }
}
