/* ============================================================================
   AfriVal Home — Single-Page Architectural Layout (The Line 2.0 + D2)
   ============================================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-inst);
  font-size: 16px;
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ul, ol, figure, blockquote, pre { margin: 0; }
a { color: inherit; }

.skip {
  position: absolute; left: -9999px;
}
.skip:focus {
  left: 16px; top: 12px; z-index: 40;
  background: var(--ink); color: var(--paper);
  padding: 8px 12px; font-size: 13px; text-decoration: none;
}

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}
@media (max-width: 560px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
}

/* ---- Masthead ---- */
.mast {
  position: sticky; top: 0; z-index: 20;
  background: var(--mast-bg);
  backdrop-filter: saturate(1.2) blur(8px);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.mast-in {
  height: var(--head-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--ink);
}
.brand svg { width: 22px; height: 22px; flex: none; display: block; }
.brand-word {
  font-size: 19px; font-weight: 600; letter-spacing: -0.026em; line-height: 1;
}
.mast-nav {
  display: flex; align-items: center; gap: 22px; font-size: 13.5px; color: var(--ink-2);
}
.mast-nav a {
  text-decoration: none; white-space: nowrap;
}
.mast-nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.22em; }
.theme-btn {
  appearance: none; background: transparent; color: var(--ink-2);
  border: 1px solid var(--rule-strong); border-radius: 2px;
  padding: 4px 9px; font-family: var(--font-mono); font-size: 11.5px;
  cursor: pointer; line-height: 1.3;
}
.theme-btn:hover { color: var(--ink); border-color: var(--ink); }
@media (max-width: 680px) {
  .mast-in { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; row-gap: 8px; }
  .mast-nav { width: 100%; flex-wrap: wrap; justify-content: flex-start; gap: 6px 14px; font-size: 12.5px; border-top: 1px solid var(--rule); padding-top: 8px; }
  .theme-btn { margin-left: auto; }
}

/* ---- Hero ---- */
.hero {
  padding: clamp(36px, 5vw, 68px) 0 clamp(28px, 3.6vw, 44px);
  border-bottom: 1px solid var(--ink);
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px; font-weight: 500; letter-spacing: 0.04em;
  color: var(--ink-3); text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
}
.eyebrow .sep { color: var(--rule-strong); }
.eyebrow .accent-dot { width: 7px; height: 7px; background: var(--line); display: inline-block; flex: none; }
.eyebrow a { text-decoration: none; color: var(--ink-2); }
.eyebrow a:hover { text-decoration: underline; color: var(--ink); }

.hero-h1 {
  margin-top: 16px;
  font-size: clamp(32px, 3.8vw + 12px, 50px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.028em;
  max-width: 22ch;
  text-wrap: balance;
}
.hero-lead {
  margin-top: 18px;
  max-width: 62ch;
  font-size: clamp(16.5px, 0.5vw + 15px, 19px);
  line-height: 1.56;
  color: var(--ink-2);
  text-wrap: pretty;
}
.hero-lead strong { color: var(--ink); font-weight: 500; }

/* ---- Ingress Actions ---- */
.actions {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 780px) {
  .actions { grid-template-columns: 1fr; }
}
.act-card {
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 16px 18px;
  border: 1px solid var(--rule-strong);
  background: var(--paper-elev);
  border-radius: 2px;
  text-decoration: none;
  transition: border-color 140ms ease;
}
.act-card:hover { border-color: var(--ink); }
.act-card.primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.act-card.primary .act-k { color: var(--rule); }
.act-card.primary .act-sub { color: var(--rule); }
.act-k {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-3);
}
.act-title {
  margin-top: 6px; font-size: 16px; font-weight: 600; letter-spacing: -0.014em; line-height: 1.3;
}
.act-sub {
  margin-top: 8px; font-size: 13px; color: var(--ink-3); line-height: 1.4;
}
.act-links {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2);
}
.act-card.primary .act-links { border-top-color: var(--ink-2); color: var(--paper); }
.act-links a {
  text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 0.2em;
}
.act-links a:hover { color: var(--ink); text-decoration-color: var(--ink); }
.act-card.primary .act-links a { color: var(--paper); text-decoration-color: var(--ink-3); }

/* ---- Method Card (V7: stated once, plainly) ---- */
.method-card {
  margin-top: 24px;
  padding: 15px 18px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--line);
  border-radius: 2px;
}
.method-k {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--line);
}
.method-p {
  margin-top: 6px; font-size: 14px; line-height: 1.56; color: var(--ink-2);
  max-width: 82ch;
}
.method-p strong { color: var(--ink); font-weight: 500; }

/* ---- Sections ---- */
.sec {
  padding: clamp(36px, 4.8vw, 56px) 0;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: calc(var(--head-h) + 16px);
}
.sec:last-of-type { border-bottom: 0; }
.sec-k {
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3);
}
.sec-h2 {
  margin-top: 8px;
  font-size: clamp(23px, 2vw + 13px, 30px);
  font-weight: 600; letter-spacing: -0.022em; line-height: 1.18;
  max-width: 30ch;
}
.sec-intro {
  margin-top: 10px; max-width: var(--measure);
  font-size: 15.5px; line-height: 1.62; color: var(--ink-2);
}

/* ---- 4 Headline Tiles ---- */
.tiles {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}
@media (max-width: 780px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 460px) {
  .tiles { grid-template-columns: 1fr; }
}
.tile {
  padding: 16px 16px 18px 0;
  border-right: 1px solid var(--rule);
}
.tile:not(:first-child) { padding-left: 16px; }
.tile:last-child { border-right: 0; }
@media (max-width: 780px) {
  .tile { padding: 14px 14px 16px 0; border-bottom: 1px solid var(--rule); }
  .tile:nth-child(2n) { border-right: 0; padding-left: 14px; }
  .tile:nth-child(2n+1) { padding-left: 0; }
  .tile:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 460px) {
  .tile { padding: 14px 0 !important; border-right: 0 !important; border-bottom: 1px solid var(--rule) !important; }
  .tile:last-child { border-bottom: 0 !important; }
}
.tile-num {
  font-family: var(--font-mono);
  font-size: clamp(22px, 1.8vw + 14px, 28px);
  font-weight: 600; letter-spacing: -0.03em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.tile-num.limit { color: var(--line); }
.tile-lbl {
  margin-top: 7px; font-size: 13.5px; line-height: 1.44; color: var(--ink-2);
}

/* ---- Exhibit 1 (Charis SIL Evidence Register) ---- */
.exhibit {
  margin-top: 28px;
  padding: 20px 22px;
  background: var(--paper-elev);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
}
.fig-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px;
  padding-bottom: 10px; border-bottom: 1px solid var(--rule);
}
.fig-tag {
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink);
}
.fig-meta {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3);
}
.ex-task {
  margin-top: 12px; font-size: 14.5px; line-height: 1.55; color: var(--ink-2);
  max-width: 78ch;
}
.ex-task strong { color: var(--ink); font-weight: 600; }
.ex-quote {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--paper-2);
  border-left: 3px solid var(--ink);
  font-family: var(--font-voice);
  font-size: clamp(16.5px, 0.5vw + 15px, 18.5px);
  line-height: 1.55;
  color: var(--ink);
}
.ex-quote mark, .ex-said mark {
  background: var(--line-tint);
  color: var(--line);
  padding: 0 3px;
  font-weight: 700;
  border-bottom: 1.5px solid var(--line);
}
.ex-cols {
  margin-top: 16px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px;
}
@media (max-width: 640px) { .ex-cols { grid-template-columns: 1fr; } }
.ex-col-k {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3);
  display: flex; align-items: center; gap: 7px;
}
.ex-col-k i { width: 8px; height: 8px; background: var(--ink); display: inline-block; }
.ex-col-k i.amber { background: var(--line); }
.ex-checks {
  margin-top: 8px; padding-left: 18px;
  font-size: 14px; line-height: 1.55; color: var(--ink-2);
}
.ex-checks li + li { margin-top: 3px; }
.ex-said {
  margin-top: 8px; font-size: 14.5px; line-height: 1.55; color: var(--ink-2);
}
.ex-said em { font-style: italic; color: var(--ink); }
.ex-foot {
  margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--rule);
  font-size: 12.5px; line-height: 1.5; color: var(--ink-3);
}

/* ---- Study Exhibit: Static 28-Model Weakest-Link Chart (Figure 2 in Line 2.0) ---- */
.chart-box {
  margin-top: 24px;
  padding: 20px 22px 18px;
  background: var(--paper-elev);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
}
.chart-title {
  margin-top: 10px;
  font-size: 19px; font-weight: 600; letter-spacing: -0.018em; line-height: 1.26;
}
.chart-sub {
  margin-top: 5px; font-size: 13.5px; color: var(--ink-2); max-width: 76ch;
}
.chart-legend {
  margin-top: 14px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2);
}
.leg-item { display: inline-flex; align-items: center; gap: 6px; }
.dot-ring {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1.8px solid var(--ink-2); background: var(--paper-elev); display: inline-block;
}
.dot-solid {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--ink); display: inline-block;
}
.dot-amber {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--line); display: inline-block;
}
.dash-ref {
  width: 14px; height: 0; border-top: 1.5px dashed var(--line); display: inline-block;
}

.wl-chart {
  margin-top: 14px;
  font-variant-numeric: tabular-nums;
}
.wl-row {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr) 118px;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
}
.wl-row.wl-hd {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
  border-bottom: 1px solid var(--ink); padding: 6px 0;
}
.wl-row.wl-band {
  border-bottom: 1px dashed var(--rule-strong);
}
.wl-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--ink); font-weight: 500;
}
.wl-name small {
  font-family: var(--font-mono); font-size: 10px; font-weight: 400;
  color: var(--ink-3); margin-left: 5px;
}
.wl-track {
  position: relative; height: 18px;
}
.wl-grid {
  position: absolute; top: -5px; bottom: -5px; width: 1px; background: var(--rule);
}
.wl-grid.ref80 {
  background: transparent; border-left: 1.5px dashed var(--line); z-index: 1;
}
.wl-span {
  position: absolute; top: 8px; height: 2px; background: var(--line-border); z-index: 2;
}
.wl-dot {
  position: absolute; top: 4px; width: 10px; height: 10px; margin-left: -5px;
  border-radius: 50%; z-index: 3;
}
.wl-dot.typed {
  border: 1.8px solid var(--ink-2); background: var(--paper-elev);
}
.wl-dot.ok {
  background: var(--ink);
}
.wl-dot.low {
  background: var(--line);
}
.wl-val {
  text-align: right; font-family: var(--font-mono); font-size: 12px; white-space: nowrap;
}
.wl-val b { font-weight: 600; color: var(--ink); }
.wl-val b.low { color: var(--line); }
.wl-val span { color: var(--ink-3); font-size: 11px; margin-left: 5px; }
.wl-axis {
  position: relative; height: 18px; margin-top: 2px;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3);
}
.wl-axis i {
  position: absolute; font-style: normal; transform: translateX(-50%);
}
.wl-axis i.first { transform: translateX(0); }
.wl-axis i.last { transform: translateX(-100%); }
.wl-axis i.ref { color: var(--line); font-weight: 600; }

@media (max-width: 640px) {
  .wl-row { grid-template-columns: 128px minmax(0, 1fr) 86px; gap: 8px; font-size: 12px; }
  .wl-name small { display: none; }
  .wl-val span { display: none; }
}

.chart-foot {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 18px;
  font-size: 12.5px; color: var(--ink-3);
}
.chart-foot a {
  color: var(--ink); font-weight: 500;
  text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 0.2em;
}

/* ---- 5-Gap Blueprint Table ---- */
.gaps {
  margin-top: 22px;
  border-top: 1px solid var(--ink);
}
.gap-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) 156px;
  gap: 8px 24px;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14.5px; line-height: 1.5; color: var(--ink-2);
}
.gap-row.hd {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3);
  padding: 9px 0;
}
.gap-row.tot { border-bottom: 1px solid var(--ink); color: var(--ink); font-weight: 600; }
.gap-row strong { color: var(--ink); font-weight: 500; }
.gap-cost {
  text-align: right; font-family: var(--font-mono); font-size: 13px;
  font-weight: 500; color: var(--ink); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.gap-k { display: none; font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px; }
@media (max-width: 680px) {
  .gap-row { grid-template-columns: 1fr; gap: 8px; }
  .gap-row.hd { display: none; }
  .gap-k { display: block; }
  .gap-cost { text-align: left; }
}

/* ---- Collaborate Tracks ---- */
.collab-grid {
  margin-top: 24px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px;
}
@media (max-width: 760px) { .collab-grid { grid-template-columns: 1fr; } }
.collab-card {
  padding: 16px 18px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
}
.collab-card h3 {
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink);
}
.collab-card p {
  margin-top: 6px; font-size: 13.5px; line-height: 1.52; color: var(--ink-2);
}
.contact-bar {
  margin-top: 18px;
  padding: 16px 18px;
  background: var(--paper-elev);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
}
.contact-main {
  font-size: 14.5px; color: var(--ink-2);
}
.contact-main a {
  font-family: var(--font-mono); font-weight: 600; color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 0.22em;
}
.contact-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-sm {
  appearance: none; background: transparent; color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: 2px;
  padding: 6px 11px; font-family: var(--font-mono); font-size: 12px;
  text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.btn-sm:hover { border-color: var(--ink); background: var(--paper-2); }

/* ---- How It Is Run (METR Pattern) + Cite ---- */
.rules-grid {
  margin-top: 22px;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 28px 36px;
}
@media (max-width: 780px) { .rules-grid { grid-template-columns: 1fr; } }
.rule-list {
  list-style: none; padding: 0; margin: 12px 0 0;
  border-top: 1px solid var(--rule);
}
.rule-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14.5px; line-height: 1.52; color: var(--ink-2);
  display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px;
}
.rule-list li span.rn {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--line);
}
.rule-list li strong { color: var(--ink); font-weight: 500; }

.sub-h3 {
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink);
}
.disc-p {
  margin-top: 10px; font-size: 14px; line-height: 1.6; color: var(--ink-2);
}
.disc-p a {
  color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 0.2em;
}

.cite-box {
  margin-top: 22px;
  padding: 16px 18px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.cite-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px;
}
.cite-pre {
  margin-top: 10px; padding: 12px 14px;
  background: var(--paper-elev); border: 1px solid var(--rule);
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5;
  color: var(--ink-2); overflow-x: auto; max-width: 100%; white-space: pre;
}
.canary-line {
  margin-top: 10px;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
  word-break: break-all;
}

/* ---- Footer ---- */
.ft {
  padding: 26px 0 42px;
  border-top: 1px solid var(--ink);
  font-size: 13px; color: var(--ink-3);
}
.ft-in {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
}
.ft-links {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
}
.ft-links a { text-decoration: none; color: var(--ink-2); }
.ft-links a:hover { color: var(--ink); text-decoration: underline; }
.ft-note {
  margin-top: 10px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
}
