/* Meadow. Early is warm, late is cold: neither reads as good or bad. */

@font-face {
  font-family: "Fraunces";
  src: url(fonts/fraunces.woff2) format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url(fonts/outfit.woff2) format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  scroll-behavior: smooth;
  --paper: light-dark(#f8f4e1, #1d1b16);
  --card: light-dark(#fffdf3, #262319);
  --ink: light-dark(#221f1a, #f3eedb);
  --muted: light-dark(#5e594c, #b9b29c);
  --line: light-dark(#221f1a26, #f3eedb2e);
  --brand: light-dark(#409d48, #6ed274);
  --early: light-dark(#b67c0d, #c38824);
  --late: light-dark(#1777b8, #4b99d7);
  --display: "Fraunces", Georgia, serif;
  --text: "Outfit", system-ui, sans-serif;
}

body {
  margin: 0 auto;
  max-width: 44rem;
  padding: 20px 16px 48px;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.55 var(--text);
}

a { color: inherit; text-decoration-color: var(--brand); text-decoration-thickness: 2px; text-underline-offset: 3px; }
/* Links to other sites: muted underline instead of the brand green. */
a[href^="http"] { text-decoration-color: var(--muted); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

h1, h2 { font-family: var(--display); line-height: 1.1; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 7vw, 2.75rem); font-weight: 900; margin: 0 0 1.25rem; }
h1 em { font-style: normal; background: linear-gradient(transparent 60%, color-mix(in oklch, var(--brand) 45%, transparent) 60%); }
h2 { font-size: 1.35rem; font-weight: 700; margin: 2rem 0 0.5rem; scroll-margin-top: 1.5rem; }

/* Header */
.site { margin-bottom: 2rem; }
.site a { display: inline-flex; align-items: center; gap: 0.5rem; font: 700 1.05rem/1 var(--display); text-decoration: none; }
.site svg { width: 1.75rem; height: 1.75rem; color: var(--brand); }
/* Hover: a line grows under the name and the rings light up outwards, once. */
.site .name { position: relative; }
.site .name::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 2px;
  background: var(--brand); transform: scaleX(0); transform-origin: left; transition: transform 0.3s ease;
}
.site a:is(:hover, :focus-visible) .name::after { transform: scaleX(1); }
.site a:is(:hover, :focus-visible) .ring { animation: call 0.9s ease-out both; }
.site a:is(:hover, :focus-visible) .ring:nth-child(2) { animation-delay: 0.12s; }
.site a:is(:hover, :focus-visible) .ring:nth-child(3) { animation-delay: 0.24s; }
@keyframes call { 0% { opacity: 0.15; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  .site .name::after { transition: none; }
  .site a:is(:hover, :focus-visible) .ring { animation: none; }
}

.eyebrow { margin: 0 0 1rem; font-size: 0.875rem; color: var(--muted); }
.eyebrow a { white-space: nowrap; }
.lede { margin: 0 0 1.5rem; color: var(--muted); }

/* Cards */
.card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 1rem;
  margin: 0 0 1.5rem;
  overflow-x: auto;
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

/* Key facts */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0 0 1rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; }

/* Tables */
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-weight: 600; padding: 0 0 0.5rem; }
th, td { text-align: left; padding: 0.4rem 0.75rem 0.4rem 0; border-bottom: 1px solid var(--line); }
tbody tr:last-child > * { border-bottom: 0; }
thead th { font-size: 0.875rem; font-weight: 600; color: var(--muted); }
thead th button { all: unset; cursor: pointer; }
thead th button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
thead small { display: block; font-size: 0.75rem; font-weight: 400; }
/* Sort arrows: space always reserved, so nothing shifts. No underline: that means a link. */
thead th .label::after { content: "↕"; display: inline-block; width: 1em; margin-left: 0.25em; visibility: hidden; color: var(--muted); }
thead th button:hover { color: var(--ink); }
thead th:not([aria-sort]) button:hover .label::after { visibility: visible; }
thead th[aria-sort] .label::after { visibility: visible; color: inherit; }
thead th[aria-sort="ascending"] .label::after { content: "↑"; }
thead th[aria-sort="descending"] .label::after { content: "↓"; }
/* "− earlier, + later" until sorted by that column; all three lines share one spot. */
thead th .order { display: grid; }
thead th .order > span { grid-area: 1 / 1; visibility: hidden; }
thead th:not([data-sorted]) .order .none,
thead th[data-sorted][aria-sort="ascending"] .order .asc,
thead th[data-sorted][aria-sort="descending"] .order .desc { visibility: visible; }
tbody th { font-weight: 500; }

/* Whole row links to the city */
table.rows-link tbody tr { position: relative; }
table.rows-link tbody th a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
table.rows-link tbody tr:hover > *,
table.rows-link tbody tr:has(a:focus-visible) > * { background: color-mix(in oklch, var(--brand) 16%, transparent); }
table.rows-link tbody tr:hover a { text-decoration-color: currentColor; }
table.rows-link tbody tr > :first-child { padding-left: 0.5rem; }
table.rows-link thead tr > :first-child { padding-left: 0.5rem; }

/* Days from average */
.days { display: flex; align-items: center; gap: 0.75rem; padding-right: 0.75rem; }
.days .number { min-width: 2.2em; text-align: right; }
.meter { position: relative; flex: 1; min-width: 4rem; height: 8px; border-radius: 4px; background: color-mix(in oklch, var(--ink) 7%, transparent); }
.meter::before { content: ""; position: absolute; left: 50%; top: -4px; bottom: -4px; width: 1px; background: var(--line); }
.meter span { position: absolute; top: 0; bottom: 0; }
.meter .early { right: 50%; background: var(--early); border-radius: 4px 0 0 4px; }
.meter .late { left: 50%; background: var(--late); border-radius: 0 4px 4px 0; }
.key { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0.75rem 0 0; font-size: 0.875rem; color: var(--muted); }
.key i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 0.35rem; }
.key .early { background: var(--early); }
.key .late { background: var(--late); }

.note { font-size: 0.875rem; color: var(--muted); }

footer { margin-top: 3rem; padding-top: 1rem; border-top: 2px solid var(--ink); font-size: 0.875rem; color: var(--muted); }
footer h2 { font-size: 1rem; color: var(--ink); margin-top: 0; }

td:has(> time), td.date { white-space: nowrap; }

/* Phones */
@media (max-width: 30rem) {
  .country, .meter, .key { display: none; }
  .card { padding: 0.75rem; }
  th, td { padding-right: 0.5rem; }
  .days { padding-right: 0; }
}
