/* Trench Heat Index — SPEC 9.1 palette, cool instrument panel.
   The heat ramp is the only saturated colour that carries meaning. */

:root {
  --bg:       #EFF1F3;
  --panel:    #FFFFFF;
  --ink:      #10151C;
  --muted:    #667085;
  --hairline: #DDE1E6;

  --track:    #E8EBEF;   /* unfilled bar / inert surface */
  --up:       #16A34A;
  --down:     #DC2626;

  --r:        14px;
  --gap:      16px;
  --pad:      24px;

  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --disp: "Archivo", "Archivo Expanded", system-ui, -apple-system, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

a { color: inherit; }
a:focus-visible, summary:focus-visible, button:focus-visible {
  outline: 2px solid #2B6CB0; outline-offset: 2px; border-radius: 6px;
}

.page { max-width: 1240px; margin: 0 auto; padding: 26px 20px 44px; }

/* ---------------------------------------------------------------- header */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { display: block; line-height: 0; }
.brand-name {
  font-family: var(--disp); font-weight: 700; font-stretch: 125%;
  font-size: 25px; letter-spacing: -.015em; margin: 0; line-height: 1.15;
}
.brand-sub { margin: 1px 0 0; font-size: 13px; color: var(--muted); }

.header-right { display: flex; align-items: center; gap: 10px; }

.socials { display: flex; align-items: center; gap: 2px; }
.social {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 9px;
  color: var(--muted); text-decoration: none;
}
.social:hover { color: var(--ink); background: var(--panel); }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: 999px; padding: 5px 12px 5px 10px;
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #C3CAD3; flex: none;
}
.status-dot.ok   { background: var(--up); }
.status-dot.down { background: #C3CAD3; }

/* ------------------------------------------------------------------ grid */
.grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }

@media (min-width: 900px) {
  .grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
  /* The two-meter hero is the whole point of the page — full width so the
     chains sit side by side at a readable size. */
  .hero  { grid-column: 1 / -1; grid-row: 1; }
  .side  { grid-column: 1 / -1; }
  .side .vitals { grid-template-columns: repeat(4, 1fr); }
  .why   { grid-column: 1 / -1; }
  .spark { grid-column: 1 / -1; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  padding: var(--pad);
}

.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}

h2 {
  font-family: var(--disp); font-weight: 700; font-stretch: 125%;
  font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 0;
}
.hint { font-size: 12px; color: var(--muted); margin: 0; }

/* ------------------------------------------------------------------ hero */
.hero { display: flex; flex-direction: column; padding-bottom: 18px; }

/* Two chains, one card. On desktop the meters sit side by side with a
   hairline divider so "which chain is hotter" is a single glance. */
.meters-row { display: grid; grid-template-columns: 1fr; gap: 26px; }
.meter-block { min-width: 0; }
@media (min-width: 720px) {
  .meters-row { grid-template-columns: 1fr 1fr; gap: 0; }
  .meters-row .meter-block { padding: 0 22px; }
  .meters-row .meter-block + .meter-block { border-left: 1px solid var(--hairline); }
}
.chain-caption {
  font-family: var(--disp); font-weight: 700; font-stretch: 125%;
  font-size: 11px; letter-spacing: .14em; color: var(--muted);
  text-align: center; margin: 0 0 4px;
}
.chain-verdict {
  text-align: center; margin: 18px 0 0;
  font-family: var(--mono); font-size: 15px; font-weight: 600;
  letter-spacing: .02em;
}
.rh-vitals-heading { margin-top: 22px; margin-bottom: 0; }
.rh-vitals-heading + .vitals { margin-top: 10px; }

/* SPEC 9.2 fixes viewBox at 640x560, but the drawn content only spans roughly
   y=160..460 — the bubble at score 50 tops out near y=166 and the arc plus its
   46px stroke ends near y=453. Cropping the empty bands here keeps the mandated
   coordinate system intact while removing the dead space.
   Percentage margins resolve against WIDTH, and the SVG renders at
   height = 0.875 x width, so 150 viewBox units off the top is
   150/560 * 0.875 = 23.4% of width. 12% off the bottom leaves the score=0/100
   bubble (which reaches y=458) fully visible. */
.gauge-wrap { overflow: hidden; margin: -4px 0 0; }
.gauge-svg  { display: block; width: 100%; height: auto;
              margin-top: -23.4%; margin-bottom: -12%; }

.needle-group {
  transform-box: view-box;
  transform-origin: 320px 430px;
  transition: transform 900ms cubic-bezier(.4, 0, .2, 1);
}
.bubble-text {
  font-family: var(--mono); font-weight: 600; font-size: 22px; fill: #fff;
}

.now-line {
  margin: 0 0 2px; display: flex; align-items: baseline; gap: 9px;
  font-family: var(--disp); font-weight: 700; font-stretch: 125%;
  font-size: 21px; letter-spacing: -.005em;
}
.now-label { color: var(--ink); }
.now-band { color: var(--muted); }

.readout { text-align: center; margin-top: 10px; }
.score-line {
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
  flex-wrap: wrap;
}
.score-digits {
  font-family: var(--mono); font-weight: 600; font-size: 58px;
  letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums;
}
.score-of { font-family: var(--mono); font-size: 19px; color: var(--muted); }
.time-adjusted { margin: 5px 0 0; font-size: 12.5px; color: var(--muted); }
.time-adjusted b { font-family: var(--mono); font-weight: 600; color: var(--ink); }

.deltas {
  display: flex; justify-content: center; gap: 30px;
  margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--hairline);
}
.delta { text-align: center; }
.delta-label {
  display: block; font-family: var(--mono); font-size: 10px;
  letter-spacing: .09em; color: var(--muted); margin-bottom: 2px;
}
.delta-val {
  font-family: var(--mono); font-weight: 600; font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.delta-val.up { color: var(--up); } .delta-val.down { color: var(--down); }

.hero-foot {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--hairline); flex-wrap: wrap;
}

.share-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--body); font-size: 13px; font-weight: 500;
  color: var(--ink); background: var(--panel);
  border: 1px solid var(--hairline); border-radius: 9px;
  padding: 7px 13px; cursor: pointer;
}
.share-btn:hover { background: #F6F8FA; }
.share-btn[disabled] { opacity: .6; cursor: default; }
.share-btn svg { flex: none; }

.calibrating {
  margin: 12px 0 0; font-size: 12px; color: var(--muted); text-align: center;
  background: #F6F8FA; border: 1px solid var(--hairline);
  border-radius: 9px; padding: 8px 12px;
}
.calibrating b { font-family: var(--mono); font-weight: 600; color: var(--ink); }

/* ----------------------------------------------------------------- side */
.side > .ladder-heading { margin-top: 24px; }
.side > .hint { margin-bottom: 12px; }

.vitals { display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
          background: var(--hairline); border: 1px solid var(--hairline);
          border-radius: 10px; overflow: hidden; margin-top: 12px; }
.vital { background: var(--panel); padding: 11px 13px; }
.vital-label {
  display: block; font-size: 10.5px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 3px;
}
.vital-val {
  font-family: var(--mono); font-weight: 600; font-size: 17px;
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.vital-sub { display: block; margin-top: 1px; font-size: 10.5px;
              color: var(--muted); font-family: var(--mono); }

/* --------------------------------------------------------------- volume */
.volrows { display: flex; flex-direction: column; }
.vrow {
  display: grid; grid-template-columns: 40px 1fr auto;
  align-items: baseline; gap: 10px; padding: 9px 2px;
  border-bottom: 1px solid var(--hairline);
}
.vrow:last-child { border-bottom: 0; }
.vwin {
  font-family: var(--mono); font-weight: 600; font-size: 11px;
  letter-spacing: .06em; color: var(--muted); text-transform: uppercase;
}
.vamt {
  font-family: var(--mono); font-weight: 600; font-size: 19px;
  font-variant-numeric: tabular-nums;
}
.vnote { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* --------------------------------------------------------------- ladder */
.ladder { display: flex; flex-direction: column; gap: 2px; }
.lrow { display: grid; grid-template-columns: 46px 1fr 26px;
        align-items: center; gap: 9px; padding: 2px 0; }
.lrung {
  font-family: var(--mono); font-weight: 600; font-size: 11px;
  color: var(--muted); text-align: right;
}
.lticks { display: flex; gap: 2px; align-items: center; flex-wrap: wrap;
          min-height: 13px; }
.lticks i { width: 4px; height: 13px; border-radius: 1px; display: block; }
.lticks .lempty { width: 100%; height: 1px; background: var(--hairline);
                  border-radius: 0; }
.lcount {
  font-family: var(--mono); font-weight: 600; font-size: 11.5px;
  text-align: right; font-variant-numeric: tabular-nums;
}
.lcount.zero { color: #B9C0C9; }

/* ------------------------------------------------------------------ why */
.why { padding: 0; }
.why > summary {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  padding: 18px var(--pad); list-style: none; user-select: none;
}
.why > summary::-webkit-details-marker { display: none; }
.why-title {
  font-family: var(--disp); font-weight: 700; font-stretch: 125%;
  font-size: 13px; letter-spacing: .02em;
}
.why-hint { font-size: 12px; color: var(--muted); flex: 1; min-width: 0; }
.chev {
  width: 9px; height: 9px; border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted); transform: rotate(45deg);
  margin-top: -4px; flex: none;
}
.why[open] .chev { transform: rotate(225deg); margin-top: 3px; }
.why-body { padding: 0 var(--pad) var(--pad); }
.why-note { margin-top: 14px; }

.components { display: grid; grid-template-columns: 1fr; gap: 3px; }
@media (min-width: 760px) { .components { grid-template-columns: 1fr 1fr;
                                          column-gap: 28px; } }
.crow { display: grid; grid-template-columns: 1fr 74px 30px;
        align-items: center; gap: 10px; padding: 8px 0;
        border-bottom: 1px solid var(--hairline); }
.cname { font-size: 13px; overflow: hidden; text-overflow: ellipsis;
         white-space: nowrap; }
.cweight { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.cbar { display: block; height: 5px; background: var(--track);
        border-radius: 3px; overflow: hidden; }
.cbar > b { display: block; height: 100%; border-radius: 3px; }
.craw { display: block; font-family: var(--mono); font-size: 11px;
        color: var(--muted); text-align: right; margin-top: 3px;
        font-variant-numeric: tabular-nums; }
.cscore {
  display: block; font-family: var(--mono); font-weight: 600; font-size: 15px;
  text-align: right; font-variant-numeric: tabular-nums; line-height: 1.15;
}
.ccontrib { display: block; font-family: var(--mono); font-size: 10.5px;
            color: var(--muted); text-align: right; }

/* ---------------------------------------------------------------- coins */
.coins-table { display: flex; flex-direction: column; }
.coin-row {
  display: grid; grid-template-columns: 22px minmax(0,1fr) auto auto auto;
  align-items: center; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--hairline);
  text-decoration: none; color: inherit;
}
.coin-row:last-child { border-bottom: 0; }
.coin-row:hover { background: #F8FAFB; }
.coin-rank { font-family: var(--mono); font-size: 11px; color: #A8B0BA;
             text-align: right; font-variant-numeric: tabular-nums; }
.coin-sym { font-weight: 500; font-size: 13.5px; overflow: hidden;
            text-overflow: ellipsis; white-space: nowrap; }
.coin-sub { font-size: 11px; color: var(--muted); }
.coin-num { font-family: var(--mono); font-size: 12.5px; text-align: right;
            font-variant-numeric: tabular-nums; }
.coin-num .lab { display: block; font-size: 9.5px; letter-spacing: .06em;
                 color: var(--muted); text-transform: uppercase; }
.coin-chg { font-family: var(--mono); font-weight: 600; font-size: 12.5px;
            text-align: right; min-width: 62px;
            font-variant-numeric: tabular-nums; }
.coin-chg.up { color: var(--up); } .coin-chg.down { color: var(--down); }
.coins-empty { font-size: 12.5px; color: var(--muted); padding: 14px 0; }

/* ------------------------------------------------------------- sparkline */
.sparkline-wrap { position: relative; }
.sparkline-svg { display: block; width: 100%; height: 150px; }
.spark-empty { position: absolute; inset: 0; display: flex;
               align-items: center; justify-content: center; }
/* a display rule outranks the [hidden] attribute unless we say so */
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- footer */
.site-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--hairline); flex-wrap: wrap;
}
.footer-links { display: flex; gap: 16px; }
.footer-links a { font-size: 12px; color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }
.disclaimer { margin: 0; font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- mobile */
@media (max-width: 560px) {
  :root { --pad: 18px; }
  .page { padding: 18px 14px 34px; }
  .score-digits { font-size: 48px; }
  .now-line { font-size: 18px; }
  .deltas { gap: 20px; }
  .vitals { grid-template-columns: 1fr 1fr; }
  .site-footer { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .needle-group { transition: none; }
  * { scroll-behavior: auto; }
}

/* ---------------------------------------------------- reference deltas */
.dchip { font-style: normal; font-family: var(--mono); font-size: 10px;
         font-weight: 600; color: var(--muted); white-space: nowrap; }
.dchip.up { color: var(--up); } .dchip.down { color: var(--down); }

/* ------------------------------------------------------- spark hover */
.spark-tip {
  position: absolute; top: 6px; pointer-events: none;
  background: var(--ink); color: #fff; border-radius: 7px;
  padding: 5px 9px; font-family: var(--mono); font-size: 12px;
  font-variant-numeric: tabular-nums; white-space: nowrap; z-index: 3;
}
.spark-tip .tipday { opacity: .65; font-size: 10.5px; }
.spark-dot { fill: var(--ink); stroke: #fff; stroke-width: 1.5; }

/* --------------------------------------------------- compact two-chain hero */
/* The meters are the headline, not the whole page: cap their size so the
   vitals are reachable without a scroll. */
.meter-block .gauge-wrap { max-width: 400px; margin: -2px auto 0; }
.hero { padding-top: 16px; padding-bottom: 12px; }
.now-line { font-size: 18px; margin: 0; }
.score-line { line-height: 1.05; }
.score-digits { font-size: 44px; }
.readout { margin-top: 4px; }
.deltas { margin-top: 6px; }
.chain-verdict { margin-top: 12px; font-size: 14px; }
.hero-foot { margin-top: 10px; }
