/* ==========================================================================
   filemonprime.net — design system
   Light engineering catalogue: paper ground, ink type, one ultramarine accent.
   Dark palette follows the OS setting via prefers-color-scheme.
   ========================================================================== */

:root {
  --paper: #f2f1ec;
  --paper-2: #e8e6df;
  --card: #fbfaf7;
  --ink: #141412;
  --ink-2: #3b3a36;
  --muted: #6c6a64;
  --faint: #9b9990;
  --line: #d9d6cd;
  --line-2: #c5c2b8;
  --accent: #2e40c9;
  --accent-hover: #2434ad;
  --accent-ink: #ffffff;
  --accent-soft: rgba(46, 64, 201, 0.08);
  --dots: rgba(20, 20, 18, 0.13);

  --ok: #1d8752;
  --warn: #b8740f;
  --bad: #c43d2c;
  --unk: #a7a59d;

  --shadow-sm: 0 1px 2px rgba(40, 36, 24, 0.08), 0 4px 12px -6px rgba(40, 36, 24, 0.16);
  --shadow: 0 1px 2px rgba(40, 36, 24, 0.06), 0 18px 40px -18px rgba(40, 36, 24, 0.32);
  --shadow-lg: 0 2px 4px rgba(40, 36, 24, 0.06), 0 30px 70px -24px rgba(40, 36, 24, 0.42);
  --backdrop: rgba(24, 23, 19, 0.34);

  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --r-xs: 5px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --header-h: 64px;

  --z-header: 20;
  --z-sticky: 15;
  --z-terminal: 35;
  --z-drawer: 40;
  --z-hud: 45;
  --z-modal: 50;
  --z-toast: 60;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f0f0e;
    --paper-2: #181816;
    --card: #1c1c1a;
    --ink: #edebe5;
    --ink-2: #c9c7bf;
    --muted: #94928a;
    --faint: #66645e;
    --line: #2a2926;
    --line-2: #3a3935;
    --accent: #8f9cff;
    --accent-hover: #aab4ff;
    --accent-ink: #0f0f0e;
    --accent-soft: rgba(143, 156, 255, 0.12);
    --dots: rgba(237, 235, 229, 0.09);

    --ok: #4cc585;
    --warn: #e0a33d;
    --bad: #ef6a58;
    --unk: #6a6862;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px -6px rgba(0, 0, 0, 0.5);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 40px -18px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 30px 70px -24px rgba(0, 0, 0, 0.85);
    --backdrop: rgba(0, 0, 0, 0.55);
  }
}

/* ---------- Base ---------- */

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

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Paper grain: fixed, behind content, never intercepts input. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.48 0 0 0 0 0.42 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
svg { flex: none; }

::selection { background: var(--accent-soft); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

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

.skip-link {
  position: fixed;
  top: 10px; left: 10px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--paper);
  font-weight: 550;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: none; }

.wrap {
  width: 100%;
  max-width: 1320px;
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 48px);
}

/* Icons drawn as strokes so they inherit currentColor. */
.tool svg, .btn svg, .icon-btn svg, .view-chip svg, .palette-head svg,
.contact-email svg, .card-launch svg, .row-launch svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: var(--r-xs);
  background: var(--card);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--unk);
  flex: none;
}
.dot[data-state="up"] { background: var(--ok); }
.dot[data-state="locked"] { background: var(--warn); }
.dot[data-state="down"] { background: var(--bad); }
.dot[data-state="unk"] { background: var(--unk); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 550;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.12s var(--ease);
}
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: translateY(1px) scale(0.99); }

.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent); color: var(--accent-ink); }

.btn-quiet { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-quiet:hover { background: var(--card); border-color: var(--ink-2); }

.btn-small { height: 36px; padding: 0 14px; font-size: 14px; border-radius: var(--r-sm); }

.tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background-color 0.2s var(--ease), transform 0.12s var(--ease);
}
.tool:hover { border-color: var(--line-2); color: var(--ink); }
.tool:active { transform: translateY(1px); }
.tool svg { width: 17px; height: 17px; }
.tool-icon { width: 36px; padding: 0; justify-content: center; }
.tool-small { height: 32px; padding: 0 10px; font-size: 13px; gap: 6px; }
.tool-small svg { width: 15px; height: 15px; }
.tool.probing svg { animation: spin 0.9s linear infinite; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink-2);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background-color 0.2s var(--ease), transform 0.12s var(--ease);
}
.icon-btn:hover { border-color: var(--line-2); color: var(--ink); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn svg { width: 18px; height: 18px; }

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: inherit;
}
.link-button:hover { color: var(--ink); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--line); }

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--header-h);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  margin-right: auto;
}
.wordmark-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.wordmark-text { display: grid; line-height: 1.2; }
.wordmark-text strong { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.wordmark-text span { font-size: 12px; color: var(--muted); }

.site-nav { display: flex; gap: 4px; }
.site-nav a {
  position: relative;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
.site-nav a:hover { color: var(--ink); }
.site-nav a.is-current { color: var(--ink); }
.site-nav a.is-current::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.header-tools { display: flex; align-items: center; gap: 8px; }
.tool-search .kbd { margin-left: 6px; }

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(32px, 5vw, 72px);
  padding-block: clamp(40px, 5vw, 72px) clamp(36px, 4vw, 56px);
}

.kicker {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: -0.01em;
}
.pulse {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 0.5em;
  border-radius: 50%;
  background: var(--ok);
}
.pulse::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--ok);
  opacity: 0;
  animation: ping 2.4s var(--ease) infinite;
}

.hero h1 {
  font-size: clamp(2.6rem, 5.2vw, 4.75rem);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.042em;
  text-wrap: balance;
}
.h1-soft { color: var(--faint); }

.lede {
  max-width: 33em;
  margin-top: 28px;
  color: var(--ink-2);
  font-size: clamp(17px, 1.45vw, 19px);
  line-height: 1.55;
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.hero-stage {
  position: relative;
  aspect-ratio: 1 / 0.8;
  isolation: isolate;
}
.hero-stage::before {
  content: "";
  position: absolute;
  inset: 4% -2% 0 4%;
  z-index: -1;
  background-image: radial-gradient(var(--dots) 1px, transparent 1.3px);
  background-size: 16px 16px;
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent);
  mask-image: radial-gradient(closest-side, #000 55%, transparent);
}

.stage-shot {
  position: absolute;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
}
.stage-shot img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: left top;
  border-radius: 8px;
}
.stage-shot:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); z-index: 5; }
.stage-back { top: 0; right: 0; width: 78%; }
.stage-mid { top: 38%; left: 0; width: 52%; z-index: 2; }
.stage-front { right: 5%; bottom: 7%; width: 56%; z-index: 3; box-shadow: var(--shadow-lg); }
.stage-caption {
  position: absolute;
  left: 2%;
  bottom: 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
}

/* ---------- Live ledger ---------- */

.ledger {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block: 1px solid var(--line);
}
.ledger-cell {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 22px 24px 24px;
  border-left: 1px solid var(--line);
  text-decoration: none;
}
.ledger-cell:first-child { border-left: 0; padding-left: 0; }
.ledger-label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
}
.ledger-hint { color: var(--faint); }
.ledger-value {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font-size: clamp(30px, 3.2vw, 42px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.ledger-value small {
  color: var(--muted);
  font-size: 14px;
  font-weight: 450;
  letter-spacing: 0;
}
.ledger-value-sm { font-size: 20px; letter-spacing: -0.02em; }
.ledger-link { transition: background-color 0.2s var(--ease); }
.ledger-link:hover .ledger-value small { color: var(--accent); }

/* ---------- Sections ---------- */

.section { padding-top: clamp(88px, 11vw, 150px); }

.section-head {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr);
  align-items: baseline;
  column-gap: 24px;
  row-gap: 12px;
  padding-top: 20px;
  margin-bottom: clamp(36px, 5vw, 64px);
  border-top: 1px solid var(--ink);
}
.section-no {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}
.section-head h2 {
  font-size: clamp(2rem, 3.6vw, 3.1rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.section-lede {
  max-width: 34em;
  color: var(--muted);
  font-size: 16.5px;
  text-wrap: pretty;
}

/* ---------- Screenshot mats ---------- */

.mat {
  position: relative;
  display: block;
  border-radius: var(--r);
  background-color: var(--paper-2);
  background-image: radial-gradient(var(--dots) 1px, transparent 1.3px);
  background-size: 14px 14px;
  overflow: hidden;
}
.mat img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: left top;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
  background: var(--card);
}
.mat-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px dashed var(--line-2);
  border-radius: 6px;
  background: color-mix(in srgb, var(--card) 70%, transparent);
  color: var(--faint);
  text-align: center;
}
.mat-empty strong {
  color: var(--muted);
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 600;
  letter-spacing: -0.04em;
}
.mat-empty span { font-family: var(--mono); font-size: 12px; }

/* ---------- Feature spreads ---------- */

.features { display: grid; }

.feature {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  padding-block: clamp(36px, 5vw, 64px);
  border-top: 1px solid var(--line);
  border-radius: 2px;
  transition: outline-color 0.3s var(--ease);
}
.feature:first-child { border-top: 0; padding-top: 0; }
.feature:nth-child(even) { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.feature:nth-child(even) .feature-media { order: 2; }

.feature-media { cursor: pointer; }
.feature-media .mat { padding: clamp(14px, 3vw, 40px); }
.feature-media:hover .mat img { transform: translateY(-5px); box-shadow: var(--shadow); }

.feature-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.feature-no { color: var(--faint); font-family: var(--mono); font-size: 13px; }
.feature-no b { color: var(--accent); font-weight: 500; }

.feature h3 {
  font-size: clamp(1.8rem, 2.7vw, 2.5rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.feature-role {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}
.feature-desc {
  margin-top: 20px;
  color: var(--ink-2);
  font-size: 17px;
  text-wrap: pretty;
}
.feature-outcome {
  margin-top: 20px;
  padding-left: 16px;
  border-left: 2px solid var(--accent);
  color: var(--ink);
  font-size: 15.5px;
  text-wrap: pretty;
}
.feature .flow { margin-top: 24px; }
.feature-stack {
  margin-top: 14px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
}
.feature-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}
.feature-actions .btn { height: 42px; padding: 0 16px; font-size: 14.5px; }

/* Status chip */
.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}
.status-ms { color: var(--faint); }

/* Request flow chain */
.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
}
.flow li {
  display: inline-flex;
  align-items: center;
  color: var(--ink-2);
}
.flow li span {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
}
.flow li:not(:last-child)::after {
  content: "";
  width: 18px;
  height: 1px;
  margin-inline: 2px;
  background: var(--line-2);
}
.flow li:last-child span { border-color: var(--ink-2); color: var(--ink); }

/* ---------- Catalogue bar ---------- */

.catalog-bar {
  position: sticky;
  top: var(--header-h);
  z-index: var(--z-sticky);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-inline: calc(-1 * clamp(20px, 4vw, 48px));
  padding: 12px clamp(20px, 4vw, 48px);
  border-bottom: 1px solid transparent;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.catalog-bar.stuck {
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
}

.lenses { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 500;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.12s var(--ease);
}
.chip:hover { color: var(--ink); background: var(--paper-2); }
.chip:active { transform: translateY(1px); }
.chip.active { background: var(--ink); color: var(--paper); }
.chip-count {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.chip.active .chip-count { color: color-mix(in srgb, var(--paper) 62%, transparent); }

.catalog-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }

.health-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.hs-item { display: inline-flex; align-items: center; gap: 6px; }
.hs-muted { color: var(--faint); }
.hs-item.is-zero { display: none; }

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-2);
}
.view-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.view-chip svg { width: 15px; height: 15px; }
.view-chip:hover { color: var(--ink); }
.view-chip.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }

.lens-note {
  margin: 14px 0 28px;
  color: var(--muted);
  font-size: 14.5px;
}

/* ---------- Grid view ---------- */

.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 40px 24px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--r);
  cursor: pointer;
  outline: none;
}
.card .mat { padding: 10px; transition: background-color 0.3s var(--ease); }
.card:hover .mat img, .card:focus-within .mat img { transform: translateY(-4px); box-shadow: var(--shadow); }
.card:hover .card-title { color: var(--accent); }

.card-body { display: grid; gap: 4px; padding: 14px 2px 0; flex: 1; }
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.card-no { color: var(--faint); font-family: var(--mono); font-size: 12px; }
.card-pin { color: var(--accent); }
/* The title button is the card's real control; its ::after stretches over the whole card. */
.card-trigger {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  cursor: pointer;
}
.card-trigger::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--r);
}
.card-trigger:focus-visible { outline: none; }
.card-trigger:focus-visible::after { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent); }
.card-launch, .row-launch { position: relative; z-index: 1; }

.card-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  transition: color 0.2s var(--ease);
}
.card-role {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 2px 0;
  border-top: 1px solid var(--line);
}
.card-stack {
  min-width: 0;
  overflow: hidden;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.card-launch, .row-launch {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink-2);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.card-launch svg, .row-launch svg { width: 15px; height: 15px; }
.card-launch:hover, .row-launch:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- List view ---------- */

.view-list .board { display: block; }

.list-head, .row {
  display: grid;
  grid-template-columns: 44px minmax(0, 2.3fr) minmax(0, 1.7fr) minmax(0, 0.9fr) minmax(0, 1fr) 30px;
  align-items: center;
  gap: 16px;
}
.list-head {
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--ink);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
}
.row {
  position: relative;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  transition: background-color 0.15s var(--ease);
}
.row:hover { background: var(--card); }
.row:hover .row-name { color: var(--accent); }
.row .card-trigger::after { border-radius: var(--r-sm); }
.row .card-trigger:focus-visible::after { box-shadow: inset 0 0 0 2px var(--accent); }
.row-no { color: var(--faint); font-family: var(--mono); font-size: 12px; }
.row-main { display: grid; gap: 2px; min-width: 0; }
.row-name { font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; transition: color 0.2s var(--ease); }
.row-role, .row-stack, .row-access {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.row-role { color: var(--muted); font-size: 13.5px; }
.row-stack, .row-access { color: var(--muted); font-family: var(--mono); font-size: 12px; }

/* ---------- Infrastructure ---------- */

.arch {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 28px;
  padding: clamp(20px, 3vw, 36px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background-color: var(--paper-2);
  background-image: radial-gradient(var(--dots) 1px, transparent 1.3px);
  background-size: 16px 16px;
}
.arch-col {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}
.arch-stack {
  display: grid;
  align-content: center;
  gap: 10px;
}
.arch-col + .arch-col::before {
  content: "";
  position: absolute;
  top: calc(50% + 16px);
  left: -26px;
  width: 24px;
  height: 1px;
  background: var(--ink-2);
}
.arch-col + .arch-col::after {
  content: "";
  position: absolute;
  top: calc(50% + 16px);
  left: -6px;
  width: 6px;
  height: 6px;
  border-top: 1px solid var(--ink-2);
  border-right: 1px solid var(--ink-2);
  transform: translateY(-50%) rotate(45deg);
  transform-origin: center;
  margin-top: 0.5px;
}
.arch-step {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}
.arch-node {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.arch-node strong { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.arch-node span { color: var(--muted); font-family: var(--mono); font-size: 11.5px; line-height: 1.45; }
.arch-node-strong { border-color: var(--ink-2); }
.arch-node-accent { border-color: var(--accent); transition: background-color 0.2s var(--ease), transform 0.2s var(--ease); }
.arch-node-accent strong { color: var(--accent); }
.arch-node-accent:hover { background: var(--accent-soft); transform: translateY(-2px); }

.principles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px 28px;
  margin-top: clamp(40px, 5vw, 64px);
}
.principle { padding-top: 18px; border-top: 1px solid var(--line); }
.principle-no { color: var(--accent); font-family: var(--mono); font-size: 13px; }
.principle h3 {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}
.principle p { margin-top: 8px; color: var(--muted); font-size: 15px; text-wrap: pretty; }

/* ---------- Contact ---------- */

.contact { padding-top: clamp(100px, 13vw, 180px); padding-bottom: clamp(64px, 8vw, 110px); }
.contact-inner { padding-top: 20px; border-top: 1px solid var(--ink); }
.contact h2 {
  max-width: 13ch;
  margin-top: 28px;
  font-size: clamp(2.6rem, 6.6vw, 5.6rem);
  font-weight: 600;
  line-height: 0.96;
  letter-spacing: -0.048em;
  text-wrap: balance;
}
.contact-lede {
  max-width: 32em;
  margin-top: 24px;
  color: var(--ink-2);
  font-size: clamp(17px, 1.5vw, 19px);
}
.contact-email {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: 36px;
  color: var(--accent);
  font-size: clamp(1.5rem, 3.4vw, 2.6rem);
  font-weight: 550;
  letter-spacing: -0.03em;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  transition: text-decoration-color 0.2s var(--ease);
  overflow-wrap: anywhere;
}
.contact-email:hover { text-decoration-color: var(--accent); }
.contact-email svg { width: 0.8em; height: 0.8em; stroke-width: 1.8; transition: transform 0.3s var(--ease); }
.contact-email:hover svg { transform: translate(3px, -3px); }

.contact-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px 28px;
  margin-top: clamp(48px, 6vw, 80px);
}
.contact-facts div { padding-top: 14px; border-top: 1px solid var(--line); }
.contact-facts dt { color: var(--faint); font-family: var(--mono); font-size: 12px; }
.contact-facts dd { margin-top: 6px; color: var(--ink-2); font-size: 15px; }

/* ---------- Footer ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-block: 24px 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13.5px;
}
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--ink); }

/* ---------- Dossier ---------- */

.dossier-drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
  visibility: hidden;
  pointer-events: none;
}
.dossier-drawer.active { visibility: visible; pointer-events: auto; }

.dossier-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.dossier-drawer.active .dossier-backdrop { opacity: 1; }

.dossier-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(660px, 100%);
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform: translateX(104%);
  transition: transform 0.45s var(--ease);
}
.dossier-drawer.active .dossier-panel { transform: none; }

.dossier-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--line);
}
.dossier-heading { min-width: 0; }
.dossier-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}
#dossierNo { color: var(--accent); }
.dossier-title {
  margin-top: 6px;
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.03em;
}
.dossier-nav { display: flex; gap: 6px; }

.dossier-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 28px 36px;
}
.dossier-media { padding: 10px; }
.dossier-media img { aspect-ratio: auto; max-height: 420px; object-fit: contain; }

.dossier-status { margin-top: 20px; }
.dossier-lede {
  margin-top: 10px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.5;
  text-wrap: pretty;
}
.dossier-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
}
.dossier-outcome {
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 4px var(--r) var(--r) 4px;
  background: var(--card);
}
.dossier-outcome .dossier-label { margin-bottom: 6px; }
.dossier-outcome p { color: var(--ink); font-size: 15.5px; }

.dossier-section { margin-top: 32px; }

.flow-vertical { display: grid; row-gap: 0; }
.flow-vertical li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 0 14px 0;
}
.flow-vertical li::before {
  content: attr(data-step);
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-size: 11px;
  z-index: 1;
}
.flow-vertical li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 24px;
  bottom: 0;
  width: 1px;
  height: auto;
  margin: 0;
  background: var(--line-2);
}
.flow-vertical li:last-child { padding-bottom: 0; }
.flow-vertical li span { font-size: 12.5px; }

.spec-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
}
.spec-list div { padding-block: 11px; border-top: 1px solid var(--line); }
.spec-list dt { color: var(--faint); font-family: var(--mono); font-size: 11.5px; }
.spec-list dd { margin-top: 3px; color: var(--ink); font-size: 14.5px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list li {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12px;
}

.notes { display: grid; gap: 10px; counter-reset: note; }
.notes li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  color: var(--ink-2);
  font-size: 15px;
  counter-increment: note;
}
.notes li::before {
  content: counter(note, decimal-leading-zero);
  padding-top: 3px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11.5px;
}

.dossier-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 28px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.dossier-footer .btn { height: 42px; padding: 0 16px; font-size: 14.5px; }
.dossier-footer .btn-primary { margin-right: auto; }
#dossierPinBtn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* ---------- Terminal ---------- */

.terminal-drawer {
  --term-bg: #121311;
  --term-fg: #e2e0d8;
  --term-dim: #8a887f;
  --term-line: #262723;
  --term-green: #7bd39a;
  --term-blue: #9aa6ff;
  --term-red: #f07a68;
  --term-amber: #e6b25a;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-terminal);
  display: flex;
  flex-direction: column;
  height: min(48vh, 460px);
  background: var(--term-bg);
  color: var(--term-fg);
  border-top: 1px solid #2d2e2a;
  box-shadow: 0 -24px 60px -20px rgba(0, 0, 0, 0.45);
  font-family: var(--mono);
  transform: translateY(102%);
  visibility: hidden;
  transition: transform 0.4s var(--ease), visibility 0s linear 0.4s;
}
.terminal-drawer.active { transform: none; visibility: visible; transition: transform 0.4s var(--ease); }

.terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 44px;
  padding: 0 16px 0 18px;
  border-bottom: 1px solid var(--term-line);
  font-size: 12.5px;
}
.terminal-controls { display: flex; align-items: center; gap: 7px; }
.terminal-controls strong { margin-left: 8px; color: var(--term-dim); font-weight: 500; }
.term-dot { width: 10px; height: 10px; border-radius: 50%; background: #3a3b36; }
.terminal-actions { display: flex; align-items: center; gap: 16px; }
.term-hint { color: var(--term-dim); }
.term-hint code { color: var(--term-fg); }
.term-close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--term-line);
  border-radius: 7px;
  background: transparent;
  color: var(--term-fg);
  font-size: 12px;
}
.term-close:hover { border-color: #45463f; }
.kbd-dark { background: #1d1e1b; border-color: #3a3b36; color: var(--term-dim); }

.terminal-body { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 14px 18px 12px; }
.terminal-output {
  flex: 1;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.term-line { min-height: 1.6em; }
.term-cmd { margin-top: 6px; color: var(--term-fg); }
.term-prompt { color: var(--term-green); }
.term-accent { color: var(--term-blue); }
.term-success { color: var(--term-green); }
.term-cmd-name { color: var(--term-amber); }
.term-err { color: var(--term-dim); }
.term-bad { color: var(--term-red); }
.term-dim { color: var(--term-dim); }
.term-name { color: var(--term-fg); }
.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--term-line);
  font-size: 13.5px;
}
.term-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--term-fg);
  font-family: var(--mono);
  caret-color: var(--term-green);
}
.term-input::placeholder { color: #55564f; }

/* ---------- Tour HUD ---------- */

.tour-hud {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: var(--z-hud);
  width: min(780px, calc(100% - 32px));
  overflow: hidden;
  border-radius: var(--r-lg);
  background: #171715;
  color: #eceae3;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
  opacity: 0;
  transform: translate(-50%, 20px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0s linear 0.3s;
}
.tour-hud.active {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
  visibility: visible;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.tour-progress { height: 2px; background: rgba(255, 255, 255, 0.08); }
.tour-progress-bar { width: 0; height: 100%; background: #9aa6ff; transition: width 0.1s linear; }
.tour-hud-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 16px 16px 22px;
}
.tour-info { flex: 1; min-width: 0; }
.tour-counter { color: #8f8d85; font-family: var(--mono); font-size: 12px; }
.tour-title { margin-top: 2px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.tour-narration { margin-top: 4px; color: #b5b3ab; font-size: 14px; line-height: 1.5; }
.tour-controls { display: flex; align-items: center; gap: 6px; }
.icon-btn-dark { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.1); color: #d8d6ce; }
.icon-btn-dark:hover { border-color: rgba(255, 255, 255, 0.24); color: #fff; }
.tour-inspect {
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: #eceae3;
  color: #141412;
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  transition: background-color 0.2s var(--ease);
}
.tour-inspect:hover { background: #fff; }

/* The dossier's own footer sits where the HUD floats; hide the HUD until it closes. */
body.dossier-open .tour-hud.active {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.tour-spotlight { position: relative; }
.tour-spotlight::after {
  content: "";
  position: absolute;
  inset: 12px -16px;
  border: 2px solid var(--accent);
  border-radius: var(--r-lg);
  pointer-events: none;
  animation: spotlight 0.5s var(--ease) both;
}
.feature.tour-spotlight::after { inset: 16px -20px; }
.feature:first-child.tour-spotlight::after { top: -20px; }
.card.tour-spotlight::after { inset: -10px; }

/* ---------- Modals & palette ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--backdrop);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s var(--ease), visibility 0s linear 0.2s;
}
.modal.show { opacity: 1; visibility: visible; transition: opacity 0.2s var(--ease); }
.modal-top { align-items: start; padding-top: min(14vh, 120px); }

.modal-panel, .palette-panel {
  width: min(560px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(0.985);
  transition: transform 0.25s var(--ease);
}
.modal.show .modal-panel, .modal.show .palette-panel { transform: none; }
.modal-panel { padding: 22px 24px 24px; }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.modal-title { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.modal-copy { margin-top: 4px; color: var(--muted); font-size: 14.5px; }

.shortcut-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 10px;
  border-top: 1px solid var(--line);
}
.shortcut-list dt { color: var(--ink-2); font-size: 14.5px; }
.shortcut-list dd { display: flex; align-items: center; gap: 4px; color: var(--faint); font-size: 12px; }

.stack-list { display: grid; }
.stack-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding-block: 16px;
  border-top: 1px solid var(--line);
}
.stack-row strong { font-size: 15.5px; font-weight: 600; }
.stack-row p { margin-top: 2px; color: var(--muted); font-size: 14px; }
.stack-actions { display: flex; gap: 8px; }
.stack-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}
.stack-links a {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card);
  color: var(--ink-2);
  font-size: 13px;
  text-decoration: none;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.stack-links a:hover { border-color: var(--ink-2); color: var(--ink); }

.palette-panel { width: min(640px, 100%); display: flex; flex-direction: column; overflow: hidden; }
.palette-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.palette-head svg { width: 19px; height: 19px; }
.palette-input {
  flex: 1;
  min-width: 0;
  height: 58px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
}
.palette-input::placeholder { color: var(--faint); }
.palette-body { max-height: min(56vh, 480px); overflow-y: auto; padding: 8px; }
.palette-group {
  padding: 10px 10px 6px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11.5px;
}
.palette-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
}
.palette-row.active { background: var(--paper-2); }
.palette-row.active .palette-name { color: var(--accent); }
.palette-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}
.palette-row .dot { justify-self: center; }
.palette-name { font-size: 14.5px; font-weight: 500; }
.palette-url {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.palette-tags { color: var(--faint); font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.palette-empty { padding: 28px 12px; color: var(--muted); text-align: center; font-size: 14.5px; }
.palette-foot {
  display: flex;
  gap: 18px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
}
.palette-foot span { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  left: 50%;
  z-index: var(--z-toast);
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, -8px);
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Reveal motion ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.js .reveal.is-in { opacity: 1; transform: none; }

@keyframes ping {
  0% { transform: scale(0.5); opacity: 0.55; }
  70%, 100% { transform: scale(1.5); opacity: 0; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spotlight {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .arch { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .arch-col:nth-child(4)::before, .arch-col:nth-child(4)::after { display: none; }
  .principles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
  .site-nav { display: none; }
  .hero { grid-template-columns: 1fr; }
  .hero h1 { font-size: clamp(2.35rem, 8.2vw, 4.4rem); }
  .hero-stage { max-width: 720px; width: 100%; justify-self: center; aspect-ratio: 1 / 0.72; }
  .feature, .feature:nth-child(even) { grid-template-columns: 1fr; }
  .feature:nth-child(even) .feature-media { order: 0; }
  .section-head { grid-template-columns: 48px minmax(0, 1fr); }
  .section-lede { grid-column: 2; }
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger-cell:nth-child(3) { border-left: 0; padding-left: 0; }
  .ledger-cell:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .list-head, .row { grid-template-columns: 36px minmax(0, 2fr) minmax(0, 1fr) 30px; }
  .list-head .col-stack, .list-head .col-access, .row-stack, .row-access { display: none; }
}

@media (max-width: 720px) {
  :root { --header-h: 58px; }
  .wordmark-text span { display: none; }
  .tool-search .tool-label, .tool-search .kbd { display: none; }
  .tool-search { width: 36px; padding: 0; justify-content: center; }
  .hero-stage { aspect-ratio: 1 / 0.8; }
  .stage-mid { display: none; }
  .stage-back { width: 86%; }
  .stage-front { width: 70%; right: 0; bottom: 8%; }
  .catalog-bar { position: static; }
  .catalog-tools { width: 100%; justify-content: space-between; }
  .health-summary { width: 100%; }
  .arch { grid-template-columns: 1fr; gap: 30px; }
  .arch-col + .arch-col::before {
    top: -22px; left: 24px;
    width: 1px; height: 14px;
  }
  .arch-col + .arch-col::after {
    top: -10px; left: 21.5px;
    transform: rotate(135deg);
  }
  .arch-col:nth-child(4)::before, .arch-col:nth-child(4)::after { display: block; }
  .principles, .contact-facts { grid-template-columns: 1fr; }
  .contact-facts { gap: 0; }
  .contact-facts div { padding-block: 14px; }
  .list-head { display: none; }
  .list-head, .row { grid-template-columns: 28px minmax(0, 1fr) 30px; gap: 12px; }
  .row { padding-inline: 4px; }
  .row-status { grid-column: 2; grid-row: 2; margin-top: -6px; }
  .spec-list { grid-template-columns: 1fr; }
  .dossier-header, .dossier-scroll, .dossier-footer { padding-inline: 18px; }
  .dossier-footer .btn { flex: 1; }
  .dossier-footer .btn-primary { flex-basis: 100%; margin-right: 0; }
  .term-hint { display: none; }
  .tour-hud-inner { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 14px 14px 16px; }
  .tour-controls { justify-content: space-between; }
  .tour-inspect { flex: 1; }
  .stack-actions { width: 100%; }
  .stack-actions .btn { flex: 1; }
}

@media (max-width: 420px) {
  .hero h1 { font-size: 2.35rem; }
  .ledger { grid-template-columns: 1fr; }
  .ledger-cell, .ledger-cell:nth-child(3) { border-left: 0; padding-left: 0; }
  .ledger-cell + .ledger-cell { border-top: 1px solid var(--line); }
  .feature-actions .btn { flex: 1; }
}

@media (hover: none) {
  .stage-shot:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}
