/* ============================================================
   Mohamedalfateh T.M. Saeed — research portfolio
   Mobile-first design system.

   Base rules describe a phone. Larger screens are additive via
   min-width queries. Nothing is overridden downward, so a rule
   never depends on its position in this file to win.

   Breakpoints:  640  large phone / small tablet
                 900  tablet landscape and up
                1200  wide desktop
   ============================================================ */

/* ---------------------------------------------- 1. tokens */
:root {
    --bg: #fdfdfc;
    --bg-soft: #f5f4f1;
    --surface: #ffffff;
    --surface-2: #faf9f7;
    --border: #e4e2dd;
    --border-strong: #d3d0c9;
    --text: #14161a;
    --muted: #555c66;
    --faint: #686e7c;
    --accent: #2f5bd0;
    --accent-2: #0d9488;
    --accent-ink: #ffffff;
    --accent-soft: rgba(47, 91, 208, 0.08);
    --accent-ring: rgba(47, 91, 208, 0.34);
    --warn: #b45309;
    --ok: #047857;

    --grad: linear-gradient(120deg, #2f5bd0 0%, #4f46e5 45%, #0d9488 100%);
    --grad-soft: linear-gradient(120deg, rgba(47,91,208,0.12), rgba(13,148,136,0.10));

    --edge-light: inset 0 1px 0 rgba(255,255,255,0.85);
    --lift-1: 0 1px 2px rgba(20,22,26,0.04), 0 2px 6px rgba(20,22,26,0.05);
    --lift-2: 0 2px 6px rgba(20,22,26,0.05), 0 10px 24px -6px rgba(20,22,26,0.10);
    --lift-3: 0 4px 10px rgba(20,22,26,0.06), 0 22px 48px -12px rgba(20,22,26,0.18);
    --ring-glow: 0 0 0 1px rgba(47,91,208,0.16), 0 18px 46px -14px rgba(47,91,208,0.42);

    --radius: 14px;
    --radius-lg: 20px;
    --maxw: 1160px;
    --readw: 720px;
    --nav-h: 60px;
    --gutter: 18px;

    /* fluid scale, anchored at 375px and capped at 1200px */
    --fs-h1:   clamp(1.75rem, 1.15rem + 2.6vw, 3.4rem);
    --fs-h2:   clamp(1.45rem, 1.10rem + 1.6vw, 2.5rem);
    --fs-h3:   clamp(1.15rem, 1.00rem + 0.7vw, 1.5rem);
    --fs-lead: clamp(1rem,    0.96rem + 0.2vw, 1.12rem);
    --fs-body: clamp(0.95rem, 0.93rem + 0.1vw, 1.03rem);

    --font-display: "Newsreader", Georgia, "Times New Roman", serif;
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

html[data-theme="dark"] {
    --bg: #0d1014;
    --bg-soft: #12161c;
    --surface: #161b22;
    --surface-2: #1a2029;
    --border: #262d38;
    --border-strong: #354052;
    --text: #e9ecf1;
    --muted: #a2abb8;
    --faint: #8d95a3;
    --accent: #7aa2ff;
    --accent-2: #2dd4bf;
    --accent-ink: #0d1014;
    --accent-soft: rgba(122, 162, 255, 0.13);
    --accent-ring: rgba(122, 162, 255, 0.42);
    --warn: #fbbf24;
    --ok: #34d399;
    --grad: linear-gradient(120deg, #7aa2ff 0%, #a78bfa 48%, #2dd4bf 100%);
    --grad-soft: linear-gradient(120deg, rgba(122,162,255,0.16), rgba(45,212,191,0.12));
    --edge-light: inset 0 1px 0 rgba(255,255,255,0.07);
    --lift-1: 0 1px 2px rgba(0,0,0,0.5);
    --lift-2: 0 6px 18px rgba(0,0,0,0.5);
    --lift-3: 0 18px 44px rgba(0,0,0,0.62);
    --ring-glow: 0 0 0 1px rgba(122,162,255,0.22), 0 18px 46px -14px rgba(0,0,0,0.75);
    color-scheme: dark;
}

/* ---------------------------------------------- 2. reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 16px);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: var(--fs-body);
    line-height: 1.68;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    max-width: 100%;
    transition: background 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4 {
    font-family: var(--font-display); font-weight: 600;
    line-height: 1.2; color: var(--text); letter-spacing: -0.015em;
    overflow-wrap: break-word;
}
a { color: inherit; text-decoration: none; }
img, canvas, svg, video { max-width: 100%; display: block; }
img { height: auto; }
ul, ol { list-style: none; }
code, pre, kbd { font-family: var(--font-mono); }
table { border-collapse: collapse; }
button { font: inherit; }

/* ---------------------------------------------- 3. layout */
.container {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    padding-inline: max(var(--gutter), env(safe-area-inset-left));
}
.narrow { max-width: 100%; }
section { padding-block: 52px; position: relative; }
section[id] { scroll-margin-top: calc(var(--nav-h) + 16px); }
.section-soft { background: var(--bg-soft); }
.rule { height: 1px; background: var(--border); border: 0; }

/* ---------------------------------------------- 4. type helpers */
.eyebrow {
    display: inline-block; position: relative; padding-left: 24px;
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.15em;
    text-transform: uppercase; color: var(--accent); margin-bottom: 12px;
}
.eyebrow::before {
    content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 16px; height: 2px; border-radius: 2px; background: var(--grad);
}
.section-title { font-size: var(--fs-h2); }
.section-head { margin-bottom: 28px; }
.section-head .section-title::after {
    content: ""; display: block; margin-top: 12px;
    width: 52px; height: 4px; border-radius: 4px; background: var(--grad);
}
.section-head.center { text-align: center; margin-inline: auto; }
.section-head.center .section-title::after { margin-inline: auto; }
.section-sub { color: var(--muted); margin-top: 10px; max-width: 68ch; }
.lede { font-size: var(--fs-lead); color: var(--muted); }
.mono-label {
    font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--faint);
}
.section-title .w { display: inline-block; }

/* ---------------------------------------------- 5. buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    min-height: 44px; padding: 11px 18px; border-radius: 999px;
    font-family: var(--font-body); font-weight: 600; font-size: 0.9rem;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    cursor: pointer; box-shadow: var(--lift-1);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.985); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.btn-primary { background: var(--grad); color: #fff; border-color: transparent; position: relative; overflow: hidden; }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 38px; padding: 8px 14px; font-size: 0.83rem; }

/* ---------------------------------------------- 6. navigation */
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 2000; }
.skip-link:focus { left: 16px; }

.navbar {
    position: fixed; inset: 0 0 auto 0; height: var(--nav-h); z-index: 1000;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding-top: env(safe-area-inset-top);
    transition: box-shadow 0.3s ease;
}
.navbar.scrolled { box-shadow: var(--lift-2); border-bottom-color: var(--border-strong); }
.navbar .container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.brand { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 600; font-size: 1rem; }
.brand img { width: 30px; height: 30px; border-radius: 8px; transition: transform 0.3s ease; }
.brand:hover img { transform: rotate(-6deg) scale(1.06); }
.brand-dot { color: var(--accent); }
.brand span { display: none; }

/* mobile: dropdown sheet */
.nav-links {
    position: fixed; top: calc(var(--nav-h) + 8px); left: 12px; right: 12px;
    display: flex; flex-direction: column; gap: 3px;
    max-height: calc(100dvh - var(--nav-h) - 28px); overflow-y: auto;
    padding: 10px; border-radius: 16px;
    background: var(--surface); border: 1px solid var(--border-strong);
    box-shadow: var(--lift-3);
    opacity: 0; transform: translateY(-10px); pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}
.nav-links.active { opacity: 1; transform: none; pointer-events: auto; }
.nav-links li { opacity: 0; transform: translateY(-6px); transition: opacity 0.3s ease, transform 0.3s ease; }
.nav-links.active li { opacity: 1; transform: none; }
.nav-links.active li:nth-child(1) { transition-delay: 0.03s; }
.nav-links.active li:nth-child(2) { transition-delay: 0.06s; }
.nav-links.active li:nth-child(3) { transition-delay: 0.09s; }
.nav-links.active li:nth-child(4) { transition-delay: 0.12s; }
.nav-links.active li:nth-child(5) { transition-delay: 0.15s; }
.nav-links.active li:nth-child(6) { transition-delay: 0.18s; }
.nav-links.active li:nth-child(7) { transition-delay: 0.21s; }
.nav-links a {
    display: flex; align-items: center; gap: 13px;
    min-height: 46px; padding: 12px 14px; border-radius: 11px;
    font-size: 0.96rem; font-weight: 500; color: var(--text);
}
.nav-links a:active { background: var(--bg-soft); }
.nav-links a.active { background: var(--accent-soft); color: var(--accent); }
.nav-ic {
    display: grid; place-items: center; flex-shrink: 0;
    width: 32px; height: 32px; border-radius: 9px; font-size: 0.87rem;
    background: var(--accent-soft); color: var(--accent);
}
.nav-links a.active .nav-ic { background: var(--accent); color: var(--accent-ink); }
.nav-cta-mobile { margin-top: 5px; padding-top: 7px; border-top: 1px solid var(--border); }
.nav-cta-mobile a { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-actions .btn-primary { display: none; }
.theme-toggle, .hamburger {
    display: grid; place-items: center; width: 42px; height: 42px;
    border-radius: 12px; cursor: pointer;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    box-shadow: var(--lift-1); transition: border-color 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.theme-toggle { border-radius: 50%; }
.theme-toggle:focus-visible, .hamburger:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.theme-toggle .fa-sun { display: none; }
html[data-theme="dark"] .theme-toggle .fa-sun { display: block; }
html[data-theme="dark"] .theme-toggle .fa-moon { display: none; }
.hamburger.is-open { background: var(--accent-soft); border-color: var(--accent-ring); color: var(--accent); }

/* ---------------------------------------------- 7. hero */
.hero { padding-top: calc(var(--nav-h) + 26px); padding-bottom: 34px; position: relative; z-index: 0; }
.hero::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: radial-gradient(70% 40% at 80% -8%, var(--accent-soft), transparent 70%);
}
.hero-grid { display: grid; gap: 20px; justify-items: start; }
.hero .role {
    font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.07em;
    text-transform: uppercase; color: var(--faint); margin-bottom: 10px;
}
.hero h1 { font-size: var(--fs-h1); line-height: 1.1; margin-bottom: 12px; }
.hero h1 em {
    font-style: italic;
    background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lead { font-size: var(--fs-lead); color: var(--muted); margin-bottom: 10px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 9px; width: 100%; margin-top: 18px; }
.hero-cta .btn { flex: 1 1 100%; }

/* portrait: centred, fluid, unframed */
.hero-photo { order: -1; justify-self: center; margin: 0 auto 6px; text-align: center; }
.portrait { position: relative; display: block; }
.portrait::after {
    content: ""; position: absolute; inset: 8% 6% -5% 6%; z-index: -1;
    border-radius: 40px; background: var(--grad); opacity: 0.18; filter: blur(26px);
}
.portrait img {
    width: min(300px, 74vw); margin-inline: auto;
    aspect-ratio: 1 / 1; object-fit: cover; object-position: center 18%;
    border-radius: 26px;
    box-shadow: 0 18px 44px -16px rgba(20,22,26,0.42);
}
html[data-theme="dark"] .portrait img { box-shadow: 0 20px 50px -14px rgba(0,0,0,0.8); }
.portrait-tag {
    position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    padding: 6px 13px; border-radius: 999px;
    font-size: 0.71rem; font-weight: 600; color: #fff;
    background: rgba(16,18,24,0.5); border: 1px solid rgba(255,255,255,0.18);
    backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%);
}
.portrait-tag i { opacity: 0.85; font-size: 0.68rem; }
.hero-photo figcaption { display: none; }

.affil { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 18px; }
.affil span {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 12px; border-radius: 999px; font-size: 0.76rem; color: var(--muted);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--lift-1);
}
.affil i { color: var(--accent); }

/* ---------------------------------------------- 8. card material */
.theme, .case, .pcard, .pub, .card, .skill-group, .cert, .tl-item,
.metric, .edu, .scholar-card, .demo, .ship-facets, .toc-mobile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--lift-1), var(--edge-light);
    transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}
html[data-theme="dark"] .theme, html[data-theme="dark"] .pcard,
html[data-theme="dark"] .pub, html[data-theme="dark"] .card,
html[data-theme="dark"] .skill-group, html[data-theme="dark"] .cert,
html[data-theme="dark"] .tl-item, html[data-theme="dark"] .ship-facets {
    background: linear-gradient(180deg, var(--surface), var(--surface-2));
}

/* ---------------------------------------------- 9. research agenda */
.agenda { display: grid; gap: 16px; }
.theme { position: relative; overflow: hidden; padding: 24px 20px; border-radius: 18px; }
.theme-num {
    display: inline-block; margin-bottom: 11px; padding: 4px 11px; border-radius: 999px;
    font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.09em; color: var(--accent);
    background: var(--grad-soft); border: 1px solid var(--border);
}
.theme h3 { font-size: var(--fs-h3); margin-bottom: 10px; }
.theme p { color: var(--muted); font-size: 0.94rem; margin-bottom: 12px; }
.theme-q {
    font-family: var(--font-display); font-style: italic; font-size: 1.02rem;
    color: var(--text); padding-left: 13px; margin-bottom: 12px;
    border-left: 3px solid; border-image: var(--grad) 1;
}
.theme-links { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-links a {
    padding: 7px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
    color: var(--accent); background: var(--accent-soft); min-height: 36px;
    display: inline-flex; align-items: center;
}

/* ---------------------------------------------- 10. case cards */
.cases { display: grid; gap: 18px; counter-reset: casec; }
.case { display: grid; overflow: hidden; border-radius: 18px; counter-increment: casec; }
.case-media { background: #fff; border-bottom: 1px solid var(--border); display: grid; place-items: center; }
.case-media img { width: 100%; max-height: 220px; object-fit: contain; padding: 14px; }
.case-body { display: flex; flex-direction: column; gap: 12px; padding: 22px 20px; }
.case-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.case-body h3 { font-size: var(--fs-h3); }
.case-body h3::before {
    content: counter(casec, decimal-leading-zero) " / ";
    font-family: var(--font-mono); font-size: 0.58em; color: var(--faint); letter-spacing: 0.05em;
}
.case-body p { color: var(--muted); font-size: 0.94rem; }
.case-metrics {
    display: flex; flex-direction: column; gap: 10px;
    padding: 12px 0; border-block: 1px dashed var(--border-strong);
}
.case-metrics div { display: flex; flex-direction: column; }
.case-metrics b {
    font-family: var(--font-mono); font-size: 1rem; font-weight: 600;
    background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.case-metrics span { font-size: 0.75rem; color: var(--faint); }
.case-more { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; min-height: 40px; font-weight: 600; font-size: 0.9rem; color: var(--accent); }
.case-more i { transition: transform 0.25s ease; }

/* ---------------------------------------------- 11. pills & tags */
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
    color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-ring);
}
.pill-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.pill-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.pill-muted { color: var(--muted); background: var(--surface-2); border-color: var(--border-strong); }
.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
    padding: 4px 10px; border-radius: 999px; font-size: 0.74rem; color: var(--muted);
    background: var(--surface-2); border: 1px solid var(--border);
    transition: border-color 0.2s ease, color 0.2s ease;
}
.badge-soon {
    margin-left: 8px; padding: 3px 9px; border-radius: 999px; vertical-align: middle;
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--accent); background: var(--accent-soft);
}

/* ---------------------------------------------- 12. delivered work */
.filterbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 44px; padding: 10px 14px; border-radius: 999px; cursor: pointer;
    font-family: var(--font-body); font-size: 0.83rem; font-weight: 600; color: var(--muted);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--lift-1);
    transition: color 0.2s ease, border-color 0.2s ease, background 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}
.chip i { font-size: 0.8rem; opacity: 0.8; }
.chip.is-active { color: #fff; background: var(--grad); border-color: transparent; box-shadow: var(--ring-glow); }
.chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.chip-count {
    padding: 3px 7px; border-radius: 999px; font-family: var(--font-mono); font-size: 0.66rem; line-height: 1;
    color: var(--faint); background: var(--surface-2); border: 1px solid var(--border);
}
.chip.is-active .chip-count { color: #fff; background: rgba(255,255,255,0.2); border-color: transparent; }

.pgrid, .ships { display: grid; gap: 22px; }
.pcard, .ship { display: grid; overflow: hidden; border-radius: 18px; }
.pcard { animation: cardIn 0.45s cubic-bezier(0.16,1,0.3,1) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.pcard-media, .ship-visual {
    position: relative; padding: 20px 20px 0;
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(110% 80% at 10% 0%, var(--grad-soft), transparent 65%),
        var(--surface-2);
}
.pcard-live {
    position: absolute; top: 13px; right: 13px; z-index: 3;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 10px; border-radius: 999px;
    font-family: var(--font-mono); font-size: 0.6rem; font-weight: 600;
    letter-spacing: 0.07em; text-transform: uppercase;
    color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--ok) 38%, transparent);
}
.pcard-live::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok);
    animation: livePulse 2.4s ease-out infinite;
}
@keyframes livePulse {
    0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
    70% { box-shadow: 0 0 0 7px transparent; }
}

/* browser chrome */
.pv-stage { width: 100%; }
.browser {
    border-radius: 12px 12px 0 0; overflow: hidden;
    border: 1px solid var(--border-strong); background: var(--surface);
    box-shadow: var(--lift-3);
}
.browser-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.bdot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--border-strong); }
.bdot:nth-child(1) { background: #ef6a5f; }
.bdot:nth-child(2) { background: #f5bd4f; }
.bdot:nth-child(3) { background: #61c454; }
.browser-url {
    flex: 1; margin-left: 8px; padding: 4px 11px; border-radius: 999px;
    display: inline-flex; align-items: center; gap: 7px; overflow: hidden; white-space: nowrap;
    font-family: var(--font-mono); font-size: 0.63rem; color: var(--muted);
    background: var(--bg); border: 1px solid var(--border);
}
.browser-url i { color: var(--ok); font-size: 0.6rem; }
.browser-view { position: relative; aspect-ratio: 16/10; background: #fff; overflow: hidden; }
.browser-view img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.browser-blank {
    position: absolute; inset: 0; display: none;
    flex-direction: column; align-items: center; justify-content: center; gap: 9px;
    background: radial-gradient(70% 90% at 25% 12%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 62%), linear-gradient(150deg, #101828, #1c2637);
}
.browser-view.is-blank .browser-blank { display: flex; }
.bb-logo { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.16em; font-size: clamp(20px, 5vw, 34px); color: #fff; }
.bb-sub { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.6); }
.bb-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding-inline: 18px; }
.bb-chips span { padding: 4px 10px; border-radius: 999px; font-family: var(--font-mono); font-size: 0.66rem; color: rgba(255,255,255,0.82); background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.22); }

.pcard-body, .ship-body { display: flex; flex-direction: column; gap: 12px; padding: 22px 20px; }
.pcard-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.pcard-meta { font-family: var(--font-mono); font-size: 0.71rem; letter-spacing: 0.03em; color: var(--faint); }
.pcard-body h3, .ship-body h3 { font-size: var(--fs-h3); }
.pcard-summary, .ship-body > p { color: var(--muted); font-size: 0.94rem; }
.pcard-metrics {
    display: grid; gap: 0; padding: 14px 16px; border-radius: 14px;
    background: var(--surface-2); border: 1px solid var(--border);
}
.pcard-metrics div { padding: 9px 0; border-top: 1px solid var(--border); }
.pcard-metrics div:first-child { padding-top: 0; border-top: 0; }
.pcard-metrics dt {
    font-family: var(--font-display); font-size: 0.96rem; font-weight: 600;
    background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.pcard-metrics dd { font-size: 0.74rem; color: var(--faint); line-height: 1.35; }
.pcard-stack .tag { font-family: var(--font-mono); font-size: 0.7rem; background: var(--surface); border-color: var(--border-strong); }
.pcard-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: auto; }
.pcard-actions .btn { flex: 1 1 100%; }
.pcard-toggle { background: var(--surface-2); }
.pcard-panel { margin-top: 14px; padding-top: 16px; border-top: 1px dashed var(--border-strong); animation: panelIn 0.35s ease both; }
@keyframes panelIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.pcard-panel[hidden] { display: none; }
.pcard-role { font-size: 0.84rem; color: var(--muted); margin-bottom: 14px; }
.pcard-role .mono-label { margin-right: 8px; }
.pcard-block { position: relative; padding-left: 16px; margin-bottom: 14px; }
.pcard-block::before { content: ""; position: absolute; left: 0; top: 5px; bottom: 3px; width: 2px; border-radius: 2px; background: var(--grad); opacity: 0.45; }
.pcard-block h4 { font-family: var(--font-body); font-size: 0.71rem; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase; color: var(--accent); margin-bottom: 5px; }
.pcard-block p { color: var(--muted); font-size: 0.92rem; }

.ship-facets { display: grid; gap: 11px; padding: 16px 18px; border-radius: 14px; }
.ship-facets div { position: relative; padding-left: 21px; display: flex; flex-direction: column; gap: 2px; }
.ship-facets div::before { content: "\f058"; font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; left: 0; top: 2px; font-size: 0.76rem; color: var(--accent); }
.ship-facets b { font-size: 0.92rem; color: var(--text); }
.ship-facets span { font-size: 0.82rem; color: var(--muted); }

.project-links { display: flex; flex-wrap: wrap; gap: 9px; }
.project-links a {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 11px 18px; border-radius: 999px; flex: 1 1 100%;
    font-size: 0.88rem; font-weight: 600; color: #fff; background: var(--grad);
    box-shadow: var(--lift-1);
}

/* ---------------------------------------------- 13. publications */
.pub-list { display: grid; gap: 13px; counter-reset: pubc; }
.pub { padding: 20px 18px; border-radius: 16px; counter-increment: pubc; }
.pub-top { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 9px; margin-bottom: 8px; }
.pub-top::after {
    content: "0" counter(pubc); order: -1; padding-top: 3px;
    font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.05em; color: var(--faint);
}
.pub h3 { font-size: 1rem; line-height: 1.4; flex: 1 1 100%; min-width: 0; }
.pub .authors { font-size: 0.85rem; color: var(--muted); margin-bottom: 7px; }
.pub .authors b { color: var(--text); font-weight: 600; }
.pub .venue { font-size: 0.83rem; font-style: italic; color: var(--faint); margin-bottom: 11px; overflow-wrap: anywhere; }
.pub .why {
    padding: 11px 14px; margin-bottom: 12px; border-radius: 0 10px 10px 0;
    font-size: 0.89rem; color: var(--muted);
    background: var(--surface-2); border-left: 3px solid var(--accent);
}
.pub .why b { color: var(--text); }
.pub-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pub-actions .btn { flex: 1 1 auto; }
.pub-status {
    display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
    padding: 7px 14px; border-radius: 999px; font-size: 0.76rem; font-weight: 600;
    color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
}
.pub-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pub-status.accepted { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 42%, transparent); }

details.bib { margin-top: 11px; }
details.bib summary { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; cursor: pointer; list-style: none; font-size: 0.81rem; font-weight: 600; color: var(--accent); }
details.bib summary::-webkit-details-marker { display: none; }
details.bib summary::before { content: "\f0da"; font-family: "Font Awesome 6 Free"; font-weight: 900; transition: transform 0.2s ease; }
details.bib[open] summary::before { transform: rotate(90deg); }
.bib pre { margin-top: 9px; padding: 12px; border-radius: 10px; overflow-x: auto; white-space: pre; font-size: 0.67rem; line-height: 1.6; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); }

.scholar-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 20px; border-radius: 16px; }
.scholar-ic { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 13px; font-size: 1.1rem; color: #fff; background: var(--grad); }
.scholar-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.scholar-body b { font-family: var(--font-display); font-size: 1rem; }
.scholar-body span { font-size: 0.83rem; color: var(--muted); }
.scholar-go { color: var(--accent); font-size: 0.88rem; }

/* ---------------------------------------------- 14. prose / case study */
.paper-hero { padding-top: calc(var(--nav-h) + 22px); padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; font-size: 0.8rem; color: var(--faint); }
.breadcrumb a { color: var(--accent); }
.paper-hero h1 { font-size: var(--fs-h1); line-height: 1.13; margin-bottom: 14px; }
.paper-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 16px; font-size: 0.8rem; color: var(--muted); }
.paper-meta span { display: inline-flex; align-items: center; gap: 7px; }
.paper-meta i { color: var(--accent); }
.paper-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.paper-layout { display: grid; padding-block: 24px 56px; }
.toc { display: none; }

.prose { max-width: 100%; counter-reset: sec; }
.prose > * + * { margin-top: 16px; }
.prose h2 {
    counter-increment: sec; display: flex; align-items: baseline; gap: 11px;
    font-size: clamp(1.3rem, 1.1rem + 0.9vw, 1.75rem);
    margin-top: 36px; padding-bottom: 9px; border-bottom: 1px solid var(--border);
    scroll-margin-top: calc(var(--nav-h) + 16px);
}
.prose h2::before { content: counter(sec, decimal-leading-zero); font-family: var(--font-mono); font-size: 0.6em; font-weight: 600; color: var(--accent); opacity: 0.75; }
.prose h3 { font-size: var(--fs-h3); margin-top: 26px; }
.prose p { color: var(--muted); }
.prose strong { color: var(--text); font-weight: 600; }
.prose ul, .prose ol { display: grid; gap: 9px; }
.prose li { position: relative; padding-left: 22px; color: var(--muted); }
.prose ul li::before { content: ""; position: absolute; left: 3px; top: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.prose ol { counter-reset: li; }
.prose ol li { counter-increment: li; }
.prose ol li::before { content: counter(li); position: absolute; left: 0; top: 0; font-family: var(--font-mono); font-size: 0.73rem; font-weight: 700; color: var(--accent); }
.prose a:not(.btn) {
    color: var(--accent);
    background-image: linear-gradient(var(--accent), var(--accent));
    background-size: 100% 1px; background-repeat: no-repeat; background-position: 0 100%;
    transition: background-size 0.3s ease;
}
.prose a:not(.btn):hover { background-size: 0% 1px; }
.prose code:not(pre code) { padding: 2px 6px; border-radius: 5px; font-size: 0.86em; color: var(--accent); background: var(--surface-2); border: 1px solid var(--border); }
.prose pre { padding: 15px; border-radius: 12px; overflow-x: auto; font-size: 0.78rem; line-height: 1.65; background: var(--surface-2); border: 1px solid var(--border); }
.prose blockquote {
    position: relative; padding: 18px 20px; border-radius: 0 14px 14px 0;
    font-family: var(--font-display); font-style: italic; font-size: 1.06rem; color: var(--text);
    background: var(--grad-soft); border-left: 4px solid; border-image: var(--grad) 1;
}
.prose > h2:first-of-type + p::first-letter {
    float: left; font-family: var(--font-display); font-weight: 600;
    font-size: 2.5em; line-height: 0.84; padding: 5px 9px 0 0;
    background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

.eq { display: block; overflow-x: auto; padding: 12px 13px; border-radius: 10px; text-align: center; font-family: var(--font-mono); font-size: 0.78rem; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); }
.eq-num { float: right; font-size: 0.78rem; color: var(--faint); }

figure.fig { position: relative; margin: 24px 0; }
figure.fig img { width: 100%; padding: 9px; border-radius: 12px; background: #fff; border: 1px solid var(--border); box-shadow: var(--lift-1); cursor: zoom-in; }
html[data-theme="dark"] figure.fig img { border-color: var(--border-strong); }
figure.fig.fig-tall img, figure.fig.fig-wide img { max-height: 420px; object-fit: contain; }
figure.fig figcaption {
    margin-top: 11px; padding: 9px 0 9px 13px; border-radius: 0 8px 8px 0;
    font-size: 0.79rem; line-height: 1.55; color: var(--faint);
    border-left: 3px solid var(--border-strong);
    background: linear-gradient(90deg, var(--surface-2), transparent 60%);
}
figure.fig figcaption b:first-child { color: var(--accent); }
figure.fig figcaption b { color: var(--muted); }
.fig-placeholder { display: grid; place-items: center; min-height: 200px; padding: 26px; text-align: center; border-radius: 12px; border: 1px dashed var(--border-strong); background: var(--surface-2); color: var(--faint); }
.fig-placeholder i { font-size: 1.6rem; color: var(--accent); margin-bottom: 10px; }
.fig-placeholder code { font-size: 0.78rem; color: var(--accent); }

.callout { padding: 16px 18px; border-radius: 0 12px 12px 0; background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--accent); }
.callout-title { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--accent); }
.callout p { color: var(--muted); font-size: 0.93rem; }
.callout.warn { border-left-color: var(--warn); }
.callout.warn .callout-title { color: var(--warn); }
.callout.ok { border-left-color: var(--ok); }
.callout.ok .callout-title { color: var(--ok); }

.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 22px 0; }
.metric { padding: 15px 10px; text-align: center; border-radius: 14px; }
.metric b { display: block; font-family: var(--font-mono); font-size: 1.2rem; font-weight: 600; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.metric span { display: block; margin-top: 4px; font-size: 0.72rem; line-height: 1.35; color: var(--faint); }

.steps { display: grid; gap: 12px; margin: 22px 0; }
.step { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; padding: 17px 15px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.step-n { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 10px; font-family: var(--font-mono); font-size: 0.79rem; font-weight: 700; color: #fff; background: var(--grad); }
.step h4 { font-size: 1rem; margin-bottom: 4px; }
.step p { color: var(--muted); font-size: 0.9rem; }

.table-wrap {
    margin: 22px calc(var(--gutter) * -1); overflow-x: auto; -webkit-overflow-scrolling: touch;
    background:
        linear-gradient(90deg, var(--surface) 30%, transparent) left / 24px 100% no-repeat,
        linear-gradient(270deg, var(--surface) 30%, transparent) right / 24px 100% no-repeat,
        var(--surface);
    border-block: 1px solid var(--border);
}
table.data { width: 100%; min-width: 460px; font-size: 0.78rem; }
table.data th, table.data td { padding: 9px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
table.data thead th { font-family: var(--font-body); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
table.data tr.best td { background: var(--grad-soft); }
table.data tr.best td:first-child { position: relative; font-weight: 600; color: var(--text); }
table.data tr.best td:first-child::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--grad); }

/* collapsible contents, mobile only */
.toc-mobile { margin-bottom: 24px; overflow: hidden; }
.toc-mobile summary {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 48px; padding: 14px 16px; cursor: pointer; list-style: none;
    font-weight: 600; font-size: 0.88rem; color: var(--text);
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary > span:first-child { display: inline-flex; align-items: center; gap: 10px; }
.toc-mobile summary i { color: var(--accent); }
.toc-count { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500; color: var(--faint); }
.toc-mobile summary::after { content: "\f078"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 0.68rem; color: var(--faint); transition: transform 0.25s ease; }
.toc-mobile[open] summary::after { transform: rotate(180deg); }
.toc-mobile[open] summary { border-bottom: 1px solid var(--border); }
.toc-mobile ol { counter-reset: tocn; display: grid; gap: 2px; padding: 8px; }
.toc-mobile li { counter-increment: tocn; padding: 0; }
.toc-mobile li::before { content: none; }
.toc-mobile ol a { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 10px 11px; border-radius: 9px; font-size: 0.88rem; color: var(--muted); background: none; }
.toc-mobile ol a::before { content: counter(tocn, decimal-leading-zero); flex-shrink: 0; font-family: var(--font-mono); font-size: 0.66rem; color: var(--accent); }
.toc-mobile ol a:active { background: var(--bg-soft); color: var(--text); }

/* ---------------------------------------------- 15. interactive demo */
.demo { overflow: hidden; border-radius: 18px; border-color: var(--border-strong); margin: 24px 0; }
.demo-head { padding: 16px 18px; border-bottom: 1px solid var(--border); background: var(--grad-soft); }
.demo-head h3 { display: flex; align-items: center; gap: 9px; font-size: 1.02rem; margin-bottom: 5px; }
.demo-head h3 i { color: var(--accent); font-size: 0.9rem; }
.demo-head p { font-size: 0.81rem; color: var(--muted); }
.demo-stage { display: grid; }
.demo-canvas-wrap { position: relative; min-height: 280px; background: var(--bg); }
.demo-canvas-wrap canvas { width: 100%; height: 100%; }
.demo-side { display: flex; flex-direction: column; gap: 15px; padding: 16px; background: var(--surface-2); border-top: 1px solid var(--border); }
.ctrl label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; font-size: 0.79rem; color: var(--muted); }
.ctrl label b { font-family: var(--font-mono); font-size: 0.81rem; font-weight: 600; color: var(--accent); }
.ctrl input[type="range"] { width: 100%; height: 30px; accent-color: var(--accent); cursor: pointer; }
.radio-set { display: grid; gap: 6px; }
.radio-set label {
    display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 12px;
    border-radius: 10px; cursor: pointer; font-size: 0.84rem; color: var(--muted);
    background: var(--surface); border: 1px solid var(--border);
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.radio-set input { accent-color: var(--accent); margin: 0; cursor: pointer; }
.radio-set label:has(input:checked) { color: var(--accent); font-weight: 600; background: var(--accent-soft); border-color: var(--accent); }
.demo-metrics { display: grid; gap: 9px; }
.dm { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.dm span { font-size: 0.74rem; color: var(--faint); }
.dm b { font-family: var(--font-mono); font-size: 0.93rem; font-variant-numeric: tabular-nums; color: var(--text); }
.dm.good { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.dm.good b { color: var(--ok); }
.dm.bad { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.dm.bad b { color: var(--warn); }
.dm-verdict { min-height: 40px; padding: 10px 12px; border-radius: 9px; font-size: 0.8rem; line-height: 1.5; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border-strong); }
.dm-verdict.ok { border-left-color: var(--ok); color: var(--ok); }
.dm-verdict.warn { border-left-color: var(--warn); color: var(--warn); }
.demo-legend { display: flex; flex-wrap: wrap; gap: 11px; font-size: 0.74rem; color: var(--muted); }
.demo-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%; }
.demo-profile-wrap { padding: 14px 18px 4px; border-top: 1px solid var(--border); background: var(--surface); }
.demo-profile { height: 150px; margin-top: 9px; }
.demo-foot { padding: 14px 18px; border-top: 1px solid var(--border); font-size: 0.78rem; color: var(--faint); background: var(--surface-2); }
.demo-foot p { margin: 0; }
.dm-fallback { margin-top: 9px; font-size: 0.82rem; color: var(--warn); }

.switch { display: flex; align-items: center; gap: 11px; min-height: 44px; cursor: pointer; user-select: none; }
.switch input { position: absolute; width: 0; height: 0; opacity: 0; }
.switch .track { position: relative; flex-shrink: 0; width: 44px; height: 25px; border-radius: 999px; background: var(--border-strong); transition: background 0.25s ease; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform 0.25s ease; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(19px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-ring); }
.switch-label { font-size: 0.87rem; font-weight: 600; color: var(--text); }

/* ---------------------------------------------- 16. timeline & credentials */
.timeline { position: relative; display: grid; gap: 16px; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: linear-gradient(180deg, var(--accent), var(--accent-2), transparent); opacity: 0.35; }
.tl-item { position: relative; padding: 20px 18px; }
.tl-item::before {
    content: ""; position: absolute; left: -24px; top: 24px; width: 11px; height: 11px;
    border-radius: 50%; background: var(--bg); border: 3px solid var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.tl-item:first-child::before { background: var(--accent); }
.tl-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 5px; }
.tl-role { font-size: 1.05rem; }
.tl-date { font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent); white-space: nowrap; }
.tl-org { margin: 3px 0 10px; font-size: 0.9rem; color: var(--muted); }
.tl-item ul { display: grid; gap: 7px; }
.tl-item li { position: relative; padding-left: 17px; font-size: 0.91rem; color: var(--muted); }
.tl-item li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }

.grid-2, .cert-grid, .edu-grid, .skills-grid { display: grid; gap: 14px; }
.card, .skill-group, .cert, .edu { padding: 19px 18px; border-radius: 16px; }
.card h3 { font-size: 1rem; margin-bottom: 3px; }
.card .sub, .edu .school { font-size: 0.88rem; color: var(--muted); }
.card .meta, .edu .edu-meta { display: flex; flex-wrap: wrap; gap: 4px 13px; margin-top: 7px; font-size: 0.78rem; color: var(--faint); }
.card .meta b, .edu .edu-meta b { color: var(--accent); font-weight: 600; }
.card-row { display: flex; align-items: flex-start; gap: 14px; }
.card-logo, .edu-logo { display: grid; place-items: center; flex-shrink: 0; width: 48px; height: 48px; padding: 6px; border-radius: 11px; background: #fff; border: 1px solid var(--border); }
.card-logo img, .edu-logo img { width: 100%; height: 100%; object-fit: contain; }
.card-ic, .cert .ic { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 11px; color: var(--accent); background: var(--accent-soft); }
.cert { display: flex; align-items: flex-start; gap: 13px; }
.cert h3 { font-size: 0.96rem; }
.cert .issuer { margin-top: 2px; font-size: 0.81rem; color: var(--accent); }
.cert .date { font-size: 0.77rem; color: var(--faint); }
.edu { display: flex; gap: 14px; }
.edu .degree { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.01em; color: var(--accent); }
.edu h3 { margin: 3px 0; font-size: 1rem; }
.skill-group h3 { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; font-size: 0.96rem; }
.skill-group h3 i { color: var(--accent); font-size: 0.88rem; }
.skill-note { margin-top: 18px; font-size: 0.85rem; text-align: center; color: var(--faint); }
.about-wrap { display: grid; gap: 26px; }
.about-wrap p { margin-bottom: 14px; color: var(--muted); }
.lang-list { display: grid; gap: 12px; }
.lang { padding: 15px 17px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--lift-1); }
.lang-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.lang-top b { font-family: var(--font-display); }
.lang-level { font-size: 0.78rem; font-weight: 600; color: var(--accent); }
.lang-bar { height: 7px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.lang-bar span { display: block; height: 100%; border-radius: 999px; background: var(--grad); }

/* ---------------------------------------------- 17. contact & footer */
.contact-card { position: relative; overflow: hidden; padding: 30px 20px; border-radius: 18px; text-align: center; background: var(--surface); box-shadow: var(--lift-2); }
.contact-card::after {
    content: ""; position: absolute; inset: 0; padding: 1.5px; border-radius: inherit; pointer-events: none;
    background: var(--grad);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
}
.contact-card h2 { font-size: var(--fs-h2); margin-bottom: 11px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.contact-card p { max-width: 52ch; margin: 0 auto 20px; color: var(--muted); }
.contact-actions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.contact-actions .btn { flex: 1 1 100%; }
.contact-content h2 { margin-bottom: 6px; }

.footer { position: relative; padding: 24px 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); background: var(--bg-soft); border-top: 1px solid var(--border); }
.footer::before { content: ""; position: absolute; inset: -1px 0 auto 0; height: 2px; background: var(--grad); opacity: 0.5; }
.footer .container { display: flex; flex-direction: column; align-items: center; gap: 13px; text-align: center; }
.footer p { font-size: 0.85rem; color: var(--muted); }
.foot-links { display: flex; gap: 10px; }
.foot-links a { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); transition: color 0.2s ease, border-color 0.2s ease; }

/* ---------------------------------------------- 18. utilities */
.scroll-progress { position: fixed; inset: 0 auto auto 0; width: 0; height: 3px; z-index: 1100; background: var(--grad); }
.back-to-top {
    position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
    display: grid; place-items: center; width: 46px; height: 46px; z-index: 1050;
    border-radius: 50%; cursor: pointer; color: var(--accent);
    background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--lift-2);
    opacity: 0; transform: translateY(14px); pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.back-to-top.visible { opacity: 1; transform: none; pointer-events: auto; }
.back-to-top:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s cubic-bezier(0.16,1,0.3,1), transform 0.6s cubic-bezier(0.16,1,0.3,1); }
.reveal.is-visible { opacity: 1; transform: none; }
.spot { display: none; }

.lightbox {
    position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center;
    padding: 12px; background: rgba(8,10,14,0.9); backdrop-filter: blur(6px);
    opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 96vw; max-height: 78vh; width: auto; padding: 8px; border-radius: 12px; background: #fff; cursor: zoom-out; }
.lb-cap { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); max-width: 92vw; text-align: center; font-size: 0.77rem; line-height: 1.5; color: #e9ecf1; }
.lb-close { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 1.05rem; color: #fff; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25); }

::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid var(--bg-soft); }

/* ============================================================
   >= 640px  large phone / small tablet
   ============================================================ */
@media (min-width: 640px) {
    :root { --gutter: 22px; }
    section { padding-block: 64px; }
    .brand span { display: inline; }
    .hero-cta .btn, .contact-actions .btn, .pcard-actions .btn { flex: 0 1 auto; }
    .project-links a { flex: 0 1 auto; }
    .metrics { grid-template-columns: repeat(3, 1fr); }
    .case-metrics { flex-direction: row; flex-wrap: wrap; gap: 10px 22px; }
    .pcard-metrics { grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .pcard-metrics div { padding: 0 14px; border-top: 0; border-left: 1px solid var(--border); }
    .pcard-metrics div:first-child { padding-left: 0; border-left: 0; }
    .grid-2, .cert-grid, .edu-grid, .skills-grid { grid-template-columns: repeat(2, 1fr); }
    .pub h3 { flex: 1 1 auto; }
    .footer .container { flex-direction: row; justify-content: space-between; text-align: left; }
    .toc-mobile ol { grid-template-columns: repeat(2, 1fr); }
    table.data { font-size: 0.82rem; }
}

/* ============================================================
   >= 900px  tablet landscape and desktop
   ============================================================ */
@media (min-width: 900px) {
    :root { --nav-h: 66px; --gutter: 24px; }

    section { padding-block: 84px; }
    .narrow { max-width: 880px; }
    .section-head { margin-bottom: 44px; }

    /* nav returns to a horizontal bar */
    .nav-links {
        position: static; flex-direction: row; align-items: center; gap: 2px;
        max-height: none; overflow: visible; padding: 0; border: 0; border-radius: 0;
        background: none; box-shadow: none; opacity: 1; transform: none; pointer-events: auto;
    }
    .nav-links li { opacity: 1; transform: none; }
    .nav-links a { min-height: 0; padding: 8px 12px; font-size: 0.9rem; color: var(--muted); border-radius: 8px; position: relative; }
    .nav-links a::after {
        content: ""; position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%);
        width: 0; height: 2px; border-radius: 2px; background: var(--accent); transition: width 0.25s ease;
    }
    .nav-links a:hover { color: var(--text); }
    .nav-links a:hover::after, .nav-links a.active::after { width: 58%; }
    .nav-links a.active { color: var(--text); background: none; }
    .nav-ic, .nav-cta-mobile { display: none; }
    .nav-actions .btn-primary { display: inline-flex; }
    .hamburger { display: none; }
    .theme-toggle { width: 38px; height: 38px; }

    /* hero becomes two columns */
    .hero { padding-top: calc(var(--nav-h) + 70px); padding-bottom: 56px; }
    .hero::after {
        content: ""; position: absolute; inset: -20% -10% auto -10%; height: 120%; z-index: -2;
        pointer-events: none; filter: blur(70px); opacity: 0.5;
        background:
            radial-gradient(38% 44% at 18% 26%, color-mix(in srgb, var(--accent) 42%, transparent), transparent 62%),
            radial-gradient(34% 40% at 82% 14%, color-mix(in srgb, var(--accent-2) 38%, transparent), transparent 62%),
            radial-gradient(30% 38% at 62% 76%, rgba(168,85,247,0.28), transparent 64%);
        animation: mesh 22s ease-in-out infinite alternate;
    }
    @keyframes mesh {
        0% { transform: translate3d(0,0,0) scale(1); }
        50% { transform: translate3d(-26px,14px,0) scale(1.07); }
        100% { transform: translate3d(20px,-16px,0) scale(1.03); }
    }
    .hero-grid { grid-template-columns: 1.45fr 0.8fr; gap: 52px; align-items: start; justify-items: start; }
    .hero-photo { order: 0; justify-self: end; margin: 0; }
    .hero-photo figcaption { display: block; max-width: 340px; margin-top: 18px; font-size: 0.79rem; line-height: 1.55; color: var(--faint); text-align: center; }
    .portrait img { width: 340px; aspect-ratio: 4 / 5; border-radius: 28px; }
    .portrait-tag { font-size: 0.75rem; padding: 7px 14px; bottom: 14px; }
    .portrait { transition: transform 0.45s cubic-bezier(0.16,1,0.3,1); }
    .portrait:hover { transform: translateY(-5px); }
    .hero h1 em { position: relative; background-size: 260% 100%; animation: shimmer 9s linear infinite; }
    @keyframes shimmer { to { background-position: -260% 0; } }
    .hero-cta { width: auto; margin-top: 26px; }
    .affil span { font-size: 0.83rem; padding: 8px 14px; transition: transform 0.2s ease, border-color 0.2s ease; }
    .affil span:hover { transform: translateY(-2px); border-color: var(--accent-ring); }

    /* multi-column layouts */
    .agenda { grid-template-columns: repeat(3, 1fr); gap: 22px; }
    .theme { padding: 30px 28px; border-radius: 20px; }
    .cases { gap: 22px; }
    .case { grid-template-columns: 300px 1fr; border-radius: 22px; }
    .case-media { border-bottom: 0; border-right: 1px solid var(--border); }
    .case-media img { max-height: none; height: 100%; min-height: 210px; padding: 16px; transition: transform 0.4s ease; }
    .case-body { padding: 28px 30px; }
    .pcard, .ship { grid-template-columns: 0.92fr 1.08fr; border-radius: 22px; }
    .ship { grid-template-columns: 1.05fr 0.95fr; gap: 52px; background: none; border: 0; box-shadow: none; align-items: center; }
    .ship-visual { padding: 0; border: 0; background: none; }
    .ship-alt .ship-visual { order: 2; }
    .pcard-media { padding: 34px 0 34px 34px; border-bottom: 0; border-right: 1px solid var(--border); }
    .pcard-body, .ship-body { padding: 32px 34px; }
    .ship-body { padding: 0; }
    .grid-2, .cert-grid, .edu-grid, .skills-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
    .about-wrap { grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
    .metrics { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
    .pub { padding: 24px 26px; }
    .pub-list { gap: 14px; }
    .contact-card { padding: 46px 40px; }
    .contact-actions .btn { flex: 0 1 auto; }
    .step { grid-template-columns: 46px 1fr; padding: 20px 22px; }
    .step-n { width: 38px; height: 38px; font-size: 0.9rem; }

    /* case-study article regains its sidebar */
    .paper-hero { padding-top: calc(var(--nav-h) + 52px); padding-bottom: 34px; }
    .paper-layout { grid-template-columns: 220px 1fr; gap: 56px; align-items: start; padding-block: 46px 90px; }
    .prose { max-width: var(--readw); }
    .prose > * + * { margin-top: 22px; }
    .toc { display: block; position: sticky; top: calc(var(--nav-h) + 28px); }
    .toc .mono-label { display: block; margin-bottom: 14px; }
    .toc ul { display: grid; gap: 3px; border-left: 2px solid var(--border); }
    .toc a { display: block; margin-left: -2px; padding: 6px 0 6px 16px; font-size: 0.86rem; color: var(--muted); border-left: 2px solid transparent; transition: color 0.2s ease, border-color 0.2s ease; }
    .toc a:hover { color: var(--text); }
    .toc a.active { color: var(--accent); font-weight: 600; border-left-color: var(--accent); }
    .toc-mobile { display: none; }
    .table-wrap { margin: 26px 0; border: 1px solid var(--border); border-radius: 12px; }
    table.data th, table.data td { white-space: normal; }
    table.data { min-width: 0; font-size: 0.89rem; }
    figure.fig img { padding: 16px; }
    figure.fig.fig-tall img { max-height: 640px; }
    figure.fig.fig-wide img { max-height: 420px; }
    .prose > h2:first-of-type + p::first-letter { font-size: 3.3em; padding: 6px 12px 0 0; }

    /* demo side-by-side */
    .demo-stage { grid-template-columns: 1fr 258px; }
    .demo-canvas-wrap { min-height: 380px; }
    .demo-side { border-top: 0; border-left: 1px solid var(--border); padding: 20px; }

    /* desktop-only depth: hover, tilt, spotlight, grain */
    body::after {
        content: ""; position: fixed; inset: 0; z-index: 9999; pointer-events: none; opacity: 0.028;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    }
    html[data-theme="dark"] body::after { opacity: 0.05; }

    .theme:hover, .card:hover, .skill-group:hover, .cert:hover, .metric:hover, .edu:hover { transform: translateY(-5px); box-shadow: var(--lift-3), var(--edge-light); }
    .case:hover, .pcard:hover, .pub:hover, .scholar-card:hover { transform: translateY(-4px); box-shadow: var(--ring-glow); }
    .case:hover .case-media img { transform: scale(1.03); }
    .case:hover .case-more i { transform: translateX(5px); }
    .tl-item:hover { transform: translateX(4px); box-shadow: var(--lift-2); }
    .tag:hover { transform: translateY(-2px); border-color: var(--accent-ring); color: var(--text); }
    .chip:hover { transform: translateY(-2px); color: var(--text); border-color: var(--accent-ring); }
    .btn:hover { transform: translateY(-2px); box-shadow: var(--lift-2); border-color: var(--accent-ring); }
    .foot-links a:hover { transform: translateY(-3px); color: var(--accent); border-color: var(--accent-ring); }
    .back-to-top:hover { transform: translateY(-3px); }
    .theme-links a:hover { transform: translateY(-2px); }
    .project-links a:hover { transform: translateY(-2px); box-shadow: var(--ring-glow); }

    .theme, .case, .pcard, .pub, .card, .skill-group { position: relative; overflow: hidden; }
    .theme::before, .case::before, .pcard::before, .pub::before, .card::before, .skill-group::before {
        content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; z-index: 3;
        background: var(--grad); transform: scaleX(0); transform-origin: left;
        transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
    }
    .theme:hover::before, .case:hover::before, .pcard:hover::before,
    .pub:hover::before, .card:hover::before, .skill-group:hover::before { transform: scaleX(1); }

    .btn-primary::after {
        content: ""; position: absolute; top: 0; left: -140%; width: 60%; height: 100%;
        background: linear-gradient(100deg, transparent, rgba(255,255,255,0.42), transparent);
        transition: left 0.65s ease;
    }
    .btn-primary:hover::after { left: 140%; }

    .spot {
        display: block; position: absolute; inset: 0; z-index: 0; pointer-events: none; border-radius: inherit;
        background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 13%, transparent), transparent 60%);
        opacity: 0; transition: opacity 0.35s ease;
    }
    .theme:hover .spot, .pub:hover .spot, .card:hover .spot, .skill-group:hover .spot, .cert:hover .spot, .metric:hover .spot { opacity: 1; }

    .pv-stage { perspective: 1300px; }
    .browser { --rx: 0deg; --ry: 0deg; transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: transform 0.5s cubic-bezier(0.16,1,0.3,1), box-shadow 0.45s ease; will-change: transform; }
    .browser.is-tilting { transition: transform 0.12s linear, box-shadow 0.45s ease; }
    .browser-view::after {
        content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
        background: linear-gradient(115deg, transparent 32%, rgba(255,255,255,0.3) 46%, transparent 58%);
        transform: translateX(-100%); transition: transform 0.9s cubic-bezier(0.16,1,0.3,1);
    }
    .pcard:hover .browser-view::after, .ship:hover .browser-view::after { transform: translateX(100%); }

    figure.fig img { transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease; }
    figure.fig img:hover { transform: translateY(-3px); box-shadow: var(--lift-2); border-color: var(--accent-ring); }
    figure.fig::after {
        content: "\f00e"; font-family: "Font Awesome 6 Free"; font-weight: 900;
        position: absolute; top: 14px; right: 14px; z-index: 2;
        display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
        font-size: 0.8rem; color: #fff; background: rgba(20,22,26,0.62);
        opacity: 0; transform: translateY(-4px); pointer-events: none;
        transition: opacity 0.25s ease, transform 0.25s ease;
    }
    figure.fig:hover::after { opacity: 1; transform: none; }

    .section-title .w { opacity: 0; transform: translateY(0.5em); }
    .section-head.is-visible .section-title .w {
        opacity: 1; transform: none;
        transition: opacity 0.55s cubic-bezier(0.16,1,0.3,1), transform 0.55s cubic-bezier(0.16,1,0.3,1);
        transition-delay: calc(var(--i) * 45ms);
    }

    .lightbox { padding: 32px; }
    .lightbox img { max-width: min(1200px, 94vw); max-height: 86vh; padding: 18px; border-radius: 14px; }
    .back-to-top { right: 22px; bottom: 22px; }
}

/* ============================================================
   >= 1200px  wide
   ============================================================ */
@media (min-width: 1200px) {
    .hero-grid { gap: 60px; }
    .paper-layout { gap: 64px; }
    .cases { gap: 24px; }
}

/* ============================================================
   preferences
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
    .reveal, .section-title .w { opacity: 1; transform: none; }
    .browser { transform: none !important; }
}

@media print {
    .navbar, .back-to-top, .scroll-progress, .toc, .toc-mobile, .demo, .skip-link, .lightbox { display: none !important; }
    body { background: #fff; color: #000; font-size: 11pt; }
    .paper-layout { grid-template-columns: 1fr; }
    figure.fig img { box-shadow: none; }
    a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; }
}

/* React island: hide the no-JS fallback once the component mounts */
#delivered-root.is-hydrated .ships { display: none; }

/* ============================================================
   REFINEMENT LAYER
   Restores polish lost in the mobile-first rewrite and adds
   modern CSS behind @supports guards.
   ============================================================ */

/* ---- typography: better line breaking ---- */
@supports (text-wrap: balance) {
    h1, h2, h3, h4, .section-title, .paper-hero h1, .hero h1 { text-wrap: balance; }
}
@supports (text-wrap: pretty) {
    p, .lead, .section-sub, .lede, figcaption, .pcard-summary { text-wrap: pretty; }
}

/* ---- zero-specificity resets so components never fight ---- */
:where(ul, ol) { list-style: none; }
:where(a) { color: inherit; }
:where(button, input, select, textarea) { font: inherit; color: inherit; }

/* ---- status badges: living indicators ---- */
.pub-status.accepted::before,
.pcard-live::before {
    animation: statusPulse 2.6s ease-out infinite;
}
@keyframes statusPulse {
    0%   { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
    70%  { box-shadow: 0 0 0 7px transparent; opacity: 0.9; }
    100% { box-shadow: 0 0 0 0 transparent; opacity: 1; }
}
.pcard-live::before { color: var(--ok); }

/* ---- section boundaries: hairline seams ---- */
.section-soft { position: relative; }
.section-soft::before,
.section-soft::after {
    content: ""; position: absolute; left: 0; right: 0; height: 1px; pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}
.section-soft::before { top: 0; }
.section-soft::after { bottom: 0; }

/* ---- hero: accent underline beneath the emphasised phrase ---- */
.hero h1 em { position: relative; }
.hero h1 em::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0.05em; height: 0.08em;
    border-radius: 4px; background: var(--grad); opacity: 0.28;
}

/* ---- scholar card: gradient wash on interaction ---- */
.scholar-card { position: relative; overflow: hidden; }
.scholar-card::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: var(--grad-soft); opacity: 0; transition: opacity 0.3s ease;
}
.scholar-card:hover::before, .scholar-card:focus-visible::before { opacity: 1; }
.scholar-card > * { position: relative; }
.scholar-go { transition: transform 0.25s ease; }
.scholar-card:hover .scholar-go { transform: translate(3px, -3px); }

/* ---- demo panel: lift on interaction ---- */
.demo { transition: box-shadow 0.35s ease, border-color 0.35s ease; }

/* ---- focus: visible without being harsh ---- */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
}
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); color: var(--text); }

/* ---- rendering economy for long pages ---- */
@supports (content-visibility: auto) {
    #publications, #background, #engineering, #contact {
        content-visibility: auto;
        contain-intrinsic-size: auto 900px;
    }
}

/* ---- honour a stated preference for more contrast ---- */
@media (prefers-contrast: more) {
    :root { --muted: #3b424c; --faint: #4b515c; --border: #c9c6bf; --border-strong: #a9a59c; }
    html[data-theme="dark"] { --muted: #d3dae5; --faint: #b6bfcc; --border: #3a4454; --border-strong: #56637a; }
    .btn, .chip, .tag, .pill { border-width: 2px; }
    figure.fig figcaption, .metric span, .pcard-metrics dd { color: var(--muted); }
}

/* ---- forced-colors (Windows high contrast) ---- */
@media (forced-colors: active) {
    .btn, .chip, .card, .theme, .pcard, .pub { border: 1px solid CanvasText; }
    .portrait img, figure.fig img { forced-color-adjust: none; }
}

/* ---- navbar: accent line strengthens as you scroll ---- */
.navbar::after {
    content: ""; position: absolute; inset: auto 0 -1px 0; height: 2px;
    background: var(--grad); opacity: 0; transition: opacity 0.35s ease;
}
.navbar.scrolled::after { opacity: 0.55; }

/* ---- dark mode: slightly warmer surfaces, deeper page ---- */
html[data-theme="dark"] {
    --bg: #0b0e13;
    --bg-soft: #11151b;
    --surface: #171c24;
    --surface-2: #1b212b;
}

/* ---- images: no layout shift, smooth decode ---- */
img { background-color: var(--surface-2); }
.portrait img, figure.fig img, .browser-view img { background-color: transparent; }

/* ============================================================
   CASE STUDY HEADER & FOOTER  (mobile-first)
   ============================================================ */

/* badges row above the headline */
.paper-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.paper-badges .mono-label { font-size: 0.68rem; }
.read-time {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.04em;
    text-transform: uppercase; color: var(--faint);
}
.read-time::before { content: ""; width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.read-time i { font-size: 0.66rem; }

/* headline result strip: the answer, before the argument */
.paper-key {
    display: grid; gap: 0; margin: 20px 0 16px;
    border-radius: 16px; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--lift-1), var(--edge-light);
}
.paper-key > div { padding: 14px 16px; border-top: 1px solid var(--border); }
.paper-key > div:first-child { border-top: 0; }
.paper-key dt {
    font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; line-height: 1.15;
    background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.paper-key dd { margin-top: 2px; font-size: 0.76rem; color: var(--faint); }

/* collapsed bibliographic detail */
.paper-details { margin-bottom: 4px; }
.paper-details summary {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
    cursor: pointer; list-style: none;
    font-size: 0.8rem; font-weight: 600; color: var(--accent);
}
.paper-details summary::-webkit-details-marker { display: none; }
.paper-details summary::before {
    content: "\f0da"; font-family: "Font Awesome 6 Free"; font-weight: 900;
    font-size: 0.75rem; transition: transform 0.2s ease;
}
.paper-details[open] summary::before { transform: rotate(90deg); }
.paper-details dl { display: grid; gap: 9px; margin-top: 8px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.paper-details dl > div { display: grid; gap: 2px; }
.paper-details dt { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.paper-details dd { font-size: 0.86rem; color: var(--muted); overflow-wrap: anywhere; }

/* continue-reading footer */
.case-next { padding-block: 0 56px; }
.next-grid { display: grid; gap: 12px; margin-bottom: 18px; }
.next-card {
    position: relative; display: grid; gap: 3px;
    padding: 20px 46px 20px 20px; border-radius: 16px;
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--lift-1), var(--edge-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.next-card b { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; }
.next-card > span:last-of-type { font-size: 0.84rem; color: var(--muted); }
.next-card i {
    position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
    color: var(--accent); font-size: 0.9rem; transition: transform 0.25s ease;
}
.next-home {
    display: inline-flex; align-items: center; gap: 9px; min-height: 44px;
    font-size: 0.88rem; font-weight: 600; color: var(--muted);
}
.next-home:hover { color: var(--accent); }

@media (min-width: 640px) {
    .paper-key { grid-template-columns: repeat(3, 1fr); }
    .paper-key > div { border-top: 0; border-left: 1px solid var(--border); }
    .paper-key > div:first-child { border-left: 0; }
    .next-grid { grid-template-columns: repeat(2, 1fr); }
    .paper-details dl { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}

@media (min-width: 900px) {
    .paper-badges { gap: 10px 16px; margin-bottom: 16px; }
    .paper-key { margin: 26px 0 18px; max-width: 760px; }
    .paper-key dt { font-size: 1.6rem; }
    .paper-key dd { font-size: 0.79rem; }
    .case-next { padding-bottom: 80px; }
    .next-card:hover { transform: translateY(-4px); box-shadow: var(--ring-glow); border-color: var(--accent-ring); }
    .next-card:hover i { transform: translateY(-50%) translateX(4px); }
}

/* ============================================================
   MOBILE UI: thumb-zone navigation and visual hierarchy
   ============================================================ */

/* ---- bottom tab bar (phones and tablets only) ---- */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1200;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(18px) saturate(170%);
    -webkit-backdrop-filter: blur(18px) saturate(170%);
    border-top: 1px solid var(--border);
    box-shadow: 0 -6px 24px -12px rgba(20,22,26,0.25);
}
html[data-theme="dark"] .tabbar { box-shadow: 0 -6px 24px -10px rgba(0,0,0,0.7); }

.tabbar a {
    position: relative; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 4px;
    min-height: 52px; padding: 6px 2px; border-radius: 12px;
    font-size: 0.63rem; font-weight: 600; letter-spacing: 0.01em;
    color: var(--faint); text-align: center;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s ease, background 0.2s ease;
}
.tabbar a i { font-size: 1.02rem; transition: transform 0.25s cubic-bezier(0.16,1,0.3,1); }
.tabbar a span { line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tabbar a:active { background: var(--bg-soft); }
.tabbar a.active { color: var(--accent); }
.tabbar a.active i { transform: translateY(-2px) scale(1.08); }
/* indicator pip above the active tab */
.tabbar a::before {
    content: ""; position: absolute; top: 2px; left: 50%; transform: translateX(-50%) scaleX(0);
    width: 22px; height: 3px; border-radius: 0 0 3px 3px; background: var(--grad);
    transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
}
.tabbar a.active::before { transform: translateX(-50%) scaleX(1); }

/* make room for it, and lift the floating controls clear */
body.has-tabbar { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
body.has-tabbar .back-to-top { bottom: calc(78px + env(safe-area-inset-bottom)); }
body.has-tabbar .footer { padding-bottom: 24px; }

/* the hamburger sheet is redundant once the bar exists.
   The CV button takes its place so the résumé stays one tap away. */
body.has-tabbar .hamburger { display: none; }
body.has-tabbar .nav-links { display: none; }
body.has-tabbar .nav-actions .btn-primary { display: inline-flex; }

/* ---- stronger hierarchy on small screens ---- */
@media (max-width: 899px) {
    .hero h1 { font-size: clamp(2rem, 1.3rem + 3.4vw, 2.6rem); letter-spacing: -0.025em; }
    .section-title { font-size: clamp(1.6rem, 1.2rem + 2vw, 2rem); letter-spacing: -0.02em; }
    .section-head { margin-bottom: 24px; }
    .eyebrow { font-size: 0.66rem; letter-spacing: 0.17em; }

    /* clearer separation between sections */
    section + section { border-top: 1px solid var(--border); }
    .section-soft { background: var(--bg-soft); }

    /* deeper cards so they read as distinct surfaces */
    .theme, .case, .pcard, .pub, .card, .cert, .tl-item, .skill-group, .edu {
        box-shadow: var(--lift-2), var(--edge-light);
    }

    /* quieter metadata */
    .pcard-meta, .tl-date, .read-time, .mono-label { font-size: 0.66rem; }
}

/* ---- research themes: swipeable row that saves a screen of height ---- */
@media (max-width: 899px) {
    .agenda {
        grid-auto-flow: column;
        grid-auto-columns: 86%;
        grid-template-columns: none;
        gap: 12px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 6px;
        margin-inline: calc(var(--gutter) * -1);
        padding-inline: var(--gutter);
    }
    .agenda::-webkit-scrollbar { display: none; }
    .agenda > .theme { scroll-snap-align: start; }
    /* hint that the row continues */
    .agenda::after { content: ""; flex: 0 0 4px; }
}

/* ---- press feedback in place of hover ---- */
@media (hover: none) {
    .btn:active, .chip:active, .next-card:active,
    .case:active, .pcard:active, .theme:active { transform: scale(0.99); }
    .case-more:active, .theme-links a:active { opacity: 0.7; }
}

@media print { .tabbar { display: none !important; } body.has-tabbar { padding-bottom: 0; } }

/* desktop: the bar never appears */
@media (min-width: 900px) {
    .tabbar { display: none; }
    body.has-tabbar { padding-bottom: 0; }
    body.has-tabbar .back-to-top { bottom: 22px; }
}

/* desktop keeps the horizontal nav regardless of the tab bar flag */
@media (min-width: 900px) {
    body.has-tabbar .nav-links { display: flex; }
}

/* ============================================================
   NAVIGATION: command palette, section rail, card affordance
   ============================================================ */

/* ---- trigger in the top bar ---- */
.palette-trigger {
    display: none; align-items: center; gap: 9px;
    height: 38px; padding: 0 12px; border-radius: 999px; cursor: pointer;
    font-family: var(--font-body); font-size: 0.83rem; color: var(--faint);
    background: var(--surface-2); border: 1px solid var(--border);
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.palette-trigger i { font-size: 0.8rem; }
.palette-trigger kbd {
    font-family: var(--font-mono); font-size: 0.65rem; padding: 2px 6px; border-radius: 5px;
    color: var(--faint); background: var(--bg); border: 1px solid var(--border);
}
.palette-trigger:hover { color: var(--text); border-color: var(--accent-ring); background: var(--surface); }
.palette-trigger:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

/* mobile: icon-only, before the theme toggle */
@media (max-width: 899px) {
    .palette-trigger { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border-radius: 12px; border-color: var(--border-strong); background: var(--surface); }
    .palette-trigger span, .palette-trigger kbd { display: none; }
    .palette-trigger i { font-size: 0.95rem; color: var(--text); }
}
@media (min-width: 900px) { .palette-trigger { display: inline-flex; } }

/* ---- the palette ---- */
.palette {
    position: fixed; inset: 0; z-index: 4000; display: grid; justify-items: center;
    align-content: start; padding: 12vh 16px 16px;
    background: rgba(8, 10, 14, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.palette.open { opacity: 1; pointer-events: auto; }
.palette-box {
    width: min(560px, 100%); overflow: hidden; border-radius: 18px;
    background: var(--surface); border: 1px solid var(--border-strong);
    box-shadow: 0 30px 70px -20px rgba(0,0,0,0.5);
    transform: translateY(-8px) scale(0.99); transition: transform 0.22s cubic-bezier(0.16,1,0.3,1);
}
.palette.open .palette-box { transform: none; }
.palette-field { display: flex; align-items: center; gap: 11px; padding: 15px 17px; border-bottom: 1px solid var(--border); }
.palette-field i { color: var(--faint); font-size: 0.9rem; }
.palette-field input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 0.98rem; color: var(--text); }
.palette-field input::placeholder { color: var(--faint); }
.palette-field kbd, .palette-foot kbd {
    font-family: var(--font-mono); font-size: 0.63rem; padding: 3px 6px; border-radius: 5px;
    color: var(--faint); background: var(--surface-2); border: 1px solid var(--border);
}
.palette-list { max-height: min(52vh, 420px); overflow-y: auto; padding: 8px; display: grid; gap: 2px; }
.palette-list li { padding: 0; }
.palette-list li::before { content: none; }
.palette-list a {
    display: flex; align-items: center; gap: 13px; padding: 11px 12px; border-radius: 11px;
    min-height: 48px; color: var(--text);
}
.palette-list li.active a { background: var(--accent-soft); }
.palette-list a > i:first-child {
    display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px;
    border-radius: 9px; font-size: 0.85rem; color: var(--accent); background: var(--accent-soft);
}
.palette-list li.active a > i:first-child { background: var(--accent); color: var(--accent-ink); }
.palette-list span { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.palette-list b { font-size: 0.92rem; font-weight: 600; }
.palette-list small { font-size: 0.77rem; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-go { opacity: 0; color: var(--accent); font-size: 0.78rem; }
.palette-list li.active .palette-go { opacity: 1; }
.palette-empty { padding: 22px 14px; text-align: center; font-size: 0.88rem; color: var(--faint); }
.palette-foot {
    display: flex; gap: 16px; padding: 10px 17px; border-top: 1px solid var(--border);
    font-size: 0.72rem; color: var(--faint); background: var(--surface-2);
}
.palette-foot span { display: inline-flex; align-items: center; gap: 6px; }

/* ---- desktop section rail ---- */
.rail { display: none; }
@media (min-width: 1100px) {
    .rail {
        position: fixed; right: 18px; top: 50%; transform: translateY(-50%); z-index: 900;
        display: grid; gap: 2px;
    }
    .rail a {
        display: flex; align-items: center; justify-content: flex-end; gap: 10px;
        padding: 6px 4px; color: var(--faint);
    }
    .rail-dot {
        width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
        background: var(--border-strong);
        transition: background 0.25s ease, transform 0.25s ease;
    }
    .rail-label {
        font-size: 0.72rem; font-weight: 600; white-space: nowrap;
        opacity: 0; transform: translateX(6px);
        transition: opacity 0.25s ease, transform 0.25s ease;
    }
    .rail a:hover .rail-label, .rail a:focus-visible .rail-label { opacity: 1; transform: none; }
    .rail a:hover .rail-dot { background: var(--accent); }
    .rail a.active .rail-dot { background: var(--grad); transform: scale(1.45); }
    .rail a.active { color: var(--accent); }
    .rail a.active .rail-label { opacity: 1; transform: none; }
}

/* ---- publications filter spacing ---- */
.pub-filter { margin-bottom: 16px; }

/* ---- whole-card click target for case studies ---- */
.case { position: relative; }
.case .case-more::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; }
.case:focus-within { box-shadow: 0 0 0 3px var(--accent-ring); }
/* keep genuinely separate links above the stretched area */
.case a:not(.case-more) { position: relative; z-index: 3; }

@media (prefers-reduced-motion: reduce) {
    .palette-box { transform: none !important; }
}

/* ============================================================
   RESEARCH AGENDA CAROUSEL (mobile)
   Native scroll-snap plus depth cues and a segmented indicator.
   ============================================================ */

.agenda-nav { display: none; }

@media (max-width: 899px) {
    .agenda {
        /* a wider peek reads as "there is more", without cramping the card */
        grid-auto-columns: 82%;
        gap: 14px;
        padding-block: 4px 10px;
        scroll-padding-inline: var(--gutter);
        overscroll-behavior-x: contain;
    }
    .agenda:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 20px; }

    /* depth: the card in view is fully present, its neighbours recede */
    .agenda > .theme {
        scroll-snap-align: start;
        scroll-snap-stop: always;
        opacity: 0.52;
        transform: scale(0.965);
        transform-origin: center;
        transition: opacity 0.35s cubic-bezier(0.16,1,0.3,1),
                    transform 0.35s cubic-bezier(0.16,1,0.3,1),
                    box-shadow 0.35s ease;
        will-change: transform, opacity;
    }
    .agenda > .theme.is-current {
        opacity: 1;
        transform: none;
        box-shadow: var(--lift-3), var(--edge-light);
    }

    /* ---- indicator ---- */
    .agenda-nav {
        display: flex; align-items: center; justify-content: space-between;
        gap: 16px; margin-top: 14px;
    }
    .agenda-dots { display: flex; align-items: center; gap: 7px; }
    .agenda-dot {
        display: grid; place-items: center;
        width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%;
        background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    /* the visible track is the inner span, so the tap target stays 34px */
    .agenda-dot > span {
        display: block; width: 8px; height: 8px; border-radius: 999px;
        background: var(--border-strong);
        transition: width 0.4s cubic-bezier(0.16,1,0.3,1),
                    background 0.3s ease, transform 0.3s ease;
    }
    .agenda-dot:active > span { transform: scale(0.86); }
    .agenda-dot.is-active > span { width: 26px; background: var(--grad); }
    .agenda-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

    .agenda-count {
        font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em;
        color: var(--faint); font-variant-numeric: tabular-nums;
    }
    .agenda-count b { color: var(--accent); font-weight: 600; }
}

/* scroll-driven depth where the browser supports it: smoother than
   class toggling, and it degrades to the JS path above elsewhere */
@supports (animation-timeline: view(inline)) {
    @media (max-width: 899px) {
        .agenda > .theme {
            animation: cardFocus linear both;
            animation-timeline: view(inline);
            animation-range: entry 12% exit 88%;
        }
        @keyframes cardFocus {
            0%   { opacity: 0.5; transform: scale(0.955); }
            42%, 58% { opacity: 1; transform: scale(1); }
            100% { opacity: 0.5; transform: scale(0.955); }
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .agenda > .theme { opacity: 1 !important; transform: none !important; animation: none !important; }
}
