/* ————————————————————————————————————————
   Wet-bulb — instrument/editorial. Color belongs to the data;
   everything else is paper, ink and hairlines.
   ———————————————————————————————————————— */

:root {
  --surface:   #f7f5f0;
  --surface-2: #fcfbf7;
  --ink:       #171512;
  --ink-2:     #55524b;
  --muted:     #8b877d;
  --hairline:  #e2ded3;
  --grid:      #e7e3d8;

  /* risk bands, cool → hot (validated on this surface) */
  --band-0: #3e8ec1;
  --band-1: #0e8c6d;
  --band-2: #ad8522;
  --band-3: #aa5910;
  --band-4: #9e2e21;
  --band-5: #7b1b2e;
  --band-6: #561329;

  --cur: var(--band-1); /* set from JS to the selected hour's band */
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface:   #161513;
    --surface-2: #1d1c19;
    --ink:       #f0ede6;
    --ink-2:     #b5b1a6;
    --muted:     #7d7a70;
    --hairline:  #2b2a26;
    --grid:      #262521;

    --band-0: #3d8cb6;
    --band-1: #3ca684;
    --band-2: #848d4b;
    --band-3: #e19535;
    --band-4: #f99262;
    --band-5: #f3947c;
    --band-6: #f8a49d;
  }
}

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

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

body {
  background: var(--surface);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "kern";
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; width: 100%; max-width: 1060px; margin: 0 auto; padding: 0 24px; }

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

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

/* ————— header ————— */

.site-head {
  max-width: 1060px; width: 100%;
  margin: 0 auto;
  padding: 22px 24px 18px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  border-bottom: 1px solid var(--hairline);
}

.wordmark { font-size: 17px; font-weight: 650; letter-spacing: .01em; }
.wordmark-deg { color: var(--cur); transition: color .4s; }

.head-tools { display: flex; align-items: center; gap: 14px; min-width: 0; }

.place-btn {
  font-size: 13.5px; color: var(--ink-2);
  padding: 4px 2px; border-bottom: 1px solid transparent;
  max-width: 40vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.place-btn:hover { color: var(--ink); border-bottom-color: var(--hairline); }
.place-caret { margin-left: 5px; color: var(--muted); font-size: 12px; }

.unit-toggle { display: flex; border: 1px solid var(--hairline); }
.unit-toggle button {
  padding: 3px 9px; font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.unit-toggle button + button { border-left: 1px solid var(--hairline); }
.unit-toggle button[aria-pressed="true"] { color: var(--surface); background: var(--ink); }

/* ————— shared bits ————— */

.micro {
  font-size: 11px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}

.section-head { font-size: 15px; font-weight: 650; letter-spacing: .01em; margin-bottom: 10px; }

.soft { color: var(--ink-2); }
.fine { font-size: 12.5px; color: var(--muted); margin-top: 14px; max-width: 62ch; }

.btn {
  border: 1px solid var(--ink);
  padding: 8px 18px; font-size: 14px; font-weight: 550;
}
.btn:hover { background: var(--ink); color: var(--surface); }
.btn-ghost { border-color: var(--hairline); color: var(--ink-2); }
.btn-ghost:hover { background: none; color: var(--ink); border-color: var(--ink); }
.btn-small { padding: 3px 12px; font-size: 12.5px; }
.btn-block { display: block; width: 100%; text-align: center; }

/* ————— state panels ————— */

.state-panel { padding: 96px 0; text-align: center; max-width: 420px; margin: 0 auto; }
.state-panel h1 { font-size: 22px; font-weight: 650; margin-bottom: 8px; }
.state-panel .soft { font-size: 14.5px; }
.nofix-actions { margin-top: 22px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.pulse-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--cur); margin: 0 auto 18px;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .25 } 50% { opacity: 1 } }
@media (prefers-reduced-motion: reduce) { .pulse-dot { animation: none } }

#panel-boot, #panel-nofix, #panel-error { display: none; }
body[data-state="boot"]  #panel-boot  { display: block; }
body[data-state="nofix"] #panel-nofix { display: block; }
body[data-state="error"] #panel-error { display: block; }
body[data-state="ready"] #app { display: block; }

/* ————— hero ————— */

.hero {
  padding: 40px 0 40px;
  border-bottom: 1px solid var(--hairline);
  text-align: center;
}

.reading .micro { white-space: nowrap; }

.big-label { font-size: 17px; font-weight: 650; letter-spacing: .01em; margin-bottom: 7px; }

.big-figure {
  font-size: clamp(92px, 15vw, 158px);
  font-weight: 200;
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin: 6px 0 2px;
  font-variant-numeric: normal;
}
.big-unit { font-size: .32em; font-weight: 300; color: var(--muted); margin-left: .08em; vertical-align: .85em; letter-spacing: 0; }

.band-chip { display: flex; align-items: baseline; justify-content: center; gap: 9px; font-size: 16px; font-weight: 600; }
.band-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--cur); align-self: center; flex: none;
  transition: background .4s;
}
.band-range { color: var(--muted); font-weight: 400; font-size: 13.5px; }

.substats { display: flex; justify-content: center; gap: 38px; margin-top: 28px; }
.substats div { border-top: 1px solid var(--hairline); padding-top: 8px; min-width: 84px; }
.substats dt { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.substats dd { font-size: 18px; font-weight: 450; margin-top: 1px; font-variant-numeric: tabular-nums; }

.verdict { max-width: 620px; margin: 38px auto 0; }
.verdict h2 { font-size: clamp(24px, 3.2vw, 30px); font-weight: 650; line-height: 1.15; letter-spacing: -0.01em; }
.verdict-line { margin-top: 8px; color: var(--ink-2); font-size: 15.5px; }
.verdict-points { margin-top: 18px; list-style: none; text-align: left; }
.verdict-points li {
  padding: 9px 0 9px 0; font-size: 14.5px; color: var(--ink-2);
  border-top: 1px solid var(--hairline);
}
.verdict-points li strong { color: var(--ink); font-weight: 600; }

/* ————— timeline ————— */

.timeline { padding: 30px 0 8px; }

.tl-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; min-height: 28px; }
.tl-head .btn-small[hidden] { display: block; visibility: hidden; }

.chart-wrap {
  position: relative;
  height: 264px;
  cursor: grab;
  touch-action: pan-y;
  outline-offset: 4px;
}
.chart-wrap:focus-visible { outline: 1.5px solid var(--ink); }
.chart-wrap.dragging { cursor: grabbing; }
.chart-wrap canvas { display: block; width: 100%; height: 100%; }
.chart-wrap.refetching { opacity: .55; }

.hint { font-size: 12px; color: var(--muted); margin-top: 10px; }
@media (hover: none) { .hint .kb { display: none; } }

/* ————— scale ————— */

.scale { padding: 38px 0 8px; border-top: 1px solid var(--hairline); margin-top: 26px; }
.scale-intro { font-size: 14px; max-width: 68ch; margin-bottom: 18px; }

.scale-list { list-style: none; }
.scale-list li {
  display: grid;
  grid-template-columns: 4px 108px 128px 1fr;
  gap: 0 18px;
  padding: 10px 10px 10px 0;
  border-top: 1px solid var(--hairline);
  align-items: baseline;
}
.scale-list li:last-child { border-bottom: 1px solid var(--hairline); }
.scale-swatch { width: 4px; height: 30px; align-self: center; }
.scale-range { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.scale-name { font-size: 14.5px; font-weight: 620; }
.scale-line { font-size: 13.5px; color: var(--ink-2); }
.scale-list li[data-active] { background: var(--surface-2); box-shadow: -12px 0 0 var(--surface-2), 12px 0 0 var(--surface-2); }
.scale-list li[data-active] .scale-name::after {
  content: "now viewing"; font-size: 10px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  margin-left: 10px; white-space: nowrap;
}

/* ————— explainer ————— */

.explain { padding: 38px 0 30px; border-top: 1px solid var(--hairline); margin-top: 34px; }
.explain-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.explain-cols p { font-size: 14.5px; color: var(--ink-2); max-width: 60ch; }

/* ————— table view ————— */

.table-view { border-top: 1px solid var(--hairline); padding: 18px 0 34px; }
.table-view summary {
  cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  list-style: none; display: inline-flex; align-items: center; gap: 8px;
}
.table-view summary::-webkit-details-marker { display: none; }
.table-view summary::before { content: "+"; font-weight: 400; color: var(--muted); }
.table-view[open] summary::before { content: "−"; }
.table-view summary:hover { color: var(--ink); }

.table-holder { margin-top: 16px; max-height: 420px; overflow: auto; border: 1px solid var(--hairline); }
.table-holder table { border-collapse: collapse; width: 100%; font-size: 13px; }
.table-holder th, .table-holder td { text-align: right; padding: 5px 14px; white-space: nowrap; }
.table-holder th:first-child, .table-holder td:first-child { text-align: left; }
.table-holder td:last-child, .table-holder th:last-child { text-align: left; }
.table-holder thead th {
  position: sticky; top: 0; background: var(--surface);
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--hairline); font-weight: 600;
}
.table-holder td { border-top: 1px solid var(--grid); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.table-holder td.t-wb { color: var(--ink); font-weight: 600; }
.table-holder tr[data-now] td { background: var(--surface-2); color: var(--ink); }
.table-band-key { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: baseline; }

/* ————— footer ————— */

.site-foot {
  max-width: 1060px; width: 100%; margin: 0 auto;
  padding: 18px 24px 30px;
  border-top: 1px solid var(--hairline);
  font-size: 12px; color: var(--muted);
}
.site-foot a { color: var(--ink-2); }

/* ————— locate dialog ————— */

.locate-dialog {
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink);
  padding: 26px;
  width: min(400px, calc(100vw - 40px));
  margin: auto;
}
.locate-dialog::backdrop { background: rgba(10, 9, 7, .45); }

.locate-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 18px; }
.locate-head h2 { font-size: 16px; font-weight: 650; }
.dialog-close { font-size: 22px; line-height: 1; color: var(--muted); padding: 2px 6px; }
.dialog-close:hover { color: var(--ink); }

.or-rule {
  display: flex; align-items: center; gap: 12px;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  margin: 18px 0 12px;
}
.or-rule::before, .or-rule::after { content: ""; flex: 1; border-top: 1px solid var(--hairline); }

#search-input {
  width: 100%; padding: 9px 12px;
  font: inherit; color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  outline: none;
}
#search-input:focus { border-color: var(--ink-2); }

.search-results { list-style: none; margin-top: 6px; }
.search-results button {
  display: block; width: 100%; text-align: left;
  padding: 9px 12px; font-size: 14px;
  border-bottom: 1px solid var(--grid);
}
.search-results button:hover { background: var(--surface-2); }
.search-results .sr-region { color: var(--muted); font-size: 12.5px; margin-left: 8px; }
.search-results .sr-empty { padding: 9px 12px; font-size: 13px; color: var(--muted); }

/* ————— responsive ————— */

@media (max-width: 820px) {
  .hero { padding: 28px 0; }
  .verdict { margin-top: 28px; }
  .explain-cols { grid-template-columns: 1fr; gap: 14px; }
  .scale-list li { grid-template-columns: 4px 96px 1fr; }
  .scale-list .scale-line { grid-column: 3; margin-top: 2px; }
  .chart-wrap { height: 228px; }
  .substats { gap: 24px; }
}

@media (max-width: 480px) {
  main { padding: 0 18px; }
  .site-head { padding: 16px 18px 14px; }
  .place-btn { max-width: 34vw; }
  .scale-list li { grid-template-columns: 4px 1fr; }
  .scale-list .scale-name { grid-column: 2; }
  .scale-list .scale-range { grid-column: 2; order: 3; }
  .scale-list .scale-line { grid-column: 2; }
  .scale-swatch { grid-row: span 3; }
}
