/* Self-hosted fonts. Downloaded from Google Fonts and served from this
   origin, so no visitor request ever reaches a third party — the CSP has
   no font/style host to allow, and no visitor IP leaks to Google.

   Filenames carry a content hash, so these are safe to cache forever;
   the static handler serves anything under /static/fonts/ as immutable.
   Declarations mirror what Google Fonts itself emits, including the
   unicode-range split, so which file loads for which text is unchanged.
   Public Sans is a variable font: 400 and 600 share one file.

   Only latin and latin-ext are shipped, matching what the old link tag
   pulled. @font-face is not affected by cascade layers. */
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/newsreader-latin-ext-9d935053.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/newsreader-latin-e6606781.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: 'Public Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/public-sans-latin-ext-3a00a32f.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/public-sans-latin-5ed4d31c.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: 'Public Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/public-sans-latin-ext-3a00a32f.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/public-sans-latin-5ed4d31c.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: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/jetbrains-mono-latin-ext-505dfba8.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/jetbrains-mono-latin-14425ba9.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;
}

/* Cascade layers, in ascending priority. Ordering the layers up front means
   specificity never has to be fought with — a component rule beats a base rule
   because of where it lives, not because it was written more specifically.

   `motion` is second to last so the reduced-motion overrides win outright. Its
   blanket rule keeps !important as well, since unlayered CSS would otherwise
   outrank every layer here.

   `print` is last: paper is a different medium, not a variation on the screen
   one, and its rules have to beat everything above without reaching for
   !important on every line. */
@layer tokens, base, components, utilities, enhance, motion, print;

/* Opts every same-origin navigation into a cross-document view transition,
   turning the multi-page app into a continuous surface with no client-side
   router. Firefox ignores this and simply navigates, which is the fallback.

   Deliberately at the top level: @view-transition is only valid at the root of
   a stylesheet or inside a conditional group rule (@media, @supports,
   @container). @layer is not one of those, so nesting it there is not
   guaranteed to be honoured. */
@view-transition {
  navigation: auto;
}

/* ==========================================================================
   tokens
   ========================================================================== */
/* Light theme is the editorial base, dark echoes the terminal direction. Both
   share the same monospace-for-meta, serif-for-headline structure.

   Every ink/accent token is opaque and carries a measured contrast ratio
   against its own --bg. Do not reintroduce alpha here: compositing a
   mid-lightness ink over a near-white page was what pushed the light theme's
   secondary text down to 2.5:1. Tint at the usage site if you need it. */
@layer tokens {
  :root {
    --font-display: 'Newsreader', Georgia, serif;
    --font-body: 'Public Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

    --bg: oklch(98% 0.006 80);
    --ink: oklch(28% 0.05 250); /* 13.75:1 */
    --ink-dim: oklch(45% 0.04 250); /*  7.00:1 */
    --ink-faint: oklch(53% 0.035 250); /*  4.97:1 */
    --rule: oklch(88% 0.008 250); /* hairline divider, decorative */
    --rule-soft: oklch(63% 0.03 250); /*  3.29:1 — control boundaries (1.4.11) */
    --accent: oklch(52% 0.13 150); /*  4.90:1 — muted phosphor green */
    --danger: oklch(56% 0.18 30); /*  4.80:1 */
    --surface: oklch(100% 0 0);

    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 40px;
    --space-5: 64px;
    --space-6: 96px;

    /* Gap between a page header and the content under it. */
    --space-header: 32px;

    /* Exponential ease-out. Motion decelerates hard and settles; no bounce,
       no elastic, nothing that draws attention to itself. */
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);

    --max-width: 1280px;
  }

  /* Dark is declared twice on purpose: once for the OS preference (skipped
     when the visitor has explicitly chosen light) and once for the explicit
     override, so a stored choice wins over the system in either direction. */
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
      --bg: oklch(14% 0.02 160);
      --ink: oklch(94% 0.01 150); /* 16.71:1 */
      --ink-dim: oklch(80% 0.02 150); /* 10.71:1 */
      --ink-faint: oklch(59% 0.03 150); /*  4.90:1 */
      --rule: oklch(24% 0.012 155);
      --rule-soft: oklch(48% 0.08 148); /*  3.15:1 */
      --accent: oklch(78% 0.17 148); /* 10.56:1 */
      --danger: oklch(61% 0.15 30); /*  4.89:1 */
      --surface: oklch(18% 0.02 160);
    }
  }

  :root[data-theme='dark'] {
    --bg: oklch(14% 0.02 160);
    --ink: oklch(94% 0.01 150);
    --ink-dim: oklch(80% 0.02 150);
    --ink-faint: oklch(59% 0.03 150);
    --rule: oklch(24% 0.012 155);
    --rule-soft: oklch(48% 0.08 148);
    --accent: oklch(78% 0.17 148);
    --danger: oklch(61% 0.15 30);
    --surface: oklch(18% 0.02 160);
  }
}

/* ==========================================================================
   base — element defaults
   ========================================================================== */
@layer base {
  * {
    box-sizing: border-box;
  }

  html {
    color-scheme: light dark;
  }

  /* An explicit override has to carry color-scheme with it. Without this the
     UA canvas, the scrollbars and the form controls stay on the OS preference,
     so a visitor who chose dark on a light OS got light scrollbars and a light
     flash behind the page during a view transition. */
  :root[data-theme='dark'] {
    color-scheme: dark;
  }
  :root[data-theme='light'] {
    color-scheme: light;
  }

  body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
  }

  a {
    color: var(--ink);
  }
  a:hover {
    color: var(--accent);
  }

  h1,
  h2,
  h3 {
    font-family: var(--font-display);
    font-weight: 400;
    margin: 0;
    color: var(--ink);
  }

  p {
    line-height: 1.6;
    margin: 0;
  }

  /* One visible focus indicator for every interactive element.
     :focus-visible keeps it off pointer clicks while always showing it for
     keyboard users. Do not reintroduce `outline: none` anywhere: on the form
     fields a 1px border colour change was the only focus cue, which fails
     WCAG 2.4.7. --accent clears 3:1 against --bg in both themes, so the ring
     is a valid indicator. */
  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  /* Keyboard users land on this first and can jump straight past the nav.
     Parked off-screen rather than display:none so it stays focusable. */
  .skip-link {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    z-index: 10;
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--rule-soft);
    border-radius: 2px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--ink);
    text-decoration: none;
    transform: translateY(-250%);
  }
  .skip-link:focus {
    transform: none;
  }
}

/* ==========================================================================
   components
   ========================================================================== */
@layer components {
  /* --- shared page furniture --- */
  .page-header {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding-top: var(--space-3);
  }
  .page-header h1 {
    font-size: 36px;
  }

  /* The `~/section` label above each page title. */
  .eyebrow {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: normal;
    color: var(--ink-faint);
    letter-spacing: 1px;
    text-transform: uppercase;
  }

  .cursor {
    display: inline-block;
    width: 8px;
    height: 15px;
    background: var(--accent);
    margin-left: 2px;
    animation: blink 1.1s step-start infinite;
  }
  @keyframes blink {
    0%,
    49% {
      opacity: 1;
    }
    50%,
    100% {
      opacity: 0;
    }
  }

  .rule {
    transform-origin: left center;
    width: 64px;
    height: 1px;
    background: var(--rule-soft);
    margin: var(--space-1) 0;
    border: none;
  }

  .tag {
    border: 1px solid var(--rule-soft);
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--ink-dim);
    padding: 5px 11px;
    border-radius: 2px;
    white-space: nowrap;
  }

  .cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--ink);
    border-bottom: 1px solid var(--ink);
    padding-bottom: 3px;
    text-decoration: none;
  }
  .cta.quiet {
    color: var(--ink-faint);
    border-bottom-color: transparent;
  }
  .cta svg {
    stroke: currentColor;
  }

  /* --- nav (cv-nav) --- */
  cv-nav {
    display: block;
    border-bottom: 1px solid var(--rule);
  }
  .nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-2) var(--space-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  @media (max-width: 900px) {
    .nav-inner {
      padding: var(--space-2) var(--space-3);
    }
  }
  .nav-logo {
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: 1px;
    color: var(--ink);
    text-decoration: none;
  }
  .nav-links {
    display: flex;
    gap: var(--space-4);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .nav-links a {
    text-decoration: none;
    color: var(--ink-dim);
    padding-bottom: 6px;
    border-bottom: 1px solid transparent;
  }
  .nav-links a[aria-current='page'] {
    color: var(--ink);
    border-bottom-color: var(--ink);
  }
  .nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }
  .nav-toggle-btn {
    background: none;
    border: 1px solid var(--rule-soft);
    border-radius: 2px;
    color: var(--ink-dim);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 5px 9px;
    cursor: pointer;
  }
  .nav-toggle-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
  }
  .nav-mobile-btn {
    display: none;
    background: none;
    border: none;
    color: var(--ink);
    cursor: pointer;
  }
  @media (max-width: 700px) {
    .nav-links {
      display: none;
    }
    .nav-links.open {
      display: flex;
      flex-direction: column;
      gap: var(--space-2);
    }
    .nav-mobile-btn {
      display: block;
    }
  }

  /* --- footer --- */
  .site-footer {
    margin-top: var(--space-6);
    border-top: 1px solid var(--rule);
    padding: var(--space-3) 0;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--ink-faint);
  }
  /* Note: no horizontal padding, so this sits flush to --max-width rather than
     lining up with the page content inside .wrap. Preserved from the original
     markup; worth revisiting as a separate alignment fix. */
  .footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  /* --- hero --- */
  .hero {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding-top: var(--space-3);
    padding-bottom: var(--space-5);
  }
  .hero h1 {
    font-size: clamp(40px, 7vw, 82px);
    line-height: 1.04;
    letter-spacing: -1.5px;
  }
  .hero .prompt {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--ink-faint);
  }
  .hero .prompt .sigil {
    color: var(--ink);
  }
  .hero p.lede {
    font-size: 21px;
    color: var(--ink-dim);
    max-width: 620px;
  }
  .hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
  }
  .hero-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-1);
  }

  .status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--rule);
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--ink-faint);
  }
  .status-availability {
    display: flex;
    align-items: center;
    gap: var(--space-1);
  }
  .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
  }

  /* --- timeline (cv-timeline) --- */
  cv-timeline {
    display: flex;
    flex-direction: column;
    margin-top: var(--space-header);
  }
  .timeline-item {
    border-top: 1px solid var(--rule);
    padding: var(--space-3) 0;
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: var(--space-4);
  }
  /* Scroll-reveal is opt-in. <cv-timeline> sets data-reveal on itself only
     once it actually has an IntersectionObserver running, so the experience
     entries render visible by default — for no-JS visitors, for a failed
     module load, and under prefers-reduced-motion. Never put opacity:0 on
     .timeline-item directly: that made the whole page blank whenever JS did
     not run. */
  cv-timeline[data-reveal] .timeline-item {
    opacity: 0;
    transform: translateY(12px);
    transition:
      opacity 0.5s ease,
      transform 0.5s ease;
  }
  cv-timeline[data-reveal] .timeline-item.in-view {
    opacity: 1;
    transform: none;
  }
  @media (max-width: 700px) {
    .timeline-item {
      grid-template-columns: 1fr;
      gap: var(--space-1);
    }
  }
  .timeline-meta {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--ink-faint);
  }
  .timeline-location {
    margin-top: 4px;
  }
  .timeline-body h2 {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 19px;
  }
  .timeline-role {
    color: var(--ink-dim);
    font-size: 14px;
    margin-top: 2px;
  }
  .timeline-summary {
    margin-top: var(--space-1);
    font-size: 15px;
    color: var(--ink-dim);
  }
  /* Animating grid-template-rows from 0fr to 1fr gives a real height
     transition to the content's own size. The old max-height clamp needed a
     magic 1200px ceiling that silently truncated longer entries, and eased
     against a height the content never actually had. */
  .timeline-reveal {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 380ms var(--ease-out-quart);
  }
  .timeline-item.expanded .timeline-reveal {
    grid-template-rows: 1fr;
  }
  .timeline-reveal-inner {
    overflow: hidden;
    min-height: 0;
  }
  .timeline-bullets {
    /* Spacing is padding, not margin, so it lives inside the overflow box and
       collapses with the row instead of leaving a gap when closed. */
    margin: 0;
    padding: var(--space-2) 0 0 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14.5px;
    color: var(--ink);
    visibility: hidden;
    transition: visibility 0s linear 380ms;
  }
  .timeline-item.expanded .timeline-bullets {
    visibility: visible;
    transition: visibility 0s linear 0s;
  }
  .timeline-toggle {
    margin-top: var(--space-2);
    background: none;
    border: none;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--accent);
    cursor: pointer;
    padding: 0;
  }
  .timeline-stack {
    margin-top: var(--space-2);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* --- projects --- */
  .project-list {
    display: flex;
    flex-direction: column;
    margin-top: var(--space-header);
  }
  .project {
    border-top: 1px solid var(--rule);
    padding: var(--space-3) 0;
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: var(--space-4);
  }
  @media (max-width: 700px) {
    .project {
      grid-template-columns: 1fr;
      gap: var(--space-1);
    }
  }
  .project-meta {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--ink-faint);
  }
  .project-period {
    margin-top: 4px;
  }
  .project-body h2 {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 19px;
  }
  /* On a project the link is the primary affordance and sits under the
     title, so it tightens up rather than sitting after the bullets. */
  .project-body .entry-links {
    margin-top: 4px;
  }
  .project-summary {
    margin-top: var(--space-1);
    font-size: 15px;
    color: var(--ink-dim);
  }
  .project-bullets {
    margin: var(--space-2) 0 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14.5px;
    color: var(--ink);
  }
  .project-stack {
    margin-top: var(--space-2);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* --- skills --- */
  .skill-grid {
    margin-top: var(--space-header);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
  }
  .skill-group h2 {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--ink-faint);
    font-weight: 400;
    margin-bottom: var(--space-2);
  }
  .skill-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* --- education --- */
  .education {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-5);
  }
  .education-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }
  .education-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--rule);
    padding-top: 12px;
  }
  .education-institution {
    font-weight: 600;
  }
  .education-program {
    font-size: 14.5px;
    color: var(--ink-dim);
    margin-top: 2px;
  }
  .education-dates {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--ink-faint);
    white-space: nowrap;
  }

  /* Where a role's output can actually be seen. Same treatment as the
     project link, so a link means the same thing on both pages. */
  .entry-links {
    list-style: none;
    margin: var(--space-2) 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
  }
  .entry-links a {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent);
  }

  .education-detail {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: var(--ink-dim);
  }

  .language-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: 0;
  }
  .language-row {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    border-top: 1px solid var(--rule);
    padding-top: 12px;
  }
  .language-name {
    font-weight: 600;
    min-width: 90px;
  }
  .language-level {
    margin: 0;
    font-size: 14.5px;
    color: var(--ink-dim);
  }

  /* --- contact --- */
  .contact-layout {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--space-5);
    margin-top: var(--space-header);
  }
  .contact-details {
    font-style: normal; /* <address> is italic by default */
    font-family: var(--font-mono);
    font-size: 14.5px;
    min-width: 220px;
  }
  .contact-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: 0;
  }
  .contact-label,
  .contact-value {
    display: inline; /* dt/dd are block by default */
    margin: 0;
  }
  .contact-label {
    color: var(--ink-faint);
  }
  .contact-label::after {
    content: ' — ';
  }
  cv-contact-form {
    display: block;
    flex: 1;
    min-width: 280px;
  }
  .contact-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-width: 480px;
  }
  .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .field label {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--ink-faint);
  }
  .field input,
  .field textarea {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--rule-soft);
    border-radius: 2px;
    padding: 10px 12px;
  }
  .field input:focus-visible,
  .field textarea:focus-visible {
    border-color: var(--accent);
  }
  .field textarea {
    resize: vertical;
    min-height: 120px;
  }
  .submit-btn {
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: 14px;
    background: var(--ink);
    color: var(--bg);
    border: none;
    border-radius: 2px;
    padding: 12px 24px;
    cursor: pointer;
  }
  .submit-btn:disabled {
    opacity: 0.5;
    cursor: default;
  }
  .form-status {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--ink-faint);
    min-height: 18px;
  }
  .form-status.ok {
    color: var(--accent);
  }
  .form-status.err {
    color: var(--danger);
  }
}

/* ==========================================================================
   utilities
   ========================================================================== */
@layer utilities {
  /* Text for assistive technology only — kept in the accessibility tree and
     out of the visual layout. Not display:none, which would remove it from
     both. */
  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /* Page gutter. The only genuinely cross-cutting class left — everything else
     that used to be a utility now lives on the component it belonged to. */
  .wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-4) var(--space-6);
  }
  @media (max-width: 900px) {
    .wrap {
      padding: var(--space-3) var(--space-3);
    }
  }
}

/* ==========================================================================
   enhance — progressive enrichment
   ==========================================================================
   Everything in this layer is additive. Each block is gated behind @supports,
   a media query, or an attribute the JS only sets once it has verified the
   feature. Strip the whole layer out and the site still works exactly as it
   did: that is the contract. */
@layer enhance {
  /* --- hero entrance ------------------------------------------------------
     One orchestrated load, then nothing moves again. The sequence reads as a
     shell session: the prompt types, the name is revealed, the supporting
     lines settle in behind it.

     `backwards` fill matters here — every element holds its from-state during
     its delay, so nothing flashes at full opacity before its turn. */
  @media (prefers-reduced-motion: no-preference) {
    .hero .prompt {
      animation: hero-type 700ms steps(28, end) 80ms backwards;
    }
    .hero-name {
      display: inline-block;
      animation: hero-reveal 900ms var(--ease-out-expo) 340ms backwards;
    }
    .hero p.lede {
      animation: hero-rise 700ms var(--ease-out-quart) 560ms backwards;
    }
    .hero .rule {
      animation: hero-rule 600ms var(--ease-out-quart) 700ms backwards;
    }
    .hero-tags .tag {
      animation: hero-rise 520ms var(--ease-out-quart) backwards;
    }
    .hero-tags .tag:nth-child(1) { animation-delay: 800ms; }
    .hero-tags .tag:nth-child(2) { animation-delay: 845ms; }
    .hero-tags .tag:nth-child(3) { animation-delay: 890ms; }
    .hero-tags .tag:nth-child(4) { animation-delay: 935ms; }
    .hero-tags .tag:nth-child(5) { animation-delay: 980ms; }
    .hero-actions {
      animation: hero-rise 640ms var(--ease-out-quart) 1040ms backwards;
    }
    .status-row {
      animation: hero-rise 640ms var(--ease-out-quart) 1160ms backwards;
    }

    /* The cursor should not blink until the prompt has finished typing. */
    .hero .prompt .cursor {
      animation:
        blink 1.1s step-start 780ms infinite backwards,
        hero-cursor-in 1ms 780ms backwards;
    }
  }

  /* Typing: clip from the right in character-width steps. clip-path is a
     paint-only property, so this never touches layout. */
  @keyframes hero-type {
    from {
      clip-path: inset(0 100% 0 0);
    }
    to {
      clip-path: inset(0 0 0 0);
    }
  }

  @keyframes hero-reveal {
    from {
      clip-path: inset(0 0 110% 0);
      translate: 0 0.18em;
    }
    to {
      clip-path: inset(0 0 -20% 0);
      translate: 0 0;
    }
  }

  @keyframes hero-rise {
    from {
      opacity: 0;
      translate: 0 10px;
    }
  }

  @keyframes hero-rule {
    from {
      scale: 0 1;
    }
  }

  @keyframes hero-cursor-in {
    from {
      opacity: 0;
    }
  }

  /* --- stack cross-filter -------------------------------------------------
     cv-filter only sets data-ready once it has upgraded the tags to buttons,
     so none of the interactive affordance shows up in the no-JS rendering. */
  cv-filter {
    display: block;
  }
  .filter-status {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--ink-faint);
    margin: var(--space-header) 0 0;
  }
  /* Once the status line exists it owns the gap under the page header, so the
     list below it tightens up rather than double-spacing. */
  cv-filter[data-ready] > cv-timeline,
  cv-filter[data-ready] > .project-list {
    margin-top: var(--space-2);
  }
  cv-filter:not([data-ready]) .filter-status {
    display: none;
  }

  button.tag-filter {
    background: none;
    cursor: pointer;
    font: inherit;
    font-family: var(--font-mono);
    font-size: 12.5px;
    transition:
      color 200ms var(--ease-out-quart),
      border-color 200ms var(--ease-out-quart);
  }
  button.tag-filter:hover {
    color: var(--ink);
    border-color: var(--accent);
  }
  button.tag-filter[aria-pressed='true'] {
    color: var(--bg);
    background: var(--accent);
    border-color: var(--accent);
  }

  /* Filtered-out entries recede without losing a single point of text
     contrast. Dimming them with opacity was the obvious move and the wrong
     one: --ink-dim and --ink-faint are sized to clear 4.5:1 exactly, so any
     alpha at all drops the secondary text below AA. Even 0.7 opacity fails.

     So the signal is carried by things that are not text. Desaturation drains
     the accent out of a non-matching entry's tags while leaving the near-
     neutral body copy visually untouched, and the match itself is marked by a
     filled node on the timeline rail. */
  .timeline-item.is-muted,
  .project.is-muted {
    filter: saturate(0.15);
    transition: filter 320ms var(--ease-out-quart);
  }

  /* A node on the rail, centred on the same gutter the spine runs down.
     Absolutely positioned, so switching a filter on and off shifts nothing. */
  @media (min-width: 701px) {
    cv-filter[data-filtered] .timeline-item,
    cv-filter[data-filtered] .project {
      position: relative;
    }
    cv-filter[data-filtered] .timeline-item::after,
    cv-filter[data-filtered] .project::after {
      content: '';
      position: absolute;
      top: calc(var(--space-3) + 0.35em);
      left: calc(200px + var(--space-4) / 2);
      translate: -50% 0;
      width: 9px;
      height: 9px;
      border-radius: 50%;
      background: var(--bg);
      border: 1px solid var(--rule-soft);
    }
    cv-filter[data-filtered] .timeline-item:not(.is-muted)::after,
    cv-filter[data-filtered] .project:not(.is-muted)::after {
      background: var(--accent);
      border-color: var(--accent);
    }
  }

  /* --- quick jump palette -------------------------------------------------
     A native popover: the browser owns the top layer, light dismiss, Escape
     and focus return. Anchor positioning tucks it under the nav button where
     supported and falls back to a centred sheet where it is not. */
  /* The language switcher sits with the other nav actions. It stays visible at
     every width: a reader who cannot read the current page needs it most on a
     phone, which is where the rest of the nav collapses. */
  .nav-lang {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-dim);
    text-decoration: none;
    padding: 5px 9px;
    border: 1px solid var(--rule-soft);
    border-radius: 2px;
    transition:
      color 200ms var(--ease-out-quart),
      border-color 200ms var(--ease-out-quart);
  }
  .nav-lang:hover,
  .nav-lang:focus-visible {
    color: var(--accent);
    border-color: var(--accent);
  }

  .nav-palette-btn {
    anchor-name: --palette-anchor;
    background: none;
    border: 1px solid var(--rule-soft);
    border-radius: 2px;
    color: var(--ink-dim);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 5px 9px;
    cursor: pointer;
    transition:
      color 200ms var(--ease-out-quart),
      border-color 200ms var(--ease-out-quart);
  }
  .nav-palette-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
  }
  @media (max-width: 700px) {
    .nav-palette-btn {
      display: none;
    }
  }

  .palette {
    margin: 0;
    padding: 0;
    border: 1px solid var(--rule-soft);
    border-radius: 4px;
    background: var(--bg);
    color: var(--ink);
    width: min(420px, calc(100vw - 2 * var(--space-2)));
    max-height: min(60vh, 520px);
    overflow: auto;
    box-shadow: 0 18px 48px oklch(0% 0 0 / 0.18);

    /* Fallback placement: a centred sheet near the top of the viewport. */
    position: fixed;
    inset: auto;
    top: 12vh;
    left: 50%;
    translate: -50% 0;
  }
  @supports (anchor-name: --a) {
    .palette {
      position-anchor: --palette-anchor;
      /* All-logical keywords: position-area rejects a mix of physical and
         logical, and silently computes to none if you give it one. */
      position-area: block-end span-inline-start;
      margin-top: 8px;
      top: auto;
      left: auto;
      translate: none;
      /* If it would overflow, flip to the other side rather than clip. */
      position-try-fallbacks: flip-block, flip-inline;
    }
  }

  .palette-panel {
    padding: var(--space-2);
  }
  .palette-search {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--rule-soft);
    border-radius: 2px;
    padding: 9px 11px;
    margin-bottom: var(--space-2);
  }
  .palette-list {
    display: flex;
    flex-direction: column;
  }
  .palette-group {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: var(--space-2) 0 6px;
  }
  .palette-group:first-child {
    margin-top: 0;
  }
  .palette-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-2);
    font-family: var(--font-mono);
    font-size: 13px;
    text-decoration: none;
    color: var(--ink);
    padding: 7px 9px;
    border-radius: 2px;
  }
  .palette-item:hover,
  .palette-item:focus-visible {
    background: var(--accent);
    color: var(--bg);
  }
  .palette-item:hover .palette-meta,
  .palette-item:focus-visible .palette-meta {
    color: var(--bg);
  }
  .palette-meta {
    font-size: 11.5px;
    color: var(--ink-faint);
    text-align: right;
  }
  .palette-empty {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--ink-faint);
    padding: 7px 9px;
  }

  /* Entry and exit. allow-discrete lets display and overlay participate, so
     the panel animates out instead of vanishing. @starting-style supplies the
     from-state for the opening direction. */
  @media (prefers-reduced-motion: no-preference) {
    .palette {
      opacity: 0;
      translate: 0 -6px;
      scale: 0.98;
      transition:
        opacity 180ms var(--ease-out-quart),
        translate 220ms var(--ease-out-expo),
        scale 220ms var(--ease-out-expo),
        overlay 220ms allow-discrete,
        display 220ms allow-discrete;
    }
    .palette:popover-open {
      opacity: 1;
      translate: 0 0;
      scale: 1;
    }
    @starting-style {
      .palette:popover-open {
        opacity: 0;
        translate: 0 -6px;
        scale: 0.98;
      }
    }
  }

  /* --- scroll-driven timeline spine ---------------------------------------
     A rail down the gutter between the date column and the entry body, with
     an accent line that draws itself as the list scrolls past. Driven purely
     by scroll position via animation-timeline, so there is no scroll listener
     and nothing runs on the main thread.

     Firefox has no scroll-driven animations, so it gets the static rail only,
     which is a perfectly good result rather than a broken one. */
  @supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) and (min-width: 701px) {
      cv-timeline,
      .project-list {
        position: relative;
      }
      cv-timeline::before,
      cv-timeline::after,
      .project-list::before,
      .project-list::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        /* Centre of the gap between the 200px meta column and the body. */
        left: calc(200px + var(--space-4) / 2);
        width: 1px;
        pointer-events: none;
      }
      cv-timeline::before,
      .project-list::before {
        background: var(--rule);
      }
      cv-timeline::after,
      .project-list::after {
        background: var(--accent);
        transform-origin: top center;
        scale: 1 0;
        animation: spine-draw linear both;
        animation-timeline: view();
        animation-range: cover 0% cover 92%;
      }
    }
  }

  @keyframes spine-draw {
    to {
      scale: 1 1;
    }
  }

  /* --- cross-document view transitions ------------------------------------
     The @view-transition rule itself sits at the top of this file, outside any
     layer. Everything below names elements and shapes the animation. */

  /* Naming an element lifts it out of the page snapshot so it animates on its
     own track and persists across the navigation. */
  cv-nav {
    view-transition-name: site-nav;
  }
  .site-footer {
    view-transition-name: site-footer;
  }
  main {
    view-transition-name: content;
  }
  /* Exactly one link carries aria-current, so this name stays unique and the
     underline slides between nav items instead of cutting. */
  .nav-links a[aria-current='page'] {
    view-transition-name: nav-current;
  }
  /* The page title morphs between routes rather than fading out and in. */
  .page-header h1,
  .hero h1 {
    view-transition-name: page-title;
  }

  ::view-transition-group(nav-current) {
    animation-duration: 420ms;
    animation-timing-function: var(--ease-out-quart);
  }
  ::view-transition-group(page-title) {
    animation-duration: 480ms;
    animation-timing-function: var(--ease-out-expo);
  }

  /* The nav and footer are fixtures: they hold still while content moves. */
  ::view-transition-old(site-nav),
  ::view-transition-new(site-nav),
  ::view-transition-old(site-footer),
  ::view-transition-new(site-footer) {
    animation: none;
  }

  /* Direction comes from the nav order, set by cv-transitions.js on both the
     outgoing and incoming document. Without JS the default cross-fade runs. */
  @media (prefers-reduced-motion: no-preference) {
    :root[data-vt='forward']::view-transition-old(content) {
      animation: vt-leave-left 320ms var(--ease-out-quart) both;
    }
    :root[data-vt='forward']::view-transition-new(content) {
      animation: vt-enter-right 420ms var(--ease-out-expo) both;
    }
    :root[data-vt='back']::view-transition-old(content) {
      animation: vt-leave-right 320ms var(--ease-out-quart) both;
    }
    :root[data-vt='back']::view-transition-new(content) {
      animation: vt-enter-left 420ms var(--ease-out-expo) both;
    }
  }

  @keyframes vt-leave-left {
    to {
      opacity: 0;
      translate: -3vw 0;
    }
  }
  @keyframes vt-enter-right {
    from {
      opacity: 0;
      translate: 3vw 0;
    }
  }
  @keyframes vt-leave-right {
    to {
      opacity: 0;
      translate: 3vw 0;
    }
  }
  @keyframes vt-enter-left {
    from {
      opacity: 0;
      translate: -3vw 0;
    }
  }
}

/* ==========================================================================
   motion
   ========================================================================== */
/* Everything that moves here is decorative, so all of it stops when the visitor
   asks for that. The blanket rule is the safety net — anything animated later
   is covered without needing to remember this block — and the specific rules
   after it say where each effect should come to rest, since "run instantly,
   then revert" is not always the right resting state.

   Living in the last layer means the specific rules beat their component
   counterparts without needing !important. The blanket keeps it anyway, as
   cover against any unlayered CSS added later. */
@layer motion {
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }

    /* The terminal cursor blinks indefinitely, which WCAG 2.2.2 asks to be
       stoppable. Settle it to a solid block — it still reads as a cursor. */
    .cursor {
      animation: none;
    }

    /* cv-timeline already skips the reveal under reduced motion by never
       setting data-reveal, so entries are visible from the start. This covers
       the case where the attribute is present anyway. */
    cv-timeline[data-reveal] .timeline-item {
      opacity: 1;
      transform: none;
    }

    .timeline-item.is-muted,
    .project.is-muted {
      transition: none;
    }

    /* View transitions cut straight to the new page. The navigation still
       works; it just does not animate. */
    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) {
      animation: none !important;
    }
  }
}

/* ==========================================================================
   print
   ==========================================================================
   Paper gets the content and nothing else. Every control on the page is
   either interactive (nav, theme toggle, command palette, filter buttons,
   contact form) or an affordance for something that cannot happen on paper,
   so all of it is dropped and the remaining text is reflowed to a single
   measure at a size that reads at arm's length.

   This is the fallback route, not the main one: /cv.pdf is a real typeset
   document generated from the same CV data. But someone will always hit Ctrl+P
   on the page itself, and what came out before this layer existed was the nav,
   a collapsed experience list with every bullet hidden, and a blank contact
   form. */
@layer print {
  @media print {
    /* Fixed light palette. A dark theme prints as a solid block of toner and
       is unreadable on paper, so the stored or system preference is overridden
       outright here rather than respected. */
    :root,
    :root[data-theme='dark'],
    :root:not([data-theme='light']) {
      --bg: #fff;
      --ink: #111;
      --ink-dim: #333;
      --ink-faint: #555;
      --rule: #ccc;
      --rule-soft: #999;
      --accent: #111;
      --surface: #fff;
    }

    @page {
      size: A4;
      margin: 14mm 12mm;
    }

    html,
    body {
      background: #fff;
      color: #111;
      font-size: 10.5pt;
      line-height: 1.4;
    }

    /* The page gutter is the @page margin now. */
    .wrap {
      max-width: none;
      margin: 0;
      padding: 0;
    }

    /* --- chrome that has no meaning on paper --- */
    cv-nav,
    .site-footer,
    .skip-link,
    #command-palette,
    .hero-actions,
    .status-row,
    .cursor,
    .filter-status,
    .timeline-toggle,
    cv-contact-form {
      display: none;
    }

    /* --- entrance and reveal animations have no print state --- */
    /* cv-timeline hides entries until they scroll into view. There is no
       scrolling on paper, so every entry has to be visible from the start —
       without this the printed experience page came out blank. */
    cv-timeline[data-reveal] .timeline-item {
      opacity: 1;
      transform: none;
      transition: none;
    }

    /* The details behind each `+ details` toggle are the substance of the CV.
       Expand every one: the collapsed track is a 0fr grid row whose contents
       are also visibility:hidden, so both have to be undone. */
    .timeline-reveal {
      grid-template-rows: 1fr;
      transition: none;
    }
    .timeline-bullets {
      visibility: visible;
      transition: none;
    }

    /* A filtered view prints the entries it dimmed, unfiltered. Desaturation
       is a screen signal for "still here, just not matching", and it reads on
       paper as a printing fault. */
    .timeline-item.is-muted,
    .project.is-muted {
      filter: none;
    }

    /* --- flow --- */
    /* Two-column entries collapse to one: 200px of dates against a full-width
       body wastes a third of a narrower page. */
    .timeline-item,
    .project {
      grid-template-columns: 1fr;
      gap: 4px;
      padding: 10pt 0;
    }
    .timeline-meta,
    .project-meta {
      display: flex;
      gap: 10pt;
    }

    /* Keep a record whole where it fits, and never leave a heading stranded at
       the foot of a page. */
    .timeline-item,
    .project,
    .education-item,
    .skill-group,
    .language-row {
      break-inside: avoid;
    }
    h1,
    h2,
    h3 {
      break-after: avoid;
    }

    .page-header {
      padding-top: 0;
    }
    .page-header h1 {
      font-size: 20pt;
    }
    .hero {
      padding: 0 0 12pt;
      gap: 10pt;
    }
    .hero h1 {
      font-size: 26pt;
      letter-spacing: -0.5px;
    }
    .hero p.lede {
      font-size: 12pt;
    }

    .timeline-body h2,
    .project-body h2 {
      font-size: 13pt;
    }
    .timeline-summary,
    .project-summary,
    .timeline-bullets,
    .project-bullets {
      font-size: 10pt;
    }
    .skill-grid,
    .education,
    cv-timeline,
    .project-list {
      margin-top: 12pt;
    }

    /* Tags lose their pill treatment and print as a plain list — a page of
       hairline boxes is noise, and the borders cost toner for nothing. */
    .tag {
      border: none;
      padding: 0;
      font-size: 9pt;
    }
    .timeline-stack,
    .project-stack,
    .skill-badges {
      gap: 0 10pt;
    }

    /* --- links --- */
    a {
      color: #111;
      text-decoration: none;
    }
    /* Entry links are labelled by name ("npm: secure-ui-components"), so the
       destination is lost the moment the page is printed. Spell it out.
       Contact values and mailto links already read as their own URL, so they
       are left alone rather than printed twice. */
    .entry-links a[href^='http']::after {
      content: ' ' attr(href);
      font-size: 8.5pt;
      color: #555;
      word-break: break-all;
    }
  }
}
