/* QuietForecast — each briefing is a weather poster.
   One colour field per state, one huge condensed word, one sign drawn at a single stroke weight.
   Colour is never the only carrier: every state also has its word and its sign. */

:root {
  --paper: #f3f5f8;
  --ink: #000;
  --calm: #1f3fbf;
  --watch: #ffd21a;
  --act: #c8211b;
  --unsure: #c4c9d1;
  --field: var(--paper);
  --on-field: var(--ink);
  --soft: rgba(0, 0, 0, .62);
  --rule: rgba(0, 0, 0, .18);
  --focus: #ff7a00;
  --grot: "Archivo", "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", sans-serif;
}

body[data-state="calm"]      { --field: var(--calm);  --on-field: #fff; --soft: rgba(255,255,255,.78); --rule: rgba(255,255,255,.3); }
body[data-state="elevated"]  { --field: var(--watch); --on-field: #000; }
body[data-state="high"]      { --field: var(--act);   --on-field: #fff; --soft: rgba(255,255,255,.92); --rule: rgba(255,255,255,.35); }
body[data-state="uncertain"] { --field: var(--unsure); --on-field: #000; }

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--grot);
  font-size: 21px;
  line-height: 1.45;
  font-variation-settings: "wdth" 100;
}
:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 9; background: #fff; padding: .5rem 1rem; }

/* ---------- the coloured poster ---------- */
.poster, .bar {
  background: var(--field);
  color: var(--on-field);
  transition: background-color .5s ease, color .5s ease;
}
body[data-state="uncertain"] .poster,
body[data-state="uncertain"] .bar {
  /* fine vertical strokes: a marimba roll, the sound of a held note */
  background-image: repeating-linear-gradient(90deg, rgba(0,0,0,.07) 0 2px, transparent 2px 9px);
}

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem) 0;
}
.name { font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.pickers { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.pickers select {
  font: inherit; font-size: .95rem; font-weight: 600; color: inherit;
  background: transparent; border: 2px solid currentColor; border-radius: 999px;
  min-height: 2.75rem; padding: 0 2.2rem 0 1rem;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(-45deg, transparent 50%, currentColor 50%);
  background-position: right 1.1rem center, right .75rem center;
  background-size: .35rem .35rem; background-repeat: no-repeat;
}
.pickers option { color: #000; background: #fff; }

.poster {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  padding: clamp(1.5rem, 5vw, 4rem) clamp(1rem, 4vw, 3rem) clamp(2rem, 5vw, 3.5rem);
  min-height: min(88vh, 54rem);
  align-items: end;
}

.mark { align-self: stretch; display: flex; flex-direction: column; justify-content: flex-end; }
.glyph { width: clamp(5rem, 12vw, 9.5rem); height: auto; color: var(--on-field); margin-bottom: clamp(.5rem, 2vw, 1.5rem); }
.word {
  margin: 0;
  font-weight: 900;
  font-variation-settings: "wdth" 62;
  font-size: clamp(5.5rem, 17vw, 15.5rem);
  line-height: .82;
  letter-spacing: -.02em;
  text-wrap: balance;
}
body:is([data-state]) .word:lang(zh), html[lang^="zh"] .word { letter-spacing: 0; line-height: .95; }
.where { margin: 1rem 0 0; font-size: 1.05rem; font-weight: 600; color: var(--soft); }

/* one orchestrated moment: the word sets in when a new state arrives */
.word.arrive { animation: setin .7s cubic-bezier(.2,.7,.1,1) both; }
@keyframes setin { from { clip-path: inset(0 0 100% 0); transform: translateY(.12em); } to { clip-path: inset(0 0 0 0); transform: none; } }

/* ---------- what it says ---------- */
.say { display: flex; flex-direction: column; gap: 1.5rem; }
.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; counter-reset: none; }
.lines li {
  font-size: clamp(1.15rem, 1.7vw, 1.4rem);
  line-height: 1.4;
  padding: .55rem 0 .55rem .7rem;
  margin-left: calc(-.7rem - 4px); /* text lines up with the big word; the reading marker sits in the margin */
  border-left: 4px solid transparent;
  max-width: 34em;
}
.lines li.minor { font-size: 1rem; color: var(--soft); }
.lines li.speaking { border-left-color: currentColor; }

.listen { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.play {
  display: inline-flex; align-items: center; gap: .7rem;
  font: inherit; font-weight: 800; font-size: 1.5rem;
  min-height: 4.5rem; padding: 0 2.2rem 0 1.6rem;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--on-field); color: var(--field);
}
body[data-state="uncertain"] .play, body[data-state="loading"] .play { color: #fff; }
.play svg { width: 1.6rem; height: 1.6rem; fill: currentColor; }
.play[aria-busy="true"] { opacity: .7; }
.ghost {
  font: inherit; font-weight: 700; font-size: 1.05rem; cursor: pointer;
  min-height: 3.25rem; padding: 0 1.4rem; border-radius: 999px;
  background: transparent; color: inherit; border: 2px solid currentColor;
}
.speed { display: inline-flex; align-items: center; gap: .6rem; font-size: .95rem; font-weight: 600; }
.speed input { accent-color: currentColor; width: 7rem; min-height: 2.75rem; }
.status { margin: 0; min-height: 1.4em; font-size: 1rem; color: var(--soft); }

/* ---------- 72-hour strip ---------- */
.strip, .more, footer { padding-left: clamp(1rem, 4vw, 3rem); padding-right: clamp(1rem, 4vw, 3rem); }
.strip { padding-top: 2.5rem; padding-bottom: 1rem; }
.strip h2, .log h2 { font-size: 1.35rem; font-weight: 800; margin: 0 0 1rem; letter-spacing: -.01em; }
figure { margin: 0; }
#chart { width: 100%; height: auto; display: block; overflow: visible; }
#chart .bar-g { fill: #000; }
#chart .bar-g.over1 { fill: #946c00; }
#chart .bar-g.over2 { fill: var(--act); }
#chart .thr { stroke: #000; stroke-width: 1.5; stroke-dasharray: 4 5; }
#chart .day { stroke: rgba(0,0,0,.25); stroke-width: 1; }
#chart .now { stroke: #000; stroke-width: 3; }
#chart text { font-family: var(--grot); font-size: 15px; fill: #000; }
#chart text.lab { font-weight: 700; }
#chart .feels { fill: none; stroke: var(--calm); stroke-width: 3; }
figcaption { margin-top: .75rem; font-size: 1rem; color: rgba(0,0,0,.7); max-width: 40em; }

/* ---------- the quiet part ---------- */
.more { display: grid; gap: 1rem; padding-top: 1.5rem; padding-bottom: 2rem; max-width: 60rem; }
details { border-top: 2px solid #000; padding: .9rem 0 .4rem; }
summary { font-weight: 800; font-size: 1.15rem; cursor: pointer; min-height: 2.75rem; display: flex; align-items: center; }
.cues { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .5rem; }
.cues button {
  width: 100%; display: grid; grid-template-columns: 3.2rem 1fr; gap: 1rem; align-items: center;
  text-align: left; font: inherit; font-size: 1.05rem; cursor: pointer;
  background: #fff; color: #000; border: 2px solid #000; border-radius: .9rem; padding: .6rem .9rem;
}
.cues .sw { width: 3.2rem; height: 3.2rem; border-radius: .6rem; display: grid; place-items: center; }
.cues .sw svg { width: 2.3rem; height: 2.3rem; }
.cues b { display: block; font-weight: 800; }
#whybody table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: .5rem 0; }
#whybody th, #whybody td { text-align: left; padding: .4rem .5rem .4rem 0; border-bottom: 1px solid rgba(0,0,0,.15); vertical-align: top; }
#whybody p { font-size: .95rem; max-width: 42em; }
.log { border-top: 2px solid #000; padding-top: 1.1rem; }
.answers { display: flex; gap: .75rem; flex-wrap: wrap; }
.answers .ghost { flex: 1 1 7rem; }
.answers .ghost[aria-pressed="true"] { background: #000; color: #fff; }
.fine { font-size: .95rem; color: rgba(0,0,0,.7); }
.link { font: inherit; background: none; border: 0; padding: 0; color: #000; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 700; }
footer { padding-bottom: 3rem; font-size: .9rem; color: rgba(0,0,0,.65); max-width: 48rem; }

/* ---------- small screens ---------- */
@media (max-width: 52rem) {
  body { font-size: 19px; }
  .poster { grid-template-columns: 1fr; min-height: 0; align-items: start; }
  .word { font-size: clamp(5rem, 27vw, 9rem); }
  .play { width: 100%; justify-content: center; }
  .ghost { flex: 1 1 auto; }
  .bar { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .word.arrive { animation: none; }
  .poster, .bar { transition: none; }
}
