/* ==========================================================================
   VibeScale — design system
   Concept: "The Annotated System" — a precise engineering document.
   Cool paper, deep spruce ink, signal-orange accents, graph-grid textures,
   monospace annotations, numbered sections, schematic SVG imagery.
   ========================================================================== */

:root {
  /* color */
  --paper: #f2f5f2;
  --paper-2: #e8ede9;
  --ink: #0f2424;
  --ink-2: #1b3636;
  --ink-3: #2a4a48;
  --muted: #51625e;
  --line: rgba(15, 36, 36, 0.16);
  --line-strong: rgba(15, 36, 36, 0.55);
  --grid-line: rgba(15, 36, 36, 0.055);
  --grid-line-dark: rgba(242, 245, 242, 0.06);
  --accent: #f04a0e;
  --accent-deep: #c93a06;
  --on-accent: #fff;
  --on-ink-strong: #fff;
  --steel: #3e6a63;
  --danger: #b3261e;

  /* type */
  --font-sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* layout */
  --wrap: 1180px;
  --pad: clamp(20px, 5vw, 48px);
  --gap: clamp(16px, 2.2vw, 28px);
  --section-y: clamp(56px, 9vw, 112px);
}

:root[data-theme="cobalt"] {
  --paper: #f6f4ee;
  --paper-2: #e9e5da;
  --ink: #111827;
  --ink-2: #263241;
  --ink-3: #374151;
  --muted: #68707a;
  --line: rgba(17, 24, 39, 0.16);
  --line-strong: rgba(17, 24, 39, 0.55);
  --grid-line: rgba(17, 24, 39, 0.06);
  --grid-line-dark: rgba(246, 244, 238, 0.075);
  --accent: #2457ff;
  --accent-deep: #1738b8;
  --on-accent: #fff;
  --on-ink-strong: #fff;
  --steel: #b6d900;
}

:root[data-theme="teal-magenta"] {
  --paper: #f3f8f7;
  --paper-2: #dfecea;
  --ink: #062b2f;
  --ink-2: #164449;
  --ink-3: #24575c;
  --muted: #5d7375;
  --line: rgba(6, 43, 47, 0.16);
  --line-strong: rgba(6, 43, 47, 0.55);
  --grid-line: rgba(6, 43, 47, 0.06);
  --grid-line-dark: rgba(243, 248, 247, 0.075);
  --accent: #e23dd2;
  --accent-deep: #b122a5;
  --on-accent: #fff;
  --on-ink-strong: #fff;
  --steel: #00a99d;
}

:root[data-theme="teal-orchid"] {
  --paper: #f3f8f7;
  --paper-2: #dfecea;
  --ink: #062b2f;
  --ink-2: #164449;
  --ink-3: #24575c;
  --muted: #5d7375;
  --line: rgba(6, 43, 47, 0.16);
  --line-strong: rgba(6, 43, 47, 0.55);
  --grid-line: rgba(6, 43, 47, 0.06);
  --grid-line-dark: rgba(243, 248, 247, 0.075);
  --accent: #c75ac7;
  --accent-deep: #9d369e;
  --on-accent: #fff;
  --on-ink-strong: #fff;
  --steel: #00a99d;
}

:root[data-theme="mist-coral"] {
  --paper: #f4f7f8;
  --paper-2: #e7eef1;
  --ink: #10212b;
  --ink-2: #243b47;
  --ink-3: #35515f;
  --muted: #60727b;
  --line: rgba(16, 33, 43, 0.14);
  --line-strong: rgba(16, 33, 43, 0.52);
  --grid-line: rgba(16, 33, 43, 0.052);
  --grid-line-dark: rgba(244, 247, 248, 0.075);
  --accent: #e85d4f;
  --accent-deep: #c63e34;
  --on-accent: #fff;
  --on-ink-strong: #fff;
  --steel: #577783;
}

:root[data-font="plus-jakarta"] {
  --font-sans: "Plus Jakarta Sans", "Helvetica Neue", Arial, sans-serif;
}

:root[data-font="roboto-flex"] {
  --font-sans: "Roboto Flex", "Helvetica Neue", Arial, sans-serif;
}

:root[data-font="noto-sans"] {
  --font-sans: "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, p, ul, ol, dl, figure { margin: 0; }

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

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; font-family: var(--font-mono); font-size: 0.8125rem;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- type scale ---------- */
.display, h1 {
  font-weight: 640;
  font-variation-settings: "wdth" 118;
  letter-spacing: -0.015em;
  line-height: 1.04;
  font-size: clamp(2.5rem, 6.4vw, 4.4rem);
  text-wrap: balance;
}
h2 {
  font-weight: 620;
  font-variation-settings: "wdth" 114;
  letter-spacing: -0.01em;
  line-height: 1.12;
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  text-wrap: balance;
}
h3 {
  font-weight: 600;
  font-variation-settings: "wdth" 110;
  line-height: 1.22;
  font-size: clamp(1.2rem, 2vw, 1.45rem);
}
h4, .h4 {
  font-weight: 600;
  font-variation-settings: "wdth" 108;
  line-height: 1.3;
  font-size: 1.0625rem;
  letter-spacing: normal;
}
.lede {
  font-size: clamp(1.125rem, 1.8vw, 1.3rem);
  line-height: 1.55;
  max-width: 46ch;
  color: var(--ink-2);
}
.measure { max-width: 64ch; }
.measure-wide { max-width: 80ch; }
.measure-full { max-width: none; }
.lede-following { margin-top: 20px; }
.lede-before-grid { margin-bottom: 20px; }
.mono, .meta {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}
.meta { color: var(--muted); text-transform: uppercase; }

/* ---------- layout primitives ---------- */
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--pad); }
.section { padding-block: var(--section-y); }
.section-tight { padding-block: clamp(36px, 5vw, 64px); }

.bg-grid {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
}
.band-dark {
  background-color: var(--ink);
  color: var(--paper);
}
.band-dark.bg-grid {
  background-image:
    linear-gradient(var(--grid-line-dark) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line-dark) 1px, transparent 1px);
}
.band-tint { background: var(--paper-2); }

/* section header: [ 01 ] — TITLE ————————— */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: clamp(28px, 4vw, 48px);
}
.sec-index {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent-deep);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.sec-index::before { content: "[ "; color: var(--muted); }
.sec-index::after { content: " ]"; color: var(--muted); }
.section-head .sec-rule {
  flex: 1;
  height: 1px;
  background: var(--line);
  align-self: center;
  min-width: 40px;
}
.section-head .sec-kicker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}
@media (max-width: 720px) {
  .section-head .sec-kicker, .section-head .sec-rule { display: none; }
}

/* grids */
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) and (min-width: 641px) {
  /* avoid a half-width orphan card in 2-column mode */
  .grid-3 > :last-child:nth-child(odd),
  .grid-4 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 680;
  font-variation-settings: "wdth" 118;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}
.brand-mark { width: 26px; height: 26px; flex: none; }
.site-nav { display: flex; align-items: center; margin-left: auto; }
.nav-list {
  display: flex;
  gap: clamp(8px, 1.6vw, 22px);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list a {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  color: var(--ink-2);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-list a:hover { color: var(--ink); border-bottom-color: var(--line-strong); }
.nav-list a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

.theme-switcher,
.font-switcher {
  display: inline-flex;
  align-items: center;
}
.theme-switcher select,
.font-switcher select {
  appearance: none;
  min-width: 116px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  background:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%) right 15px center / 5px 5px no-repeat,
    linear-gradient(135deg, var(--ink) 50%, transparent 50%) right 10px center / 5px 5px no-repeat,
    var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 8px 30px 8px 10px;
  cursor: pointer;
}
.font-switcher select {
  min-width: 128px;
}
.theme-switcher select:hover,
.font-switcher select:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.theme-switcher select:focus,
.font-switcher select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  background: none;
  border: 1px solid var(--line-strong);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  cursor: pointer;
}
.nav-toggle-bars {
  position: relative;
  width: 16px; height: 2px;
  background: var(--ink);
  transition: background 0.15s ease;
}
.nav-toggle-bars::before, .nav-toggle-bars::after {
  content: "";
  position: absolute; left: 0;
  width: 16px; height: 2px;
  background: var(--ink);
  transition: transform 0.2s ease;
}
.nav-toggle-bars::before { top: -5px; }
.nav-toggle-bars::after { top: 5px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-5px) rotate(-45deg); }

@media (max-width: 880px) {
  .nav-toggle { display: inline-flex; }
  .nav-list {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line-strong);
    padding: 8px 0 16px;
  }
  .nav-list.open { display: flex; }
  .nav-list li { border-top: 1px solid var(--line); }
  .nav-list a {
    display: block;
    padding: 14px var(--pad);
    font-size: 0.85rem;
    border-bottom: none;
    border-left: 3px solid transparent;
  }
  .nav-list a[aria-current="page"] { border-left-color: var(--accent); }
}

/* ---------- breadcrumb ---------- */
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-block: 18px 0;
}
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.breadcrumb li + li::before { content: "/"; margin-right: 8px; color: var(--line-strong); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb [aria-current="page"] { color: var(--ink-2); }

/* ---------- hero ---------- */
.hero { padding-block: clamp(30px, 5vw, 56px) clamp(30px, 5vw, 56px); position: relative; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
.hero .kicker { margin-bottom: 22px; }
.hero h1 { margin-bottom: 22px; }
.hero .lede { margin-bottom: 36px; }
.hero-figure { position: relative; }
@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-figure { max-width: 480px; }
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.kicker::before {
  content: "";
  width: 9px; height: 9px;
  background: var(--accent);
  flex: none;
}

/* page title block (interior pages) */
.page-title { padding-block: clamp(36px, 5vw, 64px) clamp(36px, 5vw, 64px); }
.page-title h1 { margin-bottom: 18px; }
.page-title .lede { max-width: 56ch; }

/* ---------- buttons ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  text-decoration: none;
  padding: 15px 24px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.btn::after { content: "→"; transition: transform 0.15s ease; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:hover::after { transform: translateX(4px); }
.btn-primary { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--on-accent); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-plain { border: none; padding: 15px 4px; }
.btn-plain:hover { background: transparent; color: var(--accent-deep); }
.band-dark .btn { border-color: var(--paper); color: var(--paper); }
.band-dark .btn:hover { background: var(--paper); color: var(--ink); }
.band-dark .btn-primary { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--on-accent); }
.band-dark .btn-primary:hover { background: var(--paper); border-color: var(--paper); color: var(--ink); }

/* text link */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.link-arrow::after { content: "→"; color: var(--accent-deep); transition: transform 0.15s ease; }
.link-arrow:hover { color: var(--accent-deep); border-color: var(--accent); }
.link-arrow:hover::after { transform: translateX(4px); }

/* ---------- cards ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: clamp(22px, 3vw, 32px);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.card::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px;
  width: 34px; height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
.card:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px);
  box-shadow: 0 14px 30px -18px rgba(15, 36, 36, 0.35);
}
.card:hover::before { transform: scaleX(1); }
.card .card-index {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.card .card-index b { color: var(--accent-deep); font-weight: 500; }
.card h3 a, .card h4 a, .card .h4 a { text-decoration: none; color: inherit; }
.card h3 a:hover, .card h4 a:hover, .card .h4 a:hover { color: var(--accent-deep); }
.card p { color: var(--ink-2); font-size: 0.97rem; }
.card .link-arrow { margin-top: auto; align-self: flex-start; }
.card-link-cover::after {
  content: "";
  position: absolute;
  inset: 0;
}
.band-tint .card { background: var(--paper); }

/* figure inside card / standalone schematic frame */
.fig {
  position: relative;
  border: 1px solid var(--line);
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    var(--paper-2);
  background-size: 20px 20px, 20px 20px, auto;
  padding: 18px;
}
.fig svg { width: 100%; height: auto; }
/* small card diagrams: cap upscaling when a card goes full-width on small screens */
.fig > svg[viewBox^="0 0 220"] { max-width: 560px; margin-inline: auto; }
/* wide annotated drawings: pan horizontally on small screens instead of
   shrinking annotations into unreadable noise */
@media (max-width: 720px) {
  .fig:has(> svg[viewBox^="0 0 1080"]) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .fig > svg[viewBox^="0 0 1080"] { min-width: 760px; }
  .hero-figure .sch-label { font-size: 13px; }
}
.fig .fig-tag, .hero-figure .fig-tag {
  position: absolute;
  bottom: 0px; right: 10px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.fig-bare { border: none; background: none; padding: 0; }

/* ---------- image placeholders ---------- */
.founders-intro { align-items: center; }
.photo-placeholder {
  min-height: clamp(260px, 32vw, 420px);
  border: 1px solid var(--line);
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    var(--paper-2);
  background-size: 20px 20px, 20px 20px, auto;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}
.photo-placeholder span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-2);
}
.photo-placeholder small {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

/* corner registration ticks (technical-drawing flourish) */
.ticks::before, .ticks::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border-color: var(--line-strong);
  border-style: solid;
  pointer-events: none;
}
.ticks::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.ticks::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

/* ---------- spec lists (checklists) ---------- */
.list-spec, .list-avoid, .list-steps {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0;
  max-width: 760px;
}
.list-spec li, .list-avoid li {
  position: relative;
  padding: 16px 0 16px 52px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
}
.list-spec li:last-child, .list-avoid li:last-child { border-bottom: 1px solid var(--line); }
.list-spec li::before {
  content: counter(spec, decimal-leading-zero);
  counter-increment: spec;
  position: absolute;
  left: 0; top: 18px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent-deep);
}
.list-spec { counter-reset: spec; }
.list-avoid li::before {
  content: "✕";
  position: absolute;
  left: 4px; top: 16px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent-deep);
}
/* numbered plain steps (e.g. what happens next) */
.list-steps { counter-reset: step; }
.list-steps li {
  position: relative;
  padding: 10px 0 10px 40px;
  color: var(--ink-2);
}
.list-steps li::before {
  content: counter(step) ".";
  counter-increment: step;
  position: absolute;
  left: 4px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-deep);
}

/* ---------- phases (engagement structure) ---------- */
.phases { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); counter-reset: phase; }
.phase {
  position: relative;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 26px;
  padding-top: 56px;
}
.phase::before {
  content: "PHASE " counter(phase, decimal-leading-zero);
  counter-increment: phase;
  position: absolute;
  top: 0; left: 0;
  padding: 6px 12px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
}
.phase h4, .phase .h4 { margin-bottom: 8px; }
.phase p { color: var(--ink-2); font-size: 0.97rem; }
.phase + .phase::after {
  content: "→";
  position: absolute;
  left: -10px; top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  color: var(--accent-deep);
  font-size: 1.1rem;
  background: var(--paper);
  padding: 2px;
}
.phases-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 880px) {
  .phases { grid-template-columns: 1fr; }
  .phase + .phase::after {
    left: 28px; top: -10px;
    transform: translateY(-50%) rotate(90deg);
  }
}
@media (max-width: 1100px) {
  .phases-4 { grid-template-columns: 1fr; }
  .phases-4 .phase + .phase::after {
    left: 28px; top: -10px;
    transform: translateY(-50%) rotate(90deg);
  }
}

/* ---------- key/value definition list ---------- */
.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 8px 20px; }
.kv dt {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding-top: 2px;
}
.kv dd { margin: 0; }

/* ---------- chips / filters ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.chip-static { cursor: default; }

/* tag label on cards */
.tag-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  align-self: flex-start;
}
.tag-label.is-case { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--on-accent); }

/* ---------- forms ---------- */
.form { display: grid; gap: 18px; }
.form .row { display: grid; gap: 7px; }
.form label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}
.form input, .form textarea, .form select {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 13px 14px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form input:focus, .form textarea:focus, .form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 74, 14, 0.18);
}
.form textarea { min-height: 150px; resize: vertical; }
.form ::placeholder { color: #8aa19a; }
.form select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230f2424' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.form-note { font-size: 0.85rem; color: var(--muted); }

/* Honeypot: kept in the layout but off screen, so naive bots fill it in.
   display:none is skipped by the better ones. Also aria-hidden in the markup. */
.hp-row {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-status {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
}
.form-status.is-pending { color: var(--muted); }
.form-status.is-ok { color: var(--steel); }
.form-status.is-error { color: var(--danger); }

/* ALTCHA widget. It renders into the light DOM and brings its own box, so these
   rules only align its type and colors with the form. Do not add a border here:
   the widget already draws one and a second box shows through. */
altcha-widget { display: block; max-width: 340px; }
altcha-widget .altcha {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}
/* The widget draws its box on .altcha-main, not on .altcha. */
altcha-widget .altcha-main {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 0;
}
altcha-widget .altcha-label { letter-spacing: 0.02em; }
altcha-widget .altcha-footer { color: var(--muted); }
/* Do not set a color on .altcha-error. It renders inside .altcha-popover, which
   the widget already paints red with white text, so recoloring the text to a
   dark red leaves it unreadable against that background. */

/* ---------- prose (article body) ---------- */
.prose { max-width: 68ch; }
.prose > * + * { margin-top: 1.15em; }
.prose h2 {
  font-size: 1.5rem;
  margin-top: 2em;
  padding-top: 0.9em;
  border-top: 1px solid var(--line);
}
.prose h3 { font-size: 1.2rem; margin-top: 1.8em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.45em; }
.prose li::marker { color: var(--accent-deep); font-family: var(--font-mono); }
.prose strong { color: var(--ink); }
.prose a { color: var(--accent-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose blockquote {
  margin: 1.6em 0;
  padding: 4px 0 4px 22px;
  border-left: 3px solid var(--accent);
  color: var(--ink-2);
  font-size: 1.1rem;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 1px 6px;
}
.prose .callout {
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  padding: 20px 22px;
  font-size: 0.97rem;
}
.prose .callout .meta { display: block; margin-bottom: 8px; }

/* article header */
.article-head { padding-block: clamp(36px, 6vw, 72px) clamp(28px, 4vw, 48px); }
.article-head .meta { margin-bottom: 14px; }
.article-head h1 { font-size: clamp(2rem, 4.6vw, 3.3rem); margin-bottom: 22px; max-width: 24ch; }
.article-head .standfirst {
  font-size: clamp(1.1rem, 1.8vw, 1.3rem);
  line-height: 1.55;
  font-weight: 520;
  color: var(--ink-2);
  max-width: 56ch;
}
.article-fig { margin-block: clamp(24px, 4vw, 44px); }

/* stat strip (for case studies) */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line-strong);
}
.stat-strip > div { padding: 20px 22px; border-left: 1px solid var(--line); }
.stat-strip > div:first-child { border-left: none; }
.stat-strip .stat-num {
  font-weight: 660;
  font-variation-settings: "wdth" 116;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  line-height: 1.1;
  color: var(--accent-deep);
}
.stat-strip .stat-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-top: 6px;
}
@media (max-width: 640px) {
  .stat-strip { grid-template-columns: 1fr; }
  .stat-strip > div { border-left: none; border-top: 1px solid var(--line); }
  .stat-strip > div:first-child { border-top: none; }
}

/* ---------- CTA band ---------- */
.cta-band { text-align: center; }
.cta-band .wrap { max-width: 820px; }
.cta-band h2 { font-size: clamp(1.7rem, 3.6vw, 2.6rem); margin-bottom: 16px; }
.cta-band p { color: rgba(242, 245, 242, 0.78); max-width: 52ch; margin-inline: auto; }
.cta-band .btn-row { justify-content: center; margin-top: 30px; }
.cta-band .kicker { color: rgba(242, 245, 242, 0.6); margin-bottom: 18px; }

/* ---------- footer ---------- */
.site-footer {
  background: var(--ink);
  color: var(--paper);
  border-top: 3px solid var(--accent);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: clamp(24px, 4vw, 48px);
  padding-block: clamp(44px, 6vw, 72px) 28px;
}
.site-footer .brand { color: var(--paper); margin-bottom: 14px; }
.site-footer p { color: rgba(242, 245, 242, 0.66); font-size: 0.93rem; max-width: 38ch; }
.site-footer h3, .site-footer h4 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(242, 245, 242, 0.5);
  margin-bottom: 14px;
}
.footer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.footer-list a, .footer-list span {
  color: rgba(242, 245, 242, 0.85);
  text-decoration: none;
  font-size: 0.95rem;
}
.footer-list a:hover { color: var(--on-ink-strong); text-decoration: underline; text-underline-offset: 3px; }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(242, 245, 242, 0.14);
  padding-block: 20px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(242, 245, 242, 0.5);
}
@media (max-width: 880px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 540px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- schematic SVG conventions ---------- */
.sch-stroke { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.sch-stroke-soft { fill: none; stroke: var(--steel); stroke-width: 1.2; opacity: 0.55; }
.sch-dash { fill: none; stroke: var(--steel); stroke-width: 1.2; stroke-dasharray: 4 5; }
.sch-accent { fill: none; stroke: var(--accent); stroke-width: 1.8; }
.sch-fill { fill: var(--ink); }
.sch-fill-accent { fill: var(--accent); }
.sch-fill-paper { fill: var(--paper); }
.sch-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  fill: var(--ink-2);
}
.sch-label-soft { fill: var(--muted); }
.sch-label-accent { fill: var(--accent-deep); }
.band-dark .sch-stroke { stroke: var(--paper); }
.band-dark .sch-fill { fill: var(--paper); }
.band-dark .sch-label { fill: rgba(242, 245, 242, 0.8); }

/* line-draw animation (add .draw to svg; paths need pathLength="1") */
.js .draw .draw-path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: drawline 1.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.js .draw .draw-path:nth-of-type(2) { animation-delay: 0.25s; }
.js .draw .draw-path:nth-of-type(3) { animation-delay: 0.5s; }
.js .draw .draw-path:nth-of-type(4) { animation-delay: 0.75s; }
@keyframes drawline { to { stroke-dashoffset: 0; } }

.pulse { animation: pulse 2.6s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

/* ---------- reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(16px); }
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.6, 0.2, 1);
}
.js .reveal-stagger > * { opacity: 0; transform: translateY(16px); }
.js .reveal-stagger.is-visible > * {
  opacity: 1;
  transform: none;
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.2, 0.6, 0.2, 1);
}
.js .reveal-stagger.is-visible > *:nth-child(2) { transition-delay: 0.09s; }
.js .reveal-stagger.is-visible > *:nth-child(3) { transition-delay: 0.18s; }
.js .reveal-stagger.is-visible > *:nth-child(4) { transition-delay: 0.27s; }
.js .reveal-stagger.is-visible > *:nth-child(5) { transition-delay: 0.36s; }
.js .reveal-stagger.is-visible > *:nth-child(6) { transition-delay: 0.45s; }

@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;
  }
  .js .reveal, .js .reveal-stagger > * { opacity: 1; transform: none; }
}

/* ---------- utilities ---------- */
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-24 { margin-top: 24px; }
.mt-40 { margin-top: 40px; }
.mb-24 { margin-bottom: 24px; }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
