/* ============================================================
   YKO.EARTH — Instrument Grade
   The one stylesheet. Every page loads this file and nothing else.
   Spec: yko-design skill. Tokens, ramp, and motion are locked there.

   Rules carried in code:
   - No green. Anywhere. Ever.
   - --cut appears once per screen: the gap or the decay. Nowhere else.
   - Every number renders in mono with tabular figures.
   - No gradients, no icons, no overshoot easing, no ALL-CAPS eyebrow.
   ============================================================ */

/* ---------- fonts (self-hosted, latin subset) ---------- */

@font-face {
  font-family: 'Archivo';
  src: url('/assets/fonts/archivo-var-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/assets/fonts/plexmono-400-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/assets/fonts/plexmono-500-latin.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
/* Digit remap — EVERY numeral on the site renders in IBM Plex Mono, no exceptions.
   unicode-range maps only the digit glyphs (0-9) onto the Archivo family, so any
   number in any heading or paragraph — static or injected by JS — uses the neutral
   Plex Mono glyph. Explicit .mono/.data-label/.score wrappers still win for tabular
   alignment; this is the site-wide safety net so no digit can leak in the body face. */
@font-face {
  font-family: 'Archivo';
  src: url('/assets/fonts/plexmono-400-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0030-0039;
}

/* ---------- tokens ---------- */

:root {
  --housing: #E6E7E3;   /* ground — instrument enclosure */
  --ink:     #17181A;   /* type, rules, YOUR line on every chart */
  --rule:    #B9BBB5;   /* hairlines, creases, grid */
  --cut:     #D6006E;   /* THE SIGNAL — cut-line magenta. Gap + decay only. */
  --crease:  #0089B8;   /* process cyan — frontier, citations, receipts */
  --paper:   #F4F5F2;   /* raised surfaces, the score card */
  --ease:    cubic-bezier(.2,0,0,1);

  --ink-60:  rgba(23,24,26,.60);
  --ink-40:  rgba(23,24,26,.40);

  --font-display: 'Archivo', system-ui, sans-serif;
  --font-body:    'Archivo', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

  --container: 1120px;
  --gutter: 24px;
}

/* ---------- base ---------- */

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

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  background: var(--housing);
  color: var(--ink);
  font: 400 17px/1.62 var(--font-body);
}

::selection { background: var(--ink); color: var(--housing); }

img, svg { max-width: 100%; display: block; }

a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

hr { border: 0; border-top: 1px solid var(--rule); }

/* Numbers are measured, not written. Mono everywhere via these hooks. */
code, .num, .mono, .data-label, .score, .delta, .receipt, td.num, .chart text {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- type ramp ---------- */

.display-1 {
  font: 600 64px/1.02 var(--font-display);
  font-stretch: 125%;
  letter-spacing: -0.02em;
}
.display-2 {
  font: 600 42px/1.08 var(--font-display);
  font-stretch: 125%;
  letter-spacing: -0.015em;
}
.heading {
  font: 500 26px/1.25 var(--font-display);
  letter-spacing: -0.01em;
}
.lede  { font: 400 21px/1.45 var(--font-body); }
.body  { font: 400 17px/1.62 var(--font-body); }
.small { font: 400 14px/1.5  var(--font-body); }

/* Labels a value. Never permitted above a headline. */
.data-label {
  font: 500 12px/1.35 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.score {
  font: 500 112px/0.9 var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.delta {
  font: 500 22px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .display-1 { font-size: 38px; }
  .display-2 { font-size: 28px; }
  .score     { font-size: 72px; }
}

.measure { max-width: 34em; }        /* body copy line length */
.measure-lede { max-width: 28em; }

/* ---------- layout ---------- */

.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }

.section { padding-block: 96px; }
.section-tight { padding-block: 40px; }   /* break the isometry deliberately */
.section-rule { border-top: 1px solid var(--rule); }

@media (max-width: 640px) {
  .section { padding-block: 56px; }
}

/* ---------- motion ----------
   Instruments do not bounce. One easing curve. One moving thing at a time. */

.t { transition: all 240ms var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- nav ---------- */

.yko-nav {
  border-bottom: 1px solid var(--rule);
  background: var(--housing);
}
.yko-nav-inner {
  max-width: var(--container); margin-inline: auto; padding: 0 var(--gutter);
  height: 60px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.yko-wordmark {
  font: 600 17px/1 var(--font-display);
  font-stretch: 125%;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.yko-nav-links { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.yko-nav-links a {
  font: 500 15px/1 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
}
.yko-nav-links a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }

/* Small screens: the bar becomes two rows rather than overflowing.
   Nav height is fixed on desktop only, so it can grow here. */
@media (max-width: 760px) {
  .yko-nav-inner {
    height: auto;
    min-height: 60px;
    padding-block: 12px;
    flex-wrap: wrap;
    gap: 8px 20px;
  }
  .yko-nav-links { gap: 8px 18px; width: 100%; }
  .yko-nav-links a { font-size: 14px; }
}
@media (max-width: 420px) {
  .yko-nav-links { gap: 8px 14px; }
  .yko-nav-links a { font-size: 13px; }
}

/* ---------- footer ---------- */

.yko-footer {
  border-top: 1px solid var(--rule);
  margin-top: 96px;
}
.yko-footer-inner {
  max-width: var(--container); margin-inline: auto; padding: 40px var(--gutter) 56px;
  display: flex; flex-wrap: wrap; gap: 16px 40px;
  align-items: baseline; justify-content: space-between;
}
.yko-footer .meta { font: 400 12px/1.6 var(--font-mono); color: var(--ink-60); }
.yko-footer a { font: 400 14px/1.5 var(--font-body); text-decoration: none; }
.yko-footer a:hover { text-decoration: underline; }
.yko-footer-links { display: flex; flex-wrap: wrap; gap: 12px 24px; }

/* ---------- buttons ----------
   Actions are ink. --cut is never a button. */

.btn {
  display: inline-block;
  font: 500 15px/1 var(--font-body);
  padding: 14px 22px;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: transparent;
  text-decoration: none;
  transition: background 200ms var(--ease), color 200ms var(--ease);
}
.btn:hover { background: var(--ink); color: var(--housing); }

.btn-solid { background: var(--ink); color: var(--housing); }
.btn-solid:hover { background: transparent; color: var(--ink); }

.btn:disabled, .btn-solid:disabled { opacity: .4; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; color: var(--ink); }

/* ---------- forms ---------- */

.field { display: block; }
.field + .field { margin-top: 16px; }
.field-label {
  font: 500 12px/1.35 var(--font-mono);
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-60);
  display: block; margin-bottom: 8px;
}
.input {
  width: 100%;
  font: 400 17px/1.4 var(--font-body);
  padding: 12px 14px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  border-radius: 0;
  transition: border-color 200ms var(--ease);
}
.input::placeholder { color: var(--ink-40); }
.input:focus { outline: none; border-color: var(--ink); }

/* Disabled action — quiet, not colored. Used by multi-step forms whose
   Continue button waits on a selection. */
.btn:disabled,
.btn[disabled] {
  color: var(--ink-40);
  border-color: var(--rule);
  background: transparent;
  cursor: not-allowed;
}
.btn-solid:disabled,
.btn-solid[disabled] {
  background: var(--rule);
  color: var(--housing);
  border-color: var(--rule);
}

/* ---------- onboarding stepper ----------
   Segmented rule that fills with ink as steps complete. No color coding,
   no green "done" state — position is the signal. Reusable across wizards. */

.progress-steps { display: flex; gap: 8px; }
.progress-step {
  height: 2px; flex: 1;
  background: var(--rule);
  transition: background 200ms var(--ease);
}
.progress-step.done   { background: var(--ink-40); }
.progress-step.active { background: var(--ink); }

/* ---------- selectable context chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: 500 13px/1 var(--font-body);
  padding: 9px 14px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 200ms var(--ease);
}
.chip:hover { border-color: var(--ink); }
.chip.selected { border-color: var(--ink); background: var(--ink); color: var(--housing); }

/* ---------- stepper options ----------
   A full-width answer choice: main line + optional sub line. Resting
   state is quiet paper; selection is an ink border + inset ring (an
   instrument's set position). No fills, no color coding. */

.options { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
  display: block; width: 100%; text-align: left;
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 14px 18px;
  cursor: pointer;
  transition: border-color 200ms var(--ease);
}
.option-btn:hover { border-color: var(--ink); }
.option-btn.selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.option-main { display: block; font: 400 16px/1.4 var(--font-body); color: var(--ink); }
.option-sub  { display: block; margin-top: 4px; font: 400 13px/1.45 var(--font-body); color: var(--ink-60); }

/* ---------- range slider ----------
   A reading set by hand. Hairline track, square ink thumb, no rounded
   ends. The set portion is painted through background-size by the page's
   script — a flat ink fill, never a colour ramp and never a status colour. */

.slider {
  width: 100%;
  -webkit-appearance: none; appearance: none;
  height: 3px;
  background-color: var(--rule);
  background-image: linear-gradient(var(--ink), var(--ink));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  border-radius: 0;
  cursor: pointer;
  outline-offset: 8px;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px;
  border-radius: 0; border: none;
  background: var(--ink);
  cursor: pointer;
}
.slider::-moz-range-track { height: 3px; background: transparent; border: none; }
.slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 0; border: none;
  background: var(--ink);
  cursor: pointer;
}

/* ---------- surfaces ---------- */

.paper { background: var(--paper); border: 1px solid var(--rule); }

/* ---------- the wall card ----------
   Flat. Name, sector, grade, one-line gap statement. No icons,
   no screenshots-at-an-angle. The card IS the proof of proximity. */

.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.wall-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 24px;
  display: flex; flex-direction: column; gap: 6px;
  text-decoration: none;
  transition: border-color 200ms var(--ease);
}
.wall-card:hover { border-color: var(--ink); }
.wall-card .data-label { color: var(--ink-60); }
.wall-card-name { font: 500 21px/1.25 var(--font-display); letter-spacing: -0.01em; }
.wall-card-grade {
  font: 500 44px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  margin-top: 12px;
}
.wall-card-gapline { font: 400 14px/1.5 var(--font-body); color: var(--ink-60); }

/* ---------- the gap — signature element ----------
   Dimension callout on a technical drawing. Hatched interior at 45
   degrees in --cut; the value in a knockout box. This component and
   the decay are the ONLY places --cut may appear.                  */

.gap-callout { position: relative; }

.gap-edge { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-block: 10px; }
.gap-edge-frontier { border-bottom: 2.2px solid var(--crease); }
.gap-edge-you      { border-top:    2.2px solid var(--ink); }
.gap-edge .data-label { color: var(--ink-60); }
.gap-edge .delta { color: var(--ink); }
.gap-edge-frontier .delta { color: var(--crease); }

.gap-interior {
  position: relative;
  min-height: 96px;
  display: flex; align-items: center; justify-content: center;
  border-left:  1px dashed var(--cut);
  border-right: 1px dashed var(--cut);
  background: repeating-linear-gradient(
    45deg,
    transparent 0 7px,
    rgba(214, 0, 110, 0.28) 7px 8px
  );
}
.gap-value {
  font: 500 22px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--cut);
  background: var(--paper);
  border: 1px solid var(--cut);
  padding: 10px 16px;
}

/* Example data must say so. Dashed = projection rules apply. */
.tag-example {
  font: 500 12px/1 var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--ink-60);
  border: 1px dashed var(--rule);
  padding: 4px 8px;
  display: inline-block;
}

/* ---------- the receipt ----------
   Every projected number carries its citation, inline and clickable. */

.receipt {
  font: 400 12px/1.6 var(--font-mono);
  color: var(--ink-60);
  letter-spacing: 0.01em;
}
.receipt a { color: var(--crease); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---------- the posture ladder ----------
   The only sanctioned triad on the site. One number per posture.
   Risk revealed by progressive disclosure; resting surface quiet. */

.ladder { border-top: 1px solid var(--rule); }

.ladder-row { border-bottom: 1px solid var(--rule); }
.ladder-row summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: 110px 1fr auto;
  align-items: baseline;
  gap: 24px;
  padding: 22px 4px;
}
.ladder-row summary::-webkit-details-marker { display: none; }
.ladder-posture {
  font: 600 15px/1 var(--font-display);
  font-stretch: 125%;
  letter-spacing: 0.04em;
}
.ladder-meaning { font: 400 15px/1.5 var(--font-body); color: var(--ink-60); }
.ladder-grade { font: 500 28px/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.ladder-row summary:hover { background: var(--paper); }
.ladder-risk {
  padding: 0 4px 22px;
  max-width: 34em;
  font: 400 15px/1.6 var(--font-body);
  color: var(--ink-60);
}
.ladder-risk strong { color: var(--ink); font-weight: 500; }

@media (max-width: 640px) {
  .ladder-row summary { grid-template-columns: 84px 1fr auto; gap: 12px; padding: 18px 2px; }
  .ladder-meaning { font-size: 13px; }
  .ladder-grade { font-size: 22px; }
}

/* ---------- disclosure row ----------
   The ladder's rules, without the grid: a hairline-ruled row that opens.
   Used where the label is a full phrase, not a one-word posture. No colour
   coding — the status word carries the reading. */

.disclosure { border-top: 1px solid var(--rule); }

.disclosure-row { border-bottom: 1px solid var(--rule); }
.disclosure-row > summary { list-style: none; cursor: pointer; padding: 18px 4px; }
.disclosure-row > summary::-webkit-details-marker { display: none; }
.disclosure-row > summary:hover { background: var(--paper); }
.disclosure-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.disclosure-body { padding: 0 4px 22px; max-width: 40em; }

/* ---------- chart conventions ----------
   Hand-computed SVG only. Your line ink, frontier crease, 2.2px.
   Projection dashed 4 4 — never rendered as fact. NOW rule splits
   observed from projected. Grid barely there.                     */

.chart text { font: 400 12px var(--font-mono); fill: var(--ink-60); }
.chart .l-you      { stroke: var(--ink);    stroke-width: 2.2; fill: none; }
.chart .l-frontier { stroke: var(--crease); stroke-width: 2.2; fill: none; }
.chart .l-proj     { stroke-dasharray: 4 4; }
.chart .grid       { stroke: var(--rule); stroke-width: 0.5; stroke-dasharray: 1 4; }
.chart .now        { stroke: var(--ink-40); stroke-width: 1; stroke-dasharray: 4 4; }

/* ---------- instrument page ---------- */

.cite-group { line-height: 0; }
.cite {
  font: 500 11px/1 var(--font-mono);
  color: var(--crease);
  text-decoration: none;
  padding: 1px 3px;
  border: 1px solid transparent;
}
.cite:hover { border-color: var(--crease); text-decoration: none; }

.req-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; max-width: 880px; }
@media (max-width: 720px) { .req-grid { grid-template-columns: 1fr; gap: 40px; } }

.req-row { border-top: 1px solid var(--rule); padding-top: 12px; }
.req-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }

.source-list { padding-left: 1.4em; max-width: 44em; }
.source-list li { padding-block: 7px; border-bottom: 1px solid var(--rule); }
.source-list li::marker { font: 500 12px var(--font-mono); color: var(--ink-60); }
.source-list a { text-decoration: none; }
.source-list a:hover { text-decoration: underline; }

/* ---------- reveal + print ----------
   Reusable JS-driven show/hide, and a print surface that isolates one
   node (e.g. a generated letter) from the rest of the page. */

.reveal { display: none; }
.reveal.show { display: block; }

.print-only { display: none; }
@media print {
  /* Isolation applies only to pages that actually carry a print surface —
     otherwise an ordinary page (a scored dashboard someone wants on paper)
     would print blank. */
  body:has(.print-only) > *:not(.print-only) { display: none !important; }
  .print-only { display: block !important; }
  .print-only #print-letter { white-space: pre-wrap; color: var(--ink); }
  .no-print { display: none !important; }
}

/* ---------- utilities ---------- */

.ink-60 { color: var(--ink-60); }
.crease { color: var(--crease); }
.right  { text-align: right; }
.stack-8  > * + * { margin-top: 8px; }
.stack-16 > * + * { margin-top: 16px; }
.stack-24 > * + * { margin-top: 24px; }
.stack-40 > * + * { margin-top: 40px; }

/* ---------- comparison table ----------
   Hairlines only. Head rule is ink, row rules are --rule. No fills, no
   status colors — the number carries the reading. td.num is already
   mono + tabular via the numbers hook near the top of this file. */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  font: 500 12px/1.35 var(--font-mono);
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-60);
  text-align: left; vertical-align: bottom;
  padding: 0 18px 10px 0;
  border-bottom: 1px solid var(--ink);
}
.table td {
  font: 400 14px/1.5 var(--font-body);
  color: var(--ink-60);
  vertical-align: top;
  padding: 14px 18px 14px 0;
  border-bottom: 1px solid var(--rule);
}
.table th:last-child, .table td:last-child { padding-right: 0; }
.table tr:last-child td { border-bottom: none; }
.table td.subject { color: var(--ink); font-weight: 500; }
/* The .table td shorthand above would reset the family, so state it again. */
.table td.num {
  font: 500 18px/1.45 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}

@media (max-width: 720px) { .table { min-width: 660px; } }

/* ---------- meter ----------
   One value on a hairline track. The fill is always ink — length is the
   signal, never color. Used by dimension rows and any 0–100 reading. */

.meter { display: flex; align-items: center; gap: 12px; }
.meter-name {
  font: 500 12px/1.35 var(--font-mono);
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-60);
  width: 132px; flex-shrink: 0;
}
.meter-track { flex: 1; height: 3px; background: var(--rule); }
.meter-fill  { display: block; height: 100%; background: var(--ink); }
.meter-val {
  font: 500 13px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  width: 44px; text-align: right; flex-shrink: 0;
}
.meter-hint { font: 400 12px/1 var(--font-mono); color: var(--ink-40); flex-shrink: 0; }

@media (max-width: 640px) {
  .meter-name { width: 96px; font-size: 11px; }
}
