/* SPDX-License-Identifier: MIT OR Apache-2.0
 * QUINE styles supplied by dhilipsiva in the reference wireframes. */
/* QUINE — Color tokens
 * Dark-first. The void is the canvas; ember is the will to build; phosphor is life.
 * Base palette → semantic aliases. Consume the semantic names in components.
 */
:root {
  /* ── Void: the indifferent universe, our background ───────────────── */
  --void-1000: #07070A;  /* deepest, page void behind everything */
  --void-900:  #0B0B10;  /* app background */
  --void-800:  #111119;  /* raised surface */
  --void-700:  #181822;  /* card */
  --void-600:  #20202C;  /* hover surface / inset */
  --void-500:  #2A2A38;  /* borders, hairlines */
  --void-400:  #3A3A4A;  /* strong border / disabled fill */

  /* ── Foreground: warm whites, never pure ──────────────────────────── */
  --paper-100: #F4F3EF;  /* primary text (warm off-white) */
  --paper-200: #C9C8C2;
  --fg-muted:  #908F9A;  /* secondary text */
  --fg-faint:  #8B8A95;  /* tertiary / placeholder — lifted to clear WCAG AA (>=4.5:1) on void/card/inset */
  --fg-ghost:  #3C3C49;  /* watermark, grid lines */

  /* ── Ember: the Rust homage, our primary accent (optimism, action) ── */
  --ember-50:  #FFE9E0;
  --ember-300: #FF9A6F;
  --ember-500: #F2542D;  /* signature */
  --ember-600: #D8431B;
  --ember-700: #B23413;

  /* ── Phosphor: terminal mint — "alive", nodes, success, life ──────── */
  --phosphor-300: #8BF0CE;
  --phosphor-500: #38E3A6;
  --phosphor-700: #16A877;

  /* ── Quanta: violet — Wasm / Web3 / symbolic, used sparingly, flat ── */
  --quanta-300: #B6A8FF;
  --quanta-500: #8B7CF6;
  --quanta-700: #5B4ACb;

  /* ── Signal: amber, sky, crimson for status ───────────────────────── */
  --amber-500:   #F5B544;
  --sky-500:     #4DB8FF;
  --crimson-500: #FF4D5E;

  /* ── Semantic aliases — components consume THESE ──────────────────── */
  --bg-base:        var(--void-900);
  --bg-sunken:      var(--void-1000);
  --bg-raised:      var(--void-800);
  --surface-card:   var(--void-700);
  --surface-inset:  var(--void-600);
  --surface-hover:  var(--void-600);

  --text-strong:    var(--paper-100);
  --text-body:      var(--paper-200);
  --text-muted:     var(--fg-muted);
  --text-faint:     var(--fg-faint);
  --text-on-ember:  #2A0A00;

  --border-subtle:  var(--void-500);
  --border-strong:  var(--void-400);
  --border-focus:   var(--ember-500);

  --accent:         var(--ember-500);
  --accent-hover:   var(--ember-300);
  --accent-press:   var(--ember-600);
  --accent-soft:    color-mix(in oklab, var(--ember-500) 16%, var(--void-900));

  /* Body-text links. On the void, ember-500 is ~4.9:1 (AA). Light theme darkens it (see below). */
  --link:           var(--accent);
  --link-hover:     var(--accent-hover);

  --alive:          var(--phosphor-500);
  --symbol:         var(--quanta-500);

  --success:        var(--phosphor-500);
  --warning:        var(--amber-500);
  --info:           var(--sky-500);
  --danger:         var(--crimson-500);

  --grid-line:      color-mix(in oklab, var(--fg-ghost) 60%, transparent);
}

/* ── Light theme: "daylight nihilism" — paper & ink, ember still burns ── */
[data-theme="light"] {
  --bg-base:        #F4F3EF;
  --bg-sunken:      #E9E8E2;
  --bg-raised:      #FBFAF7;
  --surface-card:   #FFFFFF;
  --surface-inset:  #EFEEE8;
  --surface-hover:  #EFEEE8;

  --text-strong:    #16161C;
  --text-body:      #2E2E38;
  --text-muted:     #5E5E6C;
  --text-faint:     #6B6A75;  /* darkened from #908F9A to clear WCAG AA on paper (~4.8:1) */
  --text-on-ember:  #2A0A00;

  --border-subtle:  #DAD8D0;
  --border-strong:  #C2BFB5;

  --accent-soft:    color-mix(in oklab, var(--ember-500) 12%, #FFFFFF);
  --grid-line:      color-mix(in oklab, #16161C 8%, transparent);

  /* ember-500 on paper is only ~3.1:1; ember-700 is ~5.6:1 (AA) for link text */
  --link:           var(--ember-700);
  --link-hover:     var(--ember-600);
}

/* QUINE — Typography tokens
 * Mono-forward: IBM Plex Mono is the default voice. Sans for dense reading,
 * Space Grotesk for display, Plex Serif for philosophy.
 */
:root {
  /* ── Families ─────────────────────────────────────────────────────── */
  --font-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --font-sans:    'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'IBM Plex Sans', system-ui, sans-serif;
  --font-serif:   'IBM Plex Serif', Georgia, 'Times New Roman', serif;

  /* ── Type scale (1.25 major-third, 16px root) ─────────────────────── */
  --text-2xs:  0.6875rem; /* 11 — micro labels, legend */
  --text-xs:   0.75rem;   /* 12 — captions, code annotations */
  --text-sm:   0.875rem;  /* 14 — secondary UI */
  --text-base: 1rem;      /* 16 — body */
  --text-md:   1.125rem;  /* 18 — lead body */
  --text-lg:   1.375rem;  /* 22 */
  --text-xl:   1.75rem;   /* 28 */
  --text-2xl:  2.25rem;   /* 36 */
  --text-3xl:  3rem;      /* 48 */
  --text-4xl:  4rem;      /* 64 */
  --text-5xl:  5.5rem;    /* 88 — hero display */

  /* ── Weights ──────────────────────────────────────────────────────── */
  --weight-light:   300;
  --weight-regular: 400;
  --weight-medium:  500;
  --weight-semibold:600;
  --weight-bold:    700;

  /* ── Line heights ─────────────────────────────────────────────────── */
  --leading-tight:  1.05;
  --leading-snug:   1.2;
  --leading-normal: 1.5;
  --leading-relaxed:1.7;

  /* ── Tracking — mono runs tight; display runs tighter ─────────────── */
  --tracking-tight:   -0.02em;
  --tracking-normal:  0;
  --tracking-wide:    0.04em;
  --tracking-caps:    0.12em;  /* the signature: wide-tracked mono uppercase labels */
}

/* QUINE — Spacing & sizing tokens. 4px base grid — the engineering ruler. */
:root {
  --space-0:   0;
  --space-1:   0.25rem;  /* 4 */
  --space-2:   0.5rem;   /* 8 */
  --space-3:   0.75rem;  /* 12 */
  --space-4:   1rem;     /* 16 */
  --space-5:   1.5rem;   /* 24 */
  --space-6:   2rem;     /* 32 */
  --space-7:   3rem;     /* 48 */
  --space-8:   4rem;     /* 64 */
  --space-9:   6rem;     /* 96 */
  --space-10:  8rem;     /* 128 */

  /* Layout */
  --container:    1200px;
  --container-sm: 720px;
  --gutter:       var(--space-5);
  --control-h:    2.25rem;  /* 36 — default control height */
  --control-h-sm: 1.75rem;  /* 28 */
  --control-h-lg: 2.75rem;  /* 44 — min touch target */
}

/* QUINE — Effects: radii, borders, shadows, glows, blur.
 * Engineered & sharp. Small radii. Shadows are subtle in the void; the
 * signature lift is a colored GLOW, not a soft drop shadow.
 */
:root {
  /* ── Radii — kept tight; this is precision instrumentation ────────── */
  --radius-xs:   2px;
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-lg:   10px;
  --radius-xl:   16px;
  --radius-full: 9999px;

  /* ── Border widths ────────────────────────────────────────────────── */
  --border-hair: 1px;
  --border-bold: 2px;

  /* ── Elevation in the void — restrained, cool ─────────────────────── */
  --shadow-1: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-2: 0 4px 14px rgba(0,0,0,0.45);
  --shadow-3: 0 18px 48px rgba(0,0,0,0.55);

  /* ── Glows — the optimistic light source. Use on accent/alive items ─ */
  --glow-ember:    0 0 0 1px color-mix(in oklab, var(--ember-500) 50%, transparent),
                   0 6px 28px color-mix(in oklab, var(--ember-500) 32%, transparent);
  --glow-phosphor: 0 0 0 1px color-mix(in oklab, var(--phosphor-500) 45%, transparent),
                   0 6px 26px color-mix(in oklab, var(--phosphor-500) 28%, transparent);

  /* ── Focus ring — ember, always 2px, always offset ────────────────── */
  --ring: 0 0 0 2px var(--bg-base), 0 0 0 4px var(--ember-500);

  /* ── Blur (glass over the void) ───────────────────────────────────── */
  --blur-glass: saturate(1.1) blur(14px); /* @kind other */

  /* ── The blueprint grid: a reusable background for engineered panels ─ */
  --bg-grid: linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 100% 24px,
             linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 24px 100%;
}

/* QUINE — Motion. Crisp and deterministic, with one optimistic spring.
 * Nihilist precision; optimist bounce — reserved for confirmations.
 * Durations and easings are uncategorized tokens (@kind other).
 */
:root {
  /* durations */
  --dur-instant: 80ms; /* @kind other */
  --dur-fast: 140ms; /* @kind other */
  --dur-normal: 220ms; /* @kind other */
  --dur-slow: 360ms; /* @kind other */

  /* easings */
  --ease-out: cubic-bezier(0.20, 0.80, 0.20, 1.00); /* @kind other */
  --ease-in-out: cubic-bezier(0.65, 0.00, 0.35, 1.00); /* @kind other */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1.00); /* @kind other */
  --ease-linear: linear; /* @kind other */
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-instant: 0ms; /* @kind other */
    --dur-fast: 0ms; /* @kind other */
    --dur-normal: 0ms; /* @kind other */
    --dur-slow: 0ms; /* @kind other */
  }
}

/* QUINE — Base layer: light reset, element defaults, and a few signature
 * utility classes that express the brand voice. Built entirely on tokens.
 */

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

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

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text-strong);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-4);
}

p { margin: 0 0 var(--space-4); }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

::selection { background: var(--ember-500); color: var(--text-on-ember); }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

::placeholder { color: var(--text-faint); }

hr { border: none; border-top: var(--border-hair) solid var(--border-subtle); margin: var(--space-5) 0; }

/* ── Signature utilities ──────────────────────────────────────────────
 * The wide-tracked mono uppercase label is the brand's connective tissue:
 * section eyebrows, table headers, status chips. */
.q-label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--text-muted);
}

/* Blueprint grid background for "engineered" panels */
.q-blueprint { background-image: var(--bg-grid); }

/* The comment-prompt prefix used in headings/eyebrows, e.g. "// fixed point" */
.q-comment { color: var(--text-faint); font-family: var(--font-mono); }
.q-comment::before { content: "// "; color: var(--accent); }

/* A blinking terminal cursor */
.q-cursor::after {
  content: "▌";
  color: var(--accent);
  animation: q-blink 1.1s steps(1) infinite;
  margin-left: 0.05em;
}
@keyframes q-blink { 50% { opacity: 0; } }

/* QUINE — Layer 2 · DS component classes (verbatim from dhilipsiva.dev/static/assets/quine.css).
   .q-btn / .q-badge / .q-card / .q-callout / .q-field / .q-input / .q-tabs — the React components in components/ render these exact classes. */
/* Button -------------------------------------------------------------------*/
.q-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  height: var(--control-h); /* --sm / --lg override the height below (source used a private --_h var; flattened for the token compiler) */
  padding: 0 var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: 0.02em;
  line-height: 1;
  border: var(--border-hair) solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.q-btn:active { transform: translateY(1px); }
.q-btn:disabled, .q-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.q-btn--sm { height: var(--control-h-sm); font-size: var(--text-xs); padding: 0 var(--space-3); }
.q-btn--lg { height: var(--control-h-lg); font-size: var(--text-base); padding: 0 var(--space-5); }
.q-btn--block { display: flex; width: 100%; }
.q-btn--primary { background: var(--accent); color: var(--text-on-ember); }
.q-btn--primary:hover { background: var(--accent-hover); box-shadow: var(--glow-ember); color: var(--text-on-ember); }
.q-btn--primary:active { background: var(--accent-press); }
.q-btn--secondary { background: transparent; color: var(--text-strong); border-color: var(--border-strong); }
.q-btn--secondary:hover { background: var(--surface-hover); border-color: var(--accent); color: var(--accent-hover); }
.q-btn--ghost { background: transparent; color: var(--text-muted); }
.q-btn--ghost:hover { background: var(--surface-hover); color: var(--text-strong); }
.q-btn--danger { background: transparent; color: var(--danger); border-color: color-mix(in oklab, var(--danger) 45%, transparent); }
.q-btn--danger:hover { background: color-mix(in oklab, var(--danger) 14%, transparent); border-color: var(--danger); }

/* Badge --------------------------------------------------------------------*/
.q-badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  height: 1.4rem; padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  border: var(--border-hair) solid transparent;
  white-space: nowrap;
}
.q-badge__dot { width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; }
.q-badge--neutral { color: var(--text-muted); background: var(--surface-inset); border-color: var(--border-subtle); }
.q-badge--ember   { color: var(--ember-300); background: color-mix(in oklab, var(--ember-500) 16%, transparent); border-color: color-mix(in oklab, var(--ember-500) 35%, transparent); }
.q-badge--alive   { color: var(--phosphor-300); background: color-mix(in oklab, var(--phosphor-500) 14%, transparent); border-color: color-mix(in oklab, var(--phosphor-500) 32%, transparent); }
.q-badge--symbol  { color: var(--quanta-300); background: color-mix(in oklab, var(--quanta-500) 16%, transparent); border-color: color-mix(in oklab, var(--quanta-500) 35%, transparent); }
.q-badge--warning { color: var(--amber-500); background: color-mix(in oklab, var(--amber-500) 14%, transparent); border-color: color-mix(in oklab, var(--amber-500) 32%, transparent); }
.q-badge--danger  { color: var(--crimson-500); background: color-mix(in oklab, var(--crimson-500) 14%, transparent); border-color: color-mix(in oklab, var(--crimson-500) 32%, transparent); }
.q-badge--solid   { color: var(--text-on-ember); background: var(--accent); border-color: transparent; }

/* Card ---------------------------------------------------------------------*/
.q-card {
  background: var(--surface-card);
  border: var(--border-hair) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-body);
  overflow: clip;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.q-card--pad { padding: var(--space-5); }
.q-card--inset { background: var(--surface-inset); }
.q-card--grid { background-image: var(--bg-grid); background-color: var(--surface-card); }
.q-card--interactive { cursor: pointer; }
.q-card--interactive:hover { border-color: var(--accent); box-shadow: var(--shadow-2); }
.q-card--glow:hover { box-shadow: var(--glow-ember); border-color: transparent; }
.q-card--marked { border-top: var(--border-bold) solid var(--accent); }
.q-card__header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: var(--border-hair) solid var(--border-subtle); }
.q-card__title { font-family: var(--font-display); font-weight: var(--weight-semibold); color: var(--text-strong); font-size: var(--text-md); margin: 0; }
.q-card__body { padding: var(--space-5); }
.q-card__footer { padding: var(--space-4) var(--space-5); border-top: var(--border-hair) solid var(--border-subtle); display: flex; align-items: center; gap: var(--space-3); }

/* Callout ------------------------------------------------------------------*/
.q-callout {
  display: flex; gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: var(--border-hair) solid var(--border-subtle);
  border-left-width: 3px;
  background: var(--surface-inset);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-body);
}
.q-callout__glyph { font-family: var(--font-mono); font-size: var(--text-md); line-height: 1.2; flex: none; }
.q-callout__body { min-width: 0; }
.q-callout__title { font-family: var(--font-mono); font-weight: var(--weight-semibold); color: var(--text-strong); margin: 0 0 var(--space-1); letter-spacing: 0.01em; }
.q-callout--note    { border-left-color: var(--info); }
.q-callout--note .q-callout__glyph { color: var(--info); }
.q-callout--ok      { border-left-color: var(--success); }
.q-callout--ok .q-callout__glyph { color: var(--success); }
.q-callout--warn    { border-left-color: var(--warning); }
.q-callout--warn .q-callout__glyph { color: var(--warning); }
.q-callout--error   { border-left-color: var(--danger); }
.q-callout--error .q-callout__glyph { color: var(--danger); }
.q-callout--theorem { border-left-color: var(--symbol); background: color-mix(in oklab, var(--quanta-500) 8%, var(--surface-inset)); }
.q-callout--theorem .q-callout__glyph { color: var(--quanta-300); }

/* Input / field ------------------------------------------------------------*/
.q-field { display: flex; flex-direction: column; gap: var(--space-2); }
.q-field__label { font-family: var(--font-mono); font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-muted); }
.q-field__hint { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-faint); }
.q-field__hint--error { color: var(--danger); }
.q-input-wrap { position: relative; display: flex; align-items: center; }
.q-input-wrap__affix { position: absolute; color: var(--text-faint); font-family: var(--font-mono); font-size: var(--text-sm); pointer-events: none; }
.q-input-wrap__affix--lead { left: var(--space-3); }
.q-input {
  width: 100%;
  height: var(--control-h);
  padding: 0 var(--space-3);
  background: var(--surface-inset);
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  border: var(--border-hair) solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.q-input:hover:not(:disabled) { border-color: var(--border-strong); }
.q-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.q-input::placeholder { color: var(--text-faint); }
.q-input:disabled { opacity: 0.5; cursor: not-allowed; }
.q-input--lead { padding-left: calc(var(--space-3) * 2 + 0.8em); }
.q-input--error { border-color: var(--danger); }
.q-input--error:focus { box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 22%, transparent); }
textarea.q-input { height: auto; padding: var(--space-3); line-height: var(--leading-normal); resize: vertical; }

/* Tabs ---------------------------------------------------------------------*/
.q-tabs { display: flex; gap: 2px; border-bottom: var(--border-hair) solid var(--border-subtle); }
.q-tab {
  position: relative;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: 0.01em;
  color: var(--text-muted);
  background: none; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--space-2);
  transition: color var(--dur-fast) var(--ease-out);
  text-decoration: none;
}
.q-tab:hover { color: var(--text-strong); }
.q-tab[aria-selected="true"] { color: var(--text-strong); }
.q-tab__underline {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px 2px 0 0;
  transform: scaleX(0); transform-origin: center;
  transition: transform var(--dur-normal) var(--ease-out);
}
.q-tab[aria-selected="true"] .q-tab__underline { transform: scaleX(1); }
.q-tab__count { font-size: var(--text-2xs); color: var(--text-faint); }

/* QUINE — Layer 3 · dhilipsiva.dev site composition (verbatim from static/assets/quine.css).
   Header / nav / footer / hero / project cards / post lists / prose / terminal — the class vocabulary the UI kit renders. */
:root { --site-max: 1120px; --read-max: 720px; }

body { background: var(--bg-base); color: var(--text-body); }

.container { max-width: var(--site-max); margin: 0 auto; padding: 0 28px; }
.container--read { max-width: var(--read-max); }

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

.eyebrow { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.comment { color: var(--text-faint); font-family: var(--font-mono); }
.comment::before { content: "// "; color: var(--accent); }

/* Skip link ---------------------------------------------------------------*/
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--accent); color: var(--text-on-ember); padding: 8px 14px; font-family: var(--font-mono); font-size: 13px; border-radius: var(--radius-sm); }
.skip-link:focus { left: 12px; top: 12px; color: var(--text-on-ember); }

/* ── Header / nav ─────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in oklab, var(--bg-base) 82%, transparent);
  backdrop-filter: var(--blur-glass);
}
.site-header__inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -0.03em; color: var(--text-strong); }
.brand:hover { color: var(--text-strong); }
.brand img { width: 26px; height: 26px; display: block; }
.brand__dot { color: var(--accent); }
.nav { display: flex; gap: 2px; margin-left: 6px; flex-wrap: wrap; }
.nav__link { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); padding: 6px 9px; border-radius: var(--radius-sm); white-space: nowrap; }
.nav__link:hover { color: var(--text-strong); background: var(--surface-hover); }
.nav__link[aria-current="page"] { color: var(--text-strong); }
.nav__link[aria-current="page"]::before { content: "› "; color: var(--accent); }
/* the live demos — marked with a phosphor pulse so they read as the marquee items */
.nav__link--live { color: var(--text-strong); display: inline-flex; align-items: center; gap: 6px; }
.nav__dot { width: 6px; height: 6px; border-radius: var(--radius-full); background: var(--alive); box-shadow: 0 0 6px color-mix(in oklab, var(--alive) 70%, transparent); flex: none; }
.header-spacer { flex: 1; }
.header-tools { display: flex; align-items: center; gap: 6px; }

/* theme toggle + icon button */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-md);
  background: transparent; border: 1px solid var(--border-subtle);
  color: var(--text-muted); cursor: pointer; padding: 0;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.icon-btn:hover { color: var(--text-strong); border-color: var(--accent); }
.icon-btn svg { width: 17px; height: 17px; }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="light"] .theme-toggle .sun { display: block; }
[data-theme="light"] .theme-toggle .moon { display: none; }

/* mobile nav — pure CSS checkbox toggle, no JS required */
.nav-switch { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle { display: none; }
.nav-toggle .x { display: none; }
.nav-switch:checked ~ .site-header__inner .nav-toggle .x { display: block; }
.nav-switch:checked ~ .site-header__inner .nav-toggle .bars { display: none; }
@media (max-width: 860px) {
  .nav { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-switch:checked ~ .site-header__inner .nav {
    display: flex; flex-direction: column; gap: 0;
    position: absolute; left: 0; right: 0; top: 64px;
    background: var(--bg-raised); border-bottom: 1px solid var(--border-subtle);
    padding: 8px 28px 16px; margin: 0; max-height: calc(100vh - 64px); overflow-y: auto;
  }
  .nav-switch:checked ~ .site-header__inner .nav .nav__link { padding: 12px 4px; font-size: 15px; border-bottom: 1px solid var(--border-subtle); border-radius: 0; }
}

/* ── Footer ───────────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border-subtle); margin-top: var(--space-10); }
.site-footer__top { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; padding: 56px 0 40px; }
.site-footer__brand .brand { margin-bottom: 14px; }
.site-footer__tag { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); max-width: 34ch; line-height: 1.6; }
.foot-col h4 { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-faint); margin: 0 0 14px; }
.foot-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.foot-col a { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.foot-col a:hover { color: var(--accent-hover); }
.site-footer__bottom { display: flex; align-items: center; gap: 14px; padding: 18px 0 36px; border-top: 1px solid var(--border-subtle); font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); flex-wrap: wrap; }
.site-footer__bottom .sp { flex: 1; }
.social-row { display: flex; align-items: center; gap: 8px; }
.social-row a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle); color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.social-row a:hover { color: var(--accent); border-color: var(--accent); }
.social-row svg { width: 16px; height: 16px; }
@media (max-width: 720px) { .site-footer__top { grid-template-columns: 1fr 1fr; } .site-footer__brand { grid-column: 1 / -1; } }

/* ── Section header ───────────────────────────────────────────────────── */
.section { padding: 72px 0; }
.section--tight { padding: 48px 0; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.sec-head__main { max-width: 60ch; }
.sec-head__title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-2xl); letter-spacing: -0.03em; color: var(--text-strong); margin: 10px 0 0; }
.sec-head__intro { font-family: var(--font-sans); font-size: 15px; color: var(--text-muted); margin: 12px 0 0; line-height: 1.6; }
.see-all { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.see-all:hover { color: var(--accent-hover); }

/* ── Tag / pill ───────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: var(--text-2xs);
  letter-spacing: 0.03em; color: var(--text-muted);
  height: 1.35rem; padding: 0 8px;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  background: var(--surface-inset); white-space: nowrap;
}
.pill:hover { border-color: var(--accent); color: var(--accent-hover); }
.pill--active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.pill__hash { color: var(--text-faint); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Project card ─────────────────────────────────────────────────────── */
.proj-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.proj-grid--3 { grid-template-columns: repeat(3, 1fr); }
.proj-card { display: flex; flex-direction: column; padding: var(--space-5); height: 100%; }
.proj-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.proj-card__glyph { font-family: var(--font-mono); font-size: 22px; color: var(--accent); line-height: 1; }
.proj-card__title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-md); color: var(--text-strong); margin: 0 0 6px; letter-spacing: -0.01em; }
.proj-card__desc { font-family: var(--font-sans); font-size: 14px; color: var(--text-muted); line-height: 1.55; margin: 0 0 16px; flex: 1; }
.proj-card__meta { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); margin-bottom: 14px; letter-spacing: 0.02em; }
.proj-card__role { color: var(--text-muted); }
.proj-card__tags { margin-bottom: 16px; }
.proj-card__links { display: flex; gap: 14px; font-family: var(--font-mono); font-size: 12px; padding-top: 14px; border-top: 1px solid var(--border-subtle); }
.proj-card__links a { color: var(--text-muted); display: inline-flex; align-items: center; gap: 5px; }
.proj-card__links a:hover { color: var(--accent-hover); }
.proj-card__links svg { width: 13px; height: 13px; }
@media (max-width: 760px) { .proj-grid, .proj-grid--3 { grid-template-columns: 1fr; } }

/* ── Post-list item ───────────────────────────────────────────────────── */
.post-list { display: flex; flex-direction: column; }
.post-item { display: grid; grid-template-columns: 120px 1fr; gap: 28px; padding: 26px 0; border-top: 1px solid var(--border-subtle); }
.post-item:last-child { border-bottom: 1px solid var(--border-subtle); }
.post-item__date { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); letter-spacing: 0.02em; padding-top: 4px; }
.post-item__date b { display: block; color: var(--text-muted); font-weight: 500; }
.post-item__title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); color: var(--text-strong); letter-spacing: -0.02em; margin: 0 0 8px; line-height: 1.2; }
.post-item__title a { color: inherit; }
.post-item__title a:hover { color: var(--accent-hover); }
.post-item__excerpt { font-family: var(--font-sans); font-size: 14.5px; color: var(--text-muted); line-height: 1.6; margin: 0 0 14px; max-width: 64ch; }
.post-item__foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.post-item__rt { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); letter-spacing: 0.03em; }
.post-item--pinned { background: linear-gradient(90deg, var(--accent-soft), transparent 60%); margin: 0 -20px; padding-left: 20px; padding-right: 20px; border-radius: var(--radius-md); border-top-color: transparent; }
.post-item--pinned .pin-flag { color: var(--accent); }
@media (max-width: 640px) { .post-item { grid-template-columns: 1fr; gap: 10px; } .post-item__date { padding-top: 0; } }

/* ── Compact teaser (home latest) ─────────────────────────────────────── */
.teaser { display: block; padding: 18px 0; border-top: 1px solid var(--border-subtle); }
.teaser:last-child { border-bottom: 1px solid var(--border-subtle); }
.teaser__row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.teaser__title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-md); color: var(--text-strong); margin: 0; letter-spacing: -0.01em; }
.teaser:hover .teaser__title { color: var(--accent-hover); }
.teaser__date { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); white-space: nowrap; }
.teaser__excerpt { font-family: var(--font-sans); font-size: 14px; color: var(--text-muted); margin: 8px 0 0; line-height: 1.55; max-width: 70ch; }

/* ── Terminal window ──────────────────────────────────────────────────── */
.term { background: var(--void-1000); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); overflow: hidden; }
[data-theme="light"] .term { background: #14141b; }
.term__bar { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--border-subtle); }
.term__dot { width: 11px; height: 11px; border-radius: 50%; }
.term__title { margin-left: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }
.term__body { padding: 18px 20px; font-family: var(--font-mono); font-size: 13.5px; line-height: 1.8; overflow-x: auto; color: #C9C8C2; }
.term__body .c-prompt { color: var(--phosphor-500); }
.term__body .c-key { color: var(--ember-300); }
.term__body .c-fn { color: var(--sky-500); }
.term__body .c-str { color: var(--phosphor-300); }
.term__body .c-num { color: var(--phosphor-300); }
.term__body .c-com { color: var(--text-faint); }
.term__body .c-type { color: var(--quanta-300); }
.term__body .c-pun { color: var(--text-muted); }
.term__body .c-out { color: #908F9A; }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero { position: relative; padding: 88px 0 64px; overflow: hidden; }
.hero__grid { position: absolute; inset: 0; background-image: var(--bg-grid); opacity: 0.5; mask-image: radial-gradient(ellipse 80% 70% at 28% 0%, #000 30%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse 80% 70% at 28% 0%, #000 30%, transparent 75%); pointer-events: none; }
.hero__inner { position: relative; display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 52px; align-items: center; }
.hero__eyebrow { display: inline-flex; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 22px; }
.hero h1 { font-family: var(--font-display); font-weight: 600; font-size: 56px; line-height: 1.04; letter-spacing: -0.035em; color: var(--text-strong); margin: 0 0 22px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero__tagline { font-family: var(--font-serif); font-style: italic; font-size: 19px; line-height: 1.5; color: var(--text-body); max-width: 46ch; margin: 0 0 18px; border-left: 2px solid var(--accent); padding-left: 16px; }
.hero__intro { font-family: var(--font-sans); font-size: 16px; line-height: 1.6; color: var(--text-muted); max-width: 48ch; margin: 0 0 28px; }
@media (max-width: 900px) { .hero__inner { grid-template-columns: 1fr; gap: 36px; } .hero h1 { font-size: 42px; } }

/* ── Hero menu (the panel of doors — replaced the terminal mock) ──────── */
.hero__menu { background: var(--surface-card); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); overflow: hidden; }
.hero__menu-note { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-bottom: 1px solid var(--border-subtle); font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.03em; color: var(--phosphor-300); background: color-mix(in oklab, var(--phosphor-500) 7%, transparent); }
.hero__menu-item { display: flex; align-items: center; gap: 16px; padding: 17px 20px; border-bottom: 1px solid var(--border-subtle); transition: background var(--dur-fast) var(--ease-out); }
.hero__menu-item:last-child { border-bottom: 0; }
.hero__menu-item:hover { background: var(--surface-hover); }
.hero__menu-glyph { font-family: var(--font-mono); font-size: 17px; color: var(--accent); width: 24px; text-align: center; flex: none; }
.hero__menu-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hero__menu-label { font-family: var(--font-display); font-weight: 600; font-size: var(--text-md); color: var(--text-strong); letter-spacing: -0.01em; }
.hero__menu-item:hover .hero__menu-label { color: var(--accent-hover); }
.hero__menu-desc { font-family: var(--font-sans); font-size: 13px; color: var(--text-muted); line-height: 1.4; }
.hero__menu-arrow { margin-left: auto; font-family: var(--font-mono); font-size: 15px; color: var(--text-faint); opacity: 0; transform: translateX(-4px); transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); flex: none; }
.hero__menu-item:hover .hero__menu-arrow { opacity: 1; transform: none; color: var(--accent); }

/* ── Now teaser strip ─────────────────────────────────────────────────── */
.now-strip { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; padding: var(--space-5); }
.now-strip__items { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.now-strip__item { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.now-strip__item b { color: var(--text-strong); font-weight: 500; }
.now-strip__item .k { color: var(--accent); }
@media (max-width: 720px) { .now-strip { grid-template-columns: 1fr; gap: 14px; } }

/* ── Featured book ────────────────────────────────────────────────────── */
.feat-book { display: grid; grid-template-columns: 168px 1fr; gap: 28px; align-items: center; padding: var(--space-6); }
.feat-book__cover { width: 168px; height: 240px; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border-strong); }
.feat-book__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.feat-book__title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); color: var(--text-strong); letter-spacing: -0.02em; margin: 12px 0 10px; }
.feat-book__blurb { font-family: var(--font-sans); font-size: 15px; color: var(--text-muted); line-height: 1.6; margin: 0 0 18px; max-width: 50ch; }
@media (max-width: 640px) { .feat-book { grid-template-columns: 1fr; justify-items: start; } }

/* ── Book card ────────────────────────────────────────────────────────── */
.book-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.book-card { display: grid; grid-template-columns: 96px 1fr; gap: 18px; padding: var(--space-5); }
.book-card__cover { width: 96px; height: 138px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-strong); }
.book-card__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-card__title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-md); color: var(--text-strong); margin: 8px 0 4px; }
.book-card__author { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); margin: 0 0 10px; }
.book-card__note { font-family: var(--font-sans); font-size: 13.5px; color: var(--text-muted); line-height: 1.55; margin: 0; }
@media (max-width: 760px) { .book-grid { grid-template-columns: 1fr; } }

/* ── Featured strip (home projects) ───────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border-subtle); margin: 0; }

/* ── Breadcrumb ───────────────────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); padding: 20px 0 0; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent-hover); }
.breadcrumb .sep { color: var(--text-faint); }

/* ── Long-form prose (single musing / book review) ────────────────────── */
.prose { font-family: var(--font-sans); font-size: 18px; line-height: var(--leading-relaxed); color: var(--text-body); }
.prose > * + * { margin-top: 1.4em; }
.prose p { margin: 0; }
.prose h2 { font-family: var(--font-display); font-weight: 600; font-size: 28px; letter-spacing: -0.02em; color: var(--text-strong); margin: 1.8em 0 0; line-height: 1.2; }
.prose h3 { font-family: var(--font-display); font-weight: 600; font-size: 21px; letter-spacing: -0.01em; color: var(--text-strong); margin: 1.6em 0 0; }
.prose h4 { font-family: var(--font-mono); font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin: 1.5em 0 0; }
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in oklab, var(--accent) 45%, transparent); }
.prose strong { color: var(--text-strong); font-weight: 600; }
.prose em { font-style: italic; }
.prose ul, .prose ol { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 0.5em; }
.prose li { padding-left: 0.2em; }
.prose li::marker { color: var(--accent); font-family: var(--font-mono); }
.prose blockquote { margin: 0; padding: 4px 0 4px 22px; border-left: 2px solid var(--accent); font-family: var(--font-serif); font-style: italic; font-size: 21px; line-height: 1.5; color: var(--text-body); }
.prose blockquote cite { display: block; margin-top: 10px; font-family: var(--font-mono); font-style: normal; font-size: 12px; color: var(--text-faint); }
.prose code { font-family: var(--font-mono); font-size: 0.84em; background: var(--surface-inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-xs); padding: 1px 6px; color: var(--ember-300); }
.prose :is(h2,h3) code, .prose pre code { background: none; border: none; padding: 0; color: inherit; }
.prose pre { background: var(--void-1000); border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 18px 20px; overflow-x: auto; font-size: 14px; line-height: 1.75; }
[data-theme="light"] .prose pre { background: #14141b; }
.prose pre code { font-family: var(--font-mono); color: #C9C8C2; }
.prose pre .c-key { color: var(--ember-300); } .prose pre .c-fn { color: var(--sky-500); } .prose pre .c-str { color: var(--phosphor-300); } .prose pre .c-num { color: var(--phosphor-300); } .prose pre .c-com { color: var(--text-faint); } .prose pre .c-type { color: var(--quanta-300); } .prose pre .c-pun { color: var(--text-muted); }
.prose figure { margin: 0; }
.prose figure img, .prose figure .fig-slot { width: 100%; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); display: block; }
.prose figcaption { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); margin-top: 10px; text-align: center; }
.prose hr { border: none; border-top: 1px solid var(--border-subtle); margin: 2.4em 0; }
.prose :lang(ta), .prose .tamil { font-size: 1.04em; line-height: 1.95; }
.footnotes { margin-top: 3em; padding-top: 1.5em; border-top: 1px solid var(--border-subtle); font-family: var(--font-sans); font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.footnotes ol { padding-left: 1.4em; display: flex; flex-direction: column; gap: 0.6em; }
.fn-ref { font-size: 0.7em; vertical-align: super; color: var(--accent); font-family: var(--font-mono); text-decoration: none; padding: 0 1px; }

/* ── Image / cover placeholder slots ──────────────────────────────────── */
.img-slot {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-inset) var(--bg-grid);
  color: var(--text-faint); font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.04em; text-align: center; padding: 16px;
  border: 1px dashed var(--border-strong);
}

/* ── Article header (single musing) ───────────────────────────────────── */
.article-head { padding: 8px 0 36px; }
.article-head__meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); margin-bottom: 18px; }
.article-head h1 { font-family: var(--font-display); font-weight: 600; font-size: 46px; line-height: 1.08; letter-spacing: -0.035em; color: var(--text-strong); margin: 0 0 18px; max-width: 20ch; }
.article-head__tags { margin-top: 18px; }
@media (max-width: 640px) { .article-head h1 { font-size: 34px; } }

/* article footer / prev-next */
.article-foot { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--border-subtle); }
.prev-next { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.pn-card { display: block; padding: 18px 20px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--surface-card); transition: border-color var(--dur-fast) var(--ease-out); }
.pn-card:hover { border-color: var(--accent); }
.pn-card__dir { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); letter-spacing: 0.06em; text-transform: uppercase; }
.pn-card__title { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--text-strong); margin-top: 6px; }
.pn-card--next { text-align: right; }
@media (max-width: 640px) { .prev-next { grid-template-columns: 1fr; } .pn-card--next { text-align: left; } }

/* utility */
.stack-2 { display: flex; flex-direction: column; gap: 8px; }
.stack-3 { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.lead { font-family: var(--font-sans); font-size: 18px; line-height: 1.6; color: var(--text-muted); }
