/* ============================================================
   farrier-kit — the bench

   The ForgeSworn house type system (forgesworn.dev/DESIGN.md) on
   farrier-kit's own palette: cold steel ground, one forge orange.

   The colour rule, and it is the whole rule: **orange is the kit,
   green and red are verdicts.** Nothing else on this page is
   coloured. A page whose subject is "did this check pass?" cannot
   afford decorative hues competing with the two that mean something.

   Every font is served from this domain. Nothing third-party loads.
   ============================================================ */

/* ── faces ────────────────────────────────────────────────── */

@font-face {
  font-family: 'Fraunces';
  src: url('./fonts/fraunces-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-stretch: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('./fonts/fraunces-italic-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('./fonts/inter-latin.woff2') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('./fonts/jetbrains-mono-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ── tokens ───────────────────────────────────────────────── */

:root {
  --bg: #0c0d10;
  --panel: #131519;
  --card: #191c21;
  --line: #282c33;
  --line-soft: #1e2127;

  --ink: #eceef2;
  --ink-dim: #b8bec8;
  --ink-mute: #8e96a3;

  --forge: #f2913d;
  --forge-lift: #f7ab66;
  --forge-dim: #a85f22;
  --on-forge: #1a0f04;

  /* Verdicts. Used on chips and rules only, never on prose. */
  --pass: #4ec9a0;
  --pass-bg: rgba(78, 201, 160, 0.09);
  --fail: #f0736a;
  --fail-bg: rgba(240, 115, 106, 0.09);

  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter', ui-sans-serif, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --text-lede: clamp(1.18rem, 1.5vw, 1.34rem);
  --text: 1.0625rem;
  --text-detail: 0.98rem;

  --measure: 66ch;
  --wrap: 1080px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --radius: 10px;
  --radius-sm: 6px;
}

/* ── base ─────────────────────────────────────────────────── */

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

html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-optical-sizing: auto;
  font-size: var(--text);
  line-height: 1.7;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
}

/* Atmosphere: hammer marks on cold steel. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 78% -6%, rgba(242, 145, 61, 0.05), transparent 70%),
    repeating-linear-gradient(118deg, transparent 0 26px, rgba(236, 238, 242, 0.008) 26px 27px);
}

main, header, footer { position: relative; z-index: 1; }

::selection { background: var(--forge); color: var(--on-forge); }

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--forge-dim);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}
a:hover { color: var(--forge); text-decoration-color: var(--forge); }

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

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 0.1em 0.4em;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* ── the display face ─────────────────────────────────────── */

h1, h2, h3,
.lede,
.aside,
.spec-row dt,
.colophon-note {
  font-family: var(--serif);
  letter-spacing: -0.012em;
}

h1 { font-weight: 500; font-variation-settings: 'opsz' 144; }
h2 { font-weight: 470; font-variation-settings: 'opsz' 60; }
h3 { font-weight: 520; font-variation-settings: 'opsz' 32; }

.section-body em,
.spec-row dd em,
.aside em {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.06em;
  color: var(--ink);
}

/* ── masthead ─────────────────────────────────────────────── */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 3.75rem;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.26em;
  text-decoration: none;
  color: var(--ink);
}
.wordmark svg { color: var(--forge); flex: none; }
.wordmark:hover { color: var(--forge); }

.masthead-nav {
  display: flex;
  gap: clamp(0.9rem, 2.4vw, 1.7rem);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}
.masthead-nav a { color: var(--ink-mute); text-decoration: none; }
.masthead-nav a:hover { color: var(--forge); }
.masthead-nav .ext::after { content: ' ↗'; color: var(--ink-mute); }

/* ── hero ─────────────────────────────────────────────────────
   Deliberately short. The bench below is the argument; this is only
   long enough to say what the thing is before you start using it. */

.hero {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(3rem, 8vh, 5rem) var(--gutter) clamp(1.5rem, 4vh, 2.5rem);
}

.kicker {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--forge);
  margin-bottom: 1.2rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 5.4vw, 4.1rem);
  line-height: 1.05;
  letter-spacing: -0.018em;
  margin-bottom: 1.3rem;
  text-wrap: balance;
}
.hero h1 em { font-style: italic; font-weight: 430; color: var(--forge); }

.lede {
  font-size: var(--text-lede);
  line-height: 1.52;
  max-width: 62ch;
  color: var(--ink-dim);
  margin-bottom: 1.7rem;
}
.lede strong { color: var(--ink); font-weight: 500; }

.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; margin-bottom: 1.2rem; }

.install {
  font-family: var(--mono);
  font-size: 0.85rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.1rem;
  color: var(--ink-dim);
  user-select: all;
}

.hero-meta {
  font-family: var(--mono);
  font-size: 0.73rem;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}

/* ── buttons ──────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: none;
  color: var(--ink-dim);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn-primary { background: var(--forge); border-color: var(--forge); color: var(--on-forge); font-weight: 600; }
.btn-primary:hover { background: var(--forge-lift); border-color: var(--forge-lift); color: var(--on-forge); }
.btn-ghost { border-color: var(--line); color: var(--ink-dim); }
.btn-ghost:hover { border-color: var(--forge-dim); color: var(--forge); }
.btn-quiet { color: var(--ink-mute); }
.btn-quiet:hover { color: var(--forge); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ── sections ─────────────────────────────────────────────── */

.section { max-width: var(--wrap); margin: 0 auto; padding: clamp(3rem, 8vh, 5rem) var(--gutter) 0; }
.section[id] { scroll-margin-top: 4.5rem; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
  margin-bottom: clamp(1.2rem, 3vh, 1.9rem);
}
.section-no { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.14em; color: var(--forge); flex: none; }
.section-head h2 { font-size: clamp(1.65rem, 3.3vw, 2.3rem); letter-spacing: -0.014em; }

.section-body p { max-width: var(--measure); color: var(--ink-dim); }
.section-body p + p { margin-top: 1rem; }
.section-body strong { color: var(--ink); font-weight: 600; }
.section-lede {
  font-size: var(--text-lede);
  line-height: 1.55;
  color: var(--ink-dim);
  max-width: 64ch;
  margin-bottom: 1.4rem;
}

.spec-rows { display: block; margin-top: 1.4rem; }
.spec-row {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: 1rem 2.5rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line-soft);
}
.spec-row:last-child { border-bottom: 1px solid var(--line-soft); }
.spec-row dt { font-style: italic; font-weight: 450; font-size: 1.16rem; color: var(--forge); }
.spec-row dt code {
  font-style: normal;
  font-size: 0.92rem;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}
.spec-row dd { color: var(--ink-dim); max-width: var(--measure); font-size: var(--text-detail); }

.aside {
  font-style: italic;
  font-size: var(--text-detail);
  line-height: 1.68;
  color: var(--ink-mute);
  max-width: var(--measure);
  margin-top: 1.7rem;
  padding-left: 1.1rem;
  border-left: 2px solid var(--forge-dim);
}
.aside strong { color: var(--ink-dim); font-style: normal; font-weight: 600; }

/* A class, not a style attribute: this page's CSP is style-src 'self', which
   blocks inline style attributes outright. */
.section-gap { margin-top: 2.8rem; }

.ticks { list-style: none; font-size: var(--text-detail); color: var(--ink-dim); }
.ticks li { padding: 0.5rem 0 0.5rem 1.6rem; position: relative; border-bottom: 1px solid var(--line-soft); }
.ticks li::before { content: '×'; position: absolute; left: 0.3rem; color: var(--fail); font-family: var(--mono); }

.doc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  margin-top: 1.1rem;
}

/* ── the bench ────────────────────────────────────────────────
   The page's centre of gravity, so it breaks the family's section
   rhythm on purpose: it is a workbench, not another prose block. */

.bench {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.bench-frame {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.bench-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.bench-tabs button {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  padding: 0.85rem 1.15rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}
.bench-tabs button:hover { color: var(--ink-dim); }
.bench-tabs button[aria-selected='true'] { color: var(--forge); border-bottom-color: var(--forge); }

.bench-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
/* A class selector beats the UA sheet's [hidden] rule, so `display: grid` above
   would otherwise keep every panel on screen at once. */
.bench-panel[hidden] { display: none; }
.bench-in { padding: 1.4rem; border-right: 1px solid var(--line); }
.bench-out { padding: 1.4rem; background: var(--bg); min-height: 22rem; }

.field { display: block; margin-bottom: 0.9rem; }
.field > span {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
  margin-bottom: 0.4rem;
}
.field input,
.field textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  padding: 0.62rem 0.7rem;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  resize: vertical;
  word-break: break-all;
}
.bench-in .field input,
.bench-in .field textarea { background: var(--card); }
.field input:focus, .field textarea:focus { outline: 2px solid var(--forge); outline-offset: 1px; }

.hint { font-size: 0.84rem; color: var(--ink-mute); margin-top: 0.8rem; }
.hint code { font-size: 0.8em; }

/* ── verdicts ─────────────────────────────────────────────── */

.verdict {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  margin-bottom: 1rem;
}
.verdict-pass { color: var(--pass); border-color: color-mix(in srgb, var(--pass) 40%, transparent); background: var(--pass-bg); }
.verdict-fail { color: var(--fail); border-color: color-mix(in srgb, var(--fail) 40%, transparent); background: var(--fail-bg); }
.verdict-idle { color: var(--ink-mute); border-color: var(--line); }

.verdict-why {
  font-family: var(--sans);
  font-size: var(--text-detail);
  line-height: 1.6;
  color: var(--ink-dim);
  margin-bottom: 1.1rem;
  max-width: 52ch;
}
.verdict-why strong { color: var(--ink); font-weight: 600; }

/* The decoded fields. A definition list rather than a table: the value
   is the thing you came for, so it gets the width. */
.fields { font-family: var(--mono); font-size: 0.78rem; }
.fields div {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 0.5rem 1rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line-soft);
}
.fields dt { color: var(--ink-mute); letter-spacing: 0.06em; }
.fields dd { color: var(--ink-dim); word-break: break-all; }
.fields dd.null { color: var(--ink-mute); font-style: italic; }
.fields dd.hot { color: var(--forge); }

.bench-empty {
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--ink-mute);
  max-width: 46ch;
}

/* ── conformance ──────────────────────────────────────────── */

.vec-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; margin-bottom: 1.4rem; }
.vec-total {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
}
.vec-total.pass { color: var(--pass); }
.vec-total.fail { color: var(--fail); }

.vec-rows { display: block; }
.vec-row {
  display: grid;
  grid-template-columns: 14rem 1fr auto;
  align-items: baseline;
  gap: 0.6rem 1.5rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 0.78rem;
}
.vec-row:last-child { border-bottom: 1px solid var(--line-soft); }
.vec-file { color: var(--ink-dim); letter-spacing: 0.04em; }
.vec-what { font-family: var(--sans); font-size: var(--text-detail); color: var(--ink-mute); }
.vec-count { color: var(--ink-mute); letter-spacing: 0.08em; white-space: nowrap; }
.vec-count.pass { color: var(--pass); }
.vec-count.fail { color: var(--fail); }
.vec-fails {
  grid-column: 1 / -1;
  color: var(--fail);
  background: var(--fail-bg);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── the rail ─────────────────────────────────────────────── */

.family-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; margin-top: 1.4rem; }
.family-card {
  display: block;
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.3rem 1.5rem;
  transition: border-color 150ms ease;
}
a.family-card:hover { border-color: var(--forge-dim); }
a.family-card:hover h3 { color: var(--forge); }
.family-card.current { border-style: dashed; border-color: var(--forge-dim); }
.family-ring { display: inline-block; width: 0.85rem; height: 0.85rem; border-radius: 50%; margin-bottom: 0.85rem; }
.ring-farrier { border: 3px solid var(--forge); }
.ring-nwc { border: 3px solid #a78bfa; }
.ring-toll { border: 3px solid #4ec9b0; }
.ring-mcp { border: 3px solid #e78fb3; }
.family-card h3 { font-size: 1.1rem; margin-bottom: 0.4rem; color: var(--ink); transition: color 150ms ease; }
.family-card p { font-size: 0.92rem; color: var(--ink-dim); }
.family-card .npm {
  display: block;
  margin-top: 0.7rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}

/* ── colophon ─────────────────────────────────────────────── */

.colophon { max-width: var(--wrap); margin: 0 auto; padding: clamp(3rem, 8vh, 5rem) var(--gutter) 3rem; }
.colophon-links {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
  margin-bottom: 0.8rem;
}
.colophon-links a { color: var(--ink-dim); text-decoration: none; }
.colophon-links a:hover { color: var(--forge); }
.colophon-note { font-style: italic; font-size: 0.92rem; line-height: 1.65; color: var(--ink-mute); max-width: var(--measure); }

/* ── responsive ───────────────────────────────────────────── */

@media (max-width: 980px) {
  .family-row { grid-template-columns: repeat(2, 1fr); }
  .bench-panel { grid-template-columns: 1fr; }
  .bench-in { border-right: none; border-bottom: 1px solid var(--line); }
  .bench-out { min-height: 0; }
}

@media (max-width: 820px) {
  .vec-row { grid-template-columns: 1fr auto; }
  .vec-what { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .masthead-inner { height: auto; padding-block: 0.7rem; flex-wrap: wrap; }
  .masthead-nav { flex-wrap: wrap; gap: 0.8rem; }
  .masthead-nav .nav-mobile-hide { display: none; }
  .spec-row { grid-template-columns: 1fr; gap: 0.35rem; }
  .family-row { grid-template-columns: 1fr; }
  .fields div { grid-template-columns: 1fr; gap: 0.15rem; }
}

/* ── motion ───────────────────────────────────────────────── */

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.reveal { animation: rise 0.7s cubic-bezier(0.2, 0.6, 0.2, 1) both; }
.r1 { animation-delay: 0.05s; }
.r2 { animation-delay: 0.14s; }
.r3 { animation-delay: 0.24s; }
.r4 { animation-delay: 0.34s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { animation: none; }
  .btn, a, .family-card, .bench-tabs button { transition: none; }
}

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .section-head,
    .section-body > *,
    .section > .aside,
    .spec-row,
    .vec-row,
    .family-card {
      /* Longhand on purpose: animation-timeline is a reset-only part of the
         `animation` shorthand, so a shorthand added above this would wipe the
         timeline out and hide the block for good. */
      animation-name: rise;
      animation-duration: 1s;
      animation-timing-function: cubic-bezier(0.2, 0.6, 0.2, 1);
      animation-fill-mode: both;
      animation-timeline: view();
      animation-range: cover 0% cover 340px;
    }
    /* The bench is a tool. Nothing in it moves under a pointer already on
       its way to a field. */
    .bench, .bench * { animation-name: none; }
  }
}

@media (prefers-reduced-motion: no-preference) and (min-width: 641px) {
  @supports (animation-timeline: view()) {
    .family-row > :nth-child(2) { animation-range: cover 40px cover 380px; }
    .family-row > :nth-child(3) { animation-range: cover 80px cover 420px; }
    .family-row > :nth-child(4) { animation-range: cover 120px cover 460px; }
  }
}
