/* ============================================================
   TILELLI · VARIANT N  —  premium, minimalist, fully responsive
   A single design system. Dark-first, light-aware. No half-width
   sections: every band fills its container; text uses a centered
   measure or a filled grid, never a lonely 50% column.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --terra: #6E8BFF;
  --terra-deep: #3A5BFF;
  --saffron: #22D3EE;
  --atlas: #8B5CF6;

  /* dark (default) */
  --bg: #0A0B10;
  --bg-2: #0F111A;
  --surface: #13161F;
  --surface-2: #181C28;
  --line: #262C3D;
  --line-soft: #1A1F2E;
  --ink: #F2F5FC;
  --text: #E2E7F2;
  --text-2: #A7B0C6;
  --muted: #7E88A2;   /* was #6E7790 — bumped for AA at small sizes on dark surfaces */
  --accent: var(--terra);
  --accent-2: var(--saffron);
  --accent-soft: rgba(110,139,255,0.16);
  --on-accent: #060810;

  --grad: linear-gradient(100deg, var(--terra) 0%, var(--saffron) 60%, var(--atlas) 120%);
  --grad-text: linear-gradient(100deg, var(--terra) 0%, var(--saffron) 85%);

  --shadow-1: 0 1px 0 rgba(255,255,255,0.02), 0 10px 30px -12px rgba(0,0,0,0.6);
  --shadow-2: 0 30px 80px -28px rgba(0,0,0,0.7);

  --font-display: "Fraunces", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --r-s: 10px;
  --r-m: 16px;
  --r-l: 24px;
  --r-xl: 32px;

  --gutter: clamp(20px, 5vw, 64px);
  --maxw: 1240px;
  --measure: 68ch;
  --sp: clamp(64px, 9vw, 132px);   /* section rhythm */
}

[data-theme="light"] {
  --bg: #F6F8FC;
  --bg-2: #ECF1F8;
  --surface: #FFFFFF;
  --surface-2: #F3F7FC;
  --line: #DCE3EF;
  --line-soft: #E7ECF5;
  --ink: #0C1018;
  --text: #1F2733;
  --text-2: #56607A;
  --muted: #646E88;   /* was #828DA6 (~3.4:1 on white = AA fail) — darkened to ~4.6:1 */
  --accent: var(--terra-deep);
  --accent-2: #0E8FA8;
  --accent-soft: rgba(58,91,255,0.10);
  --on-accent: #fff;
  --grad-text: linear-gradient(100deg, var(--terra-deep) 0%, #6D28D9 90%);
  --shadow-1: 0 1px 0 rgba(0,0,0,0.02), 0 12px 30px -16px rgba(30,50,120,0.20);
  --shadow-2: 0 40px 90px -30px rgba(30,50,120,0.22);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
ul { list-style: none; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--on-accent); }

/* ---------- Layout primitives ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--sp); }
.section--tight { padding-block: clamp(48px, 6vw, 80px); }
.section--alt { background: var(--bg-2); border-block: 1px solid var(--line-soft); }
.section--surface { background: var(--surface); border-block: 1px solid var(--line-soft); }

/* full-width grids that always fill — no lonely columns */
.grid { display: grid; gap: clamp(16px, 2vw, 24px); grid-template-columns: repeat(auto-fit, minmax(min(var(--min, 260px), 100%), 1fr)); }
.grid > * { min-width: 0; }

/* ---------- Typography ---------- */
.display, h1, h2, h3 { font-family: var(--font-display); font-weight: 500; line-height: 1.05; letter-spacing: -0.02em; color: var(--ink); font-variation-settings: "SOFT" 40, "opsz" 100; }
.display { font-size: clamp(2.6rem, 7vw, 5.4rem); line-height: 0.98; }
h2 { font-size: clamp(2rem, 4vw, 3.2rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.6rem); letter-spacing: -0.01em; }
p { color: var(--text-2); }
strong, b { color: var(--text); font-weight: 600; }
em { font-style: italic; }
code, .mono { font-family: var(--font-mono); }
:not(pre) > code { font-size: 0.86em; background: var(--accent-soft); color: var(--accent); padding: 0.12em 0.42em; border-radius: 6px; }

.kicker { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); display: inline-flex; align-items: center; gap: 10px; }
.kicker::before { content: ""; width: 22px; height: 1px; background: var(--accent); opacity: 0.7; }
.grad { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* chip / eyebrow pill */
.chip { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-2); padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-family: var(--font-sans); font-weight: 600; font-size: 15px; padding: 14px 24px; border-radius: 999px; border: 1px solid transparent; transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease, color .18s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: var(--on-accent); box-shadow: 0 12px 30px -12px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -14px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-ghost { border-color: var(--line); color: var(--text); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.btn-ghost:hover { border-color: var(--accent); color: var(--ink); transform: translateY(-2px); }
.btn-link { color: var(--accent); font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; }
.btn-link:hover { gap: 11px; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

/* ---------- Nav (injected) ---------- */
.t-nav { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid transparent; transition: background .25s ease, border-color .25s ease, backdrop-filter .25s ease; }
.t-nav.scrolled { background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px); border-bottom-color: var(--line); box-shadow: 0 1px 0 var(--line-soft); }
.t-nav-inner { display: flex; align-items: center; gap: 18px; height: 70px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-family: var(--font-display); font-weight: 600; font-size: 20px; color: var(--ink); letter-spacing: -0.01em; }
.brand img { width: 30px; height: 30px; }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-links a { font-size: 14.5px; font-weight: 500; color: var(--text-2); padding: 9px 13px; border-radius: 999px; transition: color .15s, background .15s; }
.nav-links a:hover { color: var(--ink); background: var(--accent-soft); }
.nav-links a.active { color: var(--accent); }
.nav-tools { display: flex; align-items: center; gap: 8px; margin-left: 6px; }
.icon-btn { width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); transition: border-color .15s, color .15s, background .15s; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
[data-theme="light"] .theme-toggle .sun { display: block; }
[data-theme="light"] .theme-toggle .moon { display: none; }
.nav-cta { display: inline-flex; }
.menu-btn { display: none; }

/* mobile menu */
.nav-drawer { display: none; }
@media (max-width: 880px) {
  .nav-links, .nav-cta { display: none; }
  .nav-tools { margin-left: auto; }   /* nav-links carried the auto-margin; it's hidden on mobile, so push tools right here */
  .menu-btn { display: inline-flex; }
  /* full-screen overlay ABOVE the nav (z-index 60 > nav 50) with its own close button, so the
     close affordance never depends on the top bar being visible */
  .nav-drawer { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--bg) 98%, transparent); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); padding: 76px var(--gutter) 40px; transform: translateY(-8px); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .nav-drawer.open { display: block; opacity: 1; transform: none; pointer-events: auto; }
  /* close button is a child of the drawer, so it only renders while the drawer is open
     (display:none on the drawer hides it); position:fixed pins it to the viewport top-right */
  .drawer-close { position: fixed; top: 14px; right: max(16px, var(--gutter)); width: 46px; height: 46px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; z-index: 61; box-shadow: var(--shadow-1); }
  .drawer-close svg { width: 22px; height: 22px; }
  .nav-drawer a { display: block; font-family: var(--font-display); font-size: 1.7rem; color: var(--ink); padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
  .nav-drawer a.active { color: var(--accent); }
  .nav-drawer .btn { margin-top: 22px; width: 100%; }
}

/* ---------- Hero (every page) ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(72px, 12vw, 150px) clamp(56px, 8vw, 104px); }
.hero-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hero-bg::before { content: ""; position: absolute; inset: -20% -10% auto -10%; height: 80%;
  background:
    radial-gradient(46% 60% at 16% 12%, color-mix(in srgb, var(--terra) 36%, transparent) 0%, transparent 60%),
    radial-gradient(40% 55% at 88% 8%, color-mix(in srgb, var(--saffron) 30%, transparent) 0%, transparent 60%),
    radial-gradient(50% 60% at 60% 90%, color-mix(in srgb, var(--atlas) 22%, transparent) 0%, transparent 65%);
  filter: blur(20px); opacity: 0.75; }
.hero-bg::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 26px 26px; opacity: 0.18; mask-image: radial-gradient(70% 70% at 50% 30%, #000 0%, transparent 75%); -webkit-mask-image: radial-gradient(70% 70% at 50% 30%, #000 0%, transparent 75%); }
.hero .container { position: relative; z-index: 1; }

.hero-title { margin-top: 22px; }
.hero-lede { margin-top: 24px; font-size: clamp(1.05rem, 1.6vw, 1.35rem); line-height: 1.6; color: var(--text-2); max-width: 60ch; }
.hero-lede em { color: var(--accent); font-style: normal; font-weight: 500; }
.hero .actions { margin-top: 32px; }

/* centered hero variant (sub-pages) — fills width, content centered */
.hero--center { text-align: center; }
.hero--center .kicker { justify-content: center; }
.hero--center .hero-lede { margin-inline: auto; }
.hero--center .actions { justify-content: center; }
.hero--center .hero-stats { margin-inline: auto; }

/* split hero (home) — two columns that both fill; collapses cleanly */
.hero--split .hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: clamp(28px, 4vw, 56px); align-items: center; }
@media (max-width: 920px) { .hero--split .hero-grid { grid-template-columns: 1fr; } }

/* hero glance panel */
.hero-panel { background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--line); border-radius: var(--r-l); padding: clamp(22px, 3vw, 30px); box-shadow: var(--shadow-2); backdrop-filter: blur(6px); }
.hero-panel-k { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.hero-panel p.lead-sm { margin-top: 8px; color: var(--text); font-size: 15px; }
.hero-panel .pgrid { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hero-panel .pgrid .pi { border: 1px solid var(--line-soft); border-radius: var(--r-s); padding: 14px; background: var(--bg); }
.hero-panel .pgrid .pi b { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--ink); }
.hero-panel .pgrid .pi span { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.hero-panel .pnote { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 13.5px; color: var(--text-2); }

/* full-width stat strip */
.hero-stats { margin-top: clamp(36px, 5vw, 56px); display: flex; flex-wrap: wrap; gap: 1px; background: var(--line-soft); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.hero-stats .hs { flex: 1 1 150px; background: var(--surface); padding: 20px 22px; }
.hero-stats .hs b { display: block; font-family: var(--font-display); font-size: clamp(1.5rem, 2.4vw, 2rem); color: var(--ink); }
.hero-stats .hs span { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* ---------- Section header ---------- */
.sec-head { max-width: 64ch; margin-bottom: clamp(28px, 4vw, 48px); }
.sec-head h2 { margin-top: 16px; }
.sec-head .sec-intro { margin-top: 16px; font-size: 1.08rem; color: var(--text-2); }
.sec-head--center { margin-inline: auto; text-align: center; }
.sec-head--center .kicker { justify-content: center; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: clamp(22px, 2.6vw, 30px); display: grid; gap: 12px; align-content: start; transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; box-shadow: var(--shadow-1); }
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: var(--shadow-2); }
.card .cap { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.card p { font-size: 15.5px; line-height: 1.62; }

/* numbered project lines */
.line { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: clamp(24px, 3vw, 36px); display: grid; gap: 20px; box-shadow: var(--shadow-1); transition: border-color .2s, transform .2s; }
.line:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-3px); }
.line-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.line-id { display: inline-flex; align-items: center; gap: 12px; }
.line-num { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.tag { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.tag.neg { background: rgba(176,51,75,0.16); color: #e0697f; }
.tag.win { background: rgba(95,154,110,0.18); color: #74c08c; }
.tag.live { background: rgba(95,154,110,0.18); color: #74c08c; }
.line-meta { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.line h3 { font-size: clamp(1.5rem, 2.4vw, 2rem); }
.line-body { color: var(--text-2); font-size: 15.5px; line-height: 1.65; max-width: 72ch; }
.line-body em { color: var(--accent); font-style: normal; }
.line-links { display: flex; flex-wrap: wrap; gap: 18px; }
.line-links a { color: var(--accent); font-family: var(--font-mono); font-size: 13px; }
.line-links a:hover { text-decoration: underline; }
.line-proof { display: flex; flex-wrap: wrap; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--r-m); overflow: hidden; }
.line-proof .pf { flex: 1 1 130px; background: var(--bg-2); padding: 16px 18px; }
.line-proof .pf b { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--ink); }
.line-proof .pf span { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }

/* stat cards block */
.stats { display: flex; flex-wrap: wrap; gap: clamp(16px, 2vw, 22px); }
.stats > .stat { flex: 1 1 220px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: clamp(22px, 2.6vw, 30px); }
.stat .v { font-family: var(--font-display); font-size: clamp(2.4rem, 4.5vw, 3.4rem); color: var(--accent); line-height: 1; }
.stat .l { display: block; margin-top: 12px; font-size: 14px; color: var(--text-2); line-height: 1.5; }

/* ---------- Editorial two-column (fills row, never half-empty) ---------- */
.editorial { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.5fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.editorial > * { min-width: 0; }   /* let columns shrink below content min (code blocks scroll instead of forcing overflow) */
.editorial .e-aside { position: sticky; top: 96px; }
@media (max-width: 860px) { .editorial { grid-template-columns: 1fr; } .editorial .e-aside { position: static; } }
.prose { color: var(--text-2); font-size: 1.05rem; line-height: 1.75; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { color: var(--ink); margin-top: 1.6em; }
.prose h3 { color: var(--ink); margin-top: 1.4em; }
.prose strong { color: var(--text); }
.prose em { color: var(--accent); font-style: normal; }
.prose a, a.inline, a.link-accent { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.prose a:hover, a.inline:hover { text-decoration-color: var(--accent); }
.prose ul { display: grid; gap: 12px; }
.prose ul li { position: relative; padding-left: 26px; color: var(--text-2); line-height: 1.65; }
.prose ul li::before { content: ""; position: absolute; left: 4px; top: 11px; width: 8px; height: 8px; border-radius: 2px; background: var(--grad); }

/* ---------- Callouts / pull quotes ---------- */
.callout { padding: clamp(24px, 3vw, 36px); border-radius: var(--r-l); border: 1px solid var(--line); background: var(--surface-2); }
.callout .star, .callout .label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 12px; }
.callout p { color: var(--text); }
.callout p + p { margin-top: 12px; }
.callout em { color: var(--accent); font-style: normal; }
.callout--accent { background: linear-gradient(135deg, color-mix(in srgb, var(--terra) 14%, transparent), color-mix(in srgb, var(--saffron) 10%, transparent)); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.callout--accent.big { font-family: var(--font-display); font-size: clamp(1.25rem, 2.2vw, 1.8rem); line-height: 1.4; color: var(--ink); }
.callout--accent.big strong { color: var(--ink); }
.callout--warn { background: rgba(176,51,75,0.08); border: 2px solid #b0334b; }
.callout--warn .label { color: #e0697f; }
.callout--warn strong { color: #e0697f; }
.pull { font-family: var(--font-display); font-size: clamp(1.5rem, 3vw, 2.4rem); line-height: 1.3; color: var(--ink); border-left: 3px solid var(--accent); padding-left: clamp(20px, 3vw, 36px); max-width: 30ch; }
.pull em { color: var(--accent); }

/* ---------- Table ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; background: var(--surface); }
table.t-table { width: 100%; border-collapse: collapse; }
.t-table th, .t-table td { padding: 16px 18px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; font-size: 15px; }
.t-table thead th { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; background: var(--bg-2); }
.t-table tbody tr:last-child td { border-bottom: 0; }
.t-table td.name, .t-table td.lead-cell { font-family: var(--font-display); font-size: 1.1rem; color: var(--ink); }
.t-table td.num { font-family: var(--font-mono); color: var(--accent); }
.t-table tr.is-top td { background: var(--accent-soft); }
@media (max-width: 720px) {
  .t-table, .t-table thead, .t-table tbody, .t-table tr, .t-table th, .t-table td { display: block; }
  .t-table thead { position: absolute; left: -9999px; }
  .t-table tr { padding: 16px; border-bottom: 1px solid var(--line); }
  .t-table td { border: 0; padding: 7px 0; display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: baseline; }
  .t-table td::before { content: attr(data-label); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
}

/* ---------- Code block ---------- */
.code { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: clamp(18px, 2.4vw, 26px); overflow-x: auto; box-shadow: var(--shadow-1); }
.code pre { margin: 0; }
.code code { font-family: var(--font-mono); font-size: 13.5px; line-height: 1.85; color: var(--text); white-space: pre; }
.code .c { color: var(--muted); }
.code .kw { color: var(--accent); }
.code .str { color: var(--atlas); }

/* ---------- CTA band ---------- */
.cta-band { position: relative; overflow: hidden; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: var(--r-xl); padding: clamp(36px, 6vw, 72px); background: linear-gradient(135deg, color-mix(in srgb, var(--terra) 16%, var(--surface)), color-mix(in srgb, var(--saffron) 10%, var(--surface))); text-align: center; }
.cta-band h2 { max-width: 22ch; margin-inline: auto; }
.cta-band p { margin: 16px auto 28px; max-width: 56ch; color: var(--text); }
.cta-band .actions { justify-content: center; }

/* ---------- Article (blog + legal) ---------- */
.article-hero { position: relative; overflow: hidden; padding-block: clamp(64px, 9vw, 120px) clamp(28px, 4vw, 48px); border-bottom: 1px solid var(--line); }
.article-hero .hero-bg { position: absolute; inset: 0; z-index: 0; }
.article-hero .container { position: relative; z-index: 1; }
.back-link { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); display: inline-flex; gap: 7px; }
.back-link:hover { color: var(--accent); }
article { display: block; }
article .container { max-width: 800px; }
article h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); margin-top: 20px; }
article .subtitle { margin-top: 18px; font-size: clamp(1.1rem, 1.8vw, 1.4rem); color: var(--text-2); font-family: var(--font-display); font-weight: 400; line-height: 1.4; }
article .subtitle em { color: var(--accent); }
.blog-meta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 24px; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.blog-meta .tag { color: var(--accent); }
article .lead { font-size: clamp(1.2rem, 2vw, 1.5rem); line-height: 1.5; color: var(--ink); font-family: var(--font-display); font-weight: 400; margin: clamp(28px, 4vw, 44px) 0 8px; }
article > .container > h2, article h2 { color: var(--ink); margin-top: 1.7em; font-size: clamp(1.5rem, 2.6vw, 2rem); }
article p { margin-top: 1.05em; color: var(--text-2); line-height: 1.78; }
article p code, article li code { font-size: 0.85em; }

/* content overflow safety — bare code blocks & wide tables must never break mobile layout */
article pre { max-width: 100%; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: clamp(16px, 2.4vw, 24px); box-shadow: var(--shadow-1); -webkit-overflow-scrolling: touch; }
article pre code { font-family: var(--font-mono); font-size: 13px; line-height: 1.8; white-space: pre; color: var(--text); }
.code pre { background: none; border: 0; border-radius: 0; padding: 0; box-shadow: none; }   /* .code wrapper already draws the box */
article figure { margin: clamp(20px, 3vw, 32px) 0; max-width: 100%; }
article table:not(.t-table) { display: block; width: 100%; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 14px; -webkit-overflow-scrolling: touch; }
article table:not(.t-table) th, article table:not(.t-table) td { padding: 10px 14px; border: 1px solid var(--line-soft); text-align: left; white-space: nowrap; vertical-align: top; }
article table:not(.t-table) thead th { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--bg-2); }
article ul, article ol { margin-top: 1.05em; display: grid; gap: 12px; padding-left: 0; }
article ul li { position: relative; padding-left: 26px; color: var(--text-2); line-height: 1.7; }
article ul li::before { content: ""; position: absolute; left: 4px; top: 12px; width: 8px; height: 8px; border-radius: 2px; background: var(--grad); }
article a.inline { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
article a.inline:hover { text-decoration-color: var(--accent); }
.legal-meta { margin-top: clamp(36px, 5vw, 56px); padding-top: 20px; border-top: 1px solid var(--line-soft); font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.outro { margin-top: 2em; font-family: var(--font-display); font-size: 1.4rem; color: var(--ink); }

/* callout used inside articles */
article .callout { margin-top: 1.4em; }
article .ratio { margin: 1.6em 0; }
.ratio-bar { display: flex; gap: 6px; height: 56px; border-radius: 12px; overflow: hidden; }
.ratio-auto { background: var(--grad); color: var(--on-accent); display: flex; align-items: center; padding-inline: 18px; font-weight: 600; font-size: 14px; }
.ratio-human { background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 13px; color: var(--text); white-space: nowrap; min-width: fit-content; padding-inline: 8px; }
.ratio-label { margin-top: 10px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* acknowledgments / humanity component grids */
.ack-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }   /* flex+center so an odd last row stays balanced, never a left-orphan with empty right */
.ack-grid > * { min-width: 0; flex: 1 1 260px; max-width: 340px; }
.ack-person { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 22px; display: grid; grid-template-rows: minmax(2.7em, auto) 1fr; gap: 8px; align-content: start; transition: border-color .2s, transform .2s; }
.ack-person:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); transform: translateY(-3px); }
.ack-person strong { color: var(--ink); font-family: var(--font-display); font-size: 1.12rem; line-height: 1.25; align-self: start; }
.ack-person span { color: var(--text-2); font-size: 14px; line-height: 1.55; align-self: start; }
.principles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.principle { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 24px; display: grid; gap: 10px; align-content: start; }
.principle h3 { font-size: 1.2rem; }
.principle p { font-size: 14.5px; color: var(--text-2); }
.pledge { margin-top: 1.4em; padding: clamp(24px,3vw,32px); border-radius: var(--r-l); background: linear-gradient(135deg, color-mix(in srgb, var(--terra) 14%, transparent), color-mix(in srgb, var(--saffron) 9%, transparent)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); font-size: 1.05rem; color: var(--text); }
.pledge strong { color: var(--ink); }

/* ---------- Blog index cards ---------- */
.blog-grid { display: grid; gap: clamp(16px, 2vw, 22px); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.blog-grid > * { min-width: 0; }
.blog-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: clamp(22px, 2.6vw, 30px); display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-1); transition: transform .2s, border-color .2s, box-shadow .2s; }
.blog-card:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow-2); }
.blog-card .blog-meta { margin-top: 0; }
.blog-card h3 { font-size: clamp(1.3rem, 1.8vw, 1.6rem); color: var(--ink); }
.blog-card p { font-size: 15px; color: var(--text-2); line-height: 1.6; }
.blog-card .read-more { margin-top: auto; color: var(--accent); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }

/* ---------- Footer (injected) ---------- */
.t-footer { border-top: 1px solid var(--line-soft); background: var(--bg-2); padding-block: clamp(48px, 6vw, 80px) 36px; margin-top: var(--sp); }
.t-footer-top { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 56px); align-items: end; padding-bottom: 40px; border-bottom: 1px solid var(--line-soft); }
@media (max-width: 760px) { .t-footer-top { grid-template-columns: 1fr; align-items: start; } }
.t-footer-top .f-kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.t-footer-top h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-top: 12px; max-width: 22ch; }
.t-footer-cta { display: flex; flex-wrap: wrap; gap: 14px; }
.t-footer-grid { display: grid; gap: clamp(24px, 3vw, 40px); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); padding-block: 40px; }
.f-col h3 { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: 14px; }
.f-col a { display: block; font-size: 14.5px; color: var(--text-2); padding: 6px 0; transition: color .15s; }
.f-col a:hover { color: var(--accent); }
.f-col a.active { color: var(--accent); }
.t-footer-bottom { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; padding-top: 24px; border-top: 1px solid var(--line-soft); font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.t-footer-bottom a:hover { color: var(--accent); }

/* ---------- Reveal animation ---------- */
/* Hidden state only applies when JS is present (html.js, set by the head inline script).
   Without JS the content stays visible — no blank page if scripts fail or are disabled. */
.reveal { transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
html.js .reveal { opacity: 0; transform: translateY(22px); }
/* Must out-specify `html.js .reveal` (0,2,1) above, else revealed content stays hidden. */
html.js .reveal.in, .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { html.js .reveal, .reveal { opacity: 1 !important; transform: none !important; transition: none; } }

/* ---------- Utilities ---------- */
.center { text-align: center; }
.measure { max-width: var(--measure); }
.measure-center { max-width: var(--measure); margin-inline: auto; }
.mt-s { margin-top: 16px; } .mt-m { margin-top: 28px; } .mt-l { margin-top: 44px; }
.divider { height: 1px; background: var(--line-soft); border: 0; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 16px; z-index: 100; background: var(--surface); padding: 10px 16px; border-radius: 8px; border: 1px solid var(--accent); }
