@layer reset, tokens, base, layout, components, chrome, utilities;
@layer tokens {
/* ============================================================
   pSEO Tech — design system (2026-09-28 redesign)
   PART 1 of 3 — tokens. DEV-TOOLS archetype: Space Grotesk
   display + Inter body, indigo / electric-blue brand.
   ============================================================ */

:root {
  /* ---- Brand (DEV-TOOLS: indigo + electric blue) ---- */
  --brand-600: #4f46eb;   /* primary actions, links */
  --brand-700: #4338ca;   /* hover states */
  --brand-50:  #eef2ff;   /* tinted surfaces */
  --brand-100: #e0e7ff;
  --accent-500: #0ea5e9;  /* sparing highlights, gradients */

  /* ---- Neutrals (cool, technical) ---- */
  --ink-950: #0c0f14;
  --ink-900: #141a23;
  --ink-700: #2b3442;
  --ink-500: #55606f;
  --ink-400: #7d8898;
  --paper:   #ffffff;
  --paper-2: #f6f8fc;   /* alt section background */
  --line:    #e4e8f2;   /* hairlines */

  /* ---- Type ---- */
  --font-display: "Space Grotesk", "Inter", -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* Fluid scale — display shrinks gracefully on mobile */
  --text-hero:    clamp(2.5rem, 1.4rem + 5vw, 4.5rem);
  --text-h1:      clamp(2rem, 1.3rem + 3.2vw, 3.25rem);
  --text-h2:      clamp(1.5rem, 1.15rem + 1.8vw, 2.25rem);
  --text-h3:      1.25rem;
  --text-lead:    clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
  --text-body:    1rem;
  --text-small:   0.875rem;
  --text-caption: 0.75rem;

  --leading-tight: 1.05;
  --leading-snug:  1.25;
  --leading-body: 1.65;

  --tracking-display: -0.02em;

  /* ---- Spacing (8pt) ---- */
  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem;
  --s6: 1.5rem;  --s8: 2rem;   --s12: 3rem;  --s16: 4rem;
  --s24: 6rem;   --s32: 8rem;

  --section-pad: clamp(3.5rem, 2rem + 6vw, 7rem);
  --container: 72rem;          /* 1152px */
  --container-narrow: 44rem;

  /* ---- Shape & depth ---- */
  --radius-sm: 0.5rem;
  --radius-md: 0.875rem;
  --radius-lg: 1.25rem;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgb(12 15 20 / 0.06);
  --shadow-md: 0 6px 24px -8px rgb(12 15 20 / 0.14);
  --shadow-lg: 0 24px 64px -24px rgb(12 15 20 / 0.22);

  /* ---- Motion ---- */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 220ms;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
}

@layer components {
/* ============================================================
   PART 2 of 3 — shared components (adapted per pSEO Tech)
   ============================================================ */

/* ---- Reset-ish ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-wrap: anywhere; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--ink-900);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-600); text-underline-offset: 3px; }
a:hover { color: var(--brand-700); }
:focus-visible {
  outline: 3px solid var(--brand-600);
  outline-offset: 2px;
  border-radius: 4px;
}
::selection { background: var(--brand-600); color: #fff; }

/* ---- Layout ---- */
.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }
.container-narrow { width: min(100% - 2.5rem, var(--container-narrow)); margin-inline: auto; }
/* .wrap is the legacy container alias used across all pages */
.wrap { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }
.section { padding-block: var(--section-pad); }
.section-alt { background: var(--paper-2); }

/* ---- Type ---- */
.display, h1, h2 {
  font-family: var(--font-display);
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-tight);
  text-wrap: balance;
}
h1, .h1 { font-size: var(--text-h1); margin: 0 0 var(--s4); }
h2, .h2 { font-size: var(--text-h2); margin: var(--s12) 0 var(--s4); }
h3, .h3 { font-size: var(--text-h3); font-weight: 650; margin: var(--s8) 0 var(--s2); line-height: var(--leading-snug); font-family: var(--font-display); }
.hero-title { font-size: var(--text-hero); margin: 0 0 var(--s6); }
.lead { font-size: var(--text-lead); color: var(--ink-500); max-width: 44rem; margin: 0 0 var(--s6); }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: var(--text-caption); font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--brand-700); margin: 0 0 var(--s4);
  font-family: var(--font-body);
}
.eyebrow::before { content: ""; width: 1.5rem; height: 2px; background: var(--brand-600); border-radius: 2px; }
.muted { color: var(--ink-500); }
.small { font-size: var(--text-small); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  font-weight: 650; font-size: var(--text-body); line-height: 1;
  padding: 0.9rem 1.6rem; border-radius: var(--radius-pill);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), background var(--dur);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--brand-600); color: #fff; box-shadow: var(--shadow-md); }
.btn-primary:hover { background: var(--brand-700); box-shadow: var(--shadow-lg); color: #fff; }
.btn-secondary {
  background: var(--paper); color: var(--ink-900);
  border-color: var(--line); box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { border-color: var(--ink-400); color: var(--ink-900); }
.btn-lg { padding: 1.1rem 2.1rem; font-size: 1.0625rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s8); }

/* ---- Nav ---- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3) var(--s4); padding-block: var(--s3); flex-wrap: wrap;
}
.brandmark { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 750; font-size: 1.0625rem; color: var(--ink-950); text-decoration: none; font-family: var(--font-display); letter-spacing: -0.01em; }
.brandmark:hover { color: var(--ink-950); }
.brandmark-mark {
  width: 2rem; height: 2rem; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-600), var(--accent-500));
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-display); font-size: 1rem; font-weight: 700;
}
.nav-links { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); list-style: none; margin: 0; padding: 0; align-items: center; }
.nav-links a { color: var(--ink-700); text-decoration: none; font-weight: 550; font-size: var(--text-small); padding: var(--s2) var(--s2); border-radius: var(--radius-sm); }
.nav-links a:hover { color: var(--brand-700); }
.nav-links a[aria-current="page"] { color: var(--brand-700); background: var(--brand-50); }
.nav-cta .btn { padding: 0.65rem 1.25rem; font-size: var(--text-small); }

/* ---- Hero ---- */
.hero { padding-block: clamp(3rem, 2rem + 7vw, 6.5rem) var(--section-pad); position: relative; overflow: clip; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(42rem 26rem at 85% -5%, color-mix(in srgb, var(--brand-600) 10%, transparent), transparent 65%),
    radial-gradient(30rem 20rem at 8% 10%, color-mix(in srgb, var(--accent-500) 8%, transparent), transparent 60%);
}
.hero > .container, .hero > .wrap { position: relative; }
.hero-copy { max-width: 46rem; }
.hero-grid { display: grid; gap: var(--s12); align-items: center; position: relative; }
@media (min-width: 64rem) { .hero-grid { grid-template-columns: 1.05fr 0.95fr; } }
.hero-proof { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s6); margin: var(--s8) 0 0; padding: 0; list-style: none; }
.hero-proof li { display: flex; align-items: center; gap: var(--s2); font-size: var(--text-small); color: var(--ink-500); font-weight: 550; }
.hero-proof li::before { content: "✓"; color: var(--brand-600); font-weight: 800; }

/* Illustrated terminal card in the hero (static, aria-hidden) */
.term {
  background: var(--ink-950); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--brand-600) 35%, var(--ink-950));
}
.term-bar { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); border-bottom: 1px solid rgb(255 255 255 / 0.08); }
.term-bar span.dot3 { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: rgb(255 255 255 / 0.18); }
.term-title { margin-left: var(--s2); font-family: var(--font-mono); font-size: var(--text-caption); color: rgb(255 255 255 / 0.55); }
.term-body {
  margin: 0; padding: var(--s6) var(--s4); font-family: var(--font-mono);
  font-size: 0.82rem; line-height: 1.9; color: #c9d4f5; white-space: pre-wrap;
  background: none;
}
.term-body .t-dim { color: rgb(255 255 255 / 0.45); }
.term-body .t-ok { color: #7ef0b2; }
.term-body .t-warn { color: #ffd479; }

/* ---- Feature grid ---- */
.grid-3 { display: grid; gap: var(--s6); grid-template-columns: 1fr; margin-top: var(--s8); }
@media (min-width: 56rem) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: var(--s8);
  box-shadow: var(--shadow-sm); color: var(--ink-900); text-decoration: none; display: block;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--brand-600); color: var(--ink-900); text-decoration: none; }
.card-icon {
  width: 2.75rem; height: 2.75rem; border-radius: var(--radius-md);
  background: var(--brand-50); color: var(--brand-700);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.35rem; margin-bottom: var(--s4); font-family: var(--font-mono); font-weight: 700;
}
.card p { color: var(--ink-500); margin: var(--s2) 0 0; font-size: var(--text-small); }
.card h3 { margin: 0; }
.card .kicker { display: block; font-size: var(--text-caption); font-weight: 700; letter-spacing: 0.12em; color: var(--brand-700); margin-bottom: var(--s3); font-family: var(--font-body); }
.card .go { display: inline-block; margin-top: var(--s4); font-weight: 700; font-size: var(--text-small); color: var(--brand-600); }
.card:hover .go { color: var(--brand-700); }

/* ---- How-it-works steps (foundation) ---- */
.steps { display: grid; gap: var(--s6); margin-top: var(--s8); counter-reset: step; }
@media (min-width: 56rem) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { position: relative; padding-top: var(--s8); border-top: 2px solid var(--line); }
.step::before {
  counter-increment: step; content: "0" counter(step);
  position: absolute; top: calc(-1 * var(--s2)); left: 0;
  font-family: var(--font-display); font-size: 2.5rem; color: var(--brand-100);
  background: var(--paper); padding-right: var(--s3); line-height: 1;
}
.section-alt .step::before { background: var(--paper-2); }
.step h3 { margin-top: 0; }
.step p { color: var(--ink-500); font-size: var(--text-small); margin: var(--s2) 0 0; }

/* ---- CTA band ---- */
.cta-band {
  background: linear-gradient(135deg, var(--ink-950), #1a2140);
  color: #fff; border-radius: var(--radius-lg);
  padding: clamp(2.5rem, 2rem + 4vw, 4.5rem);
  text-align: center; position: relative; overflow: clip;
}
.cta-band::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(36rem 18rem at 50% -20%, color-mix(in srgb, var(--brand-600) 45%, transparent), transparent 70%);
}
.cta-band > * { position: relative; }
.cta-band h2 { color: #fff; margin: 0 0 var(--s4); font-size: var(--text-h2); }
.cta-band p { color: rgb(255 255 255 / 0.72); max-width: 36rem; margin: 0 auto var(--s6); }
.cta-band .btn-row { justify-content: center; margin-top: 0; }
.cta-band .btn-secondary { background: transparent; color: #fff; border-color: rgb(255 255 255 / 0.35); }
.cta-band .btn-secondary:hover { border-color: #fff; color: #fff; }

/* ---- Footer ---- */
.footer { border-top: 1px solid var(--line); padding-block: var(--s12) var(--s8); margin-top: var(--section-pad); }
.footer-grid { display: grid; gap: var(--s8); grid-template-columns: 1fr; }
@media (min-width: 56rem) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer h2, .footer h3, .footer h4 { font-size: var(--text-caption); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-500); margin: 0 0 var(--s3); font-family: var(--font-body); }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.footer a { color: var(--ink-500); text-decoration: none; font-size: var(--text-small); }
.footer a:hover { color: var(--brand-700); }
.footer .brandmark { margin-bottom: var(--s3); }
.footer-base {
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s6); justify-content: space-between; align-items: center;
  margin-top: var(--s12); padding-top: var(--s6); border-top: 1px solid var(--line);
  font-size: var(--text-caption); color: var(--ink-500);
}
.footer-base p { margin: 0; }
.footer-base .powered strong { color: var(--ink-700); }

/* ---- Utility ---- */
.kicker-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.divider { border: 0; border-top: 1px solid var(--line); margin: var(--s12) 0; }
.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s6); margin-top: var(--s8); }
@media (min-width: 56rem) { .stat-row { grid-template-columns: repeat(4, 1fr); } }
.stat-num { font-family: var(--font-display); font-size: var(--text-h2); color: var(--ink-950); }
.stat-label { font-size: var(--text-small); color: var(--ink-500); }
}

@layer utilities {
/* ============================================================
   PART 3 of 3 — pSEO Tech site layer: tools, prose, guides
   ============================================================ */

/* ---- Skip link ---- */
.skip { position: absolute; left: 1rem; top: -6rem; z-index: 100; background: var(--ink-950); color: #fff;
  font-weight: 700; padding: 0.65rem 1.1rem; border-radius: 0.6rem; text-decoration: none;
  transition: top 0.18s ease; }
.skip:focus { top: 0.75rem; color: #fff; }

/* ---- Breadcrumbs ---- */
.breadcrumbs { font-size: var(--text-small); color: var(--ink-500); margin: var(--s6) 0 0; }
.breadcrumbs a { color: var(--ink-500); }
.breadcrumbs a:hover { color: var(--brand-700); }

/* ---- Buttons (native + legacy .button class) ---- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  font: inherit; font-weight: 650; font-size: var(--text-body); line-height: 1;
  padding: 0.85rem 1.5rem; border-radius: var(--radius-pill);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  background: var(--brand-600); color: #fff;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), background var(--dur);
  white-space: nowrap;
}
button:hover, .button:hover { background: var(--brand-700); color: #fff; text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
button:active, .button:active { transform: translateY(0); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.secondary {
  background: transparent; color: var(--brand-600);
  border: 1.5px solid var(--brand-600); box-shadow: none;
}
.secondary:hover { background: var(--brand-50); color: var(--brand-700); box-shadow: none; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s6); align-items: center; }
[hidden] { display: none !important; }

/* ---- Prose articles (guides, about, legal) ---- */
.prose { max-width: var(--container-narrow); margin: var(--s12) auto; }
.prose.wide { max-width: var(--container); }
.prose > h1 { margin-bottom: var(--s4); }
.prose p, .prose li { margin-bottom: 0.9em; }
.prose > p:first-of-type:not(.lead) { font-size: var(--text-lead); color: var(--ink-500); }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li::marker { color: var(--brand-600); font-weight: 700; }

/* ---- Tool forms (JS hooks: [data-tool], [data-link-planner] untouched) ---- */
.tool {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: clamp(1.25rem, 1rem + 2vw, 2rem);
  margin: var(--s8) 0; box-shadow: var(--shadow-md);
  position: relative; overflow: clip;
}
.tool::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--brand-600), var(--accent-500));
  pointer-events: none;
}
.tool label { display: block; font-size: var(--text-small); font-weight: 700; margin-bottom: var(--s2); }
.hint { font-size: var(--text-small); color: var(--ink-500); font-weight: 400; margin: var(--s1) 0 0; max-width: 60ch; }
input, textarea {
  display: block; width: 100%; font: inherit; font-size: 1rem; padding: 0.75rem 0.9rem;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); margin-top: var(--s2);
  color: var(--ink-900); background: var(--paper-2);
}
input:focus, textarea:focus { border-color: var(--brand-600); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-600) 18%, transparent); }
textarea { min-height: 12rem; font-family: var(--font-mono); font-size: 0.875rem; line-height: 1.65; resize: vertical; }
output {
  display: block; padding: var(--s6); background: var(--ink-950); color: #dbe4ff;
  border-radius: var(--radius-md); white-space: pre-wrap; margin-top: var(--s6);
  font-family: var(--font-mono); font-weight: 400; font-size: 0.875rem; line-height: 1.75;
  overflow-x: auto; border: 1px solid color-mix(in srgb, var(--brand-600) 30%, var(--ink-950));
}
.note { font-size: var(--text-small); color: var(--ink-500); }
.print-note { display: none; }

/* Method steps list on tool pages (renamed from legacy .steps) */
.method-steps { list-style: none; padding: 0; margin: var(--s6) 0; counter-reset: mstep; display: grid; gap: var(--s4); }
.method-steps > li {
  counter-increment: mstep; position: relative; padding: var(--s4) var(--s4) var(--s4) 4.25rem;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper);
  max-width: 75ch;
}
.method-steps > li::before {
  content: counter(mstep, decimal-leading-zero); position: absolute; left: var(--s4); top: var(--s4);
  font-family: var(--font-display); font-weight: 700; font-size: 0.9rem; color: #fff;
  background: linear-gradient(135deg, var(--brand-600), var(--accent-500));
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---- Callouts, details, tables, code ---- */
.callout {
  border-left: 4px solid var(--brand-600); background: var(--brand-50);
  padding: var(--s4) var(--s6); border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: var(--s6) 0; font-size: var(--text-small);
}
.callout strong { color: var(--brand-700); }
details { padding: var(--s4) 0; border-bottom: 1px solid var(--line); }
details:first-of-type { border-top: 1px solid var(--line); }
summary { font-weight: 700; cursor: pointer; font-size: 1.05rem; font-family: var(--font-display); }
details p { margin-bottom: 0; color: var(--ink-500); font-size: var(--text-small); }
table { width: 100%; border-collapse: collapse; margin: var(--s6) 0; font-size: var(--text-small); display: block; overflow-x: auto; }
th, td { text-align: left; padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; background: var(--brand-50); color: var(--brand-700); white-space: nowrap; }
code { font-family: var(--font-mono); font-size: 0.87em; background: var(--brand-50);
  padding: 0.15rem 0.45rem; border-radius: 0.35rem; color: var(--brand-700); }
pre {
  background: var(--ink-950); color: #dbe4ff; border-radius: var(--radius-md);
  padding: var(--s4) var(--s6); overflow-x: auto;
  font-family: var(--font-mono); font-size: 0.875rem; line-height: 1.65;
}
pre code { background: none; color: inherit; padding: 0; }

/* ---- Related + sources ---- */
.related {
  margin: var(--s12) 0 0; padding: var(--s8); border: 1px solid var(--line);
  border-radius: var(--radius-lg); background: var(--paper-2);
}
.related h2 { margin: 0 0 var(--s4); font-size: var(--text-h3); }
.related ul { margin: 0; padding-left: 1.25rem; }
.related li { margin-bottom: var(--s2); font-size: var(--text-small); }
.sources { font-size: var(--text-small); border-top: 1px solid var(--line); margin-top: var(--s12); padding-top: var(--s6); color: var(--ink-500); }
.sources h2 { font-size: 1.125rem; margin-top: var(--s6); }
.sources li { margin-bottom: var(--s2); }

/* ---- Page headers for index pages ---- */
.page-head { padding-block: clamp(2.5rem, 1.5rem + 5vw, 4.5rem) var(--s8); }
.page-head h1 { margin-bottom: var(--s4); }

/* ---- Dark scheme ---- */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10131c; --paper-2: #161b29;
    --ink-950: #f2f4fa; --ink-900: #e9edf5; --ink-700: #c3cbdd;
    --ink-500: #9aa6bd; --ink-400: #7c879e;
    --line: #242c44;
    --brand-50: #1c2140; --brand-100: #2a3170;
    --brand-600: #8b93ff; --brand-700: #a9b1ff;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-md: 0 6px 24px -8px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 24px 64px -24px rgb(0 0 0 / 0.6);
  }
  body { background: var(--paper); }
  .nav { background: color-mix(in srgb, #10131c 88%, transparent); }
  .brandmark, .brandmark:hover { color: var(--ink-950); }
  .nav-links a { color: var(--ink-700); }
  .nav-links a[aria-current="page"] { color: var(--brand-700); }
  .btn-primary { color: #10131c; }
  .btn-primary:hover { color: #10131c; }
  button, .button { color: #10131c; }
  button:hover, .button:hover { color: #10131c; }
  .secondary { color: var(--brand-700); border-color: var(--brand-600); }
  .secondary:hover { color: var(--brand-700); background: var(--brand-50); }
  input, textarea { background: #0b0e17; border-color: var(--line); color: var(--ink-900); }
  .method-steps > li::before { color: #10131c; }
  .term-body { color: #c9d4f5; }
  .cta-band { background: linear-gradient(135deg, #070a12, #141a33); }
  ::selection { background: var(--brand-600); color: #10131c; }
}

/* ---- Responsive ---- */
@media (max-width: 680px) {
  .nav-inner { gap: var(--s2) var(--s4); }
  .nav-cta { display: none; }
  .tool { padding: var(--s4); }
  .card { padding: var(--s6); }
  .term-body { font-size: 0.75rem; }
}

/* ---- Print ---- */
@media print {
  .nav, .footer, .skip, .actions, details, .related, .btn-row, .term { display: none !important; }
  body { background: #fff; color: #000; }
  .prose { max-width: none; margin: 0; }
  .tool { break-inside: avoid; box-shadow: none; }
  output { background: #fff; color: #000; border: 1px solid #999; }
  .print-note { display: block; font-size: 13px; color: #444; }
  a { color: #000; }
  .hero::before, .cta-band::before { display: none; }
}

.visually-hidden { position:absolute !important; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }
}

/* Front-End Standard v1 — token aliases (names converge, values stay per-site). */
@layer tokens {
  :root {
    --brand: var(--brand-600);
    --brand-strong: var(--brand-700);
    --surface: var(--paper);
    --ink: var(--ink-900);
    --muted: var(--ink-500);
    --wrap: var(--container);
    --radius-s: var(--radius-sm);
    --radius-m: var(--radius-md);
    --radius-l: var(--radius-lg);
    --shadow-1: var(--shadow-sm);
    --shadow-2: var(--shadow-md);
    --dur-1: 120ms;
    --dur-2: var(--dur);
    --dur-3: 320ms;
  }
}

/* Front-End Standard v1 — chrome layer (foundation family): sticky-header
   shadow, accessible mobile disclosure menu (chrome.js), current-page
   marker, back-to-top. Panel breakpoint: 48rem per SPEC §3. */
@layer chrome {
  .site-header { transition: box-shadow var(--dur-2) var(--ease-out); }
  .site-header.scrolled { box-shadow: var(--shadow-md); }
  .nav-links a[aria-current="page"] { color: var(--brand-700); font-weight: 700; }
  .nav-toggle { display: none; }
  .to-top { font-weight: 600; text-decoration: none; white-space: nowrap; }
  .to-top:hover { text-decoration: underline; }

  /* Show links from 48rem (SPEC) instead of the foundation's 56rem */
  @media (min-width: 48rem) {
    .nav-links { display: flex; }
  }

  @media (max-width: 47.99rem) {
    .nav-inner { flex-wrap: wrap; }
    /* Menu button only exists when JS is available to run it */
    .js .nav-toggle {
      display: inline-flex; align-items: center; gap: .55rem;
      min-height: 44px; padding: .5rem .9rem;
      border: 1px solid var(--line); border-radius: var(--radius-md);
      background: var(--paper); color: var(--ink-900);
      font: inherit; font-weight: 700; cursor: pointer;
    }
    .js .nav-toggle-bars,
    .js .nav-toggle-bars::before,
    .js .nav-toggle-bars::after {
      display: block; width: 1.05rem; height: 2px;
      background: currentColor; border-radius: 2px;
      transition: transform var(--dur-2) var(--ease-out), opacity var(--dur-1) var(--ease-out);
    }
    .js .nav-toggle-bars { position: relative; }
    .js .nav-toggle-bars::before,
    .js .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
    .js .nav-toggle-bars::before { top: -6px; }
    .js .nav-toggle-bars::after { top: 6px; }
    .js .nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
    .js .nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
    .js .nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }
    .js .site-nav {
      flex-basis: 100%; order: 4;
      display: grid; grid-template-rows: 0fr;
      opacity: 0; visibility: hidden;
      transition: grid-template-rows var(--dur-3) var(--ease-out), opacity var(--dur-2) var(--ease-out), visibility 0s var(--dur-3);
    }
    .js .site-nav > .nav-links {
      overflow: hidden; min-height: 0;
      display: flex; flex-direction: column; align-items: stretch; gap: 0;
    }
    .js .site-nav.open {
      grid-template-rows: 1fr; opacity: 1; visibility: visible;
      transition: grid-template-rows var(--dur-3) var(--ease-out), opacity var(--dur-2) var(--ease-out);
    }
    .js .site-nav .nav-links a { display: flex; align-items: center; min-height: 44px; width: 100%; }
    /* No-JS: links simply stack under the brand, fully usable */
    html:not(.js) .site-nav { flex-basis: 100%; order: 4; }
    html:not(.js) .nav-links { display: flex; flex-wrap: wrap; }
  }
}

@layer chrome {
  @media (min-width: 48rem) { .site-nav { display: contents; } }
}

/* Front-End Standard v1 — reveal-on-scroll. Initial state is JS-only (.js),
   so no-JS and reduced-motion users see content immediately. */
@layer utilities {
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out);
  }
  .js [data-reveal].in { opacity: 1; transform: none; }
}

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