/* Night glass: the look Andreas picked from the mockup (option B). The weather
   shows in the content, not the background; calm and dark at any hour. */
:root {
  --bg-top: #1d2b4a;
  --bg: #0c1222;
  --card: rgba(255,255,255,.06);
  --card-line: rgba(255,255,255,.08);
  --card-hover: rgba(255,255,255,.085);
  --hair: rgba(255,255,255,.1);
  --radius: 16px;
  --gutter: 16px;
  --text: #fff;
  --muted: rgba(255,255,255,.72);
  --faint: rgba(255,255,255,.48);
  --rain: #7fc4ff;
  --ok: #7ee2a0;
  --amber: #ffcf5c;
  --orange: #ff9d4d;
  --red: #ff6b6b;
  --cool: #8fd0ff;
  --warm: #ffd36b;
  --temp-size: 96px;
  --ease: cubic-bezier(.2,.7,.2,1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
/* The sky: fixed behind everything (background-attachment: fixed misbehaves on iOS). */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(120% 60% at 50% 0%, #1d2b4a 0%, #0c1222 70%);
}
.sky::after {
  content: "";
  position: absolute;
  inset: 0;
  transition: opacity 1.2s var(--ease);
  background: radial-gradient(60% 34% at 50% -4%, rgba(255,211,107,.10), transparent 70%);
}
.view-night .sky::after {
  background: radial-gradient(60% 34% at 50% -4%, rgba(160,190,255,.10), transparent 70%);
}

a { color: var(--rain); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--rain); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) calc(var(--gutter) + env(safe-area-inset-right, 0px))
           calc(env(safe-area-inset-bottom, 0px) + 32px) calc(var(--gutter) + env(safe-area-inset-left, 0px));
  opacity: 0;
  transition: opacity .5s var(--ease);
}
.ready .wrap { opacity: 1; }

/* ---- hero -------------------------------------------------------------- */
.hero { position: relative; text-align: center; padding: 46px 0 18px; }
.place { font-size: 30px; font-weight: 500; letter-spacing: .005em; line-height: 1.15; }
.temp {
  font-size: var(--temp-size);
  font-weight: 200;
  line-height: 1;
  letter-spacing: -.02em;
  margin: 4px 0 2px;
  padding-left: .18em;   /* the degree sign pulls the number left; this centres the digits */
  font-variant-numeric: tabular-nums;
}
.cond { font-size: 20px; font-weight: 500; color: var(--text); opacity: .95; }
.hl { font-size: 16px; color: var(--muted); margin-top: 3px; }
.hl.one { font-size: 13px; color: var(--faint); }
.hero .meta { margin-top: 10px; }
.pill {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  border: 1px solid var(--card-line);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.pill:hover { background: var(--card-hover); color: var(--text); }
.ic { flex: none; display: block; }

/* ---- cards ---------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 12px;
}
.ready .card, .ready .hero { animation: rise .6s var(--ease) both; }
.ready .col-main > :nth-child(3) { animation-delay: .04s; }
.ready .tiles .card:nth-child(1) { animation-delay: .08s; }
.ready .tiles .card:nth-child(2) { animation-delay: .12s; }
.ready .tiles .card:nth-child(3) { animation-delay: .16s; }
.ready .agree { animation-delay: .2s; }
.ready .days { animation-delay: .24s; }
.ready .drill { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--faint);
  margin-bottom: 8px;
}
.meta { font-size: 11px; color: var(--faint); margin-top: 10px; }
.meta a { white-space: nowrap; color: var(--faint); text-decoration: underline; text-decoration-color: rgba(255,255,255,.25); }
.meta.stale, .stale > .meta.stale { color: var(--amber); }
.sm { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.lead { font-size: 15px; margin-bottom: 6px; }
.pc { color: #7fc4ff; font-weight: 600; }
.stack > .card:first-child { margin-top: 0; }
#commuteTop:not(:empty), #warnings:not(:empty) { margin-bottom: 12px; }
#commuteBelow:not(:empty) { margin-top: 12px; }

/* ---- hourly strip ----------------------------------------------------------- */
.hours { padding: 12px 0 12px; }
.headline {
  font-size: 13.5px;
  color: var(--muted);
  padding: 0 16px 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--hair);
}
.hours .meta { padding: 0 16px; }
.strip {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 0 10px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 22px), transparent);
          mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 22px), transparent);
}
.strip::-webkit-scrollbar { display: none; }
.hr {
  flex: none;
  width: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  scroll-snap-align: start;
  font-variant-numeric: tabular-nums;
}
.hr-t { font-size: 13px; color: var(--muted); font-weight: 500; }
.hr.now .hr-t { color: var(--text); font-weight: 650; }
.hr .sym, .hr .ic { width: 30px; height: 30px; }
.hr .ic { color: var(--warm); padding: 2px; }
.hr .pc { font-size: 11px; min-height: 14px; line-height: 14px; }
.strip.dry .pc { display: none; }
.hr-temp { font-size: 16px; font-weight: 500; }
.hr.now .hr-temp { font-weight: 650; }
.ev-word { font-size: 11px; color: var(--muted); font-weight: 500; line-height: 22px; }
.hr-one { font-size: 9px; color: var(--faint); white-space: nowrap; }
.sym { display: block; width: 28px; height: 28px; }
.sym.none { visibility: hidden; }

/* ---- tiles -------------------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.tile { margin-top: 0; padding: 12px 12px 13px; min-height: 124px; display: flex; flex-direction: column; }
.tile .label { margin-bottom: 6px; }
.big { font-size: 28px; font-weight: 400; line-height: 1.1; margin-bottom: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.unit { font-size: 14px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.tile .sm + .sm { margin-top: 3px; }
.rain-now { color: #7fc4ff; font-weight: 600; margin-top: auto !important; padding-top: 6px; }
.moon .moon-glyph { margin: 0 0 6px; }
.moon .big { font-size: 22px; }
.moon-dark { fill: rgba(255,255,255,.1); stroke: rgba(255,255,255,.18); stroke-width: .8; }
.moon-lit { fill: #f3efe2; }

/* ---- commute -------------------------------------------------------------------- */
.commute.is-top { border-color: rgba(127,196,255,.32); background: rgba(127,196,255,.075); }
.trips { display: grid; gap: 0; }
.trip { padding: 10px 0; }
.trip + .trip { border-top: 1px solid var(--hair); }
.trip:first-child { padding-top: 2px; }
.trip-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.trip-name { font-size: 15px; font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.trip-time { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.trip-temp { font-size: 22px; font-weight: 300; font-variant-numeric: tabular-nums; }
.trip-text { font-size: 15px; margin: 2px 0 4px; }
.trip .sm + .sm { margin-top: 2px; }
.slippery { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; color: var(--amber); font-size: 13px; }
.slippery .ic { margin-top: 2px; }

/* ---- warnings ------------------------------------------------------------------------- */
.warning { border-left: 3px solid var(--amber); }
.warning.lvl-orange { border-left-color: var(--orange); }
.warning.lvl-red { border-left-color: var(--red); }
.warning.lvl-unknown { border-left-color: rgba(255,255,255,.3); }
.warn-level { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--amber); }
.lvl-orange .warn-level { color: var(--orange); }
.lvl-red .warn-level { color: var(--red); }
.lvl-unknown .warn-level { color: var(--muted); }
.warn-title { font-size: 16px; font-weight: 600; margin: 6px 0 4px; }
.warn-text { font-size: 14px; color: var(--muted); white-space: pre-line; }

/* ---- agreement ------------------------------------------------------------------------- */
.agree { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: none; margin-top: 5px; box-shadow: 0 0 0 4px rgba(126,226,160,.12); }
.dot.amber { background: var(--amber); box-shadow: 0 0 0 4px rgba(255,207,92,.12); }

/* ---- ten days ---------------------------------------------------------------------------- */
.days { padding-bottom: 10px; }
.day {
  display: grid;
  grid-template-columns: 74px 34px 36px 1fr 36px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 6px 4px;
  margin: 0;
  background: none;
  border: 0;
  border-top: 1px solid var(--hair);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  border-radius: 0;
  transition: background .15s;
}
.day:first-child { border-top: 0; }
.day:hover { background: rgba(255,255,255,.035); }
.day-name { font-weight: 500; white-space: nowrap; }
.day-sym { display: flex; flex-direction: column; align-items: center; }
.day-sym .pc { font-size: 10.5px; line-height: 1; margin-top: 1px; }
.lo { color: var(--faint); text-align: right; }
.hi { text-align: right; }
.bar { position: relative; height: 5px; border-radius: 3px; background: rgba(255,255,255,.14); }
.bar i {
  position: absolute; top: 0; bottom: 0;
  border-radius: 3px;
  background-image: linear-gradient(90deg, #8fd0ff, #b8e2c8 45%, #ffd36b);
  background-repeat: no-repeat;
}
.now-dot {
  position: absolute; top: 50%;
  width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 2px var(--bg);
}

/* ---- drill-downs --------------------------------------------------------------------------- */
.drills { margin-top: 4px; }
.drill { padding: 0; overflow: hidden; }
.drill summary {
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 15px 44px 15px 16px;
  cursor: pointer;
  position: relative;
  transition: background .15s;
}
.drill summary::-webkit-details-marker { display: none; }
.drill summary::after {
  content: "";
  position: absolute;
  right: 18px; top: 50%;
  width: 8px; height: 8px;
  margin-top: -6px;
  border-right: 1.8px solid var(--faint);
  border-bottom: 1.8px solid var(--faint);
  transform: rotate(45deg);
  transition: transform .25s var(--ease);
}
.drill[open] summary::after { transform: rotate(225deg); margin-top: -2px; }
.drill summary:hover { background: rgba(255,255,255,.03); }
.drill-title { font-size: 16px; font-weight: 600; }
.drill-sub { font-size: 13px; color: var(--faint); margin-left: auto; text-align: right; }
.drill-body { padding: 0 16px 16px; }
.drill[open] .drill-body { animation: open .35s var(--ease) both; }
@keyframes open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* segmented switch */
.seg { display: inline-flex; padding: 2px; border-radius: 10px; background: rgba(0,0,0,.25); border: 1px solid var(--card-line); margin-bottom: 12px; }
.seg button { border: 0; background: none; padding: 6px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; transition: background .2s, color .2s; }
.seg button[aria-pressed="true"] { background: rgba(255,255,255,.14); color: var(--text); }

/* frame loops */
.stage { position: relative; width: 100%; border-radius: 12px; overflow: hidden; background: #0a1020; border: 1px solid var(--card-line); }
.stage.radar { aspect-ratio: 298 / 344; }
.stage.sat { aspect-ratio: 800 / 600; }
.stage img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage .frame { transition: none; }
.marker {
  position: absolute;
  left: 48.49%; top: 50.44%;   /* Helsingborg: column 144, row 173 of the 298 x 344 grid */
  width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(12,18,34,.9), 0 0 0 7px rgba(255,255,255,.18);
}
.loop-controls { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.play {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--card-line); background: rgba(255,255,255,.08);
  cursor: pointer;
}
.play:hover { background: rgba(255,255,255,.14); }
.scrub { flex: 1; min-width: 0; accent-color: #7fc4ff; }
.loop-time { flex: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 94px; text-align: right; }
.empty { padding: 28px 8px; text-align: center; color: var(--muted); font-size: 14px; border: 1px dashed var(--card-line); border-radius: 12px; }
.note { color: var(--faint); }
.radar-legend { margin-top: 10px; }
.leg-bar { display: block; width: 100%; height: 8px; border-radius: 4px; }
.leg-words { display: flex; margin-top: 4px; font-size: 12px; color: var(--muted); }
.leg-word { flex: 1 1 0; min-width: 0; white-space: nowrap; }
.leg-word + .leg-word { padding-left: 6px; border-left: 1px solid var(--card-line); }

/* hour by hour */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 10px; padding: 0 16px 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--card-line); background: rgba(255,255,255,.04);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--muted); cursor: pointer;
  transition: background .2s, color .2s;
}
.chip[aria-selected="true"] { background: rgba(255,255,255,.16); color: var(--text); border-color: transparent; }
.hlist { font-variant-numeric: tabular-nums; }
.hrow { display: grid; grid-template-columns: 30px 30px 1fr 1.25fr 1.2fr; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--hair); font-size: 14.5px; }
.hrow.hhead { border-top: 0; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; padding-top: 0; }
.ht { color: var(--muted); }
.sm-sym { width: 26px; height: 26px; }
.hrain .pc { font-size: 12px; }
.hwind { display: flex; align-items: center; gap: 5px; }
.wind-arrow { color: var(--muted); transition: none; }
.wind-arrow.none { visibility: hidden; }

/* sources */
.chart { width: 100%; height: auto; display: block; margin: 2px 0 8px; }
.grid-line { stroke: rgba(255,255,255,.08); stroke-width: 1; }
.axis { fill: rgba(255,255,255,.45); font-size: 9.5px; font-family: var(--font); }
.src-line { fill: none; stroke-width: 1.2; opacity: .75; stroke-linejoin: round; }
.median-line { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.src-table { font-size: 13.5px; font-variant-numeric: tabular-nums; margin-bottom: 10px; }
.src-row { display: grid; grid-template-columns: 1.3fr 1.1fr .8fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--hair); }
.src-row > :not(:first-child) { text-align: right; }
.src-head { border-top: 0; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }
.src-row.median { font-weight: 600; }
.src-row.missing { color: var(--amber); }
.src-name { display: flex; align-items: center; gap: 8px; }
.swatch { width: 10px; height: 3px; border-radius: 2px; flex: none; }
.swatch.median { background: #fff; height: 4px; }

/* verification */
.rank { margin-top: 14px; }
.rank ol { margin: 0; padding: 0; list-style: none; counter-reset: r; }
.rank li { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--hair); font-size: 14px; counter-increment: r; }
.rank li::before { content: counter(r); color: var(--faint); width: 22px; flex: none; }
.rank li > :first-child { flex: 1; }
.rank li.is-median { color: var(--rain); }
.mae { font-variant-numeric: tabular-nums; }

/* about */
.attrib { margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.attrib li { padding: 5px 0; border-top: 1px solid var(--hair); }
.drill-body .label { margin-top: 14px; }
.drill-body > .sm + .lead { margin-top: 10px; }

.foot { text-align: center; font-size: 12px; color: var(--faint); margin-top: 28px; }

/* ---- stale: the page says it is old rather than look current ---------------------- */
.stale .hero .temp { opacity: .55; }

/* ---- desktop: the cards spread out ----------------------------------------------------- */
@media (min-width: 900px) {
  .wrap { max-width: 1120px; padding-top: 40px; }
  .hero { padding: 8px 0 28px; }
  .pill { top: 4px; }
  .layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 0 20px; align-items: start; }
  .col-side .days { margin-top: 0; }
  .col-main > .stack:first-child:empty + .stack:empty + .hours,
  .col-main > .hours:first-child { margin-top: 0; }
  .hours { margin-top: 0; }
  .stack:not(:empty) + .hours { margin-top: 12px; }
  .strip { -webkit-mask-image: none; mask-image: none; }
  .drills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; align-items: start; margin-top: 8px; }
  .tile { min-height: 132px; }
}
@media (min-width: 1200px) {
  .drills { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 359px) {
  :root { --temp-size: 80px; }
  .tiles { gap: 8px; }
  .tile { padding: 10px; }
  .big { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* two trips side by side once there is room */
@media (min-width: 560px) {
  .trips { grid-template-columns: 1fr 1fr; gap: 0 20px; }
  .trip { padding: 2px 0 4px; }
  .trip + .trip { border-top: 0; border-left: 1px solid var(--hair); padding-left: 20px; }
}
