:root {
  --ink: #171f1d;
  --ink-soft: #46524e;
  --muted: #6b7671;
  --paper: #fbfbf8;
  --panel: #f2f3ee;
  --line: #dde1da;
  --teal: #0e6b54;
  --teal-tint: #e3f1ec;
  --coral: #c65430;
  --coral-tint: #faece6;
  --violet-tint: #edecf7;
  --violet: #4c449e;
  --max: 1060px;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

body {
  font-family: "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--coral); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-weight: 500;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}
.skip-link:focus { color: #fff; transform: translateY(0); }

/* ---------- document-control bar ---------- */
.doc-bar {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.doc-bar .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}
.doc-bar .mono { font-size: 11px; }

/* ---------- header / nav ---------- */
header.site {
  max-width: var(--max);
  margin: 0 auto;
  padding: 26px 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.wordmark {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}
.wordmark:hover { color: var(--teal); }
.wordmark .mono { color: var(--muted); margin-left: 10px; font-weight: 400; }
nav.site { display: flex; gap: 22px; flex-wrap: wrap; }
nav.site a {
  font-size: 14.5px;
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
}
nav.site a:hover { color: var(--ink); border-bottom-color: var(--coral); }
nav.site a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--teal); font-weight: 500; }

/* ---------- layout ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 0 24px 80px; }
.measure { max-width: 680px; }

section { margin-top: 72px; }
.eyebrow {
  color: var(--teal);
  display: block;
  margin-bottom: 14px;
}
.eyebrow::before { content: "// "; color: var(--coral); }

h1 {
  font-size: clamp(34px, 5.2vw, 54px);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.015em;
  max-width: 820px;
}
h2 {
  font-size: clamp(24px, 3vw, 31px);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 18px;
  max-width: 760px;
}
h3 { font-size: 19px; font-weight: 600; margin-bottom: 8px; }
p + p { margin-top: 14px; }
.lede { font-size: 20px; color: var(--ink-soft); line-height: 1.6; }

.hero { padding-top: 64px; }
.hero .mission {
  margin-top: 26px;
  font-size: 20px;
  color: var(--ink-soft);
  max-width: 660px;
}
.hero .mission strong { color: var(--ink); font-weight: 600; }
.hero-rule {
  margin-top: 40px;
  height: 2px;
  background: linear-gradient(90deg, var(--teal) 0 64%, var(--coral) 64% 100%);
  max-width: 220px;
  border: 0;
}

/* ---------- cards & panels ---------- */
.card-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 28px; }
.card {
  border: 1px solid var(--line);
  background: #fff;
  padding: 26px 26px 24px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card .mono { color: var(--muted); }
.card p { font-size: 15.5px; color: var(--ink-soft); }
.card a.more { margin-top: auto; font-size: 14.5px; font-weight: 500; }

.panel {
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  background: var(--panel);
  padding: 22px 26px;
  border-radius: 0 6px 6px 0;
  margin-top: 24px;
}
.panel.coral { border-left-color: var(--coral); }
.panel .mono { color: var(--muted); display: block; margin-bottom: 8px; }

blockquote.thesis {
  margin-top: 30px;
  font-size: 23px;
  line-height: 1.45;
  font-weight: 500;
  color: var(--ink);
  border-left: 3px solid var(--coral);
  padding-left: 22px;
  max-width: 640px;
}

/* ---------- layer list (methodology) ---------- */
.layers { margin-top: 34px; display: flex; flex-direction: column; gap: 0; }
.layer {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 20px;
  align-items: start;
}
.layer + .connector {
  width: 2px; height: 34px; background: var(--ink-soft);
  margin-left: 58px; position: relative;
}
.connector::after {
  content: ""; position: absolute; bottom: -1px; left: -4px;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 7px solid var(--ink-soft);
}
.connector + .layer { margin-top: 0; }
.layer .num {
  font-family: "IBM Plex Mono", monospace;
  font-size: 26px; font-weight: 500; color: var(--teal);
  border-right: 1px solid var(--line);
  padding-right: 18px; line-height: 1.1; padding-top: 2px;
}
.layer.l3 .num { color: var(--coral); }
.layer .sentence { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.layer p { font-size: 15.5px; color: var(--ink-soft); }
.loopback {
  margin: 26px 0 0 58px;
  padding: 14px 18px;
  border: 1px dashed var(--coral);
  border-radius: 6px;
  color: var(--coral);
  font-size: 15px;
  font-weight: 500;
  max-width: 520px;
  background: var(--coral-tint);
}

/* ---------- definition lists / fact grids ---------- */
.facts { margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px 32px; }
.fact { border-top: 1px solid var(--line); padding-top: 12px; }
.fact .mono { color: var(--muted); display: block; margin-bottom: 6px; }
.fact p, .fact li { font-size: 15.5px; }
.fact ul { list-style: none; }
.fact li { padding: 3px 0; color: var(--ink-soft); }
.fact li::before { content: "\00B7\2002"; color: var(--teal); }

ul.plain { list-style: none; margin-top: 14px; }
ul.plain li { padding: 6px 0 6px 22px; position: relative; color: var(--ink-soft); font-size: 16px; }
ul.plain li::before { content: "→"; position: absolute; left: 0; color: var(--teal); }

ol.rq { margin-top: 18px; counter-reset: rq; list-style: none; max-width: 700px; }
ol.rq li {
  counter-increment: rq;
  padding: 16px 0 16px 58px;
  position: relative;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 16px;
}
ol.rq li::before {
  content: "Q" counter(rq);
  position: absolute; left: 0; top: 15px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px; color: var(--coral); font-weight: 500;
}

/* ---------- case study ---------- */
article.case { border-top: 2px solid var(--ink); padding-top: 26px; margin-top: 54px; }
.case .fiction-tag {
  display: inline-block;
  background: var(--violet-tint);
  color: var(--violet);
  padding: 4px 10px;
  border-radius: 3px;
  margin-bottom: 16px;
}
.case h2 { margin-top: 6px; }
.case .grid { display: grid; grid-template-columns: 200px 1fr; gap: 14px 30px; margin-top: 22px; }
.case .grid .mono { color: var(--muted); padding-top: 3px; }
.case .grid p { font-size: 16px; color: var(--ink-soft); }
.case .grid p strong { color: var(--ink); }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-block;
  background: var(--teal);
  color: #fff;
  text-decoration: none;
  padding: 12px 22px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 500;
  border: 0;
  cursor: pointer;
}
.btn:hover { background: var(--coral); color: #fff; }
.btn.ghost { background: transparent; color: var(--teal); border: 1px solid var(--teal); }
.btn.ghost:hover { color: var(--coral); border-color: var(--coral); background: transparent; }
.btn-row { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }

form.contact { max-width: 560px; margin-top: 26px; display: flex; flex-direction: column; gap: 16px; }
form.contact label { font-size: 14px; font-weight: 500; display: block; margin-bottom: 6px; }
form.contact input, form.contact textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  font-size: 15.5px;
  background: #fff;
  color: var(--ink);
}
form.contact input:focus, form.contact textarea:focus { border-color: var(--teal); }
form.contact input:focus:not(:focus-visible), form.contact textarea:focus:not(:focus-visible) { outline: none; }

.confirmation { min-height: 54vh; }

/* ---------- diagram ---------- */
.framework-preview svg {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  margin-top: 28px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 22px 16px 14px;
}
.framework-preview .btn-row { margin-top: 22px; }

.diagram-wrap {
  margin-top: 30px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 28px 20px 20px;
}
.diagram-wrap figcaption {
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
}

/* ---------- footer ---------- */
footer.site {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  background: var(--panel);
}
footer.site .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 34px 24px 44px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 14px;
}
footer.site a { color: var(--ink-soft); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .card-row, .facts { grid-template-columns: 1fr; }
  .case .grid { grid-template-columns: 1fr; gap: 4px 0; }
  .case .grid .mono { padding-top: 14px; }
  .layer { grid-template-columns: 44px 1fr; padding: 20px; }
  .layer .num { font-size: 20px; padding-right: 12px; }
  .layer + .connector, .loopback { margin-left: 40px; }
  .hero { padding-top: 40px; }
  section { margin-top: 56px; }
}

@media (max-width: 560px) {
  .doc-bar .inner { align-items: flex-start; flex-direction: column; gap: 2px; }
  header.site { align-items: stretch; padding-top: 20px; }
  .wordmark { display: flex; flex-direction: column; gap: 2px; }
  .wordmark .mono { margin-left: 0; }
  nav.site {
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0 -24px;
    padding: 0 24px 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }
  nav.site a {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 10px 8px 7px;
  }
  h1 { font-size: clamp(32px, 10vw, 42px); }
  .btn-row { align-items: stretch; flex-direction: column; }
  .btn-row .btn { text-align: center; }
}
