/* ─────────────────────────────────────────────────────────────
   namra.shah — shared stylesheet
   Tokens, base, layout, components shared across all pages
   ───────────────────────────────────────────────────────────── */

/* ─────────── Theme View Transition ───────────
   The theme toggle wraps the swap in a View Transition (scripts.js) and
   animates a circular clip-path from the button. The browser's default
   is to cross-fade the two snapshots; we turn that off so the new theme
   simply sits underneath and the clip reveal does the work — crisper,
   no muddy double-exposure mid-wipe. Unsupported browsers ignore all of
   this and the theme just swaps instantly. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  z-index: 1;
}

::view-transition-new(root) {
  z-index: 2;
}

@media (prefers-reduced-motion: reduce) {

  /* Belt-and-braces: JS already skips the transition under reduced motion,
     but if one is ever triggered, keep it instant. */
  ::view-transition-group(root),
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}

:root {
  /* Palette */
  --bg: #fafaf7;
  --fg: #0e0e10;
  --mid: #6b6b70;
  --dim: #6e6e6a;
  /* AA: ~4.9:1 on --bg (was #a8a8a4 ≈ 2.3:1) */
  --line: rgba(14, 14, 16, 0.08);
  --line-strong: rgba(14, 14, 16, 0.18);
  --nav-bg: rgba(250, 250, 247, 0.85);

  /* Accent (cobalt) */
  --a: #2541b2;
  --a-lo: rgba(37, 65, 178, 0.08);
  --a-mid: rgba(37, 65, 178, 0.16);
  --a-hi: #3354d8;

  /* Status */
  --grn: #2a8a4f;

  /* Contribution graph: 5 intensity levels, cobalt-tinted */
  --cl0: rgba(14, 14, 16, 0.06);
  --cl1: rgba(37, 65, 178, 0.28);
  --cl2: rgba(37, 65, 178, 0.5);
  --cl3: rgba(37, 65, 178, 0.74);
  --cl4: #2541b2;

  /* Typography */
  --serif: "Newsreader", Georgia, serif;
  --ui: "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;

  /* Layout */
  --wrap: 1180px;
  --gutter: clamp(20px, 4vw, 48px);

  /* Curves */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-snap: cubic-bezier(0.5, 0, 0.5, 1);

  /* Type scale */
  --t-display: clamp(50px, 8.3vw, 112px);
  --t-page: clamp(49px, 7.4vw, 100px);
  --t-h2: clamp(33px, 4.4vw, 52px);
  --t-h3: clamp(26px, 3.4vw, 34px);
  --t-lede: 18px;
  --t-body: 17px;
  --t-ui: 15px;
  --t-meta: 13px;
  --t-label: 11px;
  --t-micro: 10px;
}

[data-theme="dark"] {
  --bg: #0a0a0b;
  --fg: #f0f0ed;
  --mid: #8a8a8e;
  --dim: #7c7c80;
  /* AA: ~4.6:1 on dark --bg (was #46464a, near-invisible) */
  --line: rgba(240, 240, 237, 0.07);
  --line-strong: rgba(240, 240, 237, 0.18);
  --nav-bg: rgba(10, 10, 11, 0.85);
  --a: #6885ee;
  --a-lo: rgba(104, 133, 238, 0.1);
  --a-mid: rgba(104, 133, 238, 0.2);
  --a-hi: #8aa3ff;
  /* contribution graph scale, tuned for the dark background */
  --cl0: rgba(240, 240, 237, 0.07);
  --cl1: rgba(104, 133, 238, 0.32);
  --cl2: rgba(104, 133, 238, 0.55);
  --cl3: rgba(104, 133, 238, 0.78);
  --cl4: #6885ee;
}

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

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

body {
  font-family: var(--ui);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.45s var(--ease), color 0.45s var(--ease);
}

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

button {
  font: inherit;
  cursor: pointer;
}

::selection {
  background: var(--a);
  color: var(--bg);
}

:focus-visible {
  outline: 2px solid var(--a);
  outline-offset: 3px;
  border-radius: 2px;
  /* The offset eases out a touch so keyboard focus lands softly rather
     than snapping — the outline colour/width stay instant for clarity. */
  transition: outline-offset 0.15s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  :focus-visible {
    transition: none;
  }
}

/* Skip to content link for keyboard users */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 200;
  background: var(--fg);
  color: var(--bg);
  padding: 12px 18px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 16px;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ─────────────────────────── NAV ─────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-brand {
  font-family: var(--mono);
  font-size: var(--t-meta);
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  transition: opacity 0.2s var(--ease);
}

.nav-brand:hover {
  opacity: 0.75;
}

.nav-brand .dot {
  width: 7px;
  height: 7px;
  background: var(--grn);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(42, 138, 79, 0.18);
  animation: pulse 2.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(42, 138, 79, 0.18);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(42, 138, 79, 0.04);
  }
}

.nav-links {
  display: flex;
  gap: 4px;
  font-family: var(--mono);
  font-size: var(--t-meta);
  list-style: none;
}

.nav-link {
  position: relative;
  display: inline-block;
  padding: 6px 12px;
  color: var(--mid);
  transition: color 0.25s var(--ease);
}

.nav-link:hover {
  color: var(--fg);
}

.nav-link.active {
  color: var(--fg);
}

/* Structural active indicator: a cobalt underline that sits below the text.
   scaleX from center so it feels placed, not swept in. */
.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 12px;
  right: 12px;
  height: 1.5px;
  background: var(--a);
  border-radius: 1px;
}

/* Scramble effect on hover - the [data-text] attr stores original */
.nav-link span {
  display: inline-block;
  position: relative;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--line-strong);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: border-color 0.25s var(--ease), transform 0.5s var(--ease);
}

.theme-toggle:hover {
  border-color: var(--a);
  transform: rotate(30deg);
}

.theme-toggle:active {
  transform: rotate(180deg);
}

/* ─────────── Hamburger (mobile) ───────────
   Hidden on desktop; revealed only on narrow viewports AND only when JS is
   present (html.js). Without JS the nav links stay visible and wrap, so the
   menu can never become a dead end. */
.nav-burger {
  display: none;
  /* desktop default */
  background: transparent;
  border: 1px solid var(--line-strong);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--fg);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.25s var(--ease);
}

.nav-burger:hover {
  border-color: var(--a);
}

.nav-burger span {
  display: block;
  width: 15px;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.3s var(--ease), opacity 0.2s var(--ease);
}

@media (max-width: 720px) {
  .nav-brand {
    font-size: 12px;
  }

  /* JS path: collapse the link list into a burger-toggled sheet. */
  html.js .nav-burger {
    display: inline-flex;
  }

  html.js .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    /* OPAQUE sheet so the menu is legible even where backdrop-filter is
       unsupported or disabled (older Android, some in-app browsers). The
       blur + shadow are layered on as a progressive enhancement only. */
    background: var(--bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 22px 44px -26px rgba(0, 0, 0, 0.4);
    padding: 6px var(--gutter) 18px;
    counter-reset: navi;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.28s var(--ease), transform 0.28s var(--ease), visibility 0.28s;
  }

  html.js .nav.nav-open .nav-links {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  /* Each row slides up + fades, staggered just after the sheet opens. */
  html.js .nav-links li {
    width: 100%;
    counter-increment: navi;
    opacity: 0;
    transform: translateY(9px);
    transition: opacity 0.34s var(--ease), transform 0.34s var(--ease);
  }

  html.js .nav.nav-open .nav-links li {
    opacity: 1;
    transform: none;
  }

  html.js .nav.nav-open .nav-links li:nth-child(1) {
    transition-delay: 0.05s;
  }

  html.js .nav.nav-open .nav-links li:nth-child(2) {
    transition-delay: 0.10s;
  }

  html.js .nav.nav-open .nav-links li:nth-child(3) {
    transition-delay: 0.15s;
  }

  html.js .nav.nav-open .nav-links li:nth-child(4) {
    transition-delay: 0.20s;
  }

  html.js .nav.nav-open .nav-links li:nth-child(5) {
    transition-delay: 0.25s;
  }

  /* Generous tap targets (~56px), larger type. A mono index numeral leads
     each row, echoing the section eyebrows elsewhere on the site. */
  html.js .nav-link {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 17px 6px;
    font-size: 19px;
    letter-spacing: 0.01em;
    border-bottom: 1px solid var(--line);
  }

  html.js .nav-link::before {
    content: counter(navi, decimal-leading-zero);
    font-size: 11px;
    letter-spacing: 0.14em;
    color: var(--mid);
    opacity: 0.65;
  }

  /* Left cobalt accent for the current page (the underline pseudo doesn't
     suit a full-width row); the index numeral also goes cobalt. */
  html.js .nav-link.active::after {
    display: none;
  }

  html.js .nav-link.active {
    color: var(--a);
    padding-left: 12px;
    border-left: 2px solid var(--a);
  }

  html.js .nav-link.active::before {
    color: var(--a);
    opacity: 1;
  }

  html.js .nav-links li:last-child .nav-link {
    border-bottom: none;
  }

  /* Lock background scroll while the sheet is open. */
  body.nav-lock {
    overflow: hidden;
  }

  /* Burger glyph → X when the menu is open. */
  .nav.nav-open .nav-burger span:nth-child(1) {
    transform: translateY(5.5px) rotate(45deg);
  }

  .nav.nav-open .nav-burger span:nth-child(2) {
    opacity: 0;
  }

  .nav.nav-open .nav-burger span:nth-child(3) {
    transform: translateY(-5.5px) rotate(-45deg);
  }

  /* No-JS fallback: keep every link reachable. */
  html:not(.js) .nav-link {
    padding: 6px 8px;
    font-size: 12px;
  }

  html:not(.js) .nav-links {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* ─────────────────────────── SECTION SHELL ─────────────────────────── */
section {
  padding: 108px 0;
  position: relative;
}

@media (max-width: 720px) {
  section {
    padding: 72px 0;
  }
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 64px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

@media (max-width: 600px) {
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 36px;
  }
}

.section-num {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 12px;
}

.section-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-h2);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
  max-width: 18ch;
}

.section-title em {
  font-style: italic;
  color: var(--a);
}

.section-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mid);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.25s var(--ease);
  white-space: nowrap;
}

.section-link:hover {
  color: var(--a);
}

.section-link .arrow {
  display: inline-block;
  transition: transform 0.3s var(--ease);
}

.section-link:hover .arrow {
  transform: translateX(4px);
}

/* ─────────────────────────── PAGE HEADER (non-home pages) ─────────────────────────── */
.page-head {
  padding: 140px 0 64px;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  /* clip the motif's bleed past the header edges */
}

/* keep the title/lede above the motif, but let the motif stay inert */
.page-head .wrap {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.page-head .wrap a,
.page-head .wrap button {
  pointer-events: auto;
}

/* ─────────── PAGE MOTIFS (per-page signature diagrams) ───────────
   Each non-home page carries a faint, content-true line drawing behind
   its title, in the same vocabulary as the home hero: hairline strokes,
   one cobalt accent, draws itself once on load then holds as a still
   watermark. Sits to the right and is masked on the left so the
   left-aligned title is never crowded. aria-hidden + pointer-events:none,
   so it is purely decorative and inert. Reduced-motion users get the
   finished drawing with no draw-on. Per-element timing is set inline
   (style="animation-delay:...") in each page's SVG. */
.page-motif {
  position: absolute;
  top: 50%;
  right: -1%;
  transform: translateY(-50%);
  width: min(720px, 60%);
  height: auto;
  z-index: 0;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to left, #000 46%, transparent 82%);
  mask-image: linear-gradient(to left, #000 46%, transparent 82%);
}

@media (max-width: 760px) {
  .page-motif {
    width: 82%;
    right: -10%;
    opacity: 0.55;
  }
}

.pm-line {
  fill: none;
  stroke: var(--mid);
  stroke-width: 1.2;
  opacity: 0.4;
  stroke-dasharray: 2600;
  stroke-dashoffset: 2600;
  animation: pmDraw 1.15s var(--ease) forwards;
}

.pm-dot {
  fill: var(--bg);
  stroke: var(--mid);
  stroke-width: 1.2;
  opacity: 0.55;
  stroke-dasharray: 160;
  stroke-dashoffset: 160;
  animation: pmDraw 0.7s var(--ease) forwards;
}

.pm-line.pm-accent {
  stroke: var(--a);
  opacity: 0.95;
  stroke-width: 1.7;
}

.pm-dot.pm-accent {
  stroke: var(--a);
  opacity: 1;
  stroke-width: 1.7;
}

.pm-fill {
  fill: var(--mid);
  stroke: none;
  opacity: 0;
  animation: pmFade 0.6s var(--ease) forwards;
}

.pm-fill.pm-accent {
  fill: var(--a);
}

.pm-label {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  fill: var(--mid);
  opacity: 0;
  animation: pmFade 0.7s var(--ease) 0.55s forwards;
}

.pm-label.pm-accent {
  fill: var(--a);
}

@keyframes pmDraw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes pmFade {
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {

  /* !important is needed to beat the inline stroke-dashoffset that the
     concentric contact rings carry for their ring-by-ring draw-on. */
  .pm-line,
  .pm-dot {
    animation: none;
    stroke-dashoffset: 0 !important;
  }

  .pm-fill,
  .pm-label {
    animation: none;
    opacity: 1;
  }
}

.page-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 20px;
  display: inline-block;
}

.page-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-page);
  line-height: 1.02;
  letter-spacing: -0.025em;
  max-width: 14ch;
  text-wrap: balance;
}

.page-title em {
  font-style: italic;
  color: var(--a);
}

.page-lede {
  margin-top: 32px;
  font-size: var(--t-lede);
  line-height: 1.6;
  color: var(--mid);
  max-width: 60ch;
}

.page-lede strong {
  color: var(--fg);
  font-weight: 500;
}

/* ─────────────────────────── FOOTER ─────────────────────────── */
footer {
  border-top: 1px solid var(--line);
  padding: 48px 0 40px;
  margin-top: 60px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mid);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(18px, 2.2vw, 26px);
  letter-spacing: -0.016em;
  line-height: 1.3;
  color: var(--fg);
  max-width: 32ch;
}

.footer-tagline em {
  color: var(--a);
  font-style: italic;
}

.footer-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.footer-nav a {
  color: var(--mid);
  transition: color 0.2s var(--ease);
  text-decoration: none;
  letter-spacing: 0.04em;
}

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

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.footer-copy {
  letter-spacing: 0.04em;
}

.footer-built {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.04em;
}

.footer-built-dot {
  width: 5px;
  height: 5px;
  background: var(--grn);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(42, 138, 79, 0.14);
  animation: pulse 2.4s ease-in-out infinite;
}

@media (max-width: 600px) {
  .footer-nav {
    align-items: flex-start;
  }
}

/* ─────────────────────────── REVEAL ANIMATIONS ─────────────────────────── */
/* Single simple reveal — no staircase delays. The whole page fades in once. */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: reveal 0.7s var(--ease) forwards;
}

.reveal[data-delay="1"] {
  animation-delay: 0.05s;
}

.reveal[data-delay="2"] {
  animation-delay: 0.12s;
}

.reveal[data-delay="3"] {
  animation-delay: 0.2s;
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ─────────────────────────── BUTTONS ─────────────────────────── */
/* btn-f: filled / primary. Magnetic pull is applied via GSAP in scripts.js. */
.btn-f {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 13px 30px;
  background: var(--fg);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition:
    background 0.35s,
    transform 0.4s var(--ease),
    box-shadow 0.4s,
    color 0.35s;
}

.btn-f:hover {
  background: var(--a);
  color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 16px 48px var(--a-mid);
}

.btn-f .ar {
  display: inline-block;
  transition: transform 0.4s var(--ease);
}

.btn-f:hover .ar {
  transform: translateX(5px);
}

/* btn-g: ghost / outline. No magnetic pull, just a calm color shift. */
.btn-g {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 13px 24px;
  border: 1.5px solid var(--line-strong);
  color: var(--mid);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  transition:
    color 0.3s,
    border-color 0.3s;
}

.btn-g:hover {
  color: var(--fg);
  border-color: var(--fg);
}

/* fsub: form submit. Send / Sending / Sent / Error states handled in JS. */
.fsub {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 13px 28px;
  background: var(--fg);
  color: var(--bg);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  align-self: flex-start;
  transition:
    background 0.35s,
    transform 0.4s var(--ease),
    box-shadow 0.4s,
    color 0.35s;
}

.fsub:hover {
  background: var(--a);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 14px 40px var(--a-mid);
}

.fsub .ar {
  display: inline-block;
  transition: transform 0.4s var(--ease);
}

.fsub:hover .ar {
  transform: translateX(5px);
}

.fsub[data-state="sent"] {
  background: var(--grn);
  color: #fff;
}

.fsub[data-state="error"] {
  background: #b85050;
  color: #fff;
}

.fsub:disabled {
  cursor: default;
}

/* Inline link. A faint resting underline keeps it discoverable; on hover the
   cobalt underline simply appears (no left-to-right sweep) and the text shifts
   colour. background-size jumps instantly; only colour transitions. */
.link {
  color: var(--fg);
  text-decoration: none;
  background-image: linear-gradient(var(--a), var(--a));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1.5px;
  padding-bottom: 3px;
  transition: color 0.25s var(--ease);
  /* a faint resting underline so the link is discoverable before hover */
  box-shadow: inset 0 -1.5px 0 -0.5px var(--line-strong);
}

.link:hover {
  color: var(--a);
  background-size: 100% 1.5px;
}

.link:focus-visible {
  background-size: 100% 1.5px;
}

@media (prefers-reduced-motion: reduce) {
  .link {
    transition: color 0.2s;
  }
}

/* ─────────────────────────── SEMANTIC TYPE HELPERS ─────────────────────────── */
/* Drop into any new page to get the right scale without repeating values. */

.eyebrow {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mid);
}

.h-display {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-display);
  line-height: 1;
  letter-spacing: -0.028em;
  text-wrap: balance;
}

.h-page {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-page);
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.h-section {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-h2);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.h-row {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-h3);
  line-height: 1.05;
  letter-spacing: -0.018em;
}

/* The brand's signature move: <em> inside any heading turns cobalt-italic */
.h-display em,
.h-page em,
.h-section em,
.h-row em,
h1 em,
h2 em,
h3 em {
  font-style: italic;
  color: var(--a);
}

.lede {
  font-size: var(--t-lede);
  line-height: 1.6;
  color: var(--mid);
  max-width: 60ch;
}

.lede strong {
  color: var(--fg);
  font-weight: 500;
}

/* Editorial prose — case studies, about, contact */
.prose p {
  font-family: var(--serif);
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.6;
  letter-spacing: -0.005em;
  margin-bottom: 28px;
  color: var(--fg);
  /* Avoid orphans — a lone word stranded on the last line. The browser
     pulls a word down from the line above instead. Left-aligned ragged
     right is kept deliberately; justified text causes worse problems
     (rivers of whitespace) than the orphans it would fix. */
  text-wrap: pretty;
}

.prose em {
  color: var(--a);
  font-style: italic;
}

.prose a {
  color: var(--a);
  border-bottom: 1px solid var(--a-mid);
  text-decoration: none;
}

.prose a:hover {
  border-color: var(--a);
}

.prose code,
code.inline {
  font-family: var(--mono);
  font-size: 0.92em;
  padding: 2px 6px;
  background: var(--a-lo);
  color: var(--fg);
  border-radius: 2px;
}

/* ─────────────────────────────────────────────────────────────
   v9 additions — extracted from index.html + new components
   ───────────────────────────────────────────────────────────── */

/* Work row — project mark (SVG glyph above year) */
.work-mark {
  display: block;
  margin-bottom: 10px;
  color: var(--fg);
  flex-shrink: 0;
}

.work-year-wrap {
  display: flex;
  flex-direction: column;
}

/* Stack opinion line — one conviction per group */
.stack-opinion {
  font-family: var(--ui);
  font-size: 13px;
  color: var(--mid);
  line-height: 1.6;
  margin-bottom: 20px;
  max-width: 30ch;
  font-style: italic;
}

/* Writing section — draft cards instead of plain list */
.writing-drafts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--line-strong);
  border: 1px solid var(--line-strong);
  margin-top: 0;
}

@media (min-width: 720px) {
  .writing-drafts {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.draft-card {
  background: var(--bg);
  padding: 28px 24px;
  position: relative;
}

.draft-status {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.draft-status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--dim);
  flex-shrink: 0;
}

.draft-status.active::before {
  background: var(--a);
}

.draft-title {
  font-family: var(--serif);
  font-size: clamp(17px, 2vw, 20px);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.draft-hint {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  line-height: 1.5;
}

.writing-footnote {
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.06em;
}

/* ─────────────────────────── ARCHITECTURE DIAGRAMS ─────────────────────────── */

/* Shared diagram wrapper */
.arch-diagram {
  margin: 48px 0;
  border: 1px solid var(--line-strong);
  overflow: hidden;
}

.arch-diagram-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mid);
}

.arch-diagram-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--a);
  flex-shrink: 0;
  animation: pulse 2.4s ease-in-out infinite;
}

.arch-caption {
  margin-top: 0;
  padding: 12px 20px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mid);
  border-top: 1px solid var(--line);
  letter-spacing: 0.04em;
}

/* Race condition diagram */
.race-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

@media (min-width: 760px) {
  .race-wrap {
    grid-template-columns: 1fr 1px 1fr;
  }
}

.race-panel {
  padding: 24px 20px;
}

.race-panel+.race-panel {
  border-top: 1px solid var(--line);
}

@media (min-width: 760px) {
  .race-panel+.race-panel {
    border-top: none;
    border-left: none;
  }
}

.race-sep {
  background: var(--line-strong);
  display: none;
}

@media (min-width: 760px) {
  .race-sep {
    display: block;
  }
}

.race-panel-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.race-badge-err {
  color: #b85050;
}

.race-badge-ok {
  color: var(--grn);
}

.race-row {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  line-height: 1.45;
}

.race-row:last-child {
  border-bottom: none;
}

.race-row.err {
  color: #b85050;
}

.race-row.ok {
  color: var(--grn);
}

.race-row.accent {
  color: var(--a);
}

.race-row.muted {
  color: var(--mid);
}

.race-tag {
  font-size: 9px;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 2px;
  flex-shrink: 0;
}

.race-tag.a {
  background: rgba(37, 65, 178, 0.12);
  color: var(--a);
}

.race-tag.b {
  background: rgba(14, 14, 16, 0.07);
  color: var(--mid);
}

[data-theme="dark"] .race-tag.b {
  background: rgba(240, 240, 237, 0.1);
}

.race-tag.err {
  background: rgba(184, 80, 80, 0.12);
  color: #b85050;
}

.race-tag.ok {
  background: rgba(42, 138, 79, 0.12);
  color: var(--grn);
}

.race-tag.wait {
  background: rgba(184, 80, 80, 0.08);
  color: #b85050;
  animation: waitPulse 1.3s ease-in-out infinite;
}

@keyframes waitPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

.race-verdict {
  padding: 12px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

.race-verdict.err {
  color: #b85050;
}

.race-verdict.ok {
  color: var(--grn);
}

@media (prefers-reduced-motion: reduce) {
  .race-tag.wait {
    animation: none;
  }
}

/* Architecture SVG diagram (Queued, Chess) */
.svg-diagram-wrap {
  padding: 8px 0 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.svg-diagram-wrap svg {
  display: block;
  min-width: 520px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}



/* ══════════════════════════════════════════════════════════
   Home page styles — moved from index.html inline <style>
   ══════════════════════════════════════════════════════════ */

/* ─────────── HERO ─────────── */
.hero {
  padding: 130px 0 80px;
  position: relative;
}

@media (min-width: 720px) {
  .hero {
    padding: 150px 0 90px;
  }
}

.hero-inner {
  width: 100%;
}

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mid);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.hero-eyebrow .pulse {
  width: 6px;
  height: 6px;
  background: var(--grn);
  border-radius: 50%;
  animation: pulse 2.4s ease-in-out infinite;
}

.hero-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-display);
  line-height: 1;
  letter-spacing: -0.028em;
  margin-bottom: 36px;
  max-width: 13ch;
  text-wrap: balance;
}

/* Each clause of the headline is its own block, so the two lines can
   reveal independently — the cobalt emphasis settles a beat last. */
.hero-line {
  display: block;
}

.hero-title em {
  font-style: italic;
  color: var(--a);
}

.hero-meta {
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-family: var(--ui);
  font-size: var(--t-ui);
  line-height: 1.65;
  color: var(--mid);
  max-width: 62ch;
  text-wrap: pretty;
  /* avoid a stranded word on the last line */
}

.hero-status {
  color: var(--grn);
}

.hero-meta a {
  color: var(--fg);
}

/* ─────────── HERO ENTRANCE ───────────
   A staggered reveal: each [data-hero] element starts slightly low
   and transparent, then settles. The order (eyebrow → line 1 → line 2
   → meta) lets the headline assemble like it is being composed rather
   than appearing all at once. Deliberately a plain translate — no
   blur or scale — to stay in the site's restrained vocabulary. */
[data-hero] {
  opacity: 0;
  transform: translateY(14px);
  animation: heroIn 0.7s var(--ease) forwards;
}

[data-hero="1"] {
  animation-delay: 0.05s;
}

[data-hero="2"] {
  animation-delay: 0.16s;
}

[data-hero="3"] {
  animation-delay: 0.30s;
}

/* the emphasis lands last */
[data-hero="4"] {
  animation-delay: 0.44s;
}

@keyframes heroIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-hero] {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ─────────── SECTION HEADER SCROLL REVEAL ───────────
   Section headers reveal as they enter the viewport, giving the long
   scroll a quiet rhythm. The eyebrow (section-num) and the title
   reveal with a small offset between them — assembled, not popped.
   The IntersectionObserver in scripts.js adds .reveal when the header
   scrolls in; until then the children sit hidden. */
.section-head[data-reveal-on-scroll] .section-num,
.section-head[data-reveal-on-scroll] .section-title,
.section-head[data-reveal-on-scroll] .section-link {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.section-head[data-reveal-on-scroll].reveal .section-num,
.section-head[data-reveal-on-scroll].reveal .section-title,
.section-head[data-reveal-on-scroll].reveal .section-link {
  opacity: 1;
  transform: translateY(0);
}

.section-head[data-reveal-on-scroll].reveal .section-title {
  transition-delay: 0.08s;
}

.section-head[data-reveal-on-scroll].reveal .section-link {
  transition-delay: 0.14s;
}

/* The header element gets .reveal added by JS. The global .reveal rule
   would set it to opacity:0 + run the fade-up keyframe — but here the
   CHILDREN handle the motion, so the header itself must stay fully
   visible. Override the global reveal base state, not just the
   animation, or the header would vanish. */
.section-head[data-reveal-on-scroll].reveal {
  animation: none;
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {

  .section-head[data-reveal-on-scroll] .section-num,
  .section-head[data-reveal-on-scroll] .section-title,
  .section-head[data-reveal-on-scroll] .section-link {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ─────────── WORK ROWS ─────────── */
.work-list {
  display: flex;
  flex-direction: column;
}

.work-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px 32px;
  padding: 28px 24px;
  margin: 0 -24px;
  border-bottom: 1px solid var(--line);
  position: relative;
  transition: background 0.4s var(--ease);
}

.work-row [data-magnetic-inner] {
  display: contents;
  transition: transform 0.4s var(--ease);
}

@media (min-width: 800px) {
  .work-row {
    grid-template-columns: 72px 1fr 180px 60px;
    align-items: center;
  }
}

.work-row:hover {
  background: var(--a-lo);
}

.work-row:hover .work-arrow {
  opacity: 1;
  transform: translateX(0);
  color: var(--a);
}

.work-row:focus-visible {
  outline: none;
  background: var(--a-lo);
}

/* A cobalt accent line that wipes in from the left edge on hover/focus
   — a clear "this row is active" signal beyond the background tint.
   scaleX from the left origin keeps it a wipe, not a fade. */
.work-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--a);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.34s var(--ease);
}

.work-row:hover::before,
.work-row:focus-visible::before {
  transform: scaleX(1);
}

/* The title nudges right as the accent comes in — the row leans
   toward the cursor. Small (4px), but it makes the row feel alive. */
.work-row .work-title {
  transition: transform 0.34s var(--ease), color 0.34s var(--ease);
}

.work-row:hover .work-title,
.work-row:focus-visible .work-title {
  transform: translateX(4px);
  color: var(--a);
}

/* The year shifts from muted to foreground — quiet hierarchy cue. */
.work-row .work-year {
  transition: color 0.34s var(--ease);
}

.work-row:hover .work-year,
.work-row:focus-visible .work-year {
  color: var(--fg);
}

@media (prefers-reduced-motion: reduce) {
  .work-row::before {
    transition: none;
  }

  .work-row .work-title {
    transition: color 0.2s;
  }
}

.work-year {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--mid);
}

.work-title {
  font-family: var(--serif);
  font-size: var(--t-h3);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.018em;
}

.work-summary {
  font-size: 14px;
  color: var(--mid);
  margin-top: 8px;
  max-width: 56ch;
  line-height: 1.55;
  text-wrap: pretty;
  /* avoid orphans in the short project blurb */
}

.work-stack {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--mid);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.work-arrow {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--mid);
  opacity: 0.4;
  transform: translateX(-6px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), color 0.3s var(--ease);
  justify-self: end;
}

@media (max-width: 800px) {
  .work-row {
    padding: 24px 16px;
    margin: 0 -16px;
  }

  .work-arrow {
    display: none;
  }

  .work-stack {
    margin-top: 12px;
  }
}

/* ─────────── NOW WIDGET (hidden by default, shows when data loads) ─────────── */
.now-section[hidden] {
  display: none;
}

.now-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 720px) {

  /* Asymmetric layout: music card wider, film card narrower. Breaks the AI symmetry. */
  .now-grid {
    grid-template-columns: 1.6fr 1fr;
    gap: 32px;
    align-items: stretch;
  }
}

.now-card {
  border: 1px solid var(--line);
  padding: 28px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 180px;
  transition: border-color 0.3s var(--ease);
}

.now-card:hover {
  border-color: var(--line-strong);
}

.now-state {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mid);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.now-state::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--grn);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(42, 138, 79, 0.18);
}

.now-title {
  font-family: var(--serif);
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.012em;
  margin-top: 24px;
}

.now-sub {
  font-size: var(--t-meta);
}

.now-sub {
  font-size: 13px;
  color: var(--mid);
  font-family: var(--mono);
  margin-top: 6px;
}

.now-link {
  display: block;
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--mid);
  transition: color 0.25s var(--ease), text-decoration-color 0.25s var(--ease);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.now-link:hover {
  color: var(--a);
  text-decoration-color: var(--a);
}

/* ─────────── WRITING TEASE ─────────── */
.writing-empty {
  border: 1px dashed var(--line-strong);
  padding: 56px 32px;
  text-align: center;
}

.writing-empty .label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 20px;
}

.writing-empty .body {
  font-family: var(--serif);
  font-size: clamp(20px, 2.4vw, 28px);
  letter-spacing: -0.015em;
  max-width: 28ch;
  margin: 0 auto 28px;
  line-height: 1.3;
}

.writing-empty .upcoming {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mid);
  margin-top: 24px;
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.writing-empty .upcoming li {
  list-style: none;
}

.writing-empty .upcoming li::before {
  content: "→ ";
  color: var(--a);
}

/* ─────────── CTA ─────────── */
.cta {
  border-top: 1px solid var(--line);
  text-align: left;
  padding: 96px 0 64px;
}

.cta-title {
  font-family: var(--serif);
  font-size: clamp(40px, 6.5vw, 84px);
  font-weight: 400;
  letter-spacing: -0.028em;
  line-height: 1.05;
  margin-bottom: 40px;
  max-width: 14ch;
  text-wrap: balance;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.cta-meta {
  margin-top: 28px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mid);
  letter-spacing: 0.06em;
}

/* ─────────── STACK ─────────── */
.stack-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}

@media (min-width: 760px) {
  .stack-groups {
    grid-template-columns: repeat(3, 1fr);
    gap: 48px;
  }
}

.stack-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mid);
  padding-bottom: 14px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.stack-row {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
}

.stack-chip a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  transition: border-color 0.22s var(--ease), background 0.22s var(--ease), transform 0.22s var(--ease);
}

.stack-chip a:hover {
  border-color: var(--line-strong);
  background: var(--a-lo);
  transform: translateY(-3px);
}

.stack-chip img {
  width: 30px;
  height: 30px;
  filter: saturate(0.95);
}

[data-theme="dark"] .stack-chip img {
  filter: saturate(0.92) brightness(1.12);
}

/* If an icon fails to load, fall back to a text label so the chip
   is never an empty box. */
.stack-chip.icon-failed a::after {
  content: attr(aria-label);
  font-family: var(--mono);
  font-size: 9px;
  text-align: center;
  color: var(--mid);
  padding: 4px;
  line-height: 1.2;
}

.stack-chip.icon-failed img {
  display: none;
}

/* On touch devices tooltips don't work, so show a small caption
   under each icon instead. */
@media (hover: none) {
  .stack-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 64px;
  }

  .stack-chip a {
    width: 64px;
    height: 64px;
  }

  .stack-chip::after {
    content: attr(data-name);
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.02em;
    color: var(--mid);
    text-align: center;
    line-height: 1.25;
  }
}

/* ─────────── CONTRIBUTION GRAPH ───────────
   A GitHub-style activity calendar. Built with care:
   - weekday labels on the left so the grid is readable, not decorative
   - month labels anchored to real grid columns (no absolute drift)
   - one shared JS-positioned tooltip, so edge cells never clip
   - explicit loading / error states — never a silent disappearance
   - fixed 13px cells; the whole block is centered in the card. On a
     narrow viewport the calendar scrolls horizontally rather than
     shrinking the cells below a legible size.
   Layout token: --cl-cell drives cell size AND the weekday/month row
   rhythm, so all three layers (weekdays, months, grid) stay locked
   together. */
.contrib {
  --cl-cell: 13px;
  /* cell edge length (square) */
  --cl-gap: 3px;
  /* gap between cells, both axes */
  margin-top: 88px;
  padding-top: 56px;
  border-top: 1px solid var(--line);
}

.contrib[hidden] {
  display: none;
}

.contrib-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.contrib-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 10px;
}

/* Yearly total — a quiet single line, the way chanhdai's component
   reads ("N contributions in YYYY on GitHub"). Lives in the footer,
   not the header, so the card is the whole component. */
.contrib-count {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.01em;
  color: var(--mid);
  line-height: 1.5;
  margin: 0;
}

.contrib-count b {
  color: var(--fg);
  font-weight: 500;
}

.contrib-count a {
  color: var(--mid);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  transition: color 0.25s var(--ease), text-decoration-color 0.25s var(--ease);
}

.contrib-count a:hover {
  color: var(--a);
  text-decoration-color: var(--a);
}

.contrib-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mid);
  transition: color 0.25s var(--ease), text-decoration-color 0.25s var(--ease);
  white-space: nowrap;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.contrib-link:hover {
  color: var(--a);
  text-decoration-color: var(--a);
}

.contrib-card {
  border: 1px solid var(--line);
  padding: 22px 24px 18px;
}

/* The calendar block (weekday column + months + grid). It is sized to
   its content and centered in the card — so on a wide card it sits in
   the middle with even space on both sides, and on a narrow card it
   fills what it can and the inner scroll wrapper takes over.
   max-width:100% is what lets .contrib-scroll actually clip + scroll;
   without it the block would just overflow the card unbounded. */
.contrib-body {
  display: grid;
  grid-template-columns: auto minmax(0, auto);
  gap: 0 8px;
  align-items: start;
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
}

/* Weekday labels (Mon / Wed / Fri) — a 7-row column that shares the
   grid's row rhythm exactly via the same cell + gap tokens. */
.contrib-weekdays {
  display: grid;
  grid-template-rows: repeat(7, var(--cl-cell));
  gap: var(--cl-gap);
  /* push down to clear the month-label row above the grid */
  margin-top: calc(18px + 5px);
}

.contrib-weekdays span {
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: var(--cl-cell);
  color: var(--mid);
  white-space: nowrap;
  padding-right: 2px;
}

.contrib-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  padding-bottom: 2px;
  /* room for the scrollbar without clipping cells */
}

.contrib-scroll::-webkit-scrollbar {
  height: 3px;
}

.contrib-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.contrib-scroll::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 2px;
}

/* Month labels — a grid with the SAME column count as the calendar,
   so each label sits exactly above the week it belongs to. */
.contrib-months {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--cl-cell);
  gap: var(--cl-gap);
  height: 18px;
  margin-bottom: 5px;
}

.contrib-months span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mid);
  line-height: 18px;
  white-space: nowrap;
}

/* The calendar: 7 day-rows, one column per week, filled top-to-bottom. */
.contrib-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, var(--cl-cell));
  grid-auto-columns: var(--cl-cell);
  gap: var(--cl-gap);
  width: max-content;
}

.contrib-cell {
  width: var(--cl-cell);
  height: var(--cl-cell);
  border-radius: 2px;
  background: var(--cl0);
  /* hairline inset edge keeps level-0 cells from dissolving into the card */
  box-shadow: inset 0 0 0 1px rgba(14, 14, 16, 0.04);
  cursor: default;
  transition: outline-color 0.12s var(--ease);
  outline: 1.5px solid transparent;
  outline-offset: 1px;
}

[data-theme="dark"] .contrib-cell {
  box-shadow: inset 0 0 0 1px rgba(240, 240, 237, 0.05);
}

.contrib-cell[data-level="1"] {
  background: var(--cl1);
}

.contrib-cell[data-level="2"] {
  background: var(--cl2);
}

.contrib-cell[data-level="3"] {
  background: var(--cl3);
}

.contrib-cell[data-level="4"] {
  background: var(--cl4);
}

.contrib-cell.is-empty {
  box-shadow: none;
}

/* leading pad cells */
.contrib-cell:hover {
  outline-color: var(--fg);
}

/* Skeleton state — a calm pulse while data loads. */
.contrib-cell.skeleton {
  background: var(--cl0);
  animation: contribPulse 1.4s var(--ease) infinite;
}

@keyframes contribPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.45;
  }
}

@media (prefers-reduced-motion: reduce) {
  .contrib-cell.skeleton {
    animation: none;
  }
}

/* Error state — quiet, honest, never a blank box. */
.contrib-error {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mid);
  line-height: 1.6;
  padding: 8px 0;
}

.contrib-error a {
  color: var(--a);
  text-decoration: underline;
  text-decoration-color: var(--a-mid);
  text-underline-offset: 3px;
}

/* One shared tooltip, positioned by JS in viewport space — cannot be
   clipped by the scroll container the way a per-cell ::after would. */
.contrib-tip {
  position: fixed;
  z-index: 90;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%) translateY(4px);
  transition: opacity 0.13s var(--ease);
}

.contrib-tip.show {
  opacity: 1;
}

.contrib-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--fg);
}

/* Footer row: stats on the left, intensity legend on the right. */
/* Footer row: yearly count (left) and intensity legend (right).
   On narrow screens they stack, count first. */
.contrib-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.contrib-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mid);
}

.contrib-legend .lvl {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  display: inline-block;
  box-shadow: inset 0 0 0 1px rgba(14, 14, 16, 0.04);
}

[data-theme="dark"] .contrib-legend .lvl {
  box-shadow: inset 0 0 0 1px rgba(240, 240, 237, 0.05);
}

.contrib-legend .lvl[data-lvl="0"] {
  background: var(--cl0);
}

.contrib-legend .lvl[data-lvl="1"] {
  background: var(--cl1);
}

.contrib-legend .lvl[data-lvl="2"] {
  background: var(--cl2);
}

.contrib-legend .lvl[data-lvl="3"] {
  background: var(--cl3);
}

.contrib-legend .lvl[data-lvl="4"] {
  background: var(--cl4);
}

.contrib-legend span:first-child {
  margin-right: 4px;
}

.contrib-legend span:last-child {
  margin-left: 4px;
}

@media (max-width: 600px) {
  .contrib-foot {
    flex-direction: column;
    align-items: flex-start;
  }
}


/* ─────────── TOOLTIP ───────────
   Generic hover tooltip for stack chips etc. Explicitly excludes
   .contrib-cell — those carry a data-tip attribute as their data
   source but are rendered by the shared JS tooltip (.contrib-tip),
   so the CSS ::after must not fire a second time on them. */
[data-tip] {
  position: relative;
}

[data-tip]:not(.contrib-cell)::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--fg);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding: 6px 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  z-index: 20;
}

[data-tip]:not(.contrib-cell):hover::after,
[data-tip]:not(.contrib-cell):focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (hover: none) {

  /* no hover tooltips on touch devices */
  [data-tip]:not(.contrib-cell)::after {
    display: none;
  }
}


/* ════════════════════════════════════════
   cinemaranked.html — moved from inline <style>
   ════════════════════════════════════════ */

/* Case study layout */
.case-head {
  padding: 140px 0 60px;
  border-bottom: 1px solid var(--line);
}

.case-back {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mid);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  transition: color 0.25s var(--ease);
}

.case-back:hover {
  color: var(--a);
}

.case-back .arrow {
  transition: transform 0.3s var(--ease);
}

.case-back:hover .arrow {
  transform: translateX(-4px);
}

.case-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(54px, 8vw, 104px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.case-title em {
  font-style: italic;
  color: var(--a);
}

.case-tagline {
  font-family: var(--serif);
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.4;
  color: var(--mid);
  max-width: 36ch;
  font-style: italic;
  margin-bottom: 40px;
}

.case-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 40px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

@media (min-width: 720px) {
  .case-meta-grid {
    grid-template-columns: 100px 1fr 100px 180px;
  }
}

.case-meta .k {
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 8px;
}

.case-meta .v {
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--fg);
  line-height: 1.5;
}

/* Sections inside the case study */
.cs-section {
  padding: 80px 0;
  border-bottom: 1px solid var(--line);
}

.cs-section:last-of-type {
  border-bottom: none;
}

.cs-num {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 16px;
}

.cs-h {
  font-family: var(--serif);
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
  max-width: 22ch;
}

.cs-h em {
  font-style: italic;
  color: var(--a);
}

.cs-prose {
  max-width: 65ch;
  font-size: var(--t-body);
  line-height: 1.7;
  color: var(--fg);
}

.cs-prose p {
  margin-bottom: 20px;
}

.cs-prose p.muted {
  color: var(--mid);
}

.cs-prose strong {
  font-weight: 500;
}

.cs-prose em {
  font-style: italic;
  color: var(--a);
}

.cs-prose code {
  font-family: var(--mono);
  font-size: 0.92em;
  padding: 2px 6px;
  background: var(--a-lo);
  color: var(--fg);
  border-radius: 2px;
}

/* Placeholder figure (for when screenshots are added) */
.figure {
  margin: 40px 0;
  max-width: 800px;
}

.figure-frame {
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px dashed var(--line-strong);
  background:
    repeating-linear-gradient(45deg,
      var(--line) 0,
      var(--line) 1px,
      transparent 1px,
      transparent 12px),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mid);
  text-align: center;
  padding: 24px;
}

.figure-frame .label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 10px;
}

.figure-caption {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mid);
  letter-spacing: 0.04em;
}

/* Metrics table */
.metrics {
  margin: 40px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  max-width: 720px;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
}

.metric-row:last-child {
  border-bottom: none;
}

.metric-row .k {
  color: var(--mid);
}

.metric-row .v {
  color: var(--fg);
  font-weight: 500;
}

.metric-row .v.good {
  color: var(--grn);
}

.metric-row .v.accent {
  color: var(--a);
}

/* Pull-quote sized callout */
.callout {
  margin: 48px 0;
  padding: 0 0 0 24px;
  border-left: 2px solid var(--a);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.4;
  color: var(--fg);
  max-width: 30ch;
}

/* Code block (sparingly used) */
.codeblock {
  margin: 32px 0;
  padding: 20px 24px;
  border: 1px solid var(--line-strong);
  background: var(--a-lo);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--fg);
  white-space: pre;
  overflow-x: auto;
  max-width: 800px;
}

.codeblock .c {
  color: var(--mid);
}

/* Next project teaser */
.next-project {
  padding: 80px 0 100px;
  text-align: center;
  border-top: 1px solid var(--line);
}

.next-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 24px;
}

.next-link {
  font-family: var(--serif);
  font-size: clamp(36px, 6vw, 64px);
  letter-spacing: -0.025em;
  color: var(--fg);
  display: inline-block;
  transition: color 0.3s var(--ease);
}

.next-link em {
  font-style: italic;
  color: var(--a);
}

.next-link:hover {
  color: var(--a);
}

.next-arrow {
  display: inline-block;
  margin-left: 12px;
  transition: transform 0.3s var(--ease);
}

.next-link:hover .next-arrow {
  transform: translateX(8px);
}


/* ════════════════════════════════════════
   queued.html — moved from inline <style>
   ════════════════════════════════════════ */

/* Case study layout */
.case-head {
  padding: 140px 0 60px;
  border-bottom: 1px solid var(--line);
}

.case-back {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mid);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  transition: color 0.25s var(--ease);
}

.case-back:hover {
  color: var(--a);
}

.case-back .arrow {
  transition: transform 0.3s var(--ease);
}

.case-back:hover .arrow {
  transform: translateX(-4px);
}

.case-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(54px, 8vw, 104px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.case-title em {
  font-style: italic;
  color: var(--a);
}

.case-tagline {
  font-family: var(--serif);
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.4;
  color: var(--mid);
  max-width: 36ch;
  font-style: italic;
  margin-bottom: 40px;
}

.case-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 40px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

/* @media (min-width: 720px) {
  .case-meta-grid { grid-template-columns: repeat(4, 1fr); }
} */
.case-meta .k {
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 8px;
}

.case-meta .v {
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--fg);
  line-height: 1.5;
}

/* Sections inside the case study */
.cs-section {
  padding: 80px 0;
  border-bottom: 1px solid var(--line);
}

.cs-section:last-of-type {
  border-bottom: none;
}

.cs-num {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 16px;
}

.cs-h {
  font-family: var(--serif);
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
  max-width: 22ch;
}

.cs-h em {
  font-style: italic;
  color: var(--a);
}

.cs-prose {
  max-width: 65ch;
  font-size: var(--t-body);
  line-height: 1.7;
  color: var(--fg);
}

.cs-prose p {
  margin-bottom: 20px;
}

.cs-prose p.muted {
  color: var(--mid);
}

.cs-prose strong {
  font-weight: 500;
}

.cs-prose em {
  font-style: italic;
  color: var(--a);
}

.cs-prose code {
  font-family: var(--mono);
  font-size: 0.92em;
  padding: 2px 6px;
  background: var(--a-lo);
  color: var(--fg);
  border-radius: 2px;
}

/* Placeholder figure (for when screenshots are added) */
.figure {
  margin: 40px 0;
  max-width: 800px;
}

.figure-frame {
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px dashed var(--line-strong);
  background:
    repeating-linear-gradient(45deg,
      var(--line) 0,
      var(--line) 1px,
      transparent 1px,
      transparent 12px),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mid);
  text-align: center;
  padding: 24px;
}

.figure-frame .label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 10px;
}

.figure-caption {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mid);
  letter-spacing: 0.04em;
}

/* Metrics table */
.metrics {
  margin: 40px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  max-width: 720px;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
}

.metric-row:last-child {
  border-bottom: none;
}

.metric-row .k {
  color: var(--mid);
}

.metric-row .v {
  color: var(--fg);
  font-weight: 500;
}

.metric-row .v.good {
  color: var(--grn);
}

.metric-row .v.accent {
  color: var(--a);
}

/* Pull-quote sized callout */
.callout {
  margin: 48px 0;
  padding: 0 0 0 24px;
  border-left: 2px solid var(--a);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.4;
  color: var(--fg);
  max-width: 30ch;
}

/* Next project teaser */
.next-project {
  padding: 80px 0 100px;
  text-align: center;
  border-top: 1px solid var(--line);
}

.next-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 24px;
}

.next-link {
  font-family: var(--serif);
  font-size: clamp(36px, 6vw, 64px);
  letter-spacing: -0.025em;
  color: var(--fg);
  display: inline-block;
  transition: color 0.3s var(--ease);
}

.next-link em {
  font-style: italic;
  color: var(--a);
}

.next-link:hover {
  color: var(--a);
}

.next-arrow {
  display: inline-block;
  margin-left: 12px;
  transition: transform 0.3s var(--ease);
}

.next-link:hover .next-arrow {
  transform: translateX(8px);
}


/* ════════════════════════════════════════
   chess-engine.html — moved from inline <style>
   ════════════════════════════════════════ */

/* Case study layout */
.case-head {
  padding: 140px 0 60px;
  border-bottom: 1px solid var(--line);
}

.case-back {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mid);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  transition: color 0.25s var(--ease);
}

.case-back:hover {
  color: var(--a);
}

.case-back .arrow {
  transition: transform 0.3s var(--ease);
}

.case-back:hover .arrow {
  transform: translateX(-4px);
}

.case-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(54px, 8vw, 104px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.case-title em {
  font-style: italic;
  color: var(--a);
}

.case-tagline {
  font-family: var(--serif);
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.4;
  color: var(--mid);
  max-width: 36ch;
  font-style: italic;
  margin-bottom: 40px;
}

/* Dark mode refinement for case title */
[data-theme="dark"] .case-title em {
  color: var(--a);
}

.case-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 40px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

/* @media (min-width: 720px) {
  .case-meta-grid { grid-template-columns: repeat(4, 1fr); }
} */
.case-meta .k {
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 8px;
}

.case-meta .v {
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--fg);
  line-height: 1.5;
}

/* Sections inside the case study */
.cs-section {
  padding: 80px 0;
  border-bottom: 1px solid var(--line);
}

.cs-section:last-of-type {
  border-bottom: none;
}

.cs-num {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 16px;
}

.cs-h {
  font-family: var(--serif);
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
  max-width: 22ch;
}

.cs-h em {
  font-style: italic;
  color: var(--a);
}

.cs-prose {
  max-width: 65ch;
  font-size: var(--t-body);
  line-height: 1.7;
  color: var(--fg);
}

.cs-prose p {
  margin-bottom: 20px;
}

.cs-prose p.muted {
  color: var(--mid);
}

.cs-prose strong {
  font-weight: 500;
}

.cs-prose em {
  font-style: italic;
  color: var(--a);
}

.cs-prose code {
  font-family: var(--mono);
  font-size: 0.92em;
  padding: 2px 6px;
  background: var(--a-lo);
  color: var(--fg);
  border-radius: 2px;
}

/* Placeholder figure (for when screenshots are added) */
.figure {
  margin: 40px 0;
  max-width: 800px;
}

.figure-frame {
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px dashed var(--line-strong);
  background:
    repeating-linear-gradient(45deg,
      var(--line) 0,
      var(--line) 1px,
      transparent 1px,
      transparent 12px),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mid);
  text-align: center;
  padding: 24px;
}

.figure-frame .label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 10px;
}

.figure-caption {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mid);
  letter-spacing: 0.04em;
}

/* Metrics table */
.metrics {
  margin: 40px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  max-width: 720px;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
}

.metric-row:last-child {
  border-bottom: none;
}

.metric-row .k {
  color: var(--mid);
}

.metric-row .v {
  color: var(--fg);
  font-weight: 500;
}

.metric-row .v.good {
  color: var(--grn);
}

.metric-row .v.accent {
  color: var(--a);
}

/* Pull-quote sized callout */
.callout {
  margin: 48px 0;
  padding: 0 0 0 24px;
  border-left: 2px solid var(--a);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.4;
  color: var(--fg);
  max-width: 30ch;
}

/* Next project teaser */
.next-project {
  padding: 80px 0 100px;
  text-align: center;
  border-top: 1px solid var(--line);
}

.next-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 24px;
}

.next-link {
  font-family: var(--serif);
  font-size: clamp(36px, 6vw, 64px);
  letter-spacing: -0.025em;
  color: var(--fg);
  display: inline-block;
  transition: color 0.3s var(--ease);
}

.next-link em {
  font-style: italic;
  color: var(--a);
}

.next-link:hover {
  color: var(--a);
}

.next-arrow {
  display: inline-block;
  margin-left: 12px;
  transition: transform 0.3s var(--ease);
}

.next-link:hover .next-arrow {
  transform: translateX(8px);
}


/* ════════════════════════════════════════
   about.html — moved from inline <style>
   ════════════════════════════════════════ */

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 60px;
  padding: 80px 0;
}

@media (min-width: 900px) {
  .about-grid {
    grid-template-columns: 260px 1fr;
    gap: 100px;
  }
}

.about-side {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mid);
  position: sticky;
  top: 100px;
  align-self: start;
}

@media (max-width: 900px) {
  .about-side {
    position: static;
  }
}

.about-side .row {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.about-side .row:last-child {
  border-bottom: none;
}

.about-side .k {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--dim);
  margin-bottom: 5px;
}

.about-side .v {
  color: var(--fg);
  font-size: var(--t-meta);
  line-height: 1.4;
}

.about-body p {
  font-family: var(--serif);
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.6;
  letter-spacing: -0.005em;
  margin-bottom: 28px;
  color: var(--fg);
  text-wrap: pretty;
  /* no lone word stranded on the last line */
}

.about-body em {
  color: var(--a);
  font-style: italic;
}

.about-body a {
  color: var(--a);
  border-bottom: 1px solid var(--a-mid);
  text-decoration: none;
}

.about-body a:hover {
  border-color: var(--a);
}

.about-sub {
  font-family: var(--mono);
  font-size: var(--t-meta);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 16px;
}

.about-facts {
  list-style: none;
  margin: 0 0 32px;
  padding: 0;
}

.about-facts li {
  position: relative;
  padding: 14px 0 14px 24px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.55;
  color: var(--fg);
}

.about-facts li:last-child {
  border-bottom: none;
}

.about-facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 21px;
  width: 6px;
  height: 6px;
  background: var(--a);
}

.experience {
  margin-top: 80px;
  border-top: 1px solid var(--line);
  padding-top: 60px;
}

.exp-head {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 40px;
}

.exp-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 32px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

@media (max-width: 600px) {
  .exp-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.exp-when {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mid);
  padding-top: 4px;
  /* A date range like "May 2025, Present" must read as one unit —
     never let it break across two lines. The column above is sized
     to fit the longest label without wrapping. */
  white-space: nowrap;
}

.exp-role {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.exp-where {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mid);
  margin-bottom: 12px;
}

.exp-desc {
  font-size: var(--t-ui);
  color: var(--mid);
  line-height: 1.6;
  max-width: 60ch;
  text-wrap: pretty;
  /* avoid orphans in the role description */
}


/* ════════════════════════════════════════
   contact.html — moved from inline <style>
   ════════════════════════════════════════ */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 60px;
  padding: 80px 0;
}

@media (min-width: 900px) {
  .contact-grid {
    grid-template-columns: 1.2fr 1fr;
    gap: 100px;
  }
}

.ck-body p {
  font-family: var(--serif);
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.6;
  margin-bottom: 24px;
  color: var(--fg);
  text-wrap: pretty;
  /* avoid orphans on the last line */
}

.ck-body p:last-of-type {
  color: var(--mid);
}

.ck-body em {
  color: var(--a);
  font-style: italic;
}

/* Prose links inside the contact body. Scoped with :not(.btn-f) so it
   does NOT bleed onto the CTA button — that button is an <a> sitting
   inside .ck-body, and without this exclusion it inherited blue text
   on its dark fill (clearly wrong in light mode). */
.ck-body a:not(.btn-f) {
  color: var(--a);
  border-bottom: 1px solid var(--a-mid);
  text-decoration: none;
}

.ck-body a:not(.btn-f):hover {
  border-color: var(--a);
}

.ck-channels {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ck-channels-head {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.ck-channel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: var(--t-meta);
  transition: padding 0.3s var(--ease);
}

.ck-channel:hover {
  padding-left: 8px;
}

.ck-channel:hover .ck-label {
  color: var(--a);
}

.ck-label {
  color: var(--mid);
  transition: color 0.3s var(--ease);
}

.ck-value {
  color: var(--fg);
}

.ck-value:hover {
  color: var(--a);
}

.availability {
  margin-top: 60px;
  padding: 28px;
  border: 1px solid var(--line-strong);
  background: var(--a-lo);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--fg);
}

.availability .head {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--a);
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.availability .head::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--grn);
  box-shadow: 0 0 0 3px rgba(42, 138, 79, 0.2);
}

/* ─────────────────────────── MICRO-INTERACTIONS ───────────────────────────
   Final polish layer: copy actions + reading progress. All CSS + a little
   vanilla JS (scripts.js), no dependencies, reduced-motion respected below. */

/* Copy ICON button on code blocks. Small square in the corner (the
   conventional code-copy affordance). The block is wrapped (.cb-wrap) so the
   button anchors to the corner and never scrolls with overflowing code. */
.cb-wrap {
  position: relative;
  margin: 32px 0;
  max-width: 800px;
}

.cb-wrap>.codeblock {
  margin: 0;
}

.copy-icon-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--mid);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
  opacity: 1;
  /* visible by default (e.g. touch) */
  transition:
    opacity 0.2s var(--ease),
    color 0.18s var(--ease),
    border-color 0.18s var(--ease),
    transform 0.12s var(--ease);
}

.copy-icon-btn svg {
  display: block;
}

/* On hover-capable devices, reveal on hover/focus only — keeps the code clean. */
@media (hover: hover) {
  .copy-icon-btn {
    opacity: 0;
  }

  .cb-wrap:hover .copy-icon-btn,
  .copy-icon-btn:focus-visible {
    opacity: 1;
  }
}

.copy-icon-btn:hover {
  color: var(--a);
  border-color: var(--a);
}

.copy-icon-btn:active {
  transform: scale(0.9);
}

.copy-icon-btn.is-copied {
  color: var(--a);
  border-color: var(--a);
}

/* Click-to-copy email row: the whole row is the affordance, no button. */
.ck-channel.is-copyable {
  cursor: pointer;
}

.ck-value.flash-copied {
  color: var(--a);
  animation: copiedFlash 0.32s var(--ease);
}

@keyframes copiedFlash {
  0% {
    opacity: 0;
    transform: translateY(3px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Reading progress bar — only mounted on long-form pages (scripts.js). */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 101;
  /* above the fixed nav (100) */
  pointer-events: none;
  background: transparent;
}

.read-progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--a);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.08s linear;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  /* was smooth — honor reduced motion */
  .read-progress span {
    transition: none;
  }

  .copy-icon-btn {
    transition: opacity 0.2s, color 0.2s, border-color 0.2s;
  }

  .ck-value.flash-copied {
    animation: none;
  }
}

/* ═══════════════════════════ MICRO-DETAIL POLISH ═══════════════════════════
   Small, mostly-additive touches that signal hand-finishing: themed controls,
   no tap-flash on mobile, opt-in smooth in-page scrolling, tabular figures so
   counters don't jitter, tidy prose wrapping, cobalt list markers, a wipe-in
   underline on footer links, hover-reveal heading anchors, and a slim themed
   scrollbar. All respect reduced-motion and the existing two-theme system. */
html {
  -webkit-tap-highlight-color: transparent;
  accent-color: var(--a);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Figures that animate or need to line up don't shift width as digits change. */
.hd-read-num,
#hd-count,
.contrib-count,
.contrib-count b,
.work-when,
.case-meta dd,
.cs-stat-num,
.now-sub {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Prose niceties: avoid one-word orphan lines; cobalt list markers. */
.prose p,
.cs-prose p,
.page-lede,
.case-tagline,
.hero-meta {
  text-wrap: pretty;
}

.prose ul li::marker,
.cs-prose ul li::marker,
.prose ol li::marker,
.cs-prose ol li::marker {
  color: var(--a);
}

/* Footer links: instant underline on hover/focus — no wipe. */
.footer-nav a {
  padding-bottom: 2px;
  transition: color 0.25s var(--ease);
}

.footer-nav a:hover,
.footer-nav a:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--a);
  text-underline-offset: 3px;
}

/* Hover-reveal heading anchors for long-form sections. */
.has-anchor {
  scroll-margin-top: 90px;
}

.h-anchor {
  display: inline-block;
  margin-left: 0.4em;
  font-family: var(--mono);
  font-size: 0.58em;
  font-style: normal;
  color: var(--a);
  text-decoration: none;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
  vertical-align: 0.12em;
}

.cs-h:hover .h-anchor,
.prose h2:hover .h-anchor,
.prose h3:hover .h-anchor,
.h-anchor:focus-visible {
  opacity: 0.55;
  transform: none;
}

.h-anchor:hover {
  opacity: 1;
}

.h-anchor.copied {
  opacity: 1;
}

.h-anchor.copied::after {
  content: "copied";
  margin-left: 0.5em;
  font-size: 0.82em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--a);
  opacity: 0.85;
}

@media (max-width: 640px) {
  .h-anchor {
    opacity: 0.5;
    transform: none;
  }

  /* always visible, no hover on touch */
}

/* Slim, themed scrollbar — pointer devices only, so touch keeps native. */
@media (pointer: fine) {
  html {
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
  }

  ::-webkit-scrollbar {
    width: 11px;
    height: 11px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 10px;
    border: 3px solid var(--bg);
  }

  ::-webkit-scrollbar-thumb:hover {
    background: var(--mid);
  }
}

/* ════════════════════════ MEMORABLE COMPONENTS ════════════════════════ */

/* Keyboard shortcuts overlay — a power-user nav layer. Press ? to open,
   g-then-key to jump, t for theme. Discoverable via the footer hint. */
.kbd-scrim {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(10, 10, 12, 0.5);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s var(--ease), visibility 0.2s;
}

.kbd-scrim.open {
  opacity: 1;
  visibility: visible;
}

.kbd-panel {
  width: min(440px, 100%);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 40px 90px -44px rgba(0, 0, 0, 0.55);
  padding: 22px 22px 14px;
  transform: translateY(10px) scale(0.985);
  transition: transform 0.24s var(--ease);
}

.kbd-scrim.open .kbd-panel {
  transform: none;
}

.kbd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kbd-head h2 {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mid);
  margin: 0;
  font-weight: 400;
}

.kbd-close {
  background: none;
  border: none;
  color: var(--mid);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}

.kbd-close:hover {
  color: var(--fg);
}

.kbd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 10px 8px;
  border: none;
  border-radius: 8px;
  background: none;
  text-align: left;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--fg);
  transition: background 0.15s var(--ease);
}

.kbd-row:hover,
.kbd-row:focus-visible {
  background: var(--line);
  outline: none;
}

.kbd-row .lbl {
  color: var(--mid);
}

.kbd-keys {
  display: flex;
  gap: 4px;
}

.kbd-keys b,
.kbd-hint b {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  padding: 4px 7px;
  color: var(--fg);
  background: var(--line);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
}

/* Footer meta row: colophon + the shortcut hint + (JS) live local time. */
.footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--mid);
}

.kbd-hint {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--mid);
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 0.2s var(--ease);
}

.kbd-hint:hover {
  color: var(--a);
}

.kbd-hint b {
  padding: 2px 6px;
  border-bottom-width: 2px;
}

.footer-localtime {
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {

  .kbd-scrim,
  .kbd-panel {
    transition: opacity 0.2s linear;
  }

  .kbd-panel {
    transform: none;
  }
}

/* Stack meta cell: prevent TMDB orphan on the second line */
.case-meta-grid .case-meta:nth-child(2) .v {
  white-space: nowrap;
}

/* ─────────────────────────────────────────────
   Stack chip icon — dark mode fixes
   Only targets logos that are black/dark SVGs;
   colored logos (TS, JS, C++, Go, Node, etc.)
   are left to the base brightness/saturate rule.
   ───────────────────────────────────────────── */

/* Base lift for all icons in dark mode */
[data-theme="dark"] .stack-chip img {
  filter: saturate(0.92) brightness(1.12);
}

/* ── Invert-to-white icons (black SVGs) ── */

[data-theme="dark"] .stack-chip[data-name="Express"] img {
  filter: invert(1) brightness(0.9);
}

[data-theme="dark"] .stack-chip[data-name="Socket.IO"] img {
  filter: invert(1) brightness(0.9);
}

[data-theme="dark"] .stack-chip[data-name="GitHub Actions"] img {
  filter: invert(1) brightness(0.9);
}

[data-theme="dark"] .stack-chip[data-name="AWS"] img {
  filter: invert(1) brightness(0.9);
}

/* ── Hover states — dim slightly on cobalt bg ── */

[data-theme="dark"] .stack-chip[data-name="Express"] a:hover img,
[data-theme="dark"] .stack-chip[data-name="Socket.IO"] a:hover img,
[data-theme="dark"] .stack-chip[data-name="GitHub Actions"] a:hover img,
[data-theme="dark"] .stack-chip[data-name="AWS"] a:hover img {
  filter: invert(1) brightness(0.75);
}

/* ── Linux (Tux): dark outline, just needs a lift ── */

[data-theme="dark"] .stack-chip[data-name="Linux"] img {
  filter: brightness(1.4);
}

[data-theme="dark"] .stack-chip[data-name="Linux"] a:hover img {
  filter: brightness(1.2);
}

.work-links {
  position: relative;
  z-index: 2;
  margin-top: 14px;
  display: flex;
  gap: 10px;
}

.work-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--mid);
  transition:
    color 0.22s var(--ease),
    border-color 0.22s var(--ease),
    background 0.22s var(--ease);
}

.work-link:hover {
  color: var(--fg);
  border-color: var(--line-strong);
  background: var(--a-lo);
}

.work-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.work-link .ext {
  width: 11px;
  height: 11px;
  transition: transform 0.22s var(--ease);
}

.work-link:hover .ext {
  transform: translate(2px, -2px);
}

/* Live indicator: reuses the site's green status-dot motif */
.work-link .live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--grn);
  box-shadow: 0 0 0 3px rgba(42, 138, 79, 0.16);
  flex-shrink: 0;
}


/* Stretched link: the title's link covers the whole row,
       so the row stays fully clickable without nesting anchors. */
.work-title .work-main-link {
  color: inherit;
  text-decoration: none;
}

.work-title .work-main-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* GitHub / Live links sit above the stretched link */
.work-links {
  position: relative;
  z-index: 2;
  margin-top: 12px;
  display: flex;
  gap: 18px;
}

.work-links a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mid);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.work-links a:hover {
  color: var(--a);
  border-color: var(--a);
}