/*
 * heatload — single stylesheet, no build step, no external requests.
 *
 * The palette is cold on purpose: this site is about February nights, and the
 * warm sand of howmuchsun would be reading the wrong season back at people.
 */

:root {
  --bg: #f7f9fb;
  --surface: #ffffff;
  --border: #d9e1e8;
  --text: #14191f;
  --muted: #5d6b78;
  --accent: #1d5c8f;
  --accent-soft: #e5eef6;
  --warn: #8a4b16;
  --warn-soft: #fdf1e4;
  --maxw: 52rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1418;
    --surface: #171e24;
    --border: #2a343d;
    --text: #e5ecf2;
    --muted: #93a2b0;
    --accent: #6ab0e6;
    --accent-soft: #16242f;
    --warn: #e0a36a;
    --warn-soft: #241a10;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 0.25rem;
}

header.site,
footer.site {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem 1.25rem;
}

header.site {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

header.site nav {
  margin-left: auto;
  font-size: 0.9rem;
}

footer.site {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
}

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

h1 {
  font-size: 1.75rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0.5rem 0 0.75rem;
}

h2 {
  font-size: 1.2rem;
  margin: 2.5rem 0 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.lede {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
}

/* The four measured figures, above everything computed. */
.headline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  overflow: hidden;
}

.figure {
  background: var(--surface);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.figure .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.figure .value {
  font-size: 1.35rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

aside.warning {
  margin: 1.25rem 0;
  padding: 0.85rem 1rem;
  background: var(--warn-soft);
  border-left: 3px solid var(--warn);
  border-radius: 0 0.3rem 0.3rem 0;
  font-size: 0.92rem;
}

/* Wide tables scroll inside their own box rather than the page. */
.scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

th, td {
  padding: 0.45rem 0.6rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

thead th {
  text-align: right;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}

tbody th[scope="row"],
thead th:first-child {
  text-align: left;
  font-weight: 500;
  white-space: normal;
  min-width: 11rem;
}

tfoot th, tfoot td {
  font-weight: 650;
  border-top: 2px solid var(--border);
  border-bottom: none;
}

.matrix td { font-variant-numeric: tabular-nums; }

.breakdown .bar {
  display: inline-block;
  vertical-align: middle;
  width: var(--share);
  max-width: 6rem;
  height: 0.5rem;
  margin-right: 0.4rem;
  background: var(--accent);
  border-radius: 0.25rem;
  opacity: 0.65;
}

/* Calculator */
.calc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.9rem;
  padding: 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.calc .field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.calc label {
  font-size: 0.8rem;
  color: var(--muted);
}

.calc input,
.calc select {
  font: inherit;
  padding: 0.45rem 0.55rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.3rem;
}

.calc .result {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.9rem;
  background: var(--accent-soft);
  border-radius: 0.35rem;
}

.calc .result .label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.calc .result .value {
  font-size: 1.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Language switcher: on every page, in the footer. */
nav.languages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
}

nav.languages a {
  text-decoration: none;
}

nav.languages a:hover {
  text-decoration: underline;
}

nav.languages [aria-current] {
  color: var(--text);
  font-weight: 650;
}

/* The home page's language list names the countries each language covers, so
   its second column is prose rather than a number and needs room to wrap. */
.languages-list li {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.languages-list .count {
  font-size: 0.85rem;
  font-variant-numeric: normal;
}

/* Provenance: the part that keeps the site honest, so it is not small print. */
.provenance {
  margin: 1rem 0;
  padding-left: 1.1rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.provenance li { margin-bottom: 0.5rem; }
.provenance strong { color: var(--text); }

.countries {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  overflow: hidden;
}

.countries li {
  background: var(--surface);
  padding: 0.7rem 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.countries .count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.onward {
  margin: 2.5rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

.alternates a {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  text-decoration: none;
}

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

@media (max-width: 30rem) {
  h1 { font-size: 1.45rem; }
  main { padding: 1rem 0.9rem 0; }
}
