/* Colours live here as "tokens" so the whole look can be changed in one place. */
:root {
  --bg: #f7f9fb;
  --surface: #ffffff;
  --text: #1c2833;
  --muted: #5b6b78;
  --brand: #0b6e8a;
  --brand-ink: #ffffff;
  --accent: #ffb703;
  --border: #dde4ea;
  --cell-l: 88%;
  --radius: 14px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1820;
    --surface: #17232d;
    --text: #e8eef2;
    --muted: #9fb0bd;
    --brand: #4fb3cf;
    --brand-ink: #0f1820;
    --border: #2a3a47;
    --cell-l: 26%;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--brand); }

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

.hero {
  background: linear-gradient(160deg, #0b6e8a, #1597b5 60%, #f4a261);
  color: #fff;
  padding: 40px 0 32px;
}
.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(2.2rem, 8vw, 3.2rem);
  letter-spacing: -0.02em;
}
.intro { margin: 0; font-size: 1.08rem; max-width: 36em; }

main section { margin: 28px 0; }
h2 { font-size: 1.25rem; margin: 0 0 12px; }
.hint { color: var(--muted); margin: -6px 0 12px; font-size: 0.92rem; }

/* Month picker: big, thumb-friendly buttons in a grid */
.months {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.months button {
  min-height: 44px;
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.months button[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}
.months button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

@media (min-width: 640px) {
  .months { grid-template-columns: repeat(12, 1fr); }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
}

.ranking { margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.ranking li {
  counter-increment: rank;
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  grid-template-areas: "n place temp" "n low temp";
  align-items: center;
  column-gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.ranking li:first-child { border-top: 0; }
.ranking li::before {
  content: counter(rank);
  grid-area: n;
  font-weight: 700;
  color: var(--muted);
  font-size: 1.1rem;
}
.ranking li:first-child::before { content: "☀️"; }
.place { grid-area: place; }
.country { color: var(--muted); font-size: 0.9rem; }
.low { grid-area: low; color: var(--muted); font-size: 0.88rem; }
.temp {
  grid-area: temp;
  font-weight: 700;
  font-size: 1.15rem;
  padding: 6px 12px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* Table scrolls sideways inside its box if a phone is very narrow */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}
th, td { padding: 8px 4px; text-align: center; }
thead th {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
tbody th { text-align: left; padding-left: 12px; font-weight: 600; }
tbody tr { cursor: pointer; }
td.na { color: var(--muted); }
thead .sub { display: block; font-weight: 400; font-size: 0.68rem; }
tbody tr.selected th,
tbody tr.selected td {
  box-shadow: inset 0 3px 0 var(--brand), inset 0 -3px 0 var(--brand);
  font-weight: 700;
}
tbody tr.selected th { color: var(--brand); }

footer {
  color: var(--muted);
  font-size: 0.85rem;
  padding-top: 8px;
  padding-bottom: 40px;
}
