/* ==========================================================================
   Nikolas Neofytou — refined-technical portfolio
   Instrument Serif + DM Mono + Inter · deep near-black · electric cyan
   ========================================================================== */
/* Self-hosted fonts (Google Fonts, latin subset, OFL) — same origin, no
   third-party connection or @import chain before first paint. */
@font-face { font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('../assets/fonts/instrument-serif.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap;
    src: url('../assets/fonts/instrument-serif-italic.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 600; font-display: swap;
    src: url('../assets/fonts/inter-var.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 600; font-display: swap;
    src: url('../assets/fonts/inter-var-greek.woff2') format('woff2'); unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 300; font-display: swap;
    src: url('../assets/fonts/dm-mono-300.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('../assets/fonts/dm-mono-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 500; font-display: swap;
    src: url('../assets/fonts/dm-mono-500.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
    /* Light "blueprint" theme — warm paper, ink, electric cobalt */
    --bg: #F5F4EF;
    --bg-1: #0E0F12;          /* dark: used only by the (deliberately dark) photo viewer */
    --surface: #FFFFFF;
    --surface-2: #ECEAE2;

    --text: #1A1A17;
    --text-dim: #494841;
    --text-faint: #66645A;

    --accent: #1F3BFF;
    --accent-bright: #1A30E6;
    --accent-dim: #4A5BC8;

    --line: rgba(26, 26, 23, 0.12);
    --line-strong: rgba(26, 26, 23, 0.20);
    --accent-line: rgba(31, 59, 255, 0.30);

    --serif: 'Instrument Serif', Georgia, serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'DM Mono', 'Courier New', monospace;

    --maxw: 1200px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-weight: 300;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

/* faint engineering grid behind everything */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(31, 59, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(31, 59, 255, 0.05) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse 90% 70% at 70% 0%, #000 0%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 70% 0%, #000 0%, transparent 75%);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: rgba(31, 59, 255, 0.18); color: #1A1A17; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #cbc9c0; border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: #b4b2a7; }

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    z-index: 100;
    background: var(--accent);
    color: var(--bg);
    padding: 0.6rem 1rem;
    font-family: var(--mono);
    font-size: 0.8rem;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ==========================================================================
   Layout — sticky sidebar + scrolling main
   ========================================================================== */
.layout {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 clamp(1.5rem, 5vw, 4rem);
}

@media (min-width: 1024px) {
    .layout {
        display: grid;
        grid-template-columns: minmax(320px, 40%) 1fr;
        gap: clamp(2.5rem, 5vw, 5.5rem);
    }
    .sidebar { position: sticky; top: 0; height: 100vh; }
}

/* ---------- Sidebar ---------- */
.sidebar-inner {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: clamp(3rem, 9vh, 6rem) 0 2.5rem;
}

.side-name {
    display: block;
    font-family: var(--serif);
    font-size: clamp(2.6rem, 5vw, 3.6rem);
    line-height: 1;
    letter-spacing: 0.5px;
    color: var(--text);
    animation: rise 0.7s ease both;
}
.side-tagline {
    margin-top: 1.5rem;
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    font-weight: 400;
    line-height: 1.3;
    color: var(--text);
    max-width: 22ch;
    animation: rise 0.7s ease 0.08s both;
}
.side-blurb {
    margin-top: 1.1rem;
    font-size: 0.95rem;
    color: var(--text-dim);
    max-width: 34ch;
    animation: rise 0.7s ease 0.16s both;
}
.side-status {
    margin-top: 1.4rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 0.55rem;
    animation: rise 0.7s ease 0.24s both;
}
.status-pulse {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #28e07b;
    box-shadow: 0 0 0 0 rgba(40, 224, 123, 0.6);
    animation: pulse 2.4s infinite;
}

/* nav */
.side-nav { margin-top: 3rem; }
.side-nav ul { list-style: none; }
.side-nav li { margin: 0.15rem 0; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.5rem 0;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-faint);
    transition: color 0.25s ease;
}
.nav-rule {
    width: 28px;
    height: 1px;
    background: var(--text-faint);
    transition: width 0.25s ease, background 0.25s ease;
}
.nav-link:hover,
.nav-link:focus-visible { color: var(--text); }
.nav-link:hover .nav-rule,
.nav-link:focus-visible .nav-rule { width: 48px; background: var(--text); }
.nav-link.active { color: var(--accent-bright); }
.nav-link.active .nav-rule { width: 56px; background: var(--accent); }

/* sidebar bottom */
.sidebar-bottom { display: none; }
@media (min-width: 1024px) {
    .sidebar-bottom { display: block; }
}
.side-socials {
    display: flex;
    gap: 1.25rem;
    font-size: 1.2rem;
    color: var(--text-dim);
}
.side-socials a { transition: color 0.2s ease, transform 0.2s ease; }
.side-socials a:hover { color: var(--accent); transform: translateY(-2px); }
.side-cv {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.4rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    border-bottom: 1px solid var(--line-strong);
    padding-bottom: 2px;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.side-cv:hover { color: var(--accent); border-color: var(--accent); }

/* Icons: an inline SVG sprite (Font Awesome Free paths) at the top of
   <body>, so no icon font, no extra connection, nothing to wait for. */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: currentColor;
    overflow: visible;
}
.icon-spin { animation: icon-spin 1s linear infinite; }
@keyframes icon-spin { to { transform: rotate(360deg); } }

/* ---------- Main ---------- */
.main { position: relative; padding: clamp(3rem, 9vh, 6rem) 0 4rem; min-width: 0; }

/* ---------- Signal trace ----------
   A PCB-style trace in the left gutter, built by js/script.js from the
   section positions. The faint base route is always there; the cobalt
   copy draws down as you scroll and lights each section's via. Sits on
   the grid's layer (-1), so content always paints over it. */
.trace {
    position: absolute;
    top: 0;
    z-index: -1;
    overflow: visible;
    pointer-events: none;
}
.trace-base,
.trace-live,
.trace-stub,
.trace-gnd {
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: square;
    stroke-linejoin: miter;
}
.trace-base, .trace-gnd { stroke: rgba(26, 26, 23, 0.14); }
.trace-live { stroke: var(--accent); }
.trace-stub { stroke: rgba(26, 26, 23, 0.14); transition: stroke 0.3s; }
.trace-via {
    fill: var(--bg);
    stroke: rgba(26, 26, 23, 0.28);
    stroke-width: 1.5;
    transition: fill 0.3s, stroke 0.3s;
}
.trace-pad { fill: rgba(26, 26, 23, 0.18); transition: fill 0.3s; }
.trace-node.is-lit .trace-stub { stroke: var(--accent); }
.trace-node.is-lit .trace-via { fill: var(--accent); stroke: var(--accent); }
.trace-node.is-lit .trace-pad { fill: var(--accent); }
.trace-node.is-lit .trace-ring {
    animation: via-ping 0.9s ease-out 1;
}
.trace-ring {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1;
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
}
@keyframes via-ping {
    from { opacity: 0.7; transform: scale(1); }
    to   { opacity: 0;   transform: scale(3.2); }
}
.trace.is-done .trace-gnd { stroke: var(--accent); }
.trace-tip { fill: var(--accent); }
.trace-glow { fill: var(--accent); opacity: 0.22; filter: blur(5px); }
.trace.is-static .trace-tip,
.trace.is-static .trace-glow { display: none; }

/* ---------- Hero loop (Fig. 00) ---------- */
.hero-loop-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #0E0F12;
    border: 1px solid var(--line-strong);
}
.hero-loop-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.hero-loop-caption {
    display: flex;
    gap: 0.8rem;
    padding-top: 0.7rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.hero-loop-fig { color: var(--accent); }

/* ---------- Landing: the pitch over an oscilloscope ----------
   The first screen, full width above the sidebar layout. The scope's soft
   keys are the six projects (tabs, wired in js/script.js; plain links to the
   case studies without JS). The trace is static SVG; the sweep is a clip. */
.landing { min-height: 100vh; min-height: 100svh; display: flex; }
.landing-inner {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 1.75rem clamp(1.5rem, 5vw, 4rem) clamp(2rem, 5vh, 3rem);
    display: flex;
    flex-direction: column;
}
.landing-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.landing-name { font-family: var(--serif); font-size: 1.5rem; line-height: 1; color: var(--text); }
.landing-nav {
    display: flex;
    gap: clamp(1rem, 2.2vw, 1.9rem);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.landing-nav a { color: var(--text-dim); transition: color 0.2s ease; }
.landing-nav a:hover,
.landing-nav a:focus-visible { color: var(--accent); }
.landing-h {
    margin-top: auto;   /* with .landing-foot's margin-bottom: the pitch sits centred below the top bar */
    padding-top: clamp(1.75rem, 7vh, 4rem);
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(2.6rem, min(6.4vw, 10.5vh), 5.6rem);
    line-height: 0.98;
    letter-spacing: -0.02em;
    color: var(--text);
    max-width: 15.5em;
}
.landing-h em { font-style: italic; color: var(--accent); }

.scope {
    --phosphor: #A9B8FF;
    --scope-dim: rgba(230, 232, 240, 0.6);
    margin-top: clamp(1.5rem, 4.5vh, 2.6rem);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    background: #0D0F14;
    color: #E6E8F0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 24px 48px -28px rgba(13, 15, 20, 0.65);
    animation: rise 0.7s ease 0.1s both;
}
.scope-screen { display: flex; flex-direction: column; min-width: 0; padding: 1rem 1.1rem 0; }
.scope-hud {
    display: flex;
    justify-content: space-between;
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--scope-dim);
}
.scope-hud b { font-weight: 400; color: #8FA0FF; }
.scope-plot { position: relative; flex: 1 0 clamp(150px, 27vh, 250px); margin-top: 0.7rem; }
.scope-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.scope-grat line,
.scope-ticks line,
.scope-seam { vector-effect: non-scaling-stroke; stroke-width: 1; }
.scope-grat line { stroke: rgba(255, 255, 255, 0.07); }
.scope-ticks line { stroke: rgba(255, 255, 255, 0.16); }
.scope-seam { stroke: rgba(143, 160, 255, 0.45); stroke-dasharray: 3 5; }
.scope-wave { position: absolute; inset: 0; animation: scope-sweep 1.6s cubic-bezier(0.3, 0.6, 0.3, 1) 0.25s both; }
.scope-glow,
.scope-line { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.scope-glow { stroke: #3D56FF; stroke-width: 6; opacity: 0.45; filter: url(#scope-blur); }
.scope-line { stroke: var(--phosphor); stroke-width: 1.8; }
@keyframes scope-sweep { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* markers: a dashed cursor from the trace down, a dot, a label */
.scope-m {
    position: absolute;
    left: var(--x);
    top: var(--y);
    bottom: 0;
    border-left: 1px dashed rgba(169, 184, 255, 0.22);
    cursor: pointer;
    animation: scope-mark 0.35s ease var(--d) both;
    transition: border-color 0.25s ease;
}
.scope-m::before { content: ''; position: absolute; left: -16px; top: -16px; width: 32px; height: 32px; }
.scope-m i {
    position: absolute;
    left: -6px;
    top: -6px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #0D0F14;
    border: 2px solid var(--phosphor);
    transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.scope-m b {
    position: absolute;
    left: 9px;
    top: -24px;
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 400;
    color: var(--scope-dim);
    transition: color 0.25s ease;
}
.scope-m.is-on { border-left-color: rgba(169, 184, 255, 0.8); }
.scope-m.is-on i { background: #fff; border-color: #3D56FF; transform: scale(1.3); box-shadow: 0 0 0 4px rgba(61, 86, 255, 0.28); }
.scope-m.is-on b { color: #fff; }
@keyframes scope-mark { from { opacity: 0; } to { opacity: 1; } }

/* soft keys */
.scope-keys {
    display: flex;
    margin: 0.9rem -1.1rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.scope-key {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.8rem 0.8rem;
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    color: rgba(230, 232, 240, 0.72);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.2s ease, color 0.2s ease;
}
.scope-key:last-child { border-right: 0; }
.scope-key span { margin-right: 0.45rem; color: rgba(230, 232, 240, 0.55); }
.scope-key:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.scope-key:focus-visible { outline: 2px solid #8FA0FF; outline-offset: -2px; }
.scope-key[aria-selected="true"] { background: var(--accent); color: #fff; }
.scope-key[aria-selected="true"] span { color: rgba(255, 255, 255, 0.72); }

/* readout */
.scope-readout { background: #14161C; border-left: 1px solid rgba(255, 255, 255, 0.08); }
.scope-panel { display: flex; flex-direction: column; height: 100%; padding: 1rem 1.3rem 1.1rem; }
.scope-panel[hidden] { display: none; }
.scope-panel-head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.7rem;
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--scope-dim);
}
.scope-status { display: inline-flex; align-items: center; gap: 0.4rem; color: #3DDC84; }
.scope-status--bench { color: #8FA0FF; }
.scope-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.scope-cover { width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; border-radius: 3px; margin: 0.75rem 0; background: #1C1F27; }
.scope-name { font-family: var(--serif); font-size: 1.85rem; line-height: 1; color: #fff; }
.scope-line { margin-top: 0.35rem; font-size: 0.84rem; font-weight: 400; line-height: 1.45; color: rgba(230, 232, 240, 0.7); }
.scope-meas { display: grid; gap: 0.15rem; margin-top: 0.75rem; font-family: var(--mono); font-size: 0.74rem; }
.scope-meas div { display: flex; justify-content: space-between; gap: 1rem; }
.scope-meas dt { color: rgba(230, 232, 240, 0.62); }
.scope-meas dd { color: #fff; }
.scope-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: auto;
    padding-top: 0.85rem;
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    color: #8FA0FF;
    transition: color 0.2s ease, gap 0.2s ease;
}
.scope-link:hover,
.scope-link:focus-visible { color: #fff; gap: 0.7rem; }

/* pitch + calls to action */
.landing-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem 2rem;
    margin-top: clamp(1.4rem, 4vh, 2.2rem);
    margin-bottom: auto;
    animation: rise 0.7s ease 0.2s both;
}
.landing-sub { max-width: 36rem; font-size: 1.02rem; font-weight: 400; line-height: 1.55; color: var(--text-dim); }
.landing-avail { display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.landing-ctas { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.landing-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.35rem;
    font-size: 0.92rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 2px;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.landing-btn--primary { background: var(--accent); color: #fff; }
.landing-btn--primary:hover { background: var(--accent-bright); }
.landing-btn--ghost { border-color: var(--text); color: var(--text); }
.landing-btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.landing-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* below the landing the sidebar is navigation: the pitch was just made above */
.landing ~ .layout .side-tagline,
.landing ~ .layout .side-blurb { display: none; }
.landing ~ .layout .side-status { margin-top: 1.1rem; }

@media (min-width: 861px) and (max-height: 800px) {
    /* laptops: keep the calls to action above the fold */
    .landing-inner { padding-top: 1.25rem; padding-bottom: 1.25rem; }
    .landing-h { padding-top: 1.25rem; }
    .scope { margin-top: 1.25rem; }
    .scope-cover { aspect-ratio: 3 / 1; }
    .landing-foot { margin-top: 1.1rem; }
}
@media (max-width: 1023px) {
    /* the landing is the page header on small screens; the stacked sidebar would repeat it */
    .landing ~ .layout .sidebar { display: none; }
}
@media (max-width: 860px) {
    .scope { grid-template-columns: minmax(0, 1fr); }
    .scope-hud-seam { display: none; }
    .scope-plot { flex-basis: 140px; }
    .scope-keys { overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 2.5rem), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 2.5rem), transparent); }
    .scope-keys::-webkit-scrollbar { display: none; }
    .scope-key { flex: 0 0 auto; overflow: visible; }
    .scope-readout { border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.08); }
    .scope-panel { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 0 1rem; padding: 0.9rem 1rem 1rem; }
    .scope-panel-head { grid-column: 1 / -1; }
    .scope-cover { grid-row: 2 / span 3; aspect-ratio: 1; margin: 0.75rem 0 0; }
    .scope-name { margin-top: 0.75rem; font-size: 1.5rem; }
    .scope-meas { display: none; }
    .scope-link { margin-top: 0.4rem; padding-top: 0; }
}
@media (max-width: 700px) {
    .landing-inner { padding-top: 1.1rem; padding-bottom: 1.5rem; }
    .landing-h { padding-top: 1.6rem; font-size: 2.6rem; }
    .scope { margin-top: 1.4rem; }
    .scope-plot { flex-basis: 120px; }
    .scope-panel { grid-template-columns: 84px minmax(0, 1fr); }
    .landing-foot { margin-top: 1.25rem; gap: 1rem; }
    .landing-btn { padding: 0.8rem 1.05rem; font-size: 0.88rem; }
    .landing-nav a:not(.landing-cv) { display: none; }
    .landing-sub { font-size: 0.95rem; }
    .landing-avail { white-space: normal; }
}

/* ---------- Fig. 01 scrub (bench → board → silicon) ----------
   Static by default; .is-live (added by JS) makes the section tall and pins
   the frame so scroll progress can drive the canvas. */
.scrub { padding: 1.5rem 0 0; }
.scrub-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #0E0F12;
    border: 1px solid var(--line-strong);
}
.scrub-poster,
.scrub-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.scrub-steps {
    list-style: none;
    margin: 0;
    padding: 0;
}
.scrub-step {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-dim);
}
.scrub-ch {
    display: block;
    margin-bottom: 0.2rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}
.scrub-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding-top: 0.7rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.scrub-fig { color: var(--accent); }
.scrub-rule { display: none; }

/* static: steps sit under the frame as a short list */
.scrub:not(.is-live) .scrub-steps {
    position: relative;
    display: grid;
    gap: 0.9rem;
}
.scrub:not(.is-live) .scrub-sticky { display: flex; flex-direction: column; }
.scrub:not(.is-live) .scrub-frame { display: flex; flex-direction: column; aspect-ratio: auto; overflow: visible; background: none; border: 0; }
.scrub:not(.is-live) .scrub-poster { position: static; aspect-ratio: 16 / 9; border: 1px solid var(--line-strong); background: #0E0F12; }
.scrub:not(.is-live) .scrub-canvas { display: none; }
.scrub:not(.is-live) .scrub-steps { margin-top: 1.25rem; }

/* live: tall track, pinned frame, steps overlaid like scope annotations */
.scrub.is-live { height: 300vh; height: 300svh; }
.scrub.is-live .scrub-sticky {
    position: sticky;
    top: calc(13svh - 1rem);
}
/* the stage grows to most of the viewport and bleeds past the column
   (to the window's right edge on desktop, both edges on phones) */
.scrub.is-live .scrub-frame {
    --gutter: clamp(1.5rem, 5vw, 4rem);
    aspect-ratio: auto;
    height: 72vh;
    height: 72svh;
    margin-inline: calc(-1 * var(--gutter));
    border-inline: 0;
}
@media (min-width: 1024px) {
    .scrub.is-live .scrub-frame {
        margin-left: 0;
        margin-right: calc(-1 * (max((100vw - var(--maxw)) / 2, 0px) + var(--gutter)));
        border-left: 1px solid var(--line-strong);
    }
}
/* hidden lazy images are never fetched, so live mode skips the poster */
.scrub.is-live .scrub-poster { display: none; }
.scrub.is-live .scrub-steps {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 3.5rem 1.5rem 1.25rem;
    background: linear-gradient(to top, rgba(8, 9, 12, 0.82), rgba(8, 9, 12, 0));
    pointer-events: none;
}
.scrub.is-live .scrub-step {
    position: absolute;
    left: 1.5rem; right: 1.5rem; bottom: 1.25rem;
    max-width: 32rem;
    color: rgba(245, 244, 239, 0.9);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}
.scrub.is-live .scrub-step.is-on { opacity: 1; transform: none; }
.scrub.is-live .scrub-ch { color: #8C9BFF; }
.scrub.is-live .scrub-rule {
    display: block;
    flex: 1;
    height: 1px;
    background: var(--line-strong);
    overflow: hidden;
}
.scrub-fill {
    display: block;
    height: 100%;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
}

.section { padding: 3rem 0; scroll-margin-top: 2rem; }
.section:first-child { padding-top: 0; }

.section-head {
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.section-num { color: var(--accent); }

/* prose */
.prose p {
    font-size: 1.02rem;
    line-height: 1.75;
    color: var(--text-dim);
    margin-bottom: 1.1rem;
    max-width: 62ch;
}
.prose em { color: var(--text); font-style: italic; }
.prose a { color: var(--accent); border-bottom: 1px solid var(--accent-line); transition: border-color 0.2s; }
.prose a:hover { border-color: var(--accent); }

/* toolbox */
.toolbox {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem 2rem;
    margin: 2.5rem 0 1.5rem;
}
.toolbox-label {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-dim);
    margin-bottom: 0.5rem;
}
.toolbox-col p {
    font-family: var(--mono);
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--text-dim);
}
.bench {
    font-family: var(--mono);
    font-size: 0.78rem;
    line-height: 1.7;
    color: var(--text-faint);
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}
.bench-label {
    color: var(--accent-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-right: 0.5rem;
}

/* ==========================================================================
   Case studies
   ========================================================================== */
/* Horizontal snap gallery — modelled on Apple's scroll-container pattern:
   a native overflow-x scroller with mandatory x-snapping that bleeds past the
   content column, fixed-width tiles that snap to the column's left edge,
   a hidden scrollbar, and paddle buttons that disable at either end. */
.case-gallery {
    /* distance from the main column's right edge to the viewport edge */
    --gutter: clamp(1.5rem, 5vw, 4rem);
    --bleed-right: calc(max((100vw - var(--maxw)) / 2, 0px) + var(--gutter));
    --bleed-left: 0px;
    --case-gap: 1.25rem;
    --case-w: 100%;
    position: relative;
}
.case-track {
    display: flex;
    gap: var(--case-gap);
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--bleed-left) var(--bleed-right);
    margin-inline: calc(-1 * var(--bleed-left)) calc(-1 * var(--bleed-right));
    padding-inline: var(--bleed-left) var(--bleed-right);
    padding-block: 2px 1.25rem;
    scrollbar-width: none;
    outline: none;
}
.case-track::-webkit-scrollbar { display: none; }
.case-track:focus-visible { box-shadow: inset 0 0 0 1px var(--accent-line); }

.case {
    position: relative;
    flex: 0 0 var(--case-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 1.75rem 1.75rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    scroll-snap-align: start;
    scroll-snap-stop: always;
    transition: border-color 0.25s, opacity 0.35s;
}
.case:hover { border-color: var(--line-strong); }
/* corner tick, echoing the blueprint theme */
.case::after {
    content: '';
    position: absolute;
    top: -1px; right: -1px;
    width: 14px; height: 14px;
    border-top: 1px solid var(--accent);
    border-right: 1px solid var(--accent);
    opacity: 0;
    transition: opacity 0.25s;
}
.case.is-active::after { opacity: 1; }

/* cover still, bleeding to the card edges */
.case-cover {
    margin: -1.75rem -1.75rem 1.4rem;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #0E0F12;
    border-bottom: 1px solid var(--line);
}
.case-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.case-rule { margin-bottom: 1.1rem; }
.case-rule span {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
}
.case-rule span::after {
    content: '';
    display: inline-block;
    vertical-align: middle;
    width: 2.25rem; height: 1px;
    margin-left: 0.75rem;
    background: var(--accent-line);
}
.case-body { display: flex; flex-direction: column; flex: 1; }
.case-body .case-tech { margin-top: auto; padding-top: 0.75rem; }

/* paddle nav + progress */
.case-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-top: 0.5rem;
}
.case-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}
.case-counter {
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.case-counter-sep { color: var(--text-faint); margin: 0 0.1rem; }
.case-progress-rule {
    position: relative;
    flex: 1;
    max-width: 200px;
    height: 1px;
    background: var(--line-strong);
}
.case-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 33.333%;
    background: var(--accent);
    transform-origin: left;
    transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1), transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.paddlenav { display: flex; gap: 0.5rem; }
.paddle {
    width: 38px; height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    color: var(--text-dim);
    font-size: 0.8rem;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s, opacity 0.2s;
}
.paddle:hover { color: var(--accent); border-color: var(--accent); }
.paddle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.paddle[aria-disabled="true"] { opacity: 0.35; cursor: default; pointer-events: none; }
.case-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-bottom: 0.4rem;
}
.case-title {
    font-family: var(--serif);
    font-size: clamp(1.7rem, 3vw, 2.2rem);
    font-weight: 400;
    line-height: 1;
    color: var(--text);
}
.case-flag {
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
    border: 1px solid var(--line-strong);
    padding: 0.2rem 0.5rem;
}
.case-flag .icon { margin-right: 0.3rem; }
.case-flag--open { color: var(--accent-dim); border-color: var(--accent-line); }
.case-role {
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    margin-bottom: 1.25rem;
}
.case-line {
    font-size: 0.96rem;
    line-height: 1.7;
    color: var(--text-dim);
    margin-bottom: 0.85rem;
    max-width: 64ch;
}
.case-k {
    font-family: var(--mono);
    font-size: 0.64rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-right: 0.6rem;
}
.case-decisions {
    list-style: none;
    margin: 0 0 1.1rem;
    max-width: 64ch;
}
.case-decisions li {
    position: relative;
    padding-left: 1.4rem;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}
.case-decisions li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent-dim);
}
.case-tech { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.25rem 0 1rem; }
.tech-tag {
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    color: var(--text-dim);
    border: 1px solid var(--line);
    padding: 0.28rem 0.65rem;
    transition: border-color 0.2s, color 0.2s;
}
.case:hover .tech-tag { border-color: var(--line-strong); }
.case-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-faint);
}
.case-badge .icon { color: var(--accent-dim); }
.case-badge--link { color: var(--accent-dim); transition: color 0.2s; }
.case-badge--link:hover { color: var(--accent); }
.case-badge--read { color: var(--accent); font-weight: 500; }
.case-badge--read:hover { color: var(--accent-bright); }
.case-cover-link { display: block; }

/* ==========================================================================
   Case-study pages (work/*.html, generated by scripts/build-case-studies.py)
   ========================================================================== */
.cs-crumb {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-faint);
    transition: color 0.2s;
}
.cs-crumb:hover { color: var(--accent); }
.cs-head { margin: 2.25rem 0 0; }
.cs-kicker {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text);
}
.cs-title {
    margin: 1.1rem 0 0;
    font-family: var(--serif);
    font-size: clamp(3.2rem, 7vw, 5.4rem);
    font-weight: 400;
    line-height: 0.95;
    letter-spacing: -0.01em;
    width: fit-content;
}
.cs-lede {
    margin-top: 1.25rem;
    max-width: 38rem;
    font-size: clamp(1.1rem, 1.6vw, 1.3rem);
    line-height: 1.5;
    font-weight: 400;
    color: var(--text);
}
.cs-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.25rem 2rem;
    margin: 2rem 0 0;
    padding: 1.25rem 0 0;
    border-top: 1px solid var(--line);
}
.cs-meta dt {
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 0.35rem;
}
.cs-meta dd { font-size: 0.92rem; line-height: 1.45; color: var(--text-dim); }
.cs-hero {
    margin: 2.5rem 0 0;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #0E0F12;
    border: 1px solid var(--line-strong);
}
.cs-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* article body */
.cs .section { padding: 3.5rem 0 0; }
.cs-prose { max-width: 40rem; }
.cs-prose p, .cs-prose li { font-size: 1.02rem; line-height: 1.7; color: var(--text-dim); }
.cs-prose p + p { margin-top: 1rem; }
.cs-prose strong { font-weight: 500; color: var(--text); }
.cs-prose code, .cs-adr code, .cs-story code {
    font-family: var(--mono);
    font-size: 0.86em;
    padding: 0.05em 0.3em;
    background: var(--surface-2);
}
.cs-prose ul { margin-top: 1rem; padding-left: 0; list-style: none; }
.cs-prose ul li { position: relative; padding-left: 1.25rem; }
.cs-prose ul li + li { margin-top: 0.5rem; }
.cs-prose ul li::before { content: '▸'; position: absolute; left: 0; color: var(--accent); font-size: 0.8em; top: 0.25em; }

/* the path a project took — a vertical timeline */
.cs-path { list-style: none; margin: 1.75rem 0 0; padding: 0; position: relative; max-width: 42rem; }
.cs-path::before { content: ''; position: absolute; left: 5px; top: 0.4rem; bottom: 0.4rem; width: 1px; background: var(--accent-line); }
.cs-path li { position: relative; padding: 0 0 1.6rem 2rem; }
.cs-path li::before {
    content: ''; position: absolute; left: 0; top: 0.3rem;
    width: 11px; height: 11px; border-radius: 50%;
    background: var(--accent); box-shadow: 0 0 0 3px var(--bg);
}
.cs-path li.is-next::before { background: var(--bg); border: 1.5px solid var(--accent); width: 8px; height: 8px; }
.cs-path-when { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.cs-path h3 { margin: 0.3rem 0 0.35rem; font-family: var(--serif); font-size: 1.4rem; font-weight: 400; line-height: 1.2; color: var(--text); }
.cs-path p { font-size: 0.98rem; line-height: 1.65; color: var(--text-dim); }

/* numbers that can be checked against the repo */
.cs-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1px;
    margin-top: 2rem;
    background: var(--line);
    border: 1px solid var(--line);
}
.cs-stat { background: var(--bg); padding: 1.1rem 1rem 1rem; }
.cs-stat-num { display: block; font-family: var(--serif); font-size: 2.3rem; line-height: 1; color: var(--text); }
.cs-stat-label {
    display: block;
    margin-top: 0.5rem;
    font-family: var(--mono);
    font-size: 0.64rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
}

/* architecture diagram */
.cs-diagram {
    margin: 2rem 0 0;
    padding: 1.5rem 1.25rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
}
.cs-diagram svg { display: block; width: 100%; height: auto; }
.cs-diagram figcaption {
    margin-top: 0.9rem;
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.cs-diagram .dg-box { fill: var(--bg); stroke: rgba(26, 26, 23, 0.35); stroke-width: 1; }
.cs-diagram .dg-box--accent { fill: rgba(31, 59, 255, 0.06); stroke: var(--accent); }
.cs-diagram .dg-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; fill: var(--text); }
.cs-diagram .dg-sub { font-family: var(--sans); font-size: 10.5px; fill: var(--text-faint); }
.cs-diagram .dg-edge { fill: none; stroke: rgba(26, 26, 23, 0.45); stroke-width: 1.2; }
.cs-diagram .dg-edge--accent { stroke: var(--accent); }
.cs-diagram .dg-tag { font-family: var(--mono); font-size: 9.5px; fill: var(--accent-dim); letter-spacing: 0.06em; }

/* decision records */
.cs-decisions { display: grid; gap: 1rem; margin-top: 2rem; }
.cs-adr {
    position: relative;
    padding: 1.25rem 1.4rem 1.3rem;
    background: var(--surface);
    border: 1px solid var(--line);
}
.cs-adr-id {
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}
.cs-adr h3 {
    margin: 0.4rem 0 0.8rem;
    font-family: var(--serif);
    font-size: 1.45rem;
    font-weight: 400;
    line-height: 1.2;
    color: var(--text);
}
.cs-adr dl { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.5rem 1rem; }
.cs-adr dt {
    padding-top: 0.2rem;
    font-family: var(--mono);
    font-size: 0.64rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.cs-adr dd { font-size: 0.95rem; line-height: 1.6; color: var(--text-dim); }

/* war stories */
.cs-story { margin-top: 2rem; max-width: 40rem; }
.cs-story h3 {
    font-family: var(--serif);
    font-size: 1.45rem;
    font-weight: 400;
    line-height: 1.2;
    color: var(--text);
}
.cs-story p { margin-top: 0.6rem; font-size: 1rem; line-height: 1.7; color: var(--text-dim); }

/* next project */
.cs-next { margin-top: 4.5rem; border-top: 1px solid var(--line); }
.cs-next-link { display: block; padding: 2rem 0 0.5rem; }
.cs-next-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}
.cs-next-title {
    display: block;
    margin-top: 0.6rem;
    font-family: var(--serif);
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    line-height: 1;
    color: var(--text);
    transition: color 0.2s;
}
.cs-next-link:hover .cs-next-title { color: var(--accent); }
.cs-next-lede { display: block; margin-top: 0.6rem; color: var(--text-dim); }

@media (max-width: 640px) {
    /* diagrams keep a readable size and scroll sideways instead of shrinking */
    .cs-diagram { overflow-x: auto; }
    .cs-diagram svg { min-width: 600px; }
    .cs-adr dl { grid-template-columns: 1fr; gap: 0.15rem; }
    .cs-adr dd + dt { margin-top: 0.6rem; }
}

/* ---------- Interactive explainers (js/explainers.js) ---------- */
.demo { margin-top: 2rem; background: var(--surface); border: 1px solid var(--line); }
.demo-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.25rem;
    border-bottom: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.demo-head::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.demo-head b { font-weight: 500; color: var(--text); }
.demo-body { padding: 1.25rem; }
.demo-fallback { font-size: 0.95rem; color: var(--text-dim); }
.demo.is-live .demo-fallback { display: none; }
.demo-btn {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.55rem 0.9rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line-strong);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.demo-btn:hover { border-color: var(--accent); color: var(--accent); }
.demo-btn:focus-visible, .demo-chip:focus-visible, .demo-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.demo-btn--accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.demo-btn--accent:hover { background: var(--accent-bright); color: #fff; }
.demo-btn:disabled { opacity: 0.4; cursor: default; }
.demo-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.demo-note { font-size: 0.8rem; color: var(--text-faint); }

/* Plutarch: normalisation */
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; }
.demo-label {
    display: inline-flex; align-items: center; gap: 0.6rem;
    font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint);
}
.demo-input {
    width: 12rem;
    padding: 0.5rem 0.7rem;
    font: 400 1.15rem/1.2 var(--sans);
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line-strong);
    text-transform: none;
    letter-spacing: 0;
}
.demo-presets { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.demo-chip {
    padding: 0.3rem 0.6rem;
    font: 400 0.95rem/1.2 var(--sans);
    color: var(--text-dim);
    background: var(--bg);
    border: 1px solid var(--line);
    cursor: pointer;
}
.demo-chip:hover { border-color: var(--accent); color: var(--accent); }
.demo-steps { list-style: none; margin: 1.25rem 0 0; padding: 0; }
.demo-step {
    display: grid;
    grid-template-columns: 9.5rem 1fr;
    gap: 0.75rem;
    align-items: center;
    padding: 0.45rem 0;
    border-top: 1px solid var(--line);
}
.demo-step-label { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.demo-step.is-changed .demo-step-label { color: var(--accent); }
.demo-step-cps { display: flex; flex-wrap: wrap; gap: 0.2rem; }
.demo-cp {
    display: inline-flex; flex-direction: column; align-items: center;
    min-width: 2rem; padding: 0.2rem 0.2rem 0.15rem;
    background: var(--bg); border: 1px solid var(--line);
}
.demo-cp b { font: 400 1.05rem/1.2 var(--sans); color: var(--text); }
.demo-cp i { font: normal 0.56rem/1.3 var(--mono); color: var(--text-faint); letter-spacing: 0.02em; }
.demo-cp.is-mark { background: rgba(31, 59, 255, 0.07); border-color: var(--accent-line); }
.demo-cp.is-mark b, .demo-cp.is-mark i { color: var(--accent); }
.demo-step.is-final .demo-cp { border-color: var(--accent); }
.demo-result { margin-top: 1rem; font-size: 0.95rem; color: var(--text-dim); }
.demo-result-label { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); }
.demo-result code { font-size: 1.05rem; color: var(--accent); }
.demo-hit { color: var(--text); }
.demo-via { color: var(--text-faint); }

/* Cinna: naive vs tiered ETA */
.demo-stage { background: var(--bg); border: 1px solid var(--line); }
.demo-map { display: block; width: 100%; height: auto; }
.demo-road { stroke: rgba(26, 26, 23, 0.10); stroke-width: 22; }
.demo-roadlabel { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; fill: var(--text-faint); }
.demo-stoppole { stroke: var(--text); stroke-width: 1.5; }
.demo-stopsign { fill: var(--accent); }
.demo-bus rect { fill: var(--text); }
.demo-bus text { font-family: var(--mono); font-size: 10px; fill: var(--bg); }
.demo-bus.is-parked rect { fill: rgba(26, 26, 23, 0.35); }
.demo-link { stroke-width: 1.6; }
.demo-link--naive { stroke: #B4532E; stroke-dasharray: 4 4; }
.demo-link--tier { stroke: var(--accent); }
.demo-etas { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.demo-eta { padding: 0.9rem 1rem; background: var(--bg); border: 1px solid var(--line); border-left: 3px solid var(--accent); }
.demo-eta.is-wrong { border-left-color: #B4532E; }
.demo-eta-title { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text); }
.demo-eta-sub { font-size: 0.78rem; color: var(--text-faint); }
.demo-eta-val { margin-top: 0.5rem; font-family: var(--serif); font-size: 2rem; line-height: 1; color: var(--text); }
.demo-eta-why { margin-top: 0.4rem; min-height: 2.6em; font-size: 0.85rem; line-height: 1.4; color: var(--text-dim); }
.demo-eta.is-wrong .demo-eta-why { color: #9A4526; }
.demo-eta-count { margin-top: 0.4rem; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em; color: var(--text-faint); }

/* Aristophanes: a week in the production (scroll-driven) */
.week { margin-top: 2rem; }
.week .demo-body { background: var(--surface); border: 1px solid var(--line); padding: 1.1rem 1.25rem 1rem; }
.week.is-live { height: 460vh; height: 460svh; }
.week.is-live .demo-body { position: sticky; top: max(1rem, 6svh); }
.week-head { position: relative; }
.week-rail { list-style: none; margin: 0; padding: 0 0 0.7rem; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; }
.week-rail li { display: flex; flex-direction: column; gap: 0.15rem; padding-bottom: 0.15rem; }
.week-day { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); }
.week-rail li.is-on .week-day { color: var(--accent); }
.week-title { font-family: var(--serif); font-size: 1.05rem; line-height: 1.15; color: var(--text-faint); transition: color 0.3s; }
.week-rail li.is-on .week-title { color: var(--text); }
.week-rail-track { display: block; height: 1px; background: var(--line); overflow: hidden; }
.week-rail-fill { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }
.week-svg { display: block; width: 100%; height: auto; max-height: 60svh; margin: 0.6rem auto 0; }
.week-caption { min-height: 2.9em; margin-top: 0.4rem; font-size: 0.98rem; line-height: 1.45; color: var(--text); }
.week-phone { fill: var(--surface); stroke: var(--text); stroke-width: 1.5; }
.week-notch { fill: var(--text); }
.week-kicker { font-family: var(--mono); font-size: 7.5px; letter-spacing: 0.12em; fill: var(--text-faint); }
.week-screen-title { font-family: var(--serif); font-size: 17px; fill: var(--text); }
.week-card { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1; }
.week-text { font-family: var(--sans); font-size: 10.5px; fill: var(--text-dim); }
.week-strong { font-weight: 500; fill: var(--text); }
.week-small { font-family: var(--mono); font-size: 8px; letter-spacing: 0.04em; fill: var(--text-faint); }
.week-btn { fill: var(--bg); stroke: var(--accent); stroke-width: 1.2; transition: fill 0.2s; }
.week-btn-label { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.08em; fill: var(--accent); }
.week-btn.is-pressed { fill: var(--accent); }
.week-btn.is-pressed + .week-btn-label { fill: #fff; }
.week-who { font-family: var(--mono); font-size: 7.5px; letter-spacing: 0.1em; fill: var(--text-faint); }
.week-line { font-family: var(--sans); font-size: 11px; }
.week-line--base { fill: rgba(26, 26, 23, 0.25); }
.week-line--read { fill: var(--text); }
.week-line--mine { fill: var(--accent); font-weight: 500; }
.week-eyeline { fill: var(--accent); }
.week-wave { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.week-track { fill: var(--line); }
.week-bar { fill: var(--accent); }
.week-qr { fill: var(--text); }
.week-verdict { fill: var(--surface-2); stroke: var(--line); transition: fill 0.2s, opacity 0.2s; }
.week-verdict.is-ok { fill: var(--accent); }
.week-verdict.is-dup { fill: #F5A623; }
.week-verdict.is-hidden { opacity: 0; }
.week-verdict-text { font-family: var(--sans); font-size: 14px; font-weight: 600; fill: #fff; }
.week-verdict-text.is-dark { fill: var(--text); }
.week-curtain { font-family: var(--serif); font-size: 24px; fill: var(--text); }
.week-link { stroke: var(--line); stroke-width: 1; }
.week-link.is-hot { stroke: var(--accent); stroke-width: 1.4; }
.week-dot { fill: var(--accent); }
.week-seal { transition: opacity 0.3s; }
.week-seal.is-dim { opacity: 0.3; }
.week-wax { stroke: rgba(0, 0, 0, 0.18); stroke-width: 1; }
.week-initial { font-family: var(--serif); font-size: 17px; fill: #fff; }
.week-name { font-family: var(--sans); font-size: 9px; fill: var(--text-dim); }
.week-ring { fill: none; stroke: var(--accent); stroke-width: 2; }
.week-badge { fill: var(--surface); stroke: var(--text); stroke-width: 0.8; }
.week-screen { transition: none; }
/* Cinna week: the route map and the rider's screens */
.wk-street { stroke: rgba(26, 26, 23, 0.06); stroke-width: 10; stroke-linecap: round; }
.wk-route22 { fill: none; stroke: rgba(26, 26, 23, 0.16); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 2 7; }
.wk-route-tag { font-family: var(--mono); font-size: 9px; fill: var(--text-faint); }
.wk-road { fill: none; stroke: rgba(26, 26, 23, 0.18); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.wk-route-hi { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.wk-stop { fill: var(--surface); stroke: var(--text); stroke-width: 1.6; transition: fill 0.2s; }
.wk-stop.is-on { fill: var(--accent); stroke: var(--accent); }
.wk-stop-label { font-family: var(--sans); font-size: 9.5px; fill: var(--text-dim); }
.wk-pin { fill: var(--accent); }
.wk-rider { fill: var(--text); }
.wk-you { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.08em; fill: var(--text); }
.wk-bus { fill: var(--accent); stroke: var(--accent); stroke-width: 1.2; }
.wk-bus.is-lost { fill: var(--surface); stroke: var(--text-faint); stroke-dasharray: 3 3; }
.wk-bus-text { font-family: var(--mono); font-size: 10px; font-weight: 500; fill: #fff; }
.wk-bus.is-lost + .wk-bus-text { fill: var(--text-faint); }
.wk-badge { fill: var(--accent); }
.wk-badge-text { font-family: var(--mono); font-size: 10px; font-weight: 500; fill: #fff; }
.wk-big { font-family: var(--serif); font-size: 20px; fill: var(--text); }
.wk-live { fill: var(--accent); }
.wk-live.is-off { fill: var(--text-faint); }
.week-card.wk-selected { stroke: var(--accent); stroke-width: 1.6; }
.wk-pass { fill: var(--text); }
.wk-pass-kicker { font-family: var(--mono); font-size: 8px; letter-spacing: 0.14em; fill: rgba(245, 244, 239, 0.6); }
.wk-pass-title { font-family: var(--sans); font-size: 12px; font-weight: 500; fill: var(--bg); }
.wk-pass-qr { fill: var(--bg); }
.wk-tap { fill: rgba(31, 59, 255, 0.12); stroke: var(--accent); stroke-width: 2; }
.wk-tap-check { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.wk-tap-text { font-family: var(--serif); font-size: 18px; fill: var(--text); }
.wk-ride-stop { font-family: var(--serif); font-size: 26px; fill: var(--text); }
.wk-banner { fill: var(--accent); }
.wk-banner-text { font-family: var(--sans); font-size: 12px; font-weight: 500; fill: #fff; }

/* Plutarch week: the data behind an entry */
.pl-chip { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1; }
.pl-chip--key { stroke: var(--accent); fill: rgba(31, 59, 255, 0.06); }
.pl-chip-text { font-family: var(--sans); font-size: 11px; fill: var(--text); }
.pl-chip-text--key { fill: var(--accent); font-weight: 500; }
.pl-arrow { stroke: var(--text-faint); stroke-width: 1.2; }
.pl-edge { stroke: var(--line-strong); stroke-width: 1; transition: stroke 0.2s; }
.pl-edge--hot { stroke: var(--accent); stroke-width: 1.4; }
.pl-lemma { fill: var(--text); }
.pl-lemma-text { font-family: Georgia, var(--serif); font-size: 17px; fill: var(--bg); }
.pl-form { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1; transition: fill 0.2s, stroke 0.2s; }
.pl-form-text { font-family: var(--sans); font-size: 10.5px; fill: var(--text); }
g.is-hot > .pl-form { fill: var(--accent); stroke: var(--accent); }
g.is-hot > .pl-form-text { fill: #fff; }
g.is-dim { opacity: 0.35; }
.pl-source { fill: rgba(31, 59, 255, 0.08); stroke: var(--accent-line); }
.pl-source-text { font-family: var(--sans); font-size: 8.5px; fill: var(--accent); }
.pl-hash { font-family: var(--mono); font-size: 8.5px; fill: var(--text-faint); }
.pl-env { fill: var(--accent); }
.pl-typed { font-family: var(--sans); font-size: 13px; fill: var(--text); }
.pl-caret { fill: var(--accent); }
.pl-res-lemma { font-family: Georgia, var(--serif); font-size: 17px; fill: var(--text); }
.pl-example { font-family: Georgia, var(--serif); font-style: italic; font-size: 11px; fill: var(--text-dim); }
.pl-row { fill: transparent; transition: fill 0.2s; }
.pl-row.is-hot { fill: rgba(31, 59, 255, 0.12); }
.pl-wotd { font-family: Georgia, var(--serif); font-size: 30px; fill: var(--text); }
.pl-rel { font-family: var(--sans); font-size: 11.5px; fill: var(--text-faint); transition: fill 0.2s; }
.pl-rel.is-hot { fill: var(--accent); text-decoration: underline; }
.pl-radio { fill: var(--surface); stroke: var(--text-faint); stroke-width: 1.2; }
.pl-radio.is-on { fill: var(--accent); stroke: var(--accent); }

/* static storyboard (no JS / reduced motion) */
.week-story { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.week-story li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.75rem; padding-top: 0.9rem; border-top: 1px solid var(--line); }
.week-story li:first-child { border-top: 0; padding-top: 0; }
.week-story b { display: block; font-family: var(--mono); font-size: 0.66rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.week-story span { font-family: var(--serif); font-size: 1.1rem; color: var(--text); }
.week-story p { font-size: 0.95rem; line-height: 1.55; color: var(--text-dim); }

@media (max-width: 760px) {
    .demo-etas { grid-template-columns: minmax(0, 1fr); }
    .week-title { font-size: 0.85rem; }
    .week-story li { grid-template-columns: 1fr; gap: 0.2rem; }
    .demo-step { grid-template-columns: 1fr; gap: 0.35rem; }
}

/* ---------- Cross-page morph (View Transitions, progressive) ----------
   Card cover + title on the home page share a name with the case page's
   hero + title, so the browser morphs one into the other. Browsers
   without cross-document view transitions just navigate normally. */
@view-transition { navigation: auto; }
.sidebar { view-transition-name: sidebar; }
::view-transition-group(*) {
    animation-duration: 0.5s;
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.3s; }
@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) { animation: none !important; }
}

/* more-link */
/* "More projects": a compact list under the carousel (generated from content/work/more.json) */
.more-projects {
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0 2rem;
}
.more-item { padding: 1rem 0; border-top: 1px solid var(--line); }
.more-name { font-family: var(--serif); font-size: 1.3rem; font-weight: 400; line-height: 1.2; color: var(--text); }
.more-name a { display: inline-flex; align-items: center; gap: 0.4rem; color: inherit; transition: color 0.2s; }
.more-name a .icon { font-size: 0.7em; color: var(--accent); }
.more-name a:hover { color: var(--accent); }
.more-line { margin-top: 0.35rem; font-size: 0.92rem; line-height: 1.55; color: var(--text-dim); }
.more-meta { margin-top: 0.5rem; font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.06em; color: var(--text-faint); }
.more-status { margin-left: 0.4rem; padding: 0.1rem 0.4rem; border: 1px solid var(--line-strong); color: var(--text-dim); }

.more-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    transition: color 0.2s, gap 0.2s;
}
.more-link:hover { color: var(--accent); gap: 0.8rem; }

/* ==========================================================================
   Experience
   ========================================================================== */
.xp { list-style: none; }
.xp-item {
    display: grid;
    grid-template-columns: 8.5rem 1fr;
    gap: 1.25rem;
    padding: 1.4rem 0;
    border-top: 1px solid var(--line);
    transition: background 0.2s;
}
.xp-item:first-child { border-top: none; }
.xp-date {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    padding-top: 0.2rem;
}
.xp-role {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.4rem;
}
.xp-org { color: var(--accent-dim); font-weight: 400; }
.xp-body p { font-size: 0.92rem; line-height: 1.65; color: var(--text-dim); max-width: 56ch; }
.xp-body a { color: var(--accent); border-bottom: 1px solid var(--accent-line); transition: border-color 0.2s; }
.xp-body a:hover { border-color: var(--accent); }

/* ==========================================================================
   Beyond — writing + photography
   ========================================================================== */
.sub-head {
    font-family: var(--sans);
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 1.25rem;
}
.sub-head--gap { margin-top: 3rem; }
.sub-note { color: var(--text-faint); font-weight: 300; font-size: 0.92rem; }

.writing-list { display: flex; flex-direction: column; }
.writing-placeholder { font-family: var(--mono); font-size: 0.85rem; color: var(--text-faint); padding: 1rem 0; }
.writing-card {
    display: block;
    padding: 1.1rem 0;
    border-top: 1px solid var(--line);
    transition: padding-left 0.2s ease;
}
.writing-card:first-child { border-top: none; }
.writing-card:hover { padding-left: 0.5rem; }
.writing-date {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 0.3rem;
}
.writing-title {
    font-size: 1.02rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.3rem;
    transition: color 0.2s;
}
.writing-card:hover .writing-title { color: var(--accent); }
.writing-excerpt { font-size: 0.9rem; color: var(--text-dim); line-height: 1.6; max-width: 64ch; }
.writing-read-more { display: none; }

/* Bookshelf — the spines on the shelf are tabs; the picked book comes off
   the shelf as its plate (a neoclassical oil painting of the book's idea,
   warm umber and gold with one ultramarine silk), its cover laid over the
   plate's corner, and a line on it. The picked spine lifts and turns
   cobalt, like the ultramarine in each plate.
   Without JS (.is-ready unset) the rail hides and every book is listed. */
.shelf-case { display: none; }
.shelf.is-ready .shelf-case { display: grid; gap: 1.1rem; margin-bottom: 1.75rem; }
.shelf-rail {
    display: flex;
    align-items: flex-end;
    gap: 5px;
    padding-top: 18px;
    border-bottom: 2px solid var(--text);
    box-shadow: 0 12px 14px -14px rgba(26, 26, 23, 0.45);
}
.spine {
    position: relative;
    width: var(--w, 44px);
    height: var(--h, 170px);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.6rem 0 0.9rem;
    border: 0;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(90deg, #0E0E0C 0%, #2B2B26 14%, #1A1A17 46%, #111110 100%);
    color: #EDEAE0;
    font: inherit;
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
/* two stamped rules, top and foot */
.spine::before,
.spine::after {
    content: '';
    position: absolute;
    left: 6px;
    right: 6px;
    height: 1px;
    background: rgba(237, 234, 224, 0.28);
}
.spine::before { top: 1.85rem; }
.spine::after { bottom: 0.45rem; }
.spine-num {
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.06em;
    line-height: 1;
    color: rgba(237, 234, 224, 0.62);
}
.spine-title {
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 0.95rem;
    writing-mode: vertical-rl;
    font-family: var(--serif);
    font-size: 0.98rem;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (hover: hover) {
    .spine:hover { transform: translateY(-6px); }
}
.spine[aria-selected="true"] {
    transform: translateY(-16px);
    background: linear-gradient(90deg, #13239E 0%, #3550FF 14%, #1F3BFF 46%, #182DCC 100%);
    color: #FFFFFF;
}
.spine[aria-selected="true"] .spine-num { color: rgba(255, 255, 255, 0.8); }
.spine:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.shelf-label {
    margin-left: auto;
    padding: 0 0 0.5rem 1rem;
    white-space: nowrap;
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.book-panel {
    --cw: 112px;
    --inset: 1.25rem;
    display: grid;
    grid-template-columns: calc(var(--cw) + var(--inset)) minmax(0, 1fr);
    column-gap: 1.4rem;
    align-items: start;
}
.book-panel[hidden] { display: none; }
.book-panel { scroll-margin-top: 1.5rem; }
.shelf:not(.is-ready) .book-panel + .book-panel { margin-top: 3rem; }
.book-plate {
    position: relative;
    grid-column: 1 / -1;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #6E5638;
    border: 1px solid var(--line-strong);
}
.book-plate img { width: 100%; height: 100%; object-fit: cover; }
/* the living plate: a seamless loop over the still, shown once it plays */
.book-loop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.6s ease;
}
.book-loop.is-playing { opacity: 1; }
/* a fine gilt slip inside the edge, as on a framed canvas */
.book-plate::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(214, 178, 106, 0.55), inset 0 0 0 4px rgba(26, 20, 12, 0.18);
}
/* the cover lies over the plate's lower-left corner, a lit binding edge on its left */
.book-cover {
    grid-column: 1;
    position: relative;
    width: var(--cw);
    margin: calc(var(--cw) * -0.95) 0 0 var(--inset);
    border-radius: 1px 3px 3px 1px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(26, 26, 23, 0.25), 0 20px 36px -14px rgba(26, 26, 23, 0.45);
}
.book-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.28) 0, rgba(255, 255, 255, 0.16) 3px, rgba(0, 0, 0, 0.06) 7px, transparent 12px);
}
.book-cover img { width: 100%; height: auto; }
.book-body { grid-column: 2; padding-top: 1.1rem; }
.book-fig {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.book-fig span { margin-right: 0.6rem; color: var(--accent); }
.book-title {
    margin: 0.45rem 0 0.4rem;
    font-family: var(--serif);
    font-size: clamp(1.45rem, 2.4vw, 1.85rem);
    font-weight: 400;
    line-height: 1.08;
    color: var(--text);
}
.book-by {
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.book-idea { margin-top: 0.8rem; max-width: 52ch; font-size: 0.95rem; line-height: 1.6; color: var(--text-dim); }

/* Chapter tour — one panorama per book with a region per chapter. Picking
   a chapter moves the camera there (the overview loop fades out and the
   still, at full resolution, carries the close-up); "Whole painting" glides
   back and the loop fades in once the camera has settled. The cover sits
   beside the text so it never hides part of the painting. */
.plate-view {
    position: absolute;
    inset: 0;
    transform-origin: 0 0;
    transition: transform 1.4s cubic-bezier(0.65, 0, 0.35, 1);
}
.book-plate.is-focused .book-loop { opacity: 0; transition: opacity 0.3s ease; }
.book-plate.is-returning .book-loop { transition-delay: 1.3s; }
/* the chapter's own loop: shown over the close-up once the camera has
   arrived (its first frame is exactly that window of the painting) */
.chapter-loop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.chapter-loop.is-playing { opacity: 1; transition-duration: 0.6s; }
.book-panel--tour .book-cover { margin-top: 1.1rem; }
.chapters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; }
.chapter {
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--line-strong);
    border-radius: 2px;
    background: transparent;
    font-family: var(--mono);
    font-size: 0.64rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.chapter-no { color: var(--accent); }
.chapter:hover { border-color: var(--accent); color: var(--text); }
.chapter[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.chapter[aria-pressed="true"] .chapter-no { color: rgba(255, 255, 255, 0.75); }
.chapter:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chapter-note {
    min-height: 2.8em;
    margin-top: 0.85rem;
    max-width: 48ch;
    font-family: var(--serif);
    font-size: 1.1rem;
    line-height: 1.35;
    color: var(--text);
}
.chapter-note.is-hint { font-family: var(--sans); font-size: 0.85rem; color: var(--text-faint); }

/* coming off the shelf: replayed each time a panel is un-hidden */
@keyframes plate-in { from { opacity: 0; transform: scale(1.045); } }
@keyframes cover-in { from { opacity: 0; transform: translateY(22px) rotate(-2.5deg); } }
@keyframes book-body-in { from { opacity: 0; transform: translateY(8px); } }
.shelf.is-ready .book-plate img { animation: plate-in 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.shelf.is-ready .book-cover { animation: cover-in 0.6s 0.12s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.shelf.is-ready .book-body { animation: book-body-in 0.5s 0.2s ease-out both; }

@media (max-width: 560px) {
    .shelf-rail { flex-wrap: wrap; }
    .shelf-label { order: -1; flex-basis: 100%; margin: 0 0 0.6rem; padding: 0; }
    /* tour panels: title beside the cover, then the line and the chapters full width */
    .book-panel--tour .book-body { display: contents; }
    .book-panel--tour .book-cover { grid-row: 2 / span 3; }
    .book-panel--tour .book-fig { grid-column: 2; margin-top: 1.1rem; }
    .book-panel--tour .book-title,
    .book-panel--tour .book-by { grid-column: 2; }
    .book-panel--tour .book-idea,
    .book-panel--tour .chapters,
    .book-panel--tour .chapter-note { grid-column: 1 / -1; }
    .book-panel { --cw: 84px; --inset: 0.9rem; column-gap: 1rem; }
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}
.photo-item {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--surface);
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 16 / 9;
    transition: border-color 0.3s ease;
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.photo-item:hover { border-color: var(--line-strong); }
.photo-item:hover img { transform: scale(1.05); }
.photo-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-zoom {
    position: absolute;
    bottom: 0.6rem; right: 0.6rem;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(4, 6, 12, 0.8);
    border: 1px solid var(--line-strong);
    color: var(--accent);
    font-size: 0.72rem;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.photo-item:hover .photo-zoom,
.photo-item:focus-visible .photo-zoom { opacity: 1; }

/* ==========================================================================
   Contact
   ========================================================================== */
.contact-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin: 1.5rem 0 2rem;
    font-family: var(--mono);
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    color: var(--accent);
    border: 1px solid var(--accent-line);
    padding: 0.85rem 1.5rem;
    transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.contact-cta:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.contact-list { list-style: none; }
.contact-list li {
    display: flex;
    gap: 1rem;
    padding: 0.65rem 0;
    border-top: 1px solid var(--line);
    font-size: 0.95rem;
    color: var(--text-dim);
}
.contact-list li:first-child { border-top: none; }
.contact-k {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-faint);
    min-width: 6.5rem;
}
.contact-list a { color: var(--text); border-bottom: 1px solid var(--line-strong); transition: color 0.2s, border-color 0.2s; }
.contact-list a:hover { color: var(--accent); border-color: var(--accent); }

/* footer */
.site-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 0.72rem;
    line-height: 1.7;
    color: var(--text-faint);
}

/* ==========================================================================
   Photography lightbox
   ========================================================================== */
.photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(2, 4, 8, 0.95);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.photo-lightbox.open { opacity: 1; visibility: visible; }
.photo-lightbox-inner {
    display: flex;
    width: 100%;
    max-width: 1100px;
    max-height: 85vh;
    background: var(--bg-1);
    border: 1px solid var(--line-strong);
}
.photo-lightbox-image { flex: 1 1 auto; min-width: 0; background: #000; display: flex; align-items: center; justify-content: center; }
.photo-lightbox-image img { max-width: 100%; max-height: 85vh; object-fit: contain; }
.photo-lightbox-meta {
    flex: 0 0 260px;
    padding: 1.75rem 1.5rem;
    background: var(--surface);
    border-left: 1px solid var(--line);
    font-family: var(--mono);
}
.photo-exif-header { color: var(--accent-dim); font-size: 0.7rem; letter-spacing: 0.08em; margin-bottom: 1.1rem; }
.photo-exif-row { display: flex; justify-content: space-between; gap: 12px; padding: 0.4rem 0; font-size: 0.78rem; border-bottom: 1px solid var(--line); }
.exif-key { color: var(--text-faint); }
.exif-val { color: var(--text); text-align: right; }
.exif-val.accent { color: var(--accent); }
.photo-exif-link { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 1.25rem; color: var(--accent-dim); font-size: 0.72rem; transition: color 0.2s; }
.photo-exif-link:hover { color: var(--accent); }
.photo-lightbox-close {
    position: absolute; top: 1.5rem; right: 1.75rem;
    width: 42px; height: 42px;
    background: transparent; border: 1px solid var(--line-strong);
    color: var(--text-dim); font-size: 1rem; cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}
.photo-lightbox-close:hover { color: var(--accent); border-color: var(--accent); }
.photo-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 46px; height: 46px;
    background: rgba(4, 6, 12, 0.7); border: 1px solid var(--line-strong);
    color: var(--text-dim); font-size: 1rem; cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}
.photo-nav:hover { color: var(--accent); border-color: var(--accent); }
.photo-prev { left: 1.5rem; }
.photo-next { right: 1.5rem; }

/* back to top */
.back-to-top {
    position: fixed;
    bottom: 1.5rem; right: 1.5rem;
    width: 44px; height: 44px;
    background: var(--surface); border: 1px solid var(--line-strong);
    color: var(--text-dim); cursor: pointer;
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, color 0.2s, border-color 0.2s;
    z-index: 90;
}
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { color: var(--accent); border-color: var(--accent); }

/* ==========================================================================
   Motion
   ========================================================================== */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(40, 224, 123, 0.5); }
    70% { box-shadow: 0 0 0 7px rgba(40, 224, 123, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 224, 123, 0); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1023px) {
    .side-nav { display: none; }
    .sidebar-inner { padding-bottom: 1rem; }
    .side-tagline { max-width: none; }
    .side-blurb { max-width: none; }
    .main { padding-top: 1rem; }
    .case-gallery { --bleed-left: var(--gutter); --case-w: 86%; --case-gap: 1rem; }
    .case { padding: 1.4rem 1.25rem 1.25rem; }
    .case-cover { margin: -1.4rem -1.25rem 1.25rem; }
    .case-progress-rule { max-width: 120px; }
    .xp-item { grid-template-columns: 1fr; gap: 0.4rem; }
    .photo-lightbox-inner { flex-direction: column; max-height: 90vh; overflow-y: auto; }
    .photo-lightbox-image img { max-height: 56vh; }
    .photo-lightbox-meta { flex-basis: auto; border-left: none; border-top: 1px solid var(--line); }
    .photo-prev { left: 0.5rem; }
    .photo-next { right: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
    .photo-item:hover img { transform: none; }
}

/* ==========================================================================
   Photo viewer stays dark on the light theme (photos read best on black),
   and the hover chip flips to a light chip with the cobalt accent.
   ========================================================================== */
.photo-lightbox { background: rgba(10, 10, 12, 0.96); }
.photo-lightbox-inner { background: #0E0F12; border-color: rgba(255, 255, 255, 0.12); }
.photo-lightbox-meta { background: #15161B; border-left-color: rgba(255, 255, 255, 0.08); }
.photo-exif-header { color: #6E83FF; }
.photo-exif-row { border-bottom-color: rgba(255, 255, 255, 0.07); }
.exif-key { color: #8A8A92; }
.exif-val { color: #E8E8EA; }
.exif-val.accent { color: #6E83FF; }
.photo-exif-link { color: #8A8A92; }
.photo-exif-link:hover { color: #6E83FF; }
.photo-lightbox-close, .photo-nav { color: #B4B4BA; border-color: rgba(255, 255, 255, 0.18); }
.photo-lightbox-close:hover, .photo-nav:hover { color: #6E83FF; border-color: #6E83FF; }
.photo-zoom { background: rgba(245, 244, 239, 0.92); border-color: rgba(26, 26, 23, 0.2); color: var(--accent); }
