@charset "UTF-8";
/* ==========================================================================
   alexmerced.blog design system
   Layers: tokens → reset → typography → layout → components → utilities
   ========================================================================== */

/* --- Tokens: type, space, radii, motion ---------------------------------- */
:root {
  color-scheme: light;

  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Source Serif 4', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --font-ui: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Fluid type scale (1.0625rem → 1.1875rem base, ~1.24 ratio) */
  --step--2: clamp(0.75rem, 0.73rem + 0.10vw, 0.8125rem);
  --step--1: clamp(0.875rem, 0.85rem + 0.12vw, 0.9375rem);
  --step-0:  clamp(1.0625rem, 1.02rem + 0.22vw, 1.1875rem);
  --step-1:  clamp(1.25rem, 1.18rem + 0.34vw, 1.4375rem);
  --step-2:  clamp(1.5rem, 1.37rem + 0.62vw, 1.875rem);
  --step-3:  clamp(1.8125rem, 1.58rem + 1.10vw, 2.5rem);
  --step-4:  clamp(2.125rem, 1.72rem + 1.95vw, 3.25rem);
  --step-5:  clamp(2.5rem, 1.85rem + 3.10vw, 4.25rem);

  /* Spacing (0.5rem base, geometric) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --measure: 68ch;
  --measure-wide: 78ch;
  --w-shell: 72rem;
  --w-article: 48rem;

  --dur-fast: 140ms;
  --dur: 240ms;
  --dur-slow: 620ms;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --grain: 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='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");

  /* Brand badge keeps the same saturated gradient in both themes. */
  --mark-from: #0B5563;
  --mark-to: #7A2707;

  /* Code surface is intentionally dark in both themes for stable contrast. */
  --code-bg: #0F141C;
  --code-bg-header: #131A24;
  --code-rule: rgba(201, 212, 227, 0.16);
  --code-text: #C9D4E3;
  --code-comment: #7E8DA3;
  --code-keyword: #F2A0BE;
  --code-string: #8FDCA8;
  --code-number: #F5C173;
  --code-title: #7FD1E8;
  --code-type: #F0C987;
  --code-variable: #F5A05F;
  --code-punct: #9BA6B5;

  /* --- Colour: light (default) --- */

      --bg: #F7F4EE;
      --bg-tint: #F1ECE3;
      --surface: #FFFFFF;
      --surface-2: #FBF9F5;
      --ink: #161A22;
      --ink-soft: #333B49;
      --ink-muted: #5B6472;
      --brand: #0B5563;
      --brand-hover: #073B45;
      --brand-soft: rgba(11, 85, 99, 0.09);
      --accent: #C2410C;
      --accent-text: #A6350A;
      --accent-soft: rgba(194, 65, 12, 0.10);
      --rule: rgba(22, 26, 34, 0.12);
      --rule-strong: rgba(22, 26, 34, 0.22);
      --shadow-1: 0 1px 2px rgba(22, 26, 34, 0.05), 0 2px 8px rgba(22, 26, 34, 0.04);
      --shadow-2: 0 2px 4px rgba(22, 26, 34, 0.06), 0 12px 28px rgba(22, 26, 34, 0.09);
      --selection: rgba(194, 65, 12, 0.20);
}

/* Follow the OS unless the reader has made an explicit choice. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

      --bg: #0D1117;
      --bg-tint: #111823;
      --surface: #151B24;
      --surface-2: #1A2230;
      --ink: #E9E6E0;
      --ink-soft: #C7CEDA;
      --ink-muted: #9BA6B5;
      --brand: #5FD4DA;
      --brand-hover: #8FE6EA;
      --brand-soft: rgba(95, 212, 218, 0.12);
      --accent: #F5A05F;
      --accent-text: #F5A05F;
      --accent-soft: rgba(245, 160, 95, 0.14);
      --rule: rgba(233, 230, 224, 0.14);
      --rule-strong: rgba(233, 230, 224, 0.26);
      --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.35);
      --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.55), 0 16px 36px rgba(0, 0, 0, 0.45);
      --selection: rgba(95, 212, 218, 0.26);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;

      --bg: #0D1117;
      --bg-tint: #111823;
      --surface: #151B24;
      --surface-2: #1A2230;
      --ink: #E9E6E0;
      --ink-soft: #C7CEDA;
      --ink-muted: #9BA6B5;
      --brand: #5FD4DA;
      --brand-hover: #8FE6EA;
      --brand-soft: rgba(95, 212, 218, 0.12);
      --accent: #F5A05F;
      --accent-text: #F5A05F;
      --accent-soft: rgba(245, 160, 95, 0.14);
      --rule: rgba(233, 230, 224, 0.14);
      --rule-strong: rgba(233, 230, 224, 0.26);
      --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.35);
      --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.55), 0 16px 36px rgba(0, 0, 0, 0.45);
      --selection: rgba(95, 212, 218, 0.26);
}
:root[data-theme="light"] { color-scheme: light; }

/* --- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}
body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.72;
  font-optical-sizing: auto;
  color: var(--ink);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
img, picture, svg, video, canvas { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--selection); }
:where(a) { color: var(--brand); }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
:where(button, a):focus-visible { outline-color: var(--accent); }

/* --- Typography ---------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); letter-spacing: -0.028em; line-height: 1.06; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
strong, b { font-weight: 600; }

.eyebrow {
  font-family: var(--font-ui);
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.lede {
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--ink-soft);
  text-wrap: pretty;
}
.dot {
  display: inline-block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  margin: 0 0.6em;
  vertical-align: 0.22em;
}

/* --- Layout -------------------------------------------------------------- */
.shell {
  width: 100%;
  max-width: var(--w-shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
main { display: block; flex: 1 0 auto; }
.page { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.page--tight { padding-block: clamp(2rem, 4vw, 3rem); }
.page__back { margin-top: var(--space-7); }

.skip-link {
  position: absolute;
  left: var(--space-4); top: var(--space-2);
  z-index: 200;
  transform: translateY(-160%);
  background: var(--brand);
  color: var(--bg);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 600;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* --- Reading progress ---------------------------------------------------- */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 120;
  background: transparent;
  pointer-events: none;
}
.progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 90ms linear;
}

/* --- Masthead ------------------------------------------------------------ */
.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.masthead.is-stuck {
  border-bottom-color: var(--rule);
  box-shadow: 0 6px 24px -18px rgba(0,0,0,0.5);
}
.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 4.25rem;
  padding-block: 0.75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  line-height: 1.15;
  border-radius: var(--radius-sm);
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 2.1rem; height: 2.1rem;
  flex: 0 0 auto;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--mark-from), var(--mark-to));
  color: #FFFFFF;
  font-size: 0.9rem;
  letter-spacing: 0;
  box-shadow: var(--shadow-1);
}
.brand__text { max-width: 22ch; }
.brand__short { display: none; }
.brand:hover .brand__text, .brand:hover .brand__short { color: var(--brand); }
/* The full site title is too tall for a sticky mobile bar; use the wordmark. */
@media (max-width: 40rem) {
  .brand__text { display: none; }
  .brand__short { display: inline; }
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-ui);
}
.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2.75rem;
  padding: 0 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.nav__link:hover { color: var(--brand); background: var(--brand-soft); }
.nav__link sup { font-size: 0.7em; opacity: 0.65; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 2.75rem; height: 2.75rem;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.icon-btn:hover { color: var(--brand); background: var(--brand-soft); border-color: var(--rule); }
.icon-btn svg { width: 1.15rem; height: 1.15rem; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav__cta { margin-left: 0.35rem; }
#menu-btn { display: none; }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.875rem;
  padding: 0.6rem 1.25rem;
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.btn--primary { background: var(--brand); color: var(--bg); box-shadow: var(--shadow-1); }
.btn--primary:hover { background: var(--brand-hover); color: var(--bg); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn--ghost:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.btn-support { /* legacy hook kept for safety */ }

/* --- Hero (home) --------------------------------------------------------- */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(3rem, 8vw, 6rem) clamp(2.5rem, 6vw, 4.5rem);
  background:
    radial-gradient(120% 90% at 8% 0%, var(--brand-soft), transparent 60%),
    radial-gradient(90% 80% at 95% 10%, var(--accent-soft), transparent 62%),
    linear-gradient(180deg, var(--bg-tint), var(--bg));
  border-bottom: 1px solid var(--rule);
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  z-index: -2;
  background-image: var(--grain);
  background-size: 140px 140px;
  opacity: 0.035;
  mix-blend-mode: multiply;
}
:root[data-theme="dark"] .hero::before { mix-blend-mode: screen; opacity: 0.05; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero::before { mix-blend-mode: screen; opacity: 0.05; }
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand), var(--accent), transparent);
  opacity: 0.55;
}
.hero__inner {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
}
@media (min-width: 62rem) {
  .hero__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
/* Art and stats share the aside so a wide, short banner does not leave the
   column half empty next to a tall headline. */
.hero__aside { display: grid; gap: var(--space-6); align-content: center; }
.hero__aside .hero__stats { margin-top: 0; }
.hero__title {
  font-size: var(--step-5);
  margin-top: var(--space-4);
  font-weight: 800;
}
.hero__title em {
  font-style: italic;
  color: var(--brand);
}
.hero__lede {
  margin-top: var(--space-5);
  max-width: 46ch;
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--ink-soft);
  text-wrap: pretty;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}
.hero__art {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-2);
  transform: rotate(-0.6deg);
}
/* --hero-ratio is set inline from the source image's intrinsic size, so art of
   any shape is shown uncropped. */
.hero__art img { width: 100%; aspect-ratio: var(--hero-ratio, 3 / 2); object-fit: cover; }
.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5) var(--space-7);
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--rule);
  font-family: var(--font-ui);
}
.hero__stat b {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.hero__stat span { font-size: var(--step--1); color: var(--ink-muted); }

/* --- Page head band (blog index, tags, generic pages) -------------------- */
.page-head {
  position: relative;
  overflow: hidden;
  padding-block: clamp(2.75rem, 6vw, 4.5rem);
  background:
    radial-gradient(110% 140% at 0% 0%, var(--brand-soft), transparent 55%),
    linear-gradient(180deg, var(--bg-tint), var(--bg));
  border-bottom: 1px solid var(--rule);
}
.page-head__inner { max-width: 46rem; }
.page-head h1 { margin-top: var(--space-3); }
.page-head .lede { margin-top: var(--space-4); max-width: 46ch; }

/* --- Post header --------------------------------------------------------- */
.post-head {
  position: relative;
  overflow: hidden;
  padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(2rem, 4vw, 3rem);
  background:
    radial-gradient(100% 120% at 100% 0%, var(--accent-soft), transparent 58%),
    radial-gradient(90% 110% at 0% 10%, var(--brand-soft), transparent 55%),
    linear-gradient(180deg, var(--bg-tint), var(--bg));
  border-bottom: 1px solid var(--rule);
}
/* Shares the prose measure so the header and body copy sit on the same axis,
   while the title itself is allowed to run a little wider. */
.post-head__inner {
  max-width: var(--measure);
  margin-inline: auto;
}
.post-head h1 {
  margin-top: var(--space-4);
  max-width: calc(var(--measure) + 7rem);
}
.byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: var(--space-5);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  color: var(--ink-muted);
}
.byline a { color: var(--ink-soft); text-decoration-color: var(--rule-strong); }
.byline a:hover { color: var(--brand); }
.byline__author { font-weight: 600; color: var(--ink-soft); }

/* --- Chips / tags -------------------------------------------------------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0.2rem 0.7rem;
  font-family: var(--font-ui);
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-muted);
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.chip:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.chips--head { margin-top: var(--space-2); }

/* --- Long-form prose ----------------------------------------------------- */
.prose {
  max-width: var(--measure);
  margin-inline: auto;
  overflow-wrap: break-word;
  hyphens: none;
}
/* Left-aligned variant, used where prose sits under a left-aligned hero. */
.prose--flush { margin-inline: 0; }
.prose > * + * { margin-top: 1.35em; }
.prose p { text-wrap: pretty; }
.prose h2 {
  margin-top: 2.6em;
  padding-top: 0.2em;
  font-size: var(--step-2);
}
.prose h3 { margin-top: 2.1em; font-size: var(--step-1); }
.prose h4 { margin-top: 1.9em; font-size: var(--step-0); font-family: var(--font-ui); font-weight: 700; letter-spacing: 0.01em; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 0.85em; }
.prose h2::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 2px;
  margin-top: 0.5em;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

/* Lead-in treatment, applied at build time only to a genuine opening paragraph. */
.prose .lead-in {
  font-size: 1.16em;
  line-height: 1.62;
  color: var(--ink-soft);
}
.prose .lead-in::first-letter {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.32em;
  color: var(--brand);
}

.prose a {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in srgb, var(--brand) 45%, transparent);
  transition: color var(--dur-fast) var(--ease), text-decoration-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.prose a:hover {
  color: var(--brand-hover);
  text-decoration-color: currentColor;
  background: var(--brand-soft);
}

.prose ul, .prose ol { padding-left: 1.35em; }
.prose li + li { margin-top: 0.5em; }
.prose li::marker { color: var(--accent-text); font-weight: 600; }
.prose ul { list-style: none; padding-left: 1.5em; }
.prose ul > li { position: relative; }
.prose ul > li::before {
  content: "";
  position: absolute;
  left: -1.1em;
  top: 0.72em;
  width: 0.42em; height: 0.42em;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.75;
}
.prose ul ul, .prose ol ol, .prose ul ol, .prose ol ul { margin-top: 0.5em; }

.prose blockquote {
  margin-inline: 0;
  padding: 0.2em 0 0.2em 1.5em;
  border-left: 3px solid var(--accent);
  font-size: 1.06em;
  font-style: italic;
  color: var(--ink-soft);
}
.prose blockquote p + p { margin-top: 0.8em; }
.prose blockquote cite, .prose figcaption {
  display: block;
  font-family: var(--font-ui);
  font-style: normal;
  font-size: var(--step--1);
  color: var(--ink-muted);
}
.prose figure { margin-inline: 0; }
.prose figcaption { margin-top: 0.75em; text-align: center; }
.prose img {
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  margin-inline: auto;
}
.prose hr {
  border: 0;
  height: auto;
  margin-block: 2.6em;
  text-align: center;
  color: var(--ink-muted);
}
.prose hr::before {
  content: "* * *";
  letter-spacing: 0.8em;
  font-size: 0.9em;
}
.heading-anchor {
  margin-left: 0.4em;
  font-family: var(--font-ui);
  font-size: 0.7em;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.prose :is(h2, h3, h4):hover .heading-anchor,
.heading-anchor:focus-visible { opacity: 1; }
.heading-anchor:hover { color: var(--accent-text); }

/* Tables scroll rather than break the measure. */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: var(--step--1);
}
.prose th, .prose td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.prose thead th {
  background: var(--surface-2);
  font-weight: 700;
  white-space: nowrap;
}
.prose tbody tr:last-child td { border-bottom: 0; }

/* --- Code --------------------------------------------------------------- */
:not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  border: 1px solid var(--rule);
  color: var(--ink);
  word-break: break-word;
}
.prose a code { color: inherit; }

.code-block {
  position: relative;
  min-width: 0;
  border-radius: var(--radius);
  border: 1px solid var(--code-rule);
  background: var(--code-bg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.prose > .code-block { margin-top: 1.8em; margin-bottom: 1.8em; }
@media (min-width: 64rem) {
  /* Let code breathe past the reading measure without touching the page edge. */
  .prose--article > .code-block {
    width: calc(100% + 5rem);
    margin-inline: -2.5rem;
  }
}
.code-block::before {
  content: attr(data-lang);
  position: absolute;
  top: 0; left: 0;
  padding: 0.3rem 0.75rem;
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--code-comment);
  background: var(--code-bg-header);
  border-right: 1px solid var(--code-rule);
  border-bottom: 1px solid var(--code-rule);
  border-bottom-right-radius: var(--radius-sm);
}
.code-block:not([data-lang])::before { content: none; }
.code-block pre {
  margin: 0;
  padding: 2.4rem 1.15rem 1.15rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: var(--code-comment) transparent;
  scrollbar-width: thin;
}
.code-block:not([data-lang]) pre { padding-top: 2.6rem; }
.code-block pre::-webkit-scrollbar { height: 10px; }
.code-block pre::-webkit-scrollbar-track { background: transparent; }
.code-block pre::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--code-comment) 55%, transparent);
  border-radius: var(--radius-pill);
}
.code-block code {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.66;
  font-variant-ligatures: none;
  tab-size: 2;
  color: var(--code-text);
  background: none;
  padding: 0;
  border: 0;
}
@media (min-width: 40rem) { .code-block code { font-size: 0.875rem; } }
.copy-btn {
  position: absolute;
  top: 0.4rem; right: 0.5rem;
  z-index: 2;
  min-height: 1.85rem;
  padding: 0.2rem 0.65rem;
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--code-comment);
  background: color-mix(in srgb, var(--code-bg-header) 88%, transparent);
  border: 1px solid var(--code-rule);
  border-radius: var(--radius-pill);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.code-block:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--code-text); border-color: var(--code-text); }
.copy-btn.copied { color: var(--code-string); border-color: var(--code-string); opacity: 1; }

/* highlight.js token colours tuned for --code-bg */
.hljs { color: var(--code-text); background: transparent; }
.hljs-comment, .hljs-quote { color: var(--code-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-doctag, .hljs-formula, .hljs-subst, .hljs-deletion { color: var(--code-keyword); }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-meta .hljs-string, .hljs-template-tag { color: var(--code-string); }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: var(--code-number); }
.hljs-title, .hljs-title.function_, .hljs-name, .hljs-section, .hljs-selector-id { color: var(--code-title); }
.hljs-type, .hljs-title.class_, .hljs-class .hljs-title, .hljs-built_in { color: var(--code-type); }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable, .hljs-selector-class, .hljs-selector-attr, .hljs-selector-pseudo, .hljs-params { color: var(--code-variable); }
.hljs-meta, .hljs-punctuation, .hljs-operator { color: var(--code-punct); }
.hljs-link { color: var(--code-title); text-decoration: underline; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* --- Cards & grids ------------------------------------------------------- */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--rule);
}
.section-head h2 { font-size: var(--step-2); }
.section-head a {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 600;
  text-decoration: none;
  color: var(--brand);
}
.section-head a:hover { text-decoration: underline; }

.grid { display: grid; gap: var(--space-5); }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.grid--related { grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur) var(--ease);
}
.card:hover, .card:focus-within {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
  border-color: color-mix(in srgb, var(--brand) 40%, var(--rule));
}
.card__media { display: block; overflow: hidden; background: var(--surface-2); }
.card__media img {
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
}
.card:hover .card__media img { transform: scale(1.03); }
.card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
}
.card__kicker {
  font-family: var(--font-ui);
  font-size: var(--step--2);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.card__title { font-size: var(--step-1); line-height: 1.2; text-wrap: pretty; }
.card__title a { color: var(--ink); text-decoration: none; }
.card__title a:hover { color: var(--brand); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.card__excerpt { font-size: 0.9375em; line-height: 1.6; color: var(--ink-muted); }
.card__meta {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  color: var(--ink-muted);
  margin-top: auto;
}

.featured { margin-bottom: var(--space-6); }
.card--featured { border-radius: var(--radius-lg); }
.card--featured .card__title { font-size: var(--step-3); }
.card--featured .card__excerpt { font-size: 1em; color: var(--ink-soft); }
@media (min-width: 52rem) {
  .card--featured { flex-direction: row; align-items: center; }
  .card--featured .card__media { flex: 0 0 44%; align-self: stretch; display: grid; align-items: center; }
  .card--featured .card__body { flex: 1 1 auto; padding: var(--space-6); gap: var(--space-4); justify-content: center; }
}

/* --- Outbound link cards (about page "elsewhere") ------------------------ */
.link-grid {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
}
.link-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  height: 100%;
  padding: var(--space-4) var(--space-5);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur) var(--ease);
}
.link-card:hover, .link-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: color-mix(in srgb, var(--brand) 45%, var(--rule));
}
.link-card__title {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  color: var(--brand);
}
.link-card__arrow { font-size: 0.8em; opacity: 0.7; transition: transform var(--dur-fast) var(--ease); }
.link-card:hover .link-card__arrow { transform: translate(2px, -2px); }
.link-card__note {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  line-height: 1.55;
  color: var(--ink-muted);
}
@media (prefers-reduced-motion: reduce) {
  .link-card:hover { transform: none; }
  .link-card:hover .link-card__arrow { transform: none; }
}

/* --- Simple stacked list (tag pages) ------------------------------------ */
.stack { list-style: none; padding: 0; display: grid; gap: 0; }
.stack-item {
  padding-block: var(--space-5);
  border-bottom: 1px solid var(--rule);
}
.stack-item:first-child { padding-top: 0; }
.stack-item__meta {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  color: var(--ink-muted);
}
.stack-item__title { margin-top: var(--space-2); font-size: var(--step-1); }
.stack-item__title a { color: var(--ink); text-decoration: none; }
.stack-item__title a:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 0.2em; }
.stack-item__excerpt { margin-top: var(--space-2); color: var(--ink-muted); font-size: 0.9375em; }
.link-back {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 600;
  text-decoration: none;
}
.link-back:hover { text-decoration: underline; }

/* --- Article furniture --------------------------------------------------- */
.article { max-width: var(--w-article); margin-inline: auto; }
.article-foot {
  max-width: var(--w-article);
  margin: var(--space-8) auto 0;
  padding-top: var(--space-6);
  border-top: 1px solid var(--rule);
}
.article-foot h2 { font-size: var(--step-1); margin-bottom: var(--space-5); }
.comments { max-width: var(--w-article); margin: var(--space-8) auto 0; }

/* --- Pager --------------------------------------------------------------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--rule);
  font-family: var(--font-ui);
}
.pager__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-pill);
  color: var(--ink);
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.pager__link:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.pager__status { font-size: var(--step--1); color: var(--ink-muted); text-align: center; }
@media (max-width: 34rem) {
  .pager { flex-wrap: wrap; justify-content: center; }
  .pager__status { order: 3; width: 100%; }
}

/* --- Subscribe CTA ------------------------------------------------------- */
.cta {
  position: relative;
  overflow: hidden;
  margin-top: var(--space-9);
  padding-block: clamp(2.5rem, 6vw, 4rem);
  background:
    radial-gradient(90% 130% at 100% 0%, var(--accent-soft), transparent 58%),
    radial-gradient(80% 120% at 0% 100%, var(--brand-soft), transparent 55%),
    var(--bg-tint);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.cta__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}
.cta__text { max-width: 46ch; }
.cta h2 { font-size: var(--step-2); }
.cta p { margin-top: var(--space-3); color: var(--ink-soft); }

/* --- Footer -------------------------------------------------------------- */
.footer {
  padding-block: var(--space-8) var(--space-6);
  background: var(--bg);
  border-top: 1px solid var(--rule);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  color: var(--ink-muted);
}
.footer__grid {
  display: grid;
  gap: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 48rem) {
  .footer__grid { grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: var(--space-7); }
}
.footer__blurb { max-width: 42ch; line-height: 1.7; margin-top: 1rem; }
.footer h2 {
  font-family: var(--font-ui);
  font-size: var(--step--2);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: var(--space-3);
}
.footer ul { list-style: none; padding: 0; display: grid; gap: 0.4rem; }
.footer a { color: var(--ink-muted); text-decoration: none; }
.footer a:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 0.2em; }
.footer__legal { padding-top: var(--space-5); display: grid; gap: var(--space-3); }
.footer__disclaimer { max-width: 68ch; opacity: 0.85; }

/* --- Dialogs (menu + search) -------------------------------------------- */
dialog {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: 0;
}
dialog::backdrop {
  background: rgba(9, 12, 18, 0.55);
  backdrop-filter: blur(3px);
}
.dialog {
  width: min(92vw, 34rem);
  max-height: min(85vh, 44rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5);
  border-bottom: 1px solid var(--rule);
}
.dialog__head h2 { font-size: var(--step-1); }
.dialog__body { padding: var(--space-5); overflow-y: auto; }
.dialog__nav { display: grid; gap: 0.25rem; }
.dialog__nav .nav__link { min-height: 3rem; padding-inline: 0.9rem; font-size: 1.0625rem; }
.dialog__nav .btn { margin-top: var(--space-4); }
.search-input {
  width: 100%;
  padding: 0.85rem 1rem;
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  outline: none;
}
.search-input:focus-visible { border-color: var(--brand); outline: 2px solid var(--accent); outline-offset: 1px; }
.search-results { display: grid; gap: 0.5rem; margin-top: var(--space-4); }
.search-hint { font-family: var(--font-ui); font-size: var(--step--1); color: var(--ink-muted); margin-top: var(--space-4); }
.search-result {
  display: block;
  padding: 0.85rem 1rem;
  text-decoration: none;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.search-result:hover, .search-result:focus-visible { border-color: var(--brand); background: var(--brand-soft); }
.search-result__type {
  font-family: var(--font-ui);
  font-size: var(--step--2);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.search-result__title { display: block; margin-top: 0.2rem; font-family: var(--font-display); font-weight: 700; color: var(--ink); }
.search-result__desc { margin-top: 0.25rem; font-family: var(--font-ui); font-size: var(--step--1); color: var(--ink-muted); }
.search-result mark { background: var(--accent-soft); color: var(--ink); border-radius: 3px; padding: 0 2px; }

/* --- Motion ------------------------------------------------------------- */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal, .js .reveal.is-in { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .card:hover, .btn--primary:hover { transform: none; }
  .card:hover .card__media img { transform: none; }
  .progress__bar { transition: none; }
}

/* --- Small screens ------------------------------------------------------ */
@media (max-width: 60rem) {
  .nav__link, .nav__cta { display: none; }
  #menu-btn { display: grid; }
  .brand__text { font-size: 1rem; }
}
@media (max-width: 30rem) {
  .hero__art { transform: none; }
}

/* --- Print -------------------------------------------------------------- */
@media print {
  .masthead, .progress, .cta, .footer, .comments, dialog, .copy-btn { display: none !important; }
  body { background: #fff; color: #000; }
  .prose { max-width: none; }
}
