/* Copenhagen Weather — site styles.
   Palette is inherited from the TV app so the site and the screen match.
   Type system: ONE family per language, carrying the whole personality through
   weight contrast — hairline 200 for the big numerals, 700 uppercase tracked for
   micro-labels. Same system in Latin (Archivo) and Persian (Vazirmatn).
   Mobile-first: base styles target ~360px, complexity is added at min-width. */

:root {
  --night-1: #060c22;
  --night-2: #1b2a5e;
  --fg: #eaf0ff;
  --fg-dim: rgba(234, 240, 255, 0.66);
  --fg-faint: rgba(234, 240, 255, 0.4);
  --tile: rgba(255, 255, 255, 0.075);
  --tile-hi: rgba(255, 255, 255, 0.13);
  --line: rgba(234, 240, 255, 0.14);
  --amber: #ffd257;
  --wet: #63c8ff;
  /* Set live from current conditions — the glow behind the TV is a data
     channel, not decoration. Defaults to amber until the fetch lands. */
  --glow: #ffd257;

  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shell: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--night-1);
  background-image: linear-gradient(175deg, var(--night-1) 0%, var(--night-2) 62%, #0b1533 100%);
  color: var(--fg);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 4px; }

.shell { width: 100%; max-width: var(--shell); margin: 0 auto; padding: 0 20px; }

/* micro-label: the second half of the type system */
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--fg-faint); margin: 0 0 14px;
}
.eyebrow.on-amber { color: var(--amber); }

code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.86em; background: rgba(0, 0, 0, 0.3);
  padding: 1px 5px; border-radius: 4px; color: var(--wet);
}

/* ---------------- top bar ---------------- */
.topbar { padding: 12px 0; border-bottom: 1px solid var(--line); }
/* Wraps rather than shrinks: the wordmark plus three language links exceed a
   360px viewport, and neither can go below its content width. */
.topbar > .shell {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 2px 12px;
}
.topbar nav { margin-inline-start: -11px; }
.wordmark {
  font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg); display: flex; align-items: center; gap: 9px;
}
.wordmark svg { width: 20px; height: 20px; color: var(--amber); flex: none; }
.topbar nav { display: flex; align-items: center; gap: 6px; }
.topbar nav a {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-dim); padding: 9px 11px; border-radius: 999px; min-height: 44px;
  display: inline-flex; align-items: center;
}
.topbar nav a:hover { color: var(--fg); background: var(--tile); text-decoration: none; }

/* ---------------- hero: the television ---------------- */
.hero { position: relative; padding: 40px 0 8px; text-align: center; }
/* the signature — ambient light the screen throws onto the wall */
/* Sized with an explicit ellipse in percentages of its own box, so it stays
   inside the viewport — a wider-than-100% glow element scrolls the page
   sideways on every screen, which `overflow-x: hidden` masks but does not fix. */
.hero::before {
  content: ''; position: absolute; left: 0; right: 0; top: 40px; height: 470px;
  background: radial-gradient(62% 74% at 50% 44%, var(--glow) 0%, transparent 72%);
  opacity: 0.44; filter: blur(38px); pointer-events: none;
  transition: background 1.2s ease, opacity 1.2s ease;
}
@media (prefers-reduced-motion: reduce) { .hero::before { transition: none; } }

.tv { position: relative; margin: 0 auto; max-width: 820px; }
.tv-panel {
  position: relative; border-radius: 12px; padding: 7px;
  background: linear-gradient(160deg, #253052 0%, #0d1329 100%);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.09);
}
.tv-screen {
  position: relative; border-radius: 7px; overflow: hidden;
  background: linear-gradient(158deg, #0a1230 0%, #16214d 100%);
  padding: 20px 16px 18px;
  text-align: start;
}
/* screen-edge vignette: reads as glass, costs nothing */
.tv-screen::after {
  content: ''; position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  pointer-events: none; border-radius: 7px;
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.45);
}

.now { display: flex; align-items: center; gap: 14px; }
.now-icon { width: 62px; height: 62px; flex: none; color: var(--amber); }
.now-temp {
  font-size: 62px; font-weight: 200; line-height: 0.9; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.now-temp span { font-size: 24px; font-weight: 300; letter-spacing: 0; }
.now-cond { font-size: 17px; font-weight: 500; margin-top: 5px; }
.now-place { font-size: 13px; color: var(--fg-dim); margin-top: 2px; }

.now-tiles {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px;
}
.ntile { background: var(--tile); border-radius: 9px; padding: 9px 11px; }
.ntile dt {
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-faint);
}
.ntile dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

.tv-status {
  display: flex; align-items: center; gap: 7px; margin-top: 14px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-faint);
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--wet); flex: none; }
.tv-status.is-stale .dot { background: var(--amber); }
.tv-status.is-error .dot { background: #ff9b93; }

/* headline sits BELOW the television: show the object, then name it */
.hero-copy { position: relative; margin: 34px auto 0; max-width: 640px; }
h1 {
  font-size: 33px; font-weight: 300; line-height: 1.13; letter-spacing: -0.022em;
  margin: 0 0 14px;
}
h1 strong { font-weight: 700; }
.lede { font-size: 17px; color: var(--fg-dim); margin: 0 auto; max-width: 540px; }

.cta { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 13px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--amber); color: #10162f; }
.btn-primary:hover { background: #ffdd7f; text-decoration: none; }
.btn-ghost { border-color: var(--line); color: var(--fg); }
.btn-ghost:hover { background: var(--tile); text-decoration: none; }

/* ---------------- sections ---------------- */
section { padding: 52px 0; }
section + section { border-top: 1px solid var(--line); }
h2 {
  font-size: 25px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 10px;
}
.section-lede { color: var(--fg-dim); margin: 0 0 26px; max-width: 620px; }

/* hour strip */
.hours {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px;
  scroll-snap-type: x proximity;
}
.hours::-webkit-scrollbar { height: 5px; }
.hours::-webkit-scrollbar-thumb { background: var(--tile-hi); border-radius: 3px; }
.hour {
  flex: none; width: 78px; scroll-snap-align: start;
  background: var(--tile); border-radius: 11px; padding: 11px 4px; text-align: center;
}
.hour-t { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--fg-dim); }
.hour-i { width: 26px; height: 26px; margin: 7px auto 0; color: var(--amber); }
.hour-d { font-size: 19px; font-weight: 600; margin-top: 5px; font-variant-numeric: tabular-nums; }
.hour-p { font-size: 11px; font-weight: 700; color: var(--wet); height: 15px; }
.hour-p.dry { color: transparent; }

/* 7-day list. The condition column fills what would otherwise be dead space on
   a wide screen with something worth reading; it is hidden on a phone. */
.days { list-style: none; margin: 22px 0 0; padding: 0; }
.days li {
  display: grid; grid-template-columns: minmax(0, 1fr) 30px auto;
  align-items: center; gap: 12px;
  padding: 11px 2px; border-top: 1px solid var(--line);
}
.day-c { display: none; color: var(--fg-dim); font-size: 14px; }
.days li:last-child { border-bottom: 1px solid var(--line); }
.day-n { font-size: 15px; font-weight: 600; }
.day-sub { font-size: 12px; color: var(--fg-faint); font-weight: 400; }
.days svg { width: 26px; height: 26px; color: var(--amber); }
.day-t { font-variant-numeric: tabular-nums; font-size: 15px; white-space: nowrap; }
.day-t b { font-weight: 700; }
.day-t span { color: var(--fg-faint); margin-inline-start: 7px; }

/* live demo */
.demo-frame {
  position: relative; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #0a1230;
  /* 16:9 without aspect-ratio, so it also holds up in old engines */
  padding-top: 56.25%;
}
.demo-frame iframe {
  position: absolute; left: 0; top: 0;
  width: 1920px; height: 1080px; border: 0;
  transform-origin: 0 0;
}
.keys { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.keycap {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  padding: 10px 15px; border-radius: 999px; cursor: pointer;
  background: var(--tile); border: 1px solid var(--line); color: var(--fg);
  font-family: inherit; font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.keycap:hover { background: var(--tile-hi); }
.keycap i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.k-red i { background: #e2504a; } .k-green i { background: #46b46e; }
.k-yellow i { background: #e8c145; } .k-blue i { background: #4b86e8; }
.demo-note { font-size: 13px; color: var(--fg-faint); margin: 12px 0 0; }

/* engineering notes */
.notes { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.note { background: var(--tile); border-radius: 12px; padding: 18px; }
.note h3 { font-size: 16px; font-weight: 700; margin: 0 0 6px; }
.note p { margin: 0; font-size: 15px; color: var(--fg-dim); }
.note code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13px;
  background: rgba(0, 0, 0, 0.3); padding: 1px 5px; border-radius: 4px; color: var(--wet);
}

/* install steps — numbered because the order genuinely matters */
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; }
.steps li {
  counter-increment: s; position: relative;
  padding: 0 0 22px 44px; border-inline-start: 1px solid var(--line);
  margin-inline-start: 13px;
}
.steps li:last-child { border-inline-start-color: transparent; padding-bottom: 0; }
.steps li::before {
  content: counter(s); position: absolute; inset-inline-start: -13px; top: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--night-2); border: 1px solid var(--line); color: var(--amber);
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.steps h3 { font-size: 16px; font-weight: 700; margin: 2px 0 5px; }
.steps p { margin: 0 0 9px; font-size: 15px; color: var(--fg-dim); }
pre {
  margin: 0; padding: 13px 15px; border-radius: 9px; overflow-x: auto;
  background: rgba(0, 0, 0, 0.36); border: 1px solid var(--line);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13px;
  line-height: 1.65; color: var(--wet);
}

footer {
  border-top: 1px solid var(--line); padding: 26px 0 34px;
  font-size: 13px; color: var(--fg-faint); text-align: center;
}
footer p { margin: 0; }
footer a { color: var(--fg-dim); }

/* ---------------- wider screens ---------------- */
@media (min-width: 620px) {
  body { font-size: 18px; }
  .hero { padding-top: 56px; }
  .tv-screen { padding: 30px 26px 26px; }
  .now { gap: 22px; }
  .now-icon { width: 92px; height: 92px; }
  .now-temp { font-size: 96px; }
  .now-temp span { font-size: 36px; }
  .now-cond { font-size: 22px; }
  .now-place { font-size: 15px; }
  .now-tiles { grid-template-columns: repeat(4, 1fr); }
  h1 { font-size: 46px; }
  .cta { flex-direction: row; justify-content: center; }
  h2 { font-size: 31px; }
  .notes { grid-template-columns: 1fr 1fr; }
  .hour { width: 88px; }
}

@media (min-width: 900px) {
  .hero { padding: 72px 0 12px; }
  .tv-screen { padding: 40px 36px 32px; }
  .now-icon { width: 118px; height: 118px; }
  .now-temp { font-size: 130px; }
  .now-temp span { font-size: 46px; }
  h1 { font-size: 57px; }
  section { padding: 74px 0; }
  .notes { grid-template-columns: repeat(3, 1fr); }
  .days li { grid-template-columns: 220px minmax(0, 1fr) 34px auto; }
  .day-c { display: block; }

  /* Mirror the TV app: tiles sit beside the temperature, not under it. The left
     column gets the larger share so "Copenhagen, Denmark · 23:00" stays on one line. */
  .tv-screen {
    display: grid; grid-template-columns: minmax(0, 1.3fr) 1fr;
    grid-template-areas: 'now tiles' 'status tiles';
    align-items: start; column-gap: 30px;
  }
  .now { grid-area: now; }
  .now-tiles { grid-area: tiles; grid-template-columns: 1fr 1fr; margin-top: 0; align-self: center; }
  .tv-status { grid-area: status; align-self: end; }
}

/* ---------------- Persian / RTL ---------------- */
[dir="rtl"] { --font: 'Vazirmatn', system-ui, sans-serif; }
[dir="rtl"] body { font-weight: 400; }
[dir="rtl"] h1, [dir="rtl"] .now-temp { letter-spacing: 0; }
[dir="rtl"] .eyebrow, [dir="rtl"] .wordmark, [dir="rtl"] .topbar nav a,
[dir="rtl"] .btn, [dir="rtl"] .keycap, [dir="rtl"] .ntile dt,
[dir="rtl"] .hour-t, [dir="rtl"] .tv-status {
  letter-spacing: 0; text-transform: none;
}
/* Latin-only bits (temperatures, code, the wordmark) must stay LTR inside RTL. */
[dir="rtl"] .now-temp, [dir="rtl"] .ntile dd, [dir="rtl"] .day-t,
[dir="rtl"] .hour-d, [dir="rtl"] pre, [dir="rtl"] .wordmark {
  direction: ltr; unicode-bidi: isolate;
}
[dir="rtl"] .tv-screen, [dir="rtl"] .now-place { text-align: start; }
