/* ==========================================================================
   pages.css — the hero, the charts, and the page-specific furniture.
   ========================================================================== */

/* ---- hero --------------------------------------------------------------- */
/* THE DRAWING SITS BESIDE THE COPY, NOT UNDER IT. The first version put the
   canvas full-bleed behind the headline: a live simulation is a moving
   contrast field, so no scrim makes body text reliably legible over it, and
   the reader ends up with a decorative background instead of a figure they
   can read. As a survey sheet it is both. */
.hero {
  position: relative;
  padding-block: clamp(28px, 4vw, 56px) clamp(36px, 6vw, 72px);
  border-bottom: var(--rule) solid var(--plate);
}
.hero-in { position: relative; width: 100%; }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  gap: clamp(26px, 4vw, 56px); align-items: center;
  margin-bottom: clamp(26px, 3.4vw, 40px);
}
@media (max-width: 940px) { .hero-grid { grid-template-columns: minmax(0, 1fr); } }
.hero h1 { margin: 18px 0 20px; max-width: none; font-size: clamp(38px, 4.6vw, 62px); }
.hero .lede { max-width: 54ch; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

.sheet {
  margin: 0; border: var(--rule) solid var(--plate2); border-radius: var(--r-lg);
  background: linear-gradient(170deg, var(--ground2), var(--deep));
  overflow: hidden; min-width: 0;
}
.sheet canvas { width: 100%; aspect-ratio: 5 / 4; display: block; }
.sheet-head, .sheet-foot {
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
  padding: 10px 16px; font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .13em; text-transform: uppercase; color: var(--faint);
}
.sheet-head { border-bottom: var(--rule) solid var(--plate2); justify-content: space-between; }
.sheet-foot { border-top: var(--rule) solid var(--plate2); }
.key { display: inline-flex; align-items: center; gap: 7px; }
.key i { width: 14px; height: 3px; border-radius: 2px; background: var(--ink3); opacity: .5; }
.key .k-water { background: var(--spring); opacity: 1; }
.key .k-sink { width: 9px; height: 9px; border-radius: 0; background: none;
  border-top: 2px solid var(--ink); border-right: 2px solid var(--ink); transform: rotate(135deg); }
.key .k-spring { width: 9px; height: 9px; border-radius: 50%; background: none;
  border: 2px solid var(--sump); opacity: 1; }
[data-hero][data-state="done"] .sheet-head::after { content: 'settled'; color: var(--spring); }
.hero-note {
  max-width: 66ch; font-size: 14.5px; color: var(--faint); margin-top: 22px;
  border-left: 2px solid var(--plate2); padding-left: 14px;
}
[data-hero][data-failed]::after {
  content: 'The hero model failed to start — see the console. Every figure below is unaffected.';
  position: absolute; left: var(--gut); top: 24px; z-index: 2;
  font-family: var(--font-mono); font-size: 12px; color: var(--rossa);
}

.lede { font-size: clamp(17.5px, 1.9vw, 21px); color: var(--ink2); max-width: 62ch; }
.big { font-size: clamp(20px, 2.4vw, 27px); line-height: 1.42; color: var(--ink); text-wrap: pretty; }
.pull {
  border-left: 2px solid var(--accent); padding: 4px 0 4px 18px;
  color: var(--ink2); font-size: 16.5px; margin-block: 1.6em;
}
.aside { font-size: 14px; color: var(--faint); max-width: 66ch; }
.aside b { color: var(--ink2); }
.wrap-none { max-width: none; }
.fig { color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- readouts ----------------------------------------------------------- */
.readout {
  display: flex; flex-wrap: wrap; gap: 2px; margin: 0;
  border: var(--rule) solid var(--plate2); border-radius: var(--r);
  background: var(--plate2); overflow: hidden; max-width: 940px;
}
.readout > div {
  flex: 1 1 128px; background: color-mix(in oklab, var(--ground2) 82%, transparent);
  padding: 11px 14px; min-width: 0;
}
.readout dt {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint);
  /* WRAPS. Truncating with an ellipsis turns "size that holds within one per
     cent" into "SIZE THAT HOLDS W…", which is a label that has stopped
     naming its number. */
  line-height: 1.5; min-height: 3em;
}
.readout dd {
  margin: 3px 0 0; font-family: var(--font-mono); font-size: 17px;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.readout.col { flex-direction: column; }
.readout.col > div { flex: 0 0 auto; }
.readout.wide { max-width: none; margin-top: 18px; }

/* ---- charts ------------------------------------------------------------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .ax { stroke: var(--plate2); stroke-width: 1.2; }
.chart .grid { stroke: var(--plate2); stroke-width: 1; opacity: .5; }
.chart .tick {
  fill: var(--faint); font-family: var(--font-mono); font-size: 13px;
}
.chart .axlabel {
  fill: var(--faint); font-family: var(--font-mono); font-size: 11.5px;
  letter-spacing: .1em; text-transform: uppercase;
}
.chart .mid { text-anchor: middle; }
.chart .end { text-anchor: end; }
.chart .c1 { fill: var(--spring); }
.chart .c2 { fill: var(--rossa); }
.chart .ln { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart .ln-1 { stroke: var(--spring); }
.chart .ln-2 { stroke: var(--rossa); }
.chart .ln-s0 { stroke: var(--spring); }
.chart .ln-s1 { stroke: var(--sump); }
.chart .ln-s2 { stroke: var(--rossa); }
.chart .ln.dash { stroke-dasharray: 7 5; }
.chart .c-s0 { fill: var(--spring); }
.chart .c-s1 { fill: var(--sump); }
.chart .c-s2 { fill: var(--rossa); }
.chart .dot-1 { fill: var(--spring); }
.chart .dot-2 { fill: var(--sump); }
.chart .dot-3 { fill: var(--rossa); }
.chart .c3 { fill: var(--sump); }
.chart .dumb { stroke: var(--plate2); stroke-width: 3; }
.chart .ring { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.chart .mark-v { stroke: var(--ink3); stroke-width: 1.2; stroke-dasharray: 4 5; }
.chart .mark-h { stroke: var(--ink3); stroke-width: 1.2; stroke-dasharray: 4 5; }
.chart .bar-1 { fill: var(--sump); }
.chart .bar-2 { fill: color-mix(in oklab, var(--rossa) 42%, var(--plate)); }
.chart .rock { stroke: var(--ink3); stroke-linecap: round; }
.chart .cut { stroke: var(--spring); stroke-linecap: round; opacity: .95; }
.chart .water { stroke: var(--sump); stroke-linecap: round; }
.chart .cutring { fill: none; stroke: var(--spring); stroke-width: 1.4; stroke-dasharray: 5 6; opacity: .8; }
.chart .station-mk { stroke: var(--ink); stroke-width: 2; fill: none; stroke-linejoin: round; }
.chart .spring-mk { stroke: var(--sump); stroke-width: 2.2; fill: none; }

/* ---- cards -------------------------------------------------------------- */
.cards .card { display: block; color: inherit; text-decoration: none; position: relative; }
a.card { transition: border-color .2s var(--ease), transform .2s var(--ease); }
a.card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.card h3 { margin-bottom: .35em; }
.card .card-line { color: var(--ink); font-size: 16px; }
.card p { font-size: 15px; color: var(--ink3); }
.card-go {
  display: inline-block; margin-top: 6px; color: var(--accent);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .07em;
}
.card .pill { margin-bottom: 14px; }
.plate.warn { border-color: color-mix(in oklab, var(--rossa) 48%, transparent); background: var(--rossa-wash); }
.plate.warn h3 { color: var(--rossa); }
.plate.warn p { color: var(--ink2); margin-bottom: 0; }
.plate.warn p + p { margin-top: 1em; }

.page-head { padding-top: clamp(44px, 7vw, 92px); padding-bottom: clamp(24px, 3vw, 44px); }
.page-head h1 { max-width: 18ch; }

.wide-first { grid-template-columns: 1.25fr 1fr; align-items: start; }
@media (max-width: 900px) { .wide-first { grid-template-columns: minmax(0, 1fr); } }

/* ---- key/value ---------------------------------------------------------- */
.kv {
  display: grid; grid-template-columns: minmax(180px, 30%) 1fr; gap: 0;
  margin: 0 0 1.6em; font-size: 14.5px; max-width: none;
}
.kv dt {
  padding: 9px 16px 9px 0; border-bottom: var(--rule) solid var(--plate2);
  color: var(--ink3);
}
.kv dd {
  margin: 0; padding: 9px 0; border-bottom: var(--rule) solid var(--plate2);
  color: var(--ink); font-family: var(--font-mono); font-size: 13px;
  /* Monospace does not wrap on its own at a hyphen or inside an address, and
     a 42-character hex in a 500 px viewport widens the whole document rather
     than the cell. A validator cannot see this; tools/shot.mjs can. */
  min-width: 0; overflow-wrap: anywhere;
}
@media (max-width: 640px) {
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { border-bottom: 0; padding-bottom: 0; }
}

/* ---- lexicon ------------------------------------------------------------ */
.lex { padding: 20px 0; border-bottom: var(--rule) solid var(--plate2); max-width: var(--measure); }
.lex h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin-bottom: .3em; }
.lex-what {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint); font-weight: 400;
}
.lex p { margin: 0; color: var(--ink3); font-size: 15.5px; }

.markshow { display: flex; gap: 30px; align-items: flex-start; flex-wrap: wrap; max-width: none; }
.markshow > svg {
  flex: 0 0 auto; background: var(--plate); border: var(--rule) solid var(--plate2);
  border-radius: var(--r-lg); padding: 14px;
}
.markshow > div { flex: 1 1 320px; max-width: var(--measure); }

/* ---- roadmap ------------------------------------------------------------ */
.road { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.road-item {
  position: relative; padding: 22px 0 22px 34px;
  border-bottom: var(--rule) solid var(--plate2);
}
.road-item::before {
  content: ''; position: absolute; left: 4px; top: 32px;
  width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid var(--plate2); background: var(--ground);
}
.road-item.state-built::before { background: var(--spring); border-color: var(--spring); }
.road-item.state-building::before { border-color: var(--spring); }
.road-item::after {
  content: ''; position: absolute; left: 8px; top: 44px; bottom: -1px;
  width: var(--rule); background: var(--plate2);
}
.road-item:last-child::after { display: none; }
.road-item h3 { margin: 10px 0 .3em; }
.road-item p { margin: 0; color: var(--ink3); max-width: var(--measure); }
.road-item .pill { font-size: 10.5px; padding: 4px 10px; }
.road-item.state-built .pill { color: var(--spring); border-color: color-mix(in oklab, var(--spring) 45%, transparent); }

/* ---- questions ---------------------------------------------------------- */
.qa { border-bottom: var(--rule) solid var(--plate2); max-width: var(--measure); }
.qa summary { list-style: none; cursor: pointer; padding: 20px 30px 20px 0; position: relative; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary h3 { display: inline; margin: 0; font-size: 19px; }
.qa summary::after {
  content: '+'; position: absolute; right: 2px; top: 18px;
  font-family: var(--font-mono); font-size: 20px; color: var(--accent);
}
.qa[open] summary::after { content: '−'; }
.qa p { margin: 0 0 22px; color: var(--ink3); }

/* ---- the live quote panel ----------------------------------------------- */
.quote-controls {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-top: 18px;
}
.quote-controls label {
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint);
}
.quote-controls select, .quote-controls input {
  background: var(--ground2); color: var(--ink); font-family: var(--font-mono); font-size: 15px;
  border: var(--rule) solid var(--plate2); border-radius: var(--r); padding: 10px 12px;
  min-width: 160px;
}
[data-quote] .aside { margin-top: 16px; min-height: 1.4em; }

/* ---- the lab ------------------------------------------------------------ */
.lab { display: grid; grid-template-columns: 1.5fr minmax(240px, 1fr); gap: 26px; align-items: start; }
@media (max-width: 860px) { .lab { grid-template-columns: minmax(0, 1fr); } }
.lab canvas {
  width: 100%; aspect-ratio: 4 / 3; background: var(--ground2);
  border: var(--rule) solid var(--plate2); border-radius: var(--r); cursor: crosshair;
  min-width: 0;
}
.lab-controls { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.lab-controls .btn { justify-content: center; text-align: center; }
.lab .aside { margin-top: 14px; min-height: 3em; }

.vault { padding: 0; overflow: hidden; }
.vault h3 { font-size: 16px; margin: 0 0 16px; }
.vault .field small code { font-size: .92em; }
/* An address is 42 characters; at the hero input size it runs off the end of
   its own box. */
.vault .field input { font-size: clamp(13px, 1.3vw, 16px); }
.vault .app-actions { margin-top: 14px; }

/* ---- the state table ----------------------------------------------------- */
table.state td { font-size: 14px; vertical-align: top; }
table.state td:first-child { white-space: nowrap; }
.tiny { font-size: 10.5px; color: var(--faint); }
.pill.st { font-size: 10px; padding: 3px 9px; }
tr.st-live .pill.st { color: var(--spring); border-color: color-mix(in oklab, var(--spring) 50%, transparent); }
tr.st-deployable .pill.st { color: var(--sump); border-color: color-mix(in oklab, var(--sump) 45%, transparent); }
tr.st-none .pill.st { color: var(--faint); }
a.demo:hover { border-color: var(--rossa); text-decoration: none; }

/* ---- tables ------------------------------------------------------------- */
table.audit td:first-child { color: var(--faint); width: 3em; }
table.audit td:nth-child(3) { white-space: nowrap; font-size: 11px; letter-spacing: .1em; }

/* ==========================================================================
   The app. A working router, so the layout has to survive real numbers of
   unknown length and a wallet that may not be there.
   ========================================================================== */
.app {
  border: var(--rule) solid var(--plate2); border-radius: var(--r-lg);
  background: var(--plate); overflow: hidden;
}
.app-bar {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 2.4vw, 26px); border-bottom: var(--rule) solid var(--plate2);
  background: var(--ground2);
}
.app-wallet { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.wallets { display: flex; flex-wrap: wrap; gap: 8px; }
.acct { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 14px; }
.acct .mono { color: var(--ink); }
.acct [data-a="chain"] {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint);
}
.acct [data-a="chain"][data-kind="ok"] { color: var(--spring); }
.acct [data-a="chain"][data-kind="warn"] { color: var(--rossa); }
.app-slip {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint);
}

.app-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 40px); padding: clamp(20px, 3vw, 34px);
}
@media (max-width: 900px) { .app-grid { grid-template-columns: minmax(0, 1fr); } }

.field { display: block; margin-bottom: 12px; }
.field > span {
  display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .13em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 8px;
}
.field .row {
  display: flex; gap: 10px; align-items: stretch;
  border: var(--rule) solid var(--plate2); border-radius: var(--r);
  background: var(--ground2); padding: 4px;
}
.field input, .field .big-out {
  flex: 1 1 auto; min-width: 0; background: none; border: 0; color: var(--ink);
  font-family: var(--font-mono); font-size: clamp(19px, 2.4vw, 26px); padding: 10px 12px;
  font-variant-numeric: tabular-nums;
}
.field .big-out { display: block; overflow-wrap: anywhere; line-height: 1.25; }
.field input:focus { outline: none; }
.field .row:focus-within { border-color: var(--accent); }
.field select, .app-slip select {
  background: var(--plate); color: var(--ink); border: var(--rule) solid var(--plate2);
  border-radius: var(--r-sm); padding: 8px 10px; font-family: var(--font-mono); font-size: 14px;
}
.field small {
  display: flex; gap: 8px; align-items: center; margin-top: 8px;
  font-size: 12.5px; color: var(--faint);
}
.linkish {
  background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0;
  font: inherit; text-decoration: underline; text-underline-offset: 3px;
}
.flip {
  display: block; margin: 6px auto; background: var(--ground2); color: var(--ink);
  border: var(--rule) solid var(--plate2); border-radius: 50%;
  width: 34px; height: 34px; cursor: pointer; font-size: 15px; line-height: 1;
}
.flip:hover { border-color: var(--accent); }

.app-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.app-actions .btn { flex: 1 1 160px; justify-content: center; }
.sim { font-size: 13.5px; color: var(--faint); margin: 14px 0 0; min-height: 1.3em; }
.sim[data-kind="ok"] { color: var(--spring); }
.sim[data-kind="warn"] { color: var(--rossa); }
[data-a="status"][data-kind="ok"] { color: var(--spring); }
[data-a="status"][data-kind="warn"] { color: var(--rossa); }
[data-a="receipt"] { overflow-wrap: anywhere; }

.app-side h3 { font-size: 15px; margin: 22px 0 12px; }
.app-side h3:first-child { margin-top: 0; }
.narrow { border-bottom: var(--rule) solid var(--plate2); padding-bottom: 18px; }
.hopbar {
  display: flex; height: 12px; border-radius: 3px; overflow: hidden;
  background: var(--ground2); margin-bottom: 14px;
}
.hopbar .h1 { flex: 0 0 auto; background: var(--sump); }
.hopbar .h2 { flex: 1 1 auto; background: var(--rossa); }
.app-side table { font-size: 13.5px; }
.app-side tr.win td { color: var(--ink); }
.app-side tr.win td:first-child::before {
  content: '▸ '; color: var(--accent);
}
