/* Main stylesheet for the redesign (used by the page.njk layout). */

/* ---------------------------------------------------------------------------
   Fonts — self-hosted variable WOFF2 (Fontsource builds, SIL OFL 1.1, see /assets/fonts).
   One file per subset covers every weight; latin-ext only downloads when a page
   actually uses one of its characters (e.g. Turkish ş, ğ, ı).
   --------------------------------------------------------------------------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-ext-wght-normal.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: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-wght-normal.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: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/geist-latin-ext-wght-normal.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: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/geist-latin-wght-normal.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: 100 800;
  font-display: swap;
  src: url("/assets/fonts/jetbrains-mono-latin-ext-wght-normal.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: 100 800;
  font-display: swap;
  src: url("/assets/fonts/jetbrains-mono-latin-wght-normal.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;
}

@layer base, layout, components, utilities;

@property --a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes orbit { to { --a: 360deg; } }
/* starts at .01, not 0: Chrome ignores fully transparent elements when measuring
   Largest Contentful Paint, so a fade from 0 left the page with no LCP at all */
@keyframes rise { from { opacity: .01; transform: translateY(8px); } }

/* ---------------------------------------------------------------------------
   Design tokens — settled in design/prototype ("dusk" base, "plasma" accent).
   --------------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  /* surfaces */
  --bg:        #0d1422;
  --surface:   #151e30;
  --surface-2: #1b2539;
  --line:      #2b3954;

  /* text */
  --text:  #e8ecf3;
  --muted: #95a0b6;
  --faint: #66728c;

  /* accent: orange marks, cyan light */
  --accent: #ff7a33;   /* labels, icons, bullets */
  --link:   #ffa06b;
  --glow:   #55cfe8;   /* travelling light, hover glow */

  /* backdrop glows */
  --tint-a: #ff6a1a;   /* warm, top-left ("ember"; set per page, below) */
  --tint-b: #55cfe8;   /* cool, right */
  --tint-c: #2f63b8;   /* broad blue, top and bottom */
  --halo:   2.33;      /* overall backdrop glow strength */

  /* type */
  --f-head: "Inter", system-ui, sans-serif;
  --f-body: "Geist", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;

  /* shape */
  --r:    14px;
  --r-sm: 8px;

  /* motion — interactions stay snappy; only ambient effects are slow */
  --t-fast: .14s;
  --t-med:  .2s;
  --ease:   cubic-bezier(.2, .8, .2, 1);
}

/* each page tints the warm top-left glow (--tint-a) its own colour,
   chosen with `glow:` in the page's front matter (default: ember) */
[data-glow="solar"]   { --tint-a: #ffb03a; }  /* gold, starlight */
[data-glow="void"]    { --tint-a: #8b5cff; }  /* violet */
[data-glow="nebula"]  { --tint-a: #e049d0; }  /* magenta */
[data-glow="psi"]     { --tint-a: #2f7bff; }  /* electric blue */
[data-glow="nerazim"] { --tint-a: #25e0a8; }  /* spectral green */
[data-glow="crimson"] { --tint-a: #ff2e4d; }  /* red */

/* ---------------------------------------------------------------------------
   Base
   --------------------------------------------------------------------------- */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }

  body {
    margin: 0;
    min-height: 100vh;
    background:
      radial-gradient(1000px 700px at max(10%, calc(50% - 600px)) -140px,
        color-mix(in oklab, var(--tint-a) calc(var(--halo) * 13%), transparent), transparent 70%),
      radial-gradient(900px 650px at min(92%, calc(50% + 680px)) 30%,
        color-mix(in oklab, var(--tint-b) calc(var(--halo) * 6%), transparent), transparent 70%),
      radial-gradient(1600px 900px at 50% 115%,
        color-mix(in oklab, var(--tint-c) calc(var(--halo) * 14%), transparent), transparent 70%),
      radial-gradient(1400px 600px at 60% -20%,
        color-mix(in oklab, var(--tint-c) calc(var(--halo) * 9%), transparent), transparent 70%),
      var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--f-body);
    font-size: 16.5px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  h1, h2, h3, h4 {
    margin: 0;
    font-family: var(--f-head);
    font-weight: 600;
    line-height: 1.25;
  }
  p { margin: 0 0 1em; }
  img, svg, video { display: block; max-width: 100%; }
  img { height: auto; }

  /* links: underline slides in on hover */
  a {
    color: var(--link);
    text-decoration: none;
    background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
    transition: background-size var(--t-med) var(--ease);
  }
  a:hover { background-size: 100% 1px; }

  :focus-visible {
    outline: 2px solid var(--glow);
    outline-offset: 3px;
    border-radius: 2px;
  }

  ::selection { background: color-mix(in oklab, var(--accent) 35%, transparent); }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation: none !important;
      transition: none !important;
    }
  }
}

/* ---------------------------------------------------------------------------
   Layout — profile card on the left, nav + content on the right;
   one column below 880px.
   --------------------------------------------------------------------------- */
@layer layout {
  .page {
    max-width: 1480px;
    margin: 0 auto;
    padding: 32px clamp(16px, 3vw, 40px) 48px;
    display: grid;
    grid-template-columns: clamp(314px, 22vw, 330px) minmax(0, 1fr);
    gap: clamp(20px, 2vw, 32px);
    align-items: start;
  }
  .sidebar { position: sticky; top: 32px; }
  .column, main {
    display: grid;
    grid-template-columns: minmax(0, 1fr);  /* lets wide children (nav, code) shrink */
    gap: 24px;
    min-width: 0;
  }
  .site-footer {
    grid-column: 1 / -1;
    text-align: right;
    color: var(--faint);
    font-family: var(--f-mono);
    font-size: .85rem;
  }

  .skip-link {
    position: absolute;
    left: 16px;
    top: -100px;
    z-index: 10;
    padding: 8px 14px;
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--text);
  }
  .skip-link:focus { top: 16px; }

  @media (max-width: 880px) {
    .page {
      grid-template-columns: minmax(0, 1fr);
      padding: 16px 16px 40px;
      gap: 20px;
    }
    .sidebar { position: static; width: 100%; max-width: 420px; margin: 0 auto; }
  }
}

/* ---------------------------------------------------------------------------
   Components
   --------------------------------------------------------------------------- */
@layer components {
  /* inline SVG icons from the `icon` shortcode */
  .icon {
    display: inline-block;
    width: 1.125em;
    height: 1.125em;
    flex: none;
    vertical-align: -.2em;
  }
  .icon-x { transform: scale(.8); }  /* filled glyph; balance it against the outline set */

  /* frame: a 1px border around a panel, with a slow light travelling round it
     (two arcs of a conic gradient, rotated by animating --a) and a soft
     blurred bloom of the same light behind the panel.
     The light lives on the frame's two empty pseudo-elements, so each
     animation tick only restyles them, not the whole card beneath. */
  .frame {
    --glow-k: .6;    /* light strength */
    --orbit: 16s;    /* one lap */
    --bloom: .28;
    position: relative;
    isolation: isolate;
    padding: 1px;
    border-radius: var(--r);
    background: var(--line);
  }
  .frame::before,
  .frame::after {
    content: "";
    position: absolute;
    z-index: -1;      /* above the frame's own line colour, below the panel */
    border-radius: inherit;
    background: conic-gradient(from var(--a),
      transparent 0deg,
      color-mix(in oklab, var(--glow) calc(var(--glow-k) * 100%), transparent) 30deg,
      transparent 75deg,
      transparent 180deg,
      color-mix(in oklab, var(--glow) calc(var(--glow-k) * 45%), transparent) 206deg,
      transparent 240deg);
    animation: orbit var(--orbit) linear infinite;
    animation-delay: var(--phase, 0s);
    pointer-events: none;
  }
  .frame::before { inset: 0; }
  .frame::after {
    inset: -2px;
    filter: blur(8px);
    opacity: var(--bloom);
  }
  /* start each frame's light at a different point so they don't move in step */
  .profile { --phase: -3s; }
  main > :nth-child(4n + 1) .frame { --phase: -1s; }
  main > :nth-child(4n + 2) .frame { --phase: -9s; }
  main > :nth-child(4n + 3) .frame { --phase: -5s; }
  main > :nth-child(4n + 4) .frame { --phase: -13s; }

  .frame.idle::before, .frame.idle::after { animation-play-state: paused; }  /* set by main.js when off screen */

  /* a faint accent line along the top edge of content cards */
  .card .panel { position: relative; }
  .card .panel::before {
    content: "";
    position: absolute;
    left: 24px; right: 24px; top: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, color-mix(in oklab, var(--accent) 55%, transparent), transparent);
  }

  /* entrance: card, nav, then content, each rising in quickly */
  .sidebar, .site-nav, .sub-nav, main > * { animation: rise .35s var(--ease) both; }
  .site-nav { animation-delay: .04s; }
  main > :nth-child(1) { animation-delay: .08s; }
  main > :nth-child(2) { animation-delay: .12s; }
  main > :nth-child(n + 3) { animation-delay: .16s; }
  .frame > .panel {
    height: 100%;
    border-radius: calc(var(--r) - 1px);
    background: var(--surface);
  }
  .card .panel { padding: 30px clamp(24px, 3vw, 44px); }
  @media (max-width: 880px) {
    .card .panel { padding: 22px 20px; }
  }

  /* profile card */
  .profile > .panel { overflow: hidden; }
  .photo {
    position: relative;
    display: block;
    overflow: hidden;   /* keeps the hover zoom inside the fade */
    background: none;
    cursor: zoom-in;
  }
  .photo img { width: 100%; transition: transform .35s var(--ease); }
  .photo:hover img { transform: scale(1.025); }
  .photo::after {
    content: "";
    position: absolute;
    inset: 45% 0 0;
    background: linear-gradient(transparent, color-mix(in oklab, var(--surface) 70%, transparent) 65%, var(--surface));
  }
  .photo .name {
    position: absolute;
    left: 20px; right: 20px; bottom: 14px;
    z-index: 1;
    font-family: var(--f-head);
    font-size: 1.55rem;
    font-weight: 600;
    line-height: 1.25;
    color: #fff;
  }

  .facts {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 18px 20px 6px;
    list-style: none;
    font-size: .93rem;
  }
  .facts li { display: flex; align-items: center; gap: 11px; min-width: 0; }
  .facts a { color: var(--text); overflow-wrap: anywhere; }
  .facts .icon { color: var(--accent); }
  .facts .role { font-weight: 500; }

  .socials {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 10px 22px 0;
    padding: 12px 0 20px;
    border-top: 1px solid var(--line);
    list-style: none;
  }
  .socials a {
    display: grid;
    place-items: center;
    width: 36px; height: 36px;
    border-radius: var(--r-sm);
    background: none;
    color: var(--muted);
    transition: color var(--t-fast), background-color var(--t-fast), box-shadow var(--t-med);
  }
  .socials a:hover {
    color: var(--accent);
    background: var(--surface-2);
    box-shadow: 0 0 0 1px color-mix(in oklab, var(--accent) 35%, transparent), 0 0 18px -6px var(--glow);
  }

  /* nav: on hover, light rises inside the button from its bottom edge,
     and an accent hairline grows out from the centre of that edge */
  .site-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .nav-btn {
    position: relative;
    isolation: isolate;
    display: block;
    overflow: hidden;
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--muted);
    font-size: .9rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color var(--t-fast), border-color var(--t-med);
  }
  .nav-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
      radial-gradient(70% 70% at 50% 120%, color-mix(in oklab, var(--accent) 22%, transparent), transparent 70%),
      radial-gradient(90% 120% at 50% 130%, color-mix(in oklab, var(--glow) 20%, transparent), transparent 70%);
    opacity: 0;
    transition: opacity var(--t-med) var(--ease);
  }
  .nav-btn::after {
    content: "";
    position: absolute;
    left: 14%; right: 14%; bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent) 30%,
      color-mix(in oklab, var(--accent) 60%, #fff) 50%, var(--accent) 70%, transparent);
    box-shadow: 0 0 6px 0 var(--accent), 0 0 14px 1px color-mix(in oklab, var(--accent) 45%, transparent);
    transform: scaleX(0);
    transition: transform var(--t-med) var(--ease);
  }
  .nav-btn:hover { color: var(--text); border-color: color-mix(in oklab, var(--accent) 30%, var(--line)); }
  .nav-btn:hover::before { opacity: 1; }
  .nav-btn:hover::after,
  .nav-btn[aria-current]::after { transform: scaleX(1); }
  /* current page: the same light, a little quieter */
  .nav-btn[aria-current] { color: var(--text); border-color: color-mix(in oklab, var(--accent) 35%, var(--line)); }
  .nav-btn[aria-current]::before { opacity: .7; }
  .nav-btn[aria-current]:hover::before { opacity: .85; }

  /* narrow screens: one swipeable row instead of wrapping */
  @media (max-width: 880px) {
    .site-nav ul {
      flex-wrap: nowrap;
      overflow-x: auto;
      padding-bottom: 4px;
      scrollbar-width: none;
    }
    .site-nav li { flex: none; }
  }

  /* Life sub-nav: a second row of smaller tabs, right-aligned under the top nav
     (a swipeable row on phones) */
  .sub-nav { margin-top: -14px; }
  .sub-nav ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .sub-nav .nav-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    font-size: .82rem;
  }
  .sub-nav .nav-btn .icon { width: 15px; height: 15px; color: var(--faint); transition: color var(--t-fast); }
  .sub-nav .nav-btn:hover .icon,
  .sub-nav .nav-btn[aria-current] .icon { color: var(--accent); }
  @media (max-width: 880px) {
    .sub-nav { margin-top: -12px; }
    .sub-nav ul {
      flex-wrap: nowrap;
      justify-content: flex-start;
      overflow-x: auto;
      padding-bottom: 4px;
      scrollbar-width: none;
    }
    .sub-nav li { flex: none; }
  }

  /* Masters tribute: pinned to the top-right corner on every page (an icon
     button on phones) */
  .masters-link {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 40;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 8px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in oklab, var(--surface) 86%, transparent);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 6px 24px -10px rgb(0 0 0 / .7);
    color: var(--text);
    font: 500 13px/1 var(--f-body);
    letter-spacing: .02em;
    text-decoration: none;
    transition: border-color var(--t-fast), box-shadow var(--t-med), translate var(--t-fast) var(--ease);
  }
  .masters-link .icon { width: 16px; height: 16px; color: var(--accent); }
  .masters-link:hover {
    border-color: var(--accent);
    box-shadow: 0 0 22px -6px var(--accent);
    translate: 0 1px;
  }
  .masters-link[aria-current] { border-color: color-mix(in oklab, var(--accent) 60%, var(--line)); }
  @media (max-width: 880px) {
    .masters-link { width: 40px; height: 40px; padding: 0; justify-content: center; }
    .masters-link .icon { width: 18px; height: 18px; }
    .masters-link span {
      position: absolute; width: 1px; height: 1px; overflow: hidden;
      clip-path: inset(50%); white-space: nowrap;
    }
  }
  @media print { .masters-link { display: none; } }

  .photo[aria-busy] { cursor: progress; }

  /* lightbox: native <dialog>, fading and scaling in and out with no JS animation */
  dialog.lightbox {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: zoom-out;
    opacity: 0;
    transform: scale(.96);
    transition:
      opacity .2s var(--ease),
      transform .22s var(--ease),
      overlay .22s allow-discrete,
      display .22s allow-discrete;
  }
  dialog.lightbox[open] { display: grid; place-items: center; opacity: 1; transform: none; }
  dialog.lightbox::backdrop {
    background: rgb(4 6 10 / 0);
    backdrop-filter: blur(0);
    transition:
      background-color .2s,
      backdrop-filter .2s,
      overlay .22s allow-discrete,
      display .22s allow-discrete;
  }
  dialog.lightbox[open]::backdrop { background: rgb(4 6 10 / .88); backdrop-filter: blur(4px); }
  @starting-style {
    dialog.lightbox[open] { opacity: 0; transform: scale(.96); }
    dialog.lightbox[open]::backdrop { background: rgb(4 6 10 / 0); backdrop-filter: blur(0); }
  }
  dialog.lightbox figure { margin: 0; max-width: 92vw; }
  dialog.lightbox img {
    max-width: 92vw;
    max-height: calc(92dvh - 2.5rem);
    margin: 0 auto;
    border-radius: 10px;
  }
  dialog.lightbox figcaption {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    min-height: 2.5rem;
    padding-top: .6rem;
    font-size: .92rem;
    color: var(--muted);
  }
  .lb-count { font-family: var(--f-mono); font-size: .8rem; color: var(--faint); white-space: nowrap; }

  .lb-btn {
    position: absolute;
    display: grid;
    place-items: center;
    width: 44px; height: 44px;
    border: 1px solid color-mix(in oklab, var(--line) 80%, transparent);
    border-radius: 50%;
    background: rgb(13 20 34 / .6);
    color: var(--text);
    cursor: pointer;
    transition: border-color var(--t-fast), box-shadow var(--t-med), background-color var(--t-fast);
  }
  .lb-btn:hover {
    border-color: color-mix(in oklab, var(--accent) 50%, var(--line));
    background: rgb(13 20 34 / .85);
    box-shadow: 0 0 18px -6px var(--glow);
  }
  .lb-btn .icon { width: 22px; height: 22px; }
  .lb-prev { left: 16px; top: 50%; translate: 0 -50%; }
  .lb-next { right: 16px; top: 50%; translate: 0 -50%; }
  .lb-close { right: 16px; top: 16px; }
  dialog.lightbox:not(.multi) :is(.lb-prev, .lb-next) { display: none; }
  @media (max-width: 600px) {
    .lb-prev, .lb-next { top: auto; bottom: 12px; translate: none; }  /* out of the way of the photo; swipe works too */
  }

  /* back to top */
  .to-top {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 5;
    display: grid;
    place-items: center;
    width: 40px; height: 40px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: color-mix(in oklab, var(--surface) 85%, transparent);
    backdrop-filter: blur(6px);
    color: var(--muted);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition:
      opacity var(--t-med) var(--ease),
      transform var(--t-med) var(--ease),
      visibility 0s var(--t-med),
      color var(--t-fast),
      border-color var(--t-fast),
      box-shadow var(--t-med);
  }
  .to-top.show {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
  }
  .to-top:hover {
    color: var(--accent);
    border-color: color-mix(in oklab, var(--accent) 40%, var(--line));
    box-shadow: 0 0 18px -6px var(--glow);
  }

  /* collapsible sections open and close with a short height transition where
     the browser can animate to `auto` (elsewhere they just snap open) */
  @supports (interpolate-size: allow-keywords) {
    :root { interpolate-size: allow-keywords; }
    details::details-content {
      block-size: 0;
      overflow: hidden;
      transition: block-size var(--t-med) var(--ease), content-visibility var(--t-med) allow-discrete;
    }
    details[open]::details-content { block-size: auto; }
  }
  summary { cursor: pointer; list-style: none; }
  summary::-webkit-details-marker { display: none; }

  /* collapsible entry (CV): chevron, title, date on the right */
  .entry { border-top: 1px solid color-mix(in oklab, var(--line) 75%, transparent); }
  .entry:last-child { border-bottom: 1px solid color-mix(in oklab, var(--line) 75%, transparent); }
  .entry > summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 10px;
    margin: 0 -10px;
    padding: 11px 10px;
    border-radius: var(--r-sm);
    font-weight: 500;
    color: var(--text);
    transition: background-color var(--t-fast);
  }
  .entry > summary:hover { background: color-mix(in oklab, var(--surface-2) 70%, transparent); }
  .entry > summary > .icon {
    align-self: flex-start;
    margin-top: .33em;   /* centred on the first line, however many lines the title takes */
    width: 1rem; height: 1rem;
    color: var(--accent);
    transition: transform var(--t-med) var(--ease);
  }
  .entry[open] > summary > .icon { transform: rotate(90deg); }
  .entry .what { flex: 1; min-width: 0; }
  .entry .when {
    margin-left: auto;
    font-family: var(--f-mono);
    font-size: .8rem;
    font-weight: 400;
    color: var(--muted);
    white-space: nowrap;
  }
  @media (max-width: 600px) {
    .entry .when { flex-basis: 100%; margin-left: calc(1rem + 10px); }
  }
  .entry-body {
    max-width: 92ch;
    padding: 4px 0 16px 26px;
    color: color-mix(in oklab, var(--text) 86%, var(--muted));
  }
  .entry-body > :last-child { margin-bottom: 0; }

  /* label / value rows inside an entry */
  .kv {
    display: grid;
    grid-template-columns: 14ch minmax(0, 1fr);
    gap: .55rem 1.25rem;
    margin: 1rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid color-mix(in oklab, var(--line) 75%, transparent);
  }
  .kv dt {
    padding-top: .25em;
    font-family: var(--f-mono);
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--faint);
  }
  .kv dd { margin: 0; }
  @media (max-width: 600px) {
    .kv { grid-template-columns: minmax(0, 1fr); row-gap: .2rem; }
    .kv dd { margin-bottom: .6rem; }
  }

  /* "View Resume"-style viewer: an accent button that expands an embedded PDF */
  .pdf { margin-top: 1.4rem; }
  .pdf > summary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    border: 1px solid color-mix(in oklab, var(--accent) 45%, var(--line));
    border-radius: var(--r-sm);
    background: color-mix(in oklab, var(--accent) 10%, var(--surface));
    font-weight: 500;
    color: var(--text);
    transition: border-color var(--t-fast), box-shadow var(--t-med);
  }
  .pdf > summary:hover {
    border-color: var(--accent);
    box-shadow: 0 0 18px -6px var(--accent);
  }
  .pdf > summary > .icon:first-child { color: var(--accent); }
  .pdf > summary > .icon:last-child { color: var(--muted); transition: transform var(--t-med) var(--ease); }
  .pdf[open] > summary > .icon:last-child { transform: rotate(90deg); }
  .pdf .hint { font-size: .8rem; font-weight: 400; color: var(--muted); }
  .pdf-links { margin: 1rem 0 0; font-size: .9rem; color: var(--muted); }
  .pdf iframe {
    display: block;
    width: 100%;
    height: min(85vh, 1200px);
    margin-top: .8rem;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: #fff;
  }

  /* CV: career timeline. Rows share columns through subgrid. */
  .tldr h3 { margin-bottom: 1rem; font-size: 1.05rem; }
  .timeline {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, max-content) minmax(0, 1fr);
    gap: .6rem 1.25rem;
    margin: 0 0 .4rem;
    padding: 0 0 0 24px;
    list-style: none;
  }
  .timeline::before {
    content: "";
    position: absolute;
    left: 4px; top: .6em; bottom: .6em;
    width: 1px;
    background: linear-gradient(var(--line), color-mix(in oklab, var(--accent) 50%, var(--line)));
  }
  .timeline li {
    position: relative;
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    align-items: baseline;
  }
  .timeline li::before {
    content: "";
    position: absolute;
    left: -24px; top: .5em;
    width: 9px; height: 9px;
    border: 2px solid color-mix(in oklab, var(--accent) 60%, var(--line));
    border-radius: 50%;
    background: var(--surface);
  }
  .timeline li:last-child::before { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
  .timeline .when {
    font-family: var(--f-mono);
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    white-space: nowrap;
  }
  .timeline .kind {
    font-family: var(--f-mono);
    font-size: .7rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--faint);
  }
  .timeline .main { font-weight: 600; }
  .timeline .sub { color: color-mix(in oklab, var(--text) 80%, var(--muted)); }
  @media (max-width: 720px) {
    .timeline { grid-template-columns: max-content minmax(0, 1fr); row-gap: .9rem; }
    .timeline li { row-gap: .1rem; }
    .timeline .main, .timeline .sub { grid-column: 1 / -1; }
  }

  /* general content inside cards */
  .card .panel { color: color-mix(in oklab, var(--text) 88%, var(--muted)); }
  .card h3.group { margin: 0 0 .7rem; font-size: 1.05rem; color: var(--text); }
  .card hr {
    height: 1px;
    margin: 1.8rem 0;
    border: 0;
    background: linear-gradient(90deg, var(--line), transparent);
  }
  .bullets ul { margin: 0; padding-left: 1.1rem; }
  .bullets li { margin-bottom: .45rem; }
  .bullets li::marker { color: var(--accent); }

  /* prose cards: sub-headings and lists */
  .prose .panel > *, .videos .panel > p { max-width: 92ch; }
  .prose h3 { margin: 1.8rem 0 .7rem; font-size: 1.1rem; color: var(--text); }
  .prose ul { margin: 0 0 1rem; padding-left: 1.1rem; }
  .prose li { margin-bottom: .4rem; }
  .prose li::marker { color: var(--accent); }
  .prose > .panel > :last-child { margin-bottom: 0; }

  /* image (opens in the lightbox) beside a list; stacks on narrow screens */
  .prose .media {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    max-width: none;
    margin: .4rem 0 1.2rem;
  }
  .prose .media ul { margin: 0; }
  .thumb, .figure {
    display: block;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: none;
    cursor: zoom-in;
    transition: border-color var(--t-fast), box-shadow var(--t-med);
  }
  .thumb:hover, .figure:hover {
    border-color: color-mix(in oklab, var(--accent) 45%, var(--line));
    box-shadow: 0 0 18px -6px var(--glow);
  }
  .thumb img, .figure img { width: 100%; }
  .figure { width: fit-content; max-width: 100%; margin: .4rem 0 1.4rem; background: #fff; }
  @media (max-width: 600px) {
    .prose .media, .prose .media.wide { grid-template-columns: minmax(0, 1fr); }
    .prose .media .thumb { max-width: 240px; }
  }

  .prose .media.wide { grid-template-columns: 300px minmax(0, 1fr); }
  .prose .media > div > :last-child { margin-bottom: 0; }

  /* photo galleries: uniform tiles, the full photo opens in the lightbox */
  .panel > .gallery { max-width: none; }
  .prose ul.gallery { padding: 0; }
  .gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
    gap: 12px;
    margin: .4rem 0 1.4rem;
    padding: 0;
    list-style: none;
  }
  .gallery .thumb { aspect-ratio: 4 / 3; }
  .gallery .thumb img { height: 100%; object-fit: cover; transition: transform .35s var(--ease); }
  .gallery .thumb:hover img { transform: scale(1.03); }

  /* portraits with a name and years underneath */
  .gallery.portraits { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 20px 16px; }
  .portraits li { margin: 0; }
  .portraits .thumb { aspect-ratio: 4 / 5; margin-bottom: .55rem; }
  .portraits .thumb img { object-position: 50% 20%; filter: grayscale(.15); }
  .portraits .name { display: block; font-weight: 500; line-height: 1.35; color: var(--text); }
  .portraits .years { font-family: var(--f-mono); font-size: .78rem; color: var(--faint); }

  /* a single photo between paragraphs, at the size it was chosen for */
  .shot {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: .2rem auto 1.6rem;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: none;
    cursor: zoom-in;
    transition: border-color var(--t-fast), box-shadow var(--t-med);
  }
  .shot:hover {
    border-color: color-mix(in oklab, var(--accent) 45%, var(--line));
    box-shadow: 0 0 18px -6px var(--glow);
  }
  .shot img { max-width: 100%; height: auto; }  /* displayed at its width attribute */
  .story .panel > .shot { max-width: 100%; }

  /* Instagram's embed script replaces the blockquote with its own frame */
  .insta { display: flex; justify-content: center; margin: .4rem 0 1.4rem; }
  .insta .instagram-media { width: min(100%, 540px); min-width: 0 !important; margin: 0 !important; border-radius: var(--r-sm) !important; }

  /* embedded pages (status board, kit list) */
  .embed {
    display: block;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-2);
  }

  /* video rows: description beside a 16:9 player; stacks on narrow screens */
  .video {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 24px;
    align-items: start;
    padding: 18px 0;
    border-top: 1px solid color-mix(in oklab, var(--line) 60%, transparent);
  }
  .video:last-child { padding-bottom: 0; }
  .video p { margin: 0; color: var(--muted); }
  .video .fallback { display: block; margin-top: .8rem; font-size: .9rem; }
  .video :is(iframe, .facade) {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: #000;
  }
  @media (max-width: 760px) {
    .video { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  }

  /* click-to-load video preview (the real player replaces it on click) */
  .facade {
    position: relative;
    display: block;
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background:
      radial-gradient(120% 90% at 50% 130%, color-mix(in oklab, var(--glow) 20%, transparent), transparent 65%),
      radial-gradient(80% 80% at 0% 0%, color-mix(in oklab, var(--accent) 14%, transparent), transparent 60%),
      #070b14;
    color: var(--text);
    font: inherit;
    cursor: pointer;
  }
  .facade img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;   /* trims the thumbnail's letterbox bars */
    opacity: .82;
    transition: opacity var(--t-med), transform .35s var(--ease);
  }
  .facade:hover img { opacity: 1; transform: scale(1.02); }
  .facade-play {
    position: absolute;
    left: 50%; top: 50%;
    translate: -50% -50%;
    display: grid;
    place-items: center;
    width: 60px; height: 60px;
    border: 1px solid color-mix(in oklab, var(--accent) 55%, var(--line));
    border-radius: 50%;
    background: rgb(13 20 34 / .72);
    box-shadow: 0 0 24px -6px var(--accent);
    transition: scale var(--t-fast) var(--ease), box-shadow var(--t-med);
  }
  .facade-play .icon { width: 24px; height: 24px; margin-left: 3px; color: var(--accent); fill: currentColor; }
  .facade:hover .facade-play { scale: 1.07; box-shadow: 0 0 30px -4px var(--accent); }
  .facade-label {
    position: absolute;
    left: 10px; bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 8px;
    border-radius: 99px;
    background: rgb(13 20 34 / .75);
    font-size: .78rem;
    color: var(--muted);
  }
  .facade-label .icon { width: 14px; height: 14px; }

  /* music: cover videos in a row, single video, and audio tracks */
  .panel > .video-grid { max-width: none; }
  .video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 20px;
    margin: .6rem 0 0;
  }
  .video-grid figure { margin: 0; }
  .video-grid figcaption { margin-bottom: .5rem; font-weight: 500; color: var(--text); }
  .video-grid :is(iframe, .facade), .video-single :is(iframe, .facade) {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: #000;
  }
  .panel > .video-single { max-width: 560px; margin-bottom: 1rem; }

  .prose ul.tracks { max-width: 640px; margin: .2rem 0 1.4rem; padding: 0; list-style: none; }
  .tracks li {
    display: grid;
    grid-template-columns: 12rem minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    margin: 0;
    padding: 8px 0;
    border-top: 1px solid color-mix(in oklab, var(--line) 60%, transparent);
  }
  .tracks li:first-child { border-top: 0; }
  .tracks .what { font-weight: 500; color: var(--text); }
  .tracks audio, .pron audio { width: 100%; height: 36px; color-scheme: dark; }
  @media (max-width: 600px) {
    .tracks li { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  }

  /* star ratings */
  .stars { display: inline-flex; gap: 3px; white-space: nowrap; }
  .stars .icon { width: .95rem; height: .95rem; color: color-mix(in oklab, var(--line) 80%, var(--muted)); }
  .stars .on,
  .star-inline .icon { color: var(--accent); fill: currentColor; }

  /* rating rows: name · stars · note, columns shared through subgrid */
  .ratings {
    display: grid;
    grid-template-columns: max-content max-content minmax(0, 1fr);
    column-gap: 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .ratings > li {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    align-items: baseline;
    padding: 9px 0;
    border-top: 1px solid color-mix(in oklab, var(--line) 60%, transparent);
  }
  .ratings > li:first-child { border-top: 0; }
  .ratings .what { font-weight: 500; color: var(--text); }
  .ratings .stars { align-self: start; margin-top: 6px; }  /* on the first line, however long the note */
  .ratings.pairs .stars { margin-top: 0; align-self: center; }
  .ratings .note { font-size: .93rem; color: var(--muted); }
  @media (max-width: 720px) {
    .ratings { grid-template-columns: minmax(0, 1fr) max-content; }
    .ratings .note { grid-column: 1 / -1; margin-top: .2rem; }
  }
  /* short name + stars pairs, flowing into columns */
  .ratings.pairs { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); column-gap: 2.5rem; }
  .ratings.pairs > li {
    display: flex;
    grid-column: auto;
    justify-content: space-between;
    gap: 1rem;
    border-top: 0;
    border-bottom: 1px solid color-mix(in oklab, var(--line) 60%, transparent);
  }

  /* CV: publications */
  .pub-list { margin: 0; padding: 0; list-style: none; }
  .pub-list > li { padding: 14px 0; border-top: 1px solid color-mix(in oklab, var(--line) 60%, transparent); }
  .pub-list > li:first-child { padding-top: 0; border-top: 0; }
  .pub-list > li:last-child { padding-bottom: 0; }
  .pub-title { margin: 0 0 .3rem; font-family: var(--f-head); font-weight: 600; color: var(--text); }
  .pub-info { margin: 0 0 .55rem; font-size: .9rem; color: var(--muted); }
  .pub-info strong { font-weight: 500; color: var(--text); }
  .pub-list > li:target .pub-title { color: var(--link); }

  /* home: intro */
  .intro .panel > * { max-width: 92ch; }
  .intro p { color: color-mix(in oklab, var(--text) 86%, var(--muted)); }
  .intro .hi { margin-bottom: .6rem; font-family: var(--f-head); font-size: 1.7rem; font-weight: 600; color: var(--text); }
  .intro .lede { font-size: 1.08rem; color: var(--text); }
  .intro ul { margin: 0 0 1.4rem; padding-left: 1.1rem; }
  .intro li { margin-bottom: .45rem; }
  .intro li::marker { color: var(--accent); }
  .intro .signoff { margin: 1.4rem 0 0; }

  /* home: "how do you say your name?" */
  .pron {
    margin-top: 1.6rem;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
  }
  .pron h3 { display: flex; align-items: center; gap: 10px; margin-bottom: .6rem; font-size: 1.05rem; }
  .pron h3 .icon { color: var(--accent); }
  .pron audio { display: block; width: 100%; max-width: 340px; height: 36px; margin-bottom: .8rem; }
  .pron p { margin: 0; font-size: .95rem; color: var(--muted); }

  /* home: news */
  .news .month {
    margin: 0 0 .6rem;
    font-family: var(--f-mono);
    font-size: .8rem;
    font-weight: 400;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--faint);
  }
  .news article { position: relative; padding: 14px 0 14px 20px; }
  .news article::before {
    content: "";
    position: absolute;
    left: 0; top: 18px; bottom: 18px;
    width: 2px;
    border-radius: 2px;
    background: var(--line);
    transition: background-color var(--t-fast), box-shadow var(--t-med);
  }
  .news article:hover::before { background: var(--accent); box-shadow: 0 0 12px var(--glow); }
  .news h4 { margin-bottom: .35rem; font-size: 1.1rem; }
  .news h4 a { color: var(--text); transition: color var(--t-fast), background-size var(--t-med) var(--ease); }
  .news h4 a:hover { color: var(--link); }
  .news p { margin: 0 0 .4rem; font-size: .95rem; color: var(--muted); }

  .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
  .tags a {
    display: block;
    padding: 2px 9px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: none;
    font-family: var(--f-mono);
    font-size: .75rem;
    color: var(--muted);
    transition: border-color var(--t-fast), color var(--t-fast);
  }
  .tags a:hover { border-color: var(--link); color: var(--link); }
}

/* ---------------------------------------------------------------------------
   Utilities
   --------------------------------------------------------------------------- */
@layer utilities {
  /* small monospace section label with a fading rule, e.g. "ABOUT ———" */
  .label {
    display: flex;
    align-items: center;
    gap: .6em;
    margin-bottom: 1.1rem;
    font-family: var(--f-mono);
    font-size: .72rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
  }
  .label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, color-mix(in oklab, var(--accent) 45%, transparent), transparent);
  }

  .visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
