/* ==========================================================================
   awonaziz.github.io — stylesheet v2
   Design system: "instrument panel" — a control room for systems that watch
   other systems. Dark by default. Three signal colours carry real meaning
   (held / flagged / signal); nothing glows without a reason.
   ========================================================================== */

/* ---------------------------------------------------------------- tokens -- */

:root {
  color-scheme: dark;

  /* surfaces — near-black with a deliberate cool green-black undertone,
     not a flat #0B0B0B */
  --void:       #0a0f0d;
  --panel:      #0f1815;
  --panel-2:    #121e1a;
  --panel-deep: #080c0b;

  /* strokes */
  --line:       #1e2b26;   /* decorative hairlines only */
  --stroke:     #546d64;   /* informational strokes — meets 3:1 */

  /* ink */
  --ink:        #eef4f0;
  --ink-2:      #a9bab1;
  --ink-3:      #85988f;

  /* signal — three accents, three meanings. Never decorative alone. */
  --held:       #3ee08c;   /* healthy / passing / current champion */
  --held-soft:  #0f2a1e;
  --flagged:    #ff9d5c;   /* a finding / a failing source / a limitation */
  --flagged-soft:#2e1c10;
  --signal:     #4fe0d4;   /* interactive — links, focus, palette, cursor glow */
  --signal-soft:#0e2b28;

  /* type */
  --display: "Space Grotesk", "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body:    "Inter", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono:    "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  /* rhythm */
  --gap:      1.5rem;
  --band:     clamp(3.5rem, 8vw, 7rem);
  --measure:  66ch;
  --shell:    min(100% - 2.5rem, 69rem);
  --rail:     13rem;

  --ease:     cubic-bezier(0.22, 0.68, 0.32, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light override — reachable via the theme toggle. Dark is the identity;
   light is a courtesy for anyone who wants it. */
:root[data-theme="light"] {
  color-scheme: light;
  --void:       #eef1ec;
  --panel:      #f6f7f3;
  --panel-2:    #e4e8e0;
  --panel-deep: #dde2d9;
  --line:       #ccd2c6;
  --stroke:     #6c7c72;
  --ink:        #131c19;
  --ink-2:      #46564e;
  --ink-3:      #57685e;
  --held:       #1b764b;
  --held-soft:  #d9ecdf;
  --flagged:    #a8451c;
  --flagged-soft:#f1e0d3;
  --signal:     #06746a;
  --signal-soft:#dcf0ec;
}

/* ------------------------------------------------------------------ base -- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.2rem;
}

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

body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* film grain — static texture, not motion. Gives the dark surface depth
   instead of the flat plastic look of an unbroken near-black. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="light"] body::before { opacity: 0.025; mix-blend-mode: multiply; }

p { margin: 0 0 1.05em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.08;
  margin: 0;
  text-wrap: balance;
}

a { color: inherit; }

a.lk {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--stroke), var(--stroke));
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.2s var(--ease), color 0.2s var(--ease);
  padding-bottom: 1px;
}
a.lk:hover, a.lk:focus-visible {
  color: var(--signal);
  background-image: linear-gradient(var(--signal), var(--signal));
  background-size: 100% 1px;
}

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

code, kbd, samp, .mono {
  font-family: var(--mono);
  font-size: 0.85em;
  font-variant-ligatures: none;
}

code:not(pre code) {
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 0.1em 0.34em;
  border-radius: 2px;
  color: var(--ink-2);
}

kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.5em; padding: 0.1em 0.4em;
  background: var(--panel-2); border: 1px solid var(--stroke);
  border-bottom-width: 2px; border-radius: 3px;
  font-size: 0.76em; color: var(--ink-2); line-height: 1.6;
}

hr { border: 0; border-top: 1px solid var(--line); margin: 0; }

img, svg { max-width: 100%; }

::selection { background: var(--signal); color: var(--panel-deep); }

/* thin console-style scrollbar, not the default chunky one */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: var(--panel-2); border: 2px solid var(--void); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--stroke); }
html { scrollbar-width: thin; scrollbar-color: var(--panel-2) var(--void); }

/* a single, deliberate pulse — reserved for the one thing on the page that
   is genuinely live. Not a utility class; not used elsewhere. */
.pulse-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--held); flex: none;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--held) 60%, transparent);
  animation: pulse-dot 2.2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--held) 45%, transparent); }
  50%      { box-shadow: 0 0 0 5px color-mix(in srgb, var(--held) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .pulse-dot { animation: none; } }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  background: var(--ink); color: var(--void);
  padding: 0.7rem 1.1rem; font-family: var(--display); font-size: 0.9rem;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

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

/* -------------------------------------------------------- scroll progress -- */
/* Answers the reader's own scrolling — not attention-seeking motion. */

.progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: var(--signal);
  box-shadow: 0 0 8px 0 color-mix(in srgb, var(--signal) 70%, transparent);
  z-index: 60;
  transition: width 0.12s linear;
}
@media (prefers-reduced-motion: reduce) { .progress { transition: none; } }

/* ----------------------------------------------------------------- shell -- */

.shell { width: var(--shell); margin-inline: auto; }

.rows { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); gap: 0 3rem; }
.rail { grid-column: 1; }
.col  { grid-column: 2; min-width: 0; }

.rail-label {
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-3);
  position: sticky;
  top: 5.2rem;
  margin: 0;
  line-height: 1.35;
}
.rail-label span { display: block; color: var(--ink-3); font-weight: 400; margin-top: 0.3rem; }

@media (max-width: 62rem) {
  .rows { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .rail, .col { grid-column: 1; }
  .rail-label { position: static; margin-bottom: 1rem; }
}

/* ---------------------------------------------------------------- header -- */

.top {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--void) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-in {
  width: var(--shell); margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; height: 3.6rem;
}
.mark {
  font-family: var(--display); font-weight: 600;
  font-size: 0.98rem; letter-spacing: -0.005em; text-decoration: none; color: var(--ink);
  display: inline-flex; align-items: baseline; gap: 0.5rem;
}
.mark i {
  font-style: normal; font-weight: 400;
  color: var(--ink-3); font-size: 0.8rem;
}
nav.top-nav { display: flex; gap: 1.1rem; align-items: center; }
nav.top-nav a {
  font-family: var(--display); font-size: 0.86rem; font-weight: 500;
  text-decoration: none; color: var(--ink-2);
  transition: color 0.18s var(--ease);
}
nav.top-nav a:hover, nav.top-nav a:focus-visible, nav.top-nav a[aria-current] { color: var(--ink); }
nav.top-nav a[aria-current] { box-shadow: 0 1px 0 var(--signal); }

.icon-btn {
  font-family: var(--display); font-size: 0.8rem; font-weight: 500;
  background: none; border: 1px solid var(--stroke); color: var(--ink-2);
  padding: 0.3rem 0.6rem; border-radius: 3px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), background 0.18s var(--ease);
}
.icon-btn:hover, .icon-btn:focus-visible { color: var(--ink); border-color: var(--signal); background: var(--signal-soft); }
.icon-btn kbd { padding: 0 0.32em; font-size: 0.7rem; min-width: 1.2em; white-space: nowrap; }

@media (max-width: 40rem) {
  .mark i { display: none; }
}
@media (max-width: 34rem) {
  nav.top-nav { gap: 0.65rem; }
  nav.top-nav a { font-size: 0.82rem; }
  /* About and GitHub stay one tap away in the command palette and the
     footer; Work is the one link worth keeping in a crowded header */
  nav.top-nav a:nth-of-type(2), nav.top-nav a:nth-of-type(3) { display: none; }
  [data-cmdk-open] span.lbl { display: none; }
  .icon-btn { padding: 0.3rem 0.5rem; }
}

/* ---------------------------------------------------------- command palette -- */

.cmdk-veil {
  position: fixed; inset: 0; z-index: 200;
  background: color-mix(in srgb, var(--panel-deep) 72%, transparent);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 1.25rem 2rem;
  opacity: 0;
  transition: opacity 0.16s var(--ease);
}
.cmdk-veil.is-open { opacity: 1; }
.cmdk-veil[hidden] { display: none; }

.cmdk {
  width: min(100%, 34rem);
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 4px;
  box-shadow: 0 20px 60px -10px rgba(0,0,0,0.55), 0 0 0 1px color-mix(in srgb, var(--signal) 12%, transparent);
  transform: translateY(-10px) scale(0.98);
  transition: transform 0.18s var(--ease-out);
  overflow: hidden;
}
:root[data-theme="light"] .cmdk {
  box-shadow: 0 20px 44px -14px rgba(20, 30, 26, 0.22), 0 0 0 1px color-mix(in srgb, var(--signal) 14%, transparent);
}
.cmdk-veil.is-open .cmdk { transform: none; }

.cmdk-input-row {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
}
.cmdk-input-row svg { flex: none; color: var(--ink-3); }
.cmdk-input-row input {
  flex: 1; min-width: 0;
  background: none; border: 0; outline: 0;
  font-family: var(--body); font-size: 1rem; color: var(--ink);
}
.cmdk-input-row input::placeholder { color: var(--ink-3); }
.cmdk-close {
  flex: none; background: none; border: 0; color: var(--ink-3);
  font-family: var(--mono); font-size: 0.72rem;
  cursor: pointer; padding: 0.2rem 0.4rem;
}
.cmdk-close:hover, .cmdk-close:focus-visible { color: var(--ink); }

.cmdk-list { max-height: 60vh; overflow-y: auto; padding: 0.5rem; }
.cmdk-group-label {
  font-family: var(--display); font-size: 0.72rem; font-weight: 600;
  color: var(--ink-3); padding: 0.6rem 0.6rem 0.3rem;
}
.cmdk-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  width: 100%; text-align: left;
  padding: 0.6rem 0.65rem;
  border: 0; border-radius: 3px; background: none;
  font-family: var(--body); font-size: 0.92rem; color: var(--ink-2);
  cursor: pointer;
}
.cmdk-item .t { color: var(--ink); }
.cmdk-item .d { display: block; font-size: 0.78rem; color: var(--ink-3); margin-top: 0.1rem; }
.cmdk-item .h { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3); flex: none; }
.cmdk-item[data-active="true"] {
  background: var(--signal-soft);
  box-shadow: inset 2px 0 0 var(--signal);
}
.cmdk-item[data-active="true"] .t { color: var(--signal); }
.cmdk-empty { padding: 1.4rem 0.65rem; color: var(--ink-3); font-size: 0.9rem; }

.cmdk-foot {
  display: flex; gap: 1rem; align-items: center;
  padding: 0.6rem 1rem; border-top: 1px solid var(--line);
  font-family: var(--display); font-size: 0.72rem; color: var(--ink-3);
}
.cmdk-foot span { display: inline-flex; align-items: center; gap: 0.35rem; }

/* --------------------------------------------------------------- reveal -- */

[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  transition-delay: calc(var(--stagger, 0) * 70ms);
}
[data-reveal="fade"] { transform: none; }
[data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* one-time page-load entrance for the hero only */
.acquire { opacity: 0; animation: acquire 0.55s var(--ease) forwards; }
.acquire[data-d="1"] { animation-delay: 0.05s; }
.acquire[data-d="2"] { animation-delay: 0.16s; }
.acquire[data-d="3"] { animation-delay: 0.27s; }
@keyframes acquire { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .acquire { opacity: 1; animation: none; } }

/* ------------------------------------------------------------------ hero -- */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(3rem, 8vw, 6.5rem) 0 clamp(2.5rem, 5vw, 4rem);
}

/* ambient drift — two soft signal-coloured fields, barely perceptible,
   moving on a 40s cycle. This is the one non-triggered motion on the page
   that exists purely to set atmosphere. */
.hero::before {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: -1;
  background:
    radial-gradient(38rem 24rem at 14% 8%,  color-mix(in srgb, var(--signal) 13%, transparent), transparent 65%),
    radial-gradient(30rem 22rem at 82% 32%, color-mix(in srgb, var(--held) 9%, transparent), transparent 68%),
    linear-gradient(color-mix(in srgb, var(--stroke) 20%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--stroke) 20%, transparent) 1px, transparent 1px);
  background-size: auto, auto, 42px 42px, 42px 42px;
  mask-image: radial-gradient(60% 55% at 30% 20%, black, transparent 75%);
  animation: drift 44s ease-in-out infinite alternate;
}
:root[data-theme="light"] .hero::before {
  background:
    radial-gradient(38rem 24rem at 14% 8%,  color-mix(in srgb, var(--signal) 7%, transparent), transparent 65%),
    radial-gradient(30rem 22rem at 82% 32%, color-mix(in srgb, var(--held) 6%, transparent), transparent 68%),
    linear-gradient(color-mix(in srgb, var(--stroke) 14%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--stroke) 14%, transparent) 1px, transparent 1px);
  background-size: auto, auto, 42px 42px, 42px 42px;
}
@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-3%, 2%) scale(1.06); }
}
@media (prefers-reduced-motion: reduce) { .hero::before { animation: none; } }

.hero h1 {
  font-size: clamp(2.35rem, 6.2vw, 4.9rem);
  line-height: 1.03;
  letter-spacing: -0.02em;
  max-width: 20ch;
  margin-bottom: 1.6rem;
}
.hero h1 em {
  display: block;
  font-style: normal;
  font-weight: 500;
  color: var(--ink-2);
}

.hero-sub {
  font-size: clamp(1.02rem, 1.5vw, 1.18rem);
  color: var(--ink-2);
  max-width: 54ch;
  margin-bottom: 2.4rem;
}
.hero-sub strong { color: var(--ink); font-weight: 600; }

.hero-meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; max-width: none;
  font-family: var(--display); font-size: 0.84rem; color: var(--ink-3);
  margin-top: 1.7rem;
}

/* ---------------------------------------------------- live status readout -- */

.readout {
  position: relative;
  border: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(6px);
  border-radius: 3px;
  max-width: 44rem;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--signal) 8%, transparent),
              0 30px 60px -20px rgba(0,0,0,0.5);
  overflow: hidden;
}
:root[data-theme="light"] .readout {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--signal) 10%, transparent),
              0 16px 32px -18px rgba(20, 30, 26, 0.18);
}
/* corner reticle — two opposing brackets, console-bezel motif */
.readout::before {
  content: "";
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(var(--signal), var(--signal)) no-repeat 0 0 / 14px 2px,
    linear-gradient(var(--signal), var(--signal)) no-repeat 0 0 / 2px 14px,
    linear-gradient(var(--signal), var(--signal)) no-repeat 100% 100% / 14px 2px,
    linear-gradient(var(--signal), var(--signal)) no-repeat 100% 100% / 2px 14px;
  opacity: 0.55;
}
/* scanline sweep — slow, faint, purely atmospheric */
.readout::after {
  content: "";
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--signal) 10%, transparent) 50%, transparent);
  background-size: 100% 260%;
  background-position: 0 -160%;
  animation: scan 6s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .readout::after { animation: none; opacity: 0; } }
@keyframes scan { to { background-position: 0 100%; } }

.readout-top {
  position: relative; z-index: 3;
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.8rem; flex-wrap: wrap;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.readout-title {
  font-family: var(--display); font-size: 0.83rem; font-weight: 600; color: var(--ink);
}
.readout-title a { text-decoration: none; }
.readout-title a:hover { color: var(--signal); }
.readout-when { font-family: var(--mono); font-size: 0.74rem; color: var(--ink-3); }

.readout-grid {
  position: relative; z-index: 3;
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}
.readout-cell { padding: 0.9rem 1.1rem; border-right: 1px solid var(--line); }
.readout-cell:last-child { border-right: 0; }
.readout-n {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.5rem, 3.4vw, 2.05rem); line-height: 1;
  letter-spacing: -0.015em; display: block;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.readout-n .sl { color: var(--ink-3); font-weight: 400; padding: 0 0.05em; }
.readout-k {
  font-family: var(--display); font-size: 0.755rem; color: var(--ink-3);
  display: block; margin-top: 0.42rem; line-height: 1.3;
}

.sources { position: relative; z-index: 3; padding: 0.85rem 1.1rem 0.95rem; }
.sources-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 0.65rem; }
.src {
  width: 13px; height: 13px; border-radius: 1px;
  background: var(--held);
  box-shadow: 0 0 6px 0 color-mix(in srgb, var(--held) 55%, transparent);
  transition: transform 0.15s var(--ease);
}
.src[data-ok="false"] { background: var(--flagged); box-shadow: 0 0 6px 0 color-mix(in srgb, var(--flagged) 55%, transparent); }
.src[data-ok="pending"] { background: var(--stroke); box-shadow: none; }
.src:hover { transform: scale(1.35); }
.sources-note { font-size: 0.8rem; color: var(--ink-3); line-height: 1.45; max-width: 46ch; }
.sources-note b { color: var(--ink-2); font-weight: 600; }

.readout[data-state="stale"] .readout-when { color: var(--flagged); }

@media (max-width: 30rem) {
  .readout-grid { grid-template-columns: 1fr 1fr; }
  .readout-cell:nth-child(2) { border-right: 0; }
  .readout-cell:nth-child(3) { border-top: 1px solid var(--line); grid-column: 1 / -1; }
}

/* ------------------------------------------------------------------ band -- */

.band { padding: var(--band) 0; border-top: 1px solid var(--line); }
.band-head { margin-bottom: 2.6rem; }
.band-head h2 {
  font-size: clamp(1.45rem, 3.1vw, 2.15rem);
  margin-bottom: 0.8rem;
}
.band-head p { color: var(--ink-2); max-width: 58ch; }

/* ------------------------------------------------------------- work entry -- */

.entry {
  position: relative;
  border-top: 1px solid var(--line);
  padding: 2.4rem 1.25rem;
  margin-inline: -1.25rem;
  border-radius: 4px;
  transition: background 0.3s var(--ease);
}
.entry:first-of-type { border-top: 1px solid var(--stroke); }
.entry::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 4px;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--signal) 7%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}
.entry:hover::before, .entry:focus-within::before { opacity: 1; }
.entry:hover, .entry:focus-within { background: color-mix(in srgb, var(--panel) 55%, transparent); }

.entry-grid { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 2rem; align-items: start; position: relative; z-index: 1; }
@media (max-width: 58rem) { .entry-grid { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; } }

.entry h3 {
  font-size: clamp(1.32rem, 2.6vw, 1.85rem);
  margin-bottom: 0.55rem;
}
.entry h3 a { text-decoration: none; }
.entry h3 a:hover, .entry h3 a:focus-visible { color: var(--signal); }

.entry-kicker {
  font-family: var(--display); font-size: 0.78rem; font-weight: 500;
  color: var(--ink-3); margin-bottom: 0.85rem; display: flex; gap: 0.75rem; flex-wrap: wrap;
  max-width: none;
}
.entry-kicker b { color: var(--held); font-weight: 600; }
.entry-kicker b[data-kind="wip"] { color: var(--ink-2); }

.entry-what { color: var(--ink-2); margin-bottom: 1.1rem; }

.finding {
  border-left: 3px solid var(--flagged);
  background: var(--flagged-soft);
  padding: 0.85rem 1.05rem;
  margin: 0 0 1.2rem;
  max-width: var(--measure);
  border-radius: 0 3px 3px 0;
}
.finding-k {
  font-family: var(--display); font-size: 0.73rem; font-weight: 600;
  color: var(--flagged); display: block; margin-bottom: 0.35rem;
}
.finding p { font-size: 0.95rem; margin: 0; color: var(--ink); }

.stackline {
  font-family: var(--mono); font-size: 0.755rem; color: var(--ink-3);
  line-height: 1.75; word-spacing: 0.1em;
}

.entry-links { display: flex; gap: 1.3rem; flex-wrap: wrap; margin-top: 1.2rem; font-family: var(--display); font-size: 0.87rem; }
.entry-links a { text-decoration: none; font-weight: 500; box-shadow: 0 1px 0 var(--stroke); padding-bottom: 2px; transition: box-shadow 0.18s var(--ease), color 0.18s var(--ease); }
.entry-links a:hover, .entry-links a:focus-visible { color: var(--signal); box-shadow: 0 1px 0 var(--signal); }

.fig {
  position: relative;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 4px;
  padding: 1rem;
}
.fig svg { display: block; width: 100%; height: auto; }
.fig figcaption {
  font-size: 0.78rem; color: var(--ink-3); margin-top: 0.8rem;
  line-height: 1.5; font-family: var(--display);
}

/* ---------------------------------------------------------------- tables -- */

.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.archive {
  width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 38rem;
}
table.archive th {
  text-align: left; font-family: var(--display); font-size: 0.76rem; font-weight: 600;
  color: var(--ink-3); padding: 0 0.9rem 0.6rem 0; border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}
table.archive td {
  padding: 0.72rem 0.9rem 0.72rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
  color: var(--ink-2);
}
table.archive td:first-child { color: var(--ink); font-weight: 600; font-family: var(--display); font-size: 0.92rem; }
table.archive td.num { font-family: var(--mono); font-size: 0.78rem; white-space: nowrap; color: var(--ink-3); }
table.archive tr { transition: background 0.2s var(--ease); }
table.archive tr:hover td { background: var(--panel); }
table.archive td a { text-decoration: none; box-shadow: 0 1px 0 var(--stroke); }
table.archive td a:hover { color: var(--signal); box-shadow: 0 1px 0 var(--signal); }

/* ------------------------------------------------------------- case study -- */

.case-head { position: relative; isolation: isolate; overflow: hidden; padding: clamp(2.5rem, 6vw, 4.5rem) 0 2.5rem; }
.case-head::before {
  content: "";
  position: absolute; inset: -20%; z-index: -1;
  background: radial-gradient(34rem 20rem at 10% 0%, color-mix(in srgb, var(--signal) 10%, transparent), transparent 65%);
}
.back {
  font-family: var(--display); font-size: 0.83rem; color: var(--ink-3);
  text-decoration: none; display: inline-block; margin-bottom: 2rem;
  transition: color 0.18s var(--ease);
}
.back::before { content: "← "; }
.back:hover, .back:focus-visible { color: var(--signal); }

.case-head h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: -0.02em;
  max-width: 19ch; margin-bottom: 1.2rem;
}
.case-dek { font-size: clamp(1.02rem, 1.6vw, 1.15rem); color: var(--ink-2); max-width: 56ch; }

.factbar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  border: 1px solid var(--stroke); border-radius: 4px;
  margin-top: 2.4rem; background: var(--panel);
}
.fact { padding: 0.85rem 1rem; border-right: 1px solid var(--line); }
.fact:last-child { border-right: 0; }
.fact dt { font-family: var(--display); font-size: 0.73rem; color: var(--ink-3); margin-bottom: 0.3rem; }
.fact dd {
  margin: 0; font-family: var(--display); font-weight: 600; font-size: 0.98rem;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
@media (max-width: 40rem) { .fact { border-right: 0; border-bottom: 1px solid var(--line); } .fact:last-child { border-bottom: 0; } }

.sec { border-top: 1px solid var(--line); padding: clamp(2.5rem, 5vw, 4rem) 0; }
.sec h2 {
  font-size: clamp(1.28rem, 2.4vw, 1.7rem); margin-bottom: 1.3rem;
}
.sec h3 {
  font-size: 1.04rem; margin: 2rem 0 0.5rem;
}
.sec h3:first-child { margin-top: 0; }

.prose { max-width: var(--measure); }
.prose > * + h3 { margin-top: 2.2rem; }

ul.plain { list-style: none; padding: 0; margin: 0 0 1.1rem; max-width: var(--measure); }
ul.plain li { padding-left: 1.25rem; position: relative; margin-bottom: 0.62rem; }
ul.plain li::before {
  content: ""; position: absolute; left: 0; top: 0.66em;
  width: 7px; height: 7px; background: var(--stroke); border-radius: 1px;
}
ul.plain li[data-mark="ok"]::before { background: var(--held); box-shadow: 0 0 5px 0 color-mix(in srgb, var(--held) 60%, transparent); }
ul.plain li[data-mark="flag"]::before { background: var(--flagged); box-shadow: 0 0 5px 0 color-mix(in srgb, var(--flagged) 60%, transparent); }

.dec { border-top: 1px solid var(--line); padding: 1.5rem 0; }
.dec:first-of-type { border-top: 1px solid var(--stroke); }
.dec h3 { margin: 0 0 0.6rem; font-size: 1.06rem; }
.dec p { font-size: 0.99rem; }
.dec .cost {
  font-size: 0.9rem; color: var(--ink-2); margin-top: 0.7rem;
  padding-left: 0.85rem; border-left: 2px solid var(--stroke);
}
.dec .cost b { font-family: var(--display); font-weight: 600; color: var(--ink); font-size: 0.85rem; }

pre {
  background: var(--panel-deep); border: 1px solid var(--line);
  border-radius: 4px; padding: 0.9rem 1rem; overflow-x: auto;
  font-family: var(--mono); font-size: 0.79rem; line-height: 1.65;
  color: var(--ink-2); margin: 0 0 1.1rem;
}

.callout {
  border: 1px solid var(--stroke); border-left: 3px solid var(--signal);
  background: var(--panel); padding: 1rem 1.15rem; border-radius: 0 4px 4px 0;
  max-width: var(--measure); margin: 0 0 1.2rem;
}
.callout p { font-size: 0.95rem; }
.callout-k { font-family: var(--display); font-size: 0.74rem; font-weight: 600; color: var(--ink-3); display: block; margin-bottom: 0.4rem; }

/* --------------------------------------------------------- drift explorer -- */

.drift { border: 1px solid var(--stroke); background: var(--panel); border-radius: 4px; }
.drift-head {
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap;
}
.drift-head span { font-family: var(--display); font-size: 0.82rem; font-weight: 600; }
.drift-head em { font-style: normal; font-family: var(--mono); font-size: 0.73rem; color: var(--flagged); }
.drift-rows { padding: 0.4rem 0; }
.drift-row {
  display: grid; grid-template-columns: 6.2rem 1fr 5.6rem;
  gap: 0.75rem; align-items: center; padding: 0.42rem 1rem;
}
.drift-row b { font-family: var(--mono); font-size: 0.75rem; font-weight: 400; color: var(--ink-2); }
.drift-bar { height: 10px; background: var(--panel-deep); border-radius: 1px; position: relative; }
.drift-bar i {
  display: block; height: 100%; background: var(--flagged);
  box-shadow: 0 0 8px 0 color-mix(in srgb, var(--flagged) 45%, transparent);
  border-radius: 1px;
  transform-origin: left; transform: scaleX(0);
  transition: transform 0.85s var(--ease-out);
  transition-delay: calc(var(--stagger, 0) * 90ms);
}
.drift-bar i.is-in { transform: scaleX(1); }
.drift-bar i[data-sev="none"] { background: var(--held); box-shadow: 0 0 8px 0 color-mix(in srgb, var(--held) 45%, transparent); }
.drift-bar i[data-sev="mod"] {
  background: repeating-linear-gradient(
    135deg,
    var(--flagged) 0 3px,
    color-mix(in srgb, var(--flagged) 45%, var(--panel-deep)) 3px 6px
  );
  box-shadow: none;
}
.drift-bar::after {
  content: ""; position: absolute; top: -3px; bottom: -3px; left: 14.1%;
  width: 1px; background: var(--ink-3); opacity: 0.85;
}
.drift-row u {
  text-decoration: none; font-family: var(--mono); font-size: 0.73rem;
  color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums;
}
.drift-foot {
  border-top: 1px solid var(--line); padding: 0.7rem 1rem; max-width: none;
  font-size: 0.8rem; color: var(--ink-3); font-family: var(--display); line-height: 1.5;
}
.drift-foot mark { background: none; color: var(--flagged); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .drift-bar i { transform: scaleX(1) !important; transition: none !important; }
}

@media (max-width: 30rem) {
  .drift-row { grid-template-columns: 4.8rem 1fr 4.2rem; gap: 0.5rem; padding: 0.42rem 0.7rem; }
  .drift-row b, .drift-row u { font-size: 0.68rem; }
}

/* ---------------------------------------------------------------- footer -- */

.foot { border-top: 1px solid var(--stroke); padding: 3rem 0 3.5rem; }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; align-items: start; }
@media (max-width: 44rem) { .foot-grid { grid-template-columns: 1fr; } }
.foot h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin-bottom: 0.9rem; }
.foot p:not(.colophon) { color: var(--ink-2); max-width: 46ch; }
.foot-links { display: flex; flex-direction: column; gap: 0.5rem; font-family: var(--display); font-size: 0.9rem; }
.foot-links a { text-decoration: none; color: var(--ink-2); transition: color 0.18s var(--ease); }
.foot-links a:hover, .foot-links a:focus-visible { color: var(--signal); }
.colophon {
  max-width: none;
  margin-top: 2.6rem; padding-top: 1.2rem; border-top: 1px solid var(--line);
  font-size: 0.79rem; color: var(--ink-3); font-family: var(--display);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}

/* ------------------------------------------------------------ SVG figures -- */

.dia-box { fill: var(--panel-2); stroke: var(--stroke); stroke-width: 1; }
.dia-box-2 { fill: var(--panel-deep); stroke: var(--stroke); stroke-width: 1; }
.dia-box-flag { fill: var(--flagged-soft); stroke: var(--flagged); stroke-width: 1; }
.dia-box-ok { fill: var(--held-soft); stroke: var(--held); stroke-width: 1; }
.dia-t { font-family: var(--display); font-size: 11px; font-weight: 600; fill: var(--ink); }
.dia-s { font-family: var(--mono); font-size: 10px; fill: var(--ink-3); }
.dia-line { stroke: var(--stroke); stroke-width: 1; fill: none; }
.dia-line-flag { stroke: var(--flagged); stroke-width: 1.4; fill: none; }
.dia-line-dash { stroke: var(--stroke); stroke-width: 1; fill: none; stroke-dasharray: 3 3; }
.dia-arrow { fill: var(--stroke); }
.dia-arrow-flag { fill: var(--flagged); }

/* draw-on-scroll. JS sets dasharray/dashoffset=length on load (the very
   first style a path ever gets, so nothing animates yet), then sets
   dashoffset=0 on intersection — a genuine later change, so this transition,
   present from the start, fires correctly. Boxes/text follow the same
   principle with a plain .is-in class instead of dash math. */
.fig svg .dia-line,
.fig svg .dia-line-flag {
  transition: stroke-dashoffset 0.9s var(--ease-out);
  transition-delay: calc(var(--stagger, 0) * 70ms);
}
.fig svg .dia-box,
.fig svg .dia-box-2,
.fig svg .dia-box-flag,
.fig svg .dia-box-ok {
  opacity: 0; transform: scale(0.94); transform-origin: center;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  transition-delay: calc(var(--stagger, 0) * 45ms);
}
.fig svg .dia-t,
.fig svg .dia-s {
  opacity: 0; transition: opacity 0.4s var(--ease);
  transition-delay: calc(var(--stagger, 0) * 45ms + 80ms);
}
.fig svg.is-in .dia-box,
.fig svg.is-in .dia-box-2,
.fig svg.is-in .dia-box-flag,
.fig svg.is-in .dia-box-ok { opacity: 1; transform: none; }
.fig svg.is-in .dia-t,
.fig svg.is-in .dia-s { opacity: 1; }
/* if JS never runs (or a path can't report its length), nothing should be
   permanently invisible — the no-motion state below is also the no-JS state */
.fig svg:not(.js-draw) .dia-box, .fig svg:not(.js-draw) .dia-box-2,
.fig svg:not(.js-draw) .dia-box-flag, .fig svg:not(.js-draw) .dia-box-ok,
.fig svg:not(.js-draw) .dia-t, .fig svg:not(.js-draw) .dia-s { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .fig svg .dia-line, .fig svg .dia-line-flag,
  .fig svg .dia-box, .fig svg .dia-box-2,
  .fig svg .dia-box-flag, .fig svg .dia-box-ok,
  .fig svg .dia-t, .fig svg .dia-s {
    opacity: 1 !important; transform: none !important; transition: none !important;
    stroke-dashoffset: 0 !important;
  }
}
