:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --border: #dcded6;
  --text: #1d201c;
  --muted: #676c62;
  --accent: #2f6f4f;

  --level-0: #7fa8c9;
  --level-1: #6aa84f;
  --level-2: #d6b419;
  --level-3: #dd7f2a;
  --level-4: #c23b32;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --surface: #1c2024;
    --border: #2e343a;
    --text: #e8eae6;
    --muted: #9aa19a;
    --accent: #6cc296;
  }
}

* { box-sizing: border-box; }

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

.masthead {
  padding: 1.5rem 1.5rem 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.masthead h1 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tabs { display: flex; gap: 0.25rem; flex-wrap: wrap; }

.tab {
  appearance: none;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

main { max-width: 68rem; margin: 0 auto; padding: 1.5rem; }

.banner {
  border: 1px solid var(--level-4);
  border-left-width: 4px;
  background: color-mix(in srgb, var(--level-4) 8%, var(--surface));
  padding: 0.9rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  font-size: 0.94rem;
}

.block { margin-top: 2.25rem; }

.block h2 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 0.85rem;
}

/* Map -------------------------------------------------------------------- */

.map-wrap {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.map-wrap-small { max-width: 480px; }

.map-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: crosshair;
}

.map-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  font-size: 0.8rem;
  line-height: 1.35;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 5;
}

.map-controls {
  max-width: 600px;
  margin: 0.9rem auto 0.4rem;
}

.map-controls input[type="range"] { width: 100%; }

.map-when {
  margin: 0.3rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.map-legend {
  list-style: none;
  margin: 0.75rem auto 0;
  padding: 0;
  max-width: 600px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: center;
  font-size: 0.82rem;
  color: var(--muted);
}

.map-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }

.legend-swatch { width: 0.85rem; height: 0.85rem; border-radius: 3px; }

.map-note {
  max-width: 600px;
  margin: 0.9rem auto 0;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.panel-intro {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 44rem;
}

.pick-location { margin: 0 0 0.9rem; font-size: 0.88rem; color: var(--muted); }
.pick-location span { color: var(--text); font-weight: 550; }

/* Current conditions ----------------------------------------------------- */

.now-card {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}

.now-label {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.now-category {
  margin: 0.2rem 0 0;
  font-size: 2.6rem;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.now-description { margin: 0.3rem 0 0; color: var(--muted); }

.now-figures { display: flex; gap: 2rem; margin: 0; flex-wrap: wrap; }
.now-figures dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.now-figures dd { margin: 0.15rem 0 0; font-size: 1.2rem; font-weight: 550; }

/* Daily peaks ------------------------------------------------------------ */

.peaks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }

.peaks li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.peaks .peak-day { font-weight: 550; }
.peaks .peak-window { color: var(--muted); }

/* Chart ------------------------------------------------------------------ */

.chart-scroll { overflow-x: auto; }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 180px;
  min-width: 100%;
  padding: 0 0 1.4rem;
  position: relative;
}

.bar { flex: 1 0 14px; position: relative; border-radius: 2px 2px 0 0; min-height: 2px; }
.bar[data-source="forecast"] { opacity: 0.85; }
.bar .bar-tick {
  position: absolute;
  bottom: -1.3rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Tables ----------------------------------------------------------------- */

.table-scroll { overflow-x: auto; }

.grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
}

.grid th, .grid td {
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.grid th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}

.grid tbody tr:last-child td { border-bottom: none; }
.grid .numeric { text-align: right; font-variant-numeric: tabular-nums; }

.pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 550;
  color: #10120f;
}

.row-day-break td { border-top: 2px solid var(--border); }

/* Forms ------------------------------------------------------------------ */

.entry-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.75rem;
}

.entry-form h2 { margin: 0 0 1rem; font-size: 1.05rem; font-weight: 600; }

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.fields label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.fields .wide { grid-column: 1 / -1; }

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

.entry-form button {
  font: inherit;
  font-weight: 550;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
}

.form-message { margin: 0.75rem 0 0; font-size: 0.88rem; min-height: 1.2em; }
.form-message.is-error { color: var(--level-4); }
.form-message.is-success { color: var(--accent); }

/* Detail ----------------------------------------------------------------- */

.detail-list {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem;
}

.detail-list dt {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.detail-list dd { margin: 0.15rem 0 0; font-variant-numeric: tabular-nums; }

.scale, .notes { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.scale li, .notes li { margin-bottom: 0.35rem; }
.scale strong { color: var(--text); }
