@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(fonts/bricolage-grotesque-latin.woff2) format('woff2');
}

:root {
  --sky: #4fa3d1;
  --ground: #e6eef2;       /* the page tint; app.js follows the sky with it */
  --ink: #10212b;
  --ink-soft: #33454f;
  --app: #f5f8f8;
  --tone-1: #e2eaec;
  --tone-2: #cfdadd;
  --night: #d9e3e6;
  --dry: #bfe5d1;
  --rain: #7fa3b5;
  --accent: #b83a0c;
  --bezel: #0f171d;
  --gutter: clamp(16px, 4vw, 40px);
  --font: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
}
h1, h2, h3, p, dl, dd, ol { margin: 0; padding: 0; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- Bar ---- */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px var(--gutter);
}
.wordmark { font-weight: 800; font-size: 22px; letter-spacing: -0.03em; text-decoration: none; }
.bar nav { display: flex; align-items: center; gap: clamp(14px, 3vw, 32px); font-size: 16px; }
.bar nav a { text-decoration: none; padding: 8px 0; min-height: 44px; display: inline-flex; align-items: center; }
.bar nav a:hover { text-decoration: underline; }
.bar .bar-action {
  background: var(--ink); color: #fff; padding: 8px 18px; font-weight: 600; text-decoration: none;
}
.bar .bar-action:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* ---- Opening ---- */
.opening {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 414px;
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
  grid-template-areas: "intro stage" "try stage";
  grid-template-rows: auto 1fr;
  row-gap: 0;
  padding: clamp(8px, 2vw, 24px) var(--gutter) clamp(72px, 10vw, 160px);
  max-width: 1440px; margin: 0 auto;
}
.intro { grid-area: intro; padding-top: clamp(0px, 3vw, 48px); }
h1 {
  font-size: clamp(2.7rem, 5.7vw, 5.6rem);
  line-height: 0.98; letter-spacing: -0.03em; font-weight: 800;
  max-width: 17ch; text-wrap: balance;
}
.lede { font-size: clamp(1.15rem, 1.7vw, 1.5rem); line-height: 1.4; max-width: 34em; margin-top: clamp(20px, 3vw, 36px); }
.plain { margin-top: 20px; max-width: 34em; color: var(--ink-soft); }

/* ---- Phone ---- */
.stage { grid-area: stage; display: flex; justify-content: center; position: sticky; top: 8px; }
.phone {
  width: 414px; max-width: 100%;
  padding: 12px; background: var(--bezel); border-radius: 52px;
}
.screen {
  background: var(--app);
  border-radius: 40px;
  max-height: calc(100vh - 112px);
  overflow-y: auto; overflow-x: hidden;
  padding: 20px 0 18px;
  scrollbar-width: none;
  display: flex; flex-direction: column; gap: 10px;
}
.screen::-webkit-scrollbar { display: none; }
.screen > * { flex: none; }
.no-js { padding: 16px 20px; }

.topline { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 0 22px; }
.where h2 { max-width: none; font-size: 26px; line-height: 1.1; letter-spacing: -0.03em; font-weight: 700; }
.where p { font-size: 14px; color: var(--ink-soft); margin-top: 2px; }
.tag { background: var(--tone-1); color: var(--ink); font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 999px; white-space: nowrap; }

.scene { position: relative; aspect-ratio: 390 / 250; margin: 0 8px; border-radius: 24px; overflow: hidden; background: var(--sky); touch-action: pan-y; }
.scene svg { display: block; width: 100%; height: 100%; }
#sun { fill: #fff3c9; }
#moon { fill: #e3ebf2; }
#stars circle { fill: #fff; }
#cloud { opacity: 0.93; }
#rain { fill: none; stroke: #eaf4f9; stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 5 9; animation: fall 0.7s linear infinite; }
@keyframes fall { to { stroke-dashoffset: -14; } }
.station { fill: #fff; opacity: 0.85; }
.pin-ring { fill: #fff; }
.pin-core { fill: var(--ink); }
.edge-label { fill: #fff; font: 600 12px var(--font); }
.pin-label {
  position: absolute; transform: translate(-50%, calc(-100% - 20px));
  left: 50%; top: 50%;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; line-height: 1;
  padding: 7px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none;
  max-width: 90%;
}
.pin-label { margin-left: 0; }

/* range inputs sit over their pictures; the picture is the control */
.scene input, .chart input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: ew-resize; -webkit-appearance: none; appearance: none; background: transparent;
  touch-action: pan-y;
}
.scene input::-webkit-slider-thumb, .chart input::-webkit-slider-thumb { -webkit-appearance: none; width: 1px; height: 100%; }
.scene input::-moz-range-thumb, .chart input::-moz-range-thumb { width: 1px; height: 100%; border: 0; background: transparent; }
.ring { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; }
input:focus-visible + .ring { border: 3px solid var(--ink); outline: 3px solid #fff; outline-offset: -6px; }

.now { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 0 22px; }
.temp { font-size: 76px; line-height: 0.85; font-weight: 800; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.temp .unit { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin-left: 2px; vertical-align: top; position: relative; top: 4px; }
.cond { text-align: right; padding-bottom: 2px; }
.cond #cond { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.clock { font-size: 15px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 0 8px; }
.stats div { background: var(--tone-1); border-radius: 14px; padding: 9px 6px 9px 10px; min-width: 0; }
.stats dt { font-size: 13px; color: var(--ink-soft); line-height: 1.2; }
.stats dd { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; }

.hours { padding: 0 8px; }
.chart { position: relative; height: 92px; border-radius: 16px; overflow: hidden; background: var(--tone-1); }
.chart svg { display: block; width: 100%; height: 100%; }
.chart .night { fill: var(--night); }
#dryBand { fill: var(--dry); transition: opacity 0.2s; }
#rainBars rect { fill: var(--rain); opacity: 0.8; }
#tempLine { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
#scrub { stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
#tempDot { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.ticks { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); padding: 4px 2px 0; font-variant-numeric: tabular-nums; }

.controls { display: flex; flex-direction: column; gap: 8px; padding: 0 8px; }
.play {
  font: inherit; font-weight: 700; font-size: 15px; color: #fff; background: var(--accent);
  border: 0; border-radius: 999px; min-height: 44px; cursor: pointer;
  transition: transform 0.12s;
}
.play:hover { background: #9a2f08; }
.play:active { transform: scale(0.98); }
.play[hidden] { display: none; }
.places { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.chip {
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; color: var(--ink);
  background: var(--tone-1); border: 0; border-radius: 14px; padding: 8px 4px; min-height: 48px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: transform 0.12s, background-color 0.15s;
}
.chip span { font-size: 13px; font-weight: 500; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.chip:hover { background: var(--tone-2); }
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.chip[aria-pressed="true"] span { color: #d3dfe3; }
.window { font-size: 14px; line-height: 1.4; color: var(--ink-soft); padding: 0 22px; }

/* ---- Starting points ---- */
.try { grid-area: try; margin-top: clamp(32px, 4vw, 56px); max-width: 34em; }
.try-title { font-size: 1.35rem; letter-spacing: -0.02em; line-height: 1.2; max-width: none; margin-bottom: 12px; }
.try ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.try button {
  font: inherit; width: 100%; text-align: left; cursor: pointer; color: var(--ink);
  background: var(--tone-1); border: 0; border-radius: 4px; padding: 14px 18px;
  display: flex; flex-direction: column; gap: 2px; min-height: 48px;
  transition: background-color 0.15s, transform 0.12s;
}
.try button b { font-size: 1.1rem; letter-spacing: -0.01em; }
.try button span { font-size: 15px; color: var(--ink-soft); }
.try button:hover { background: var(--ink); color: #fff; }
.try button:hover span { color: #d3dfe3; }
.try button:active { transform: scale(0.99); }

/* ---- Sections ---- */
.how, .about { max-width: 1440px; margin: 0 auto; padding: 0 var(--gutter) clamp(72px, 10vw, 160px); }
h2 { font-size: clamp(2rem, 4.4vw, 4rem); line-height: 1; letter-spacing: -0.035em; font-weight: 800; max-width: 16ch; text-wrap: balance; }
.how-lede { margin-top: 24px; max-width: 38em; font-size: 1.15rem; }

.rules { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 24px); margin-top: clamp(32px, 5vw, 64px); }
.rules li { background: var(--tone-1); padding: clamp(20px, 2.4vw, 32px); border-radius: 4px; }
.rules .big { font-size: clamp(2.4rem, 4.4vw, 4.2rem); font-weight: 800; line-height: 0.95; letter-spacing: -0.04em; }
.rules .big span { display: block; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; margin-top: 8px; }
.rules li > p:last-child { margin-top: 18px; max-width: 34em; }

.about-grid { display: grid; grid-template-columns: 1.1fr 1.1fr 0.8fr; gap: clamp(24px, 4vw, 64px); margin-top: clamp(32px, 5vw, 64px); }
.about h3 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 14px; }
.about-grid p + p { margin-top: 14px; }

footer { background: var(--ink); color: #fff; padding: clamp(40px, 6vw, 80px) var(--gutter) 32px; }
.foot-name { font-size: clamp(3.6rem, 17vw, 17rem); font-weight: 800; line-height: 0.85; letter-spacing: -0.06em; }
.foot-line { margin-top: 32px; max-width: 52em; color: #d3dfe3; font-size: 15px; }
footer a:hover { color: #fff; }
footer :focus-visible { outline-color: #fff; }

/* ---- Narrow screens: the app becomes the page ---- */
@media (max-width: 960px) {
  .opening { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "stage" "try"; grid-template-rows: none; row-gap: 32px; }
  .try { margin-top: clamp(32px, 6vw, 48px); }
  .stage { position: static; }

  .rules, .about-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .bar nav a:not(.bar-action) { display: none; }
  .stage { margin: 0 calc(var(--gutter) * -1); }
  .phone { width: 100%; padding: 0; background: transparent; border-radius: 0; }
  .screen { max-height: none; border-radius: 0; overflow: visible; }
  h1 { font-size: 2.7rem; }
}

.rise { opacity: 0; transform: translateY(28px); transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.rise.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .rise { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
  #rain { animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
