:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #1f232c;
  --border: #2a2f3a;
  --text: #e6e9ef;
  --muted: #9aa3b2;
  --accent: #5aa9ff;
  --warm: #ffb454;
  --cool: #5ad1ff;
  --good: #6fcf97;
}

* { box-sizing: border-box; }

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

header {
  padding: 2.4rem 1.5rem 1.4rem;
  max-width: 980px;
  margin: 0 auto;
}
header h1 { margin: 0; font-size: 1.9rem; letter-spacing: -0.01em; }
.tagline { color: var(--muted); margin: .35rem 0 0; }

main { max-width: 980px; margin: 0 auto; padding: 0 1.5rem 3rem; }

footer {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.5rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-size: .85rem;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Index grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  color: var(--text);
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.card h2 { margin: 0 0 .3rem; font-size: 1.15rem; }
.card .meta { color: var(--muted); font-size: .82rem; margin-bottom: .5rem; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; }
.empty { color: var(--muted); }

.tag {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .05rem .55rem;
  font-size: .72rem;
  color: var(--muted);
  margin-left: .35rem;
}

/* ---- Report pages ---- */
.report h1 { font-size: 1.7rem; letter-spacing: -0.01em; margin-bottom: .2rem; }
.report .sub { color: var(--muted); margin-top: 0; }
.report h2 { margin-top: 2.2rem; font-size: 1.3rem; border-bottom: 1px solid var(--border); padding-bottom: .35rem; }
.report .lead { font-size: 1.05rem; color: var(--text); }
.report .note {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warm);
  border-radius: 8px;
  padding: .8rem 1rem;
  margin: 1.2rem 0;
  color: var(--muted);
}
.back { display: inline-block; margin: 1.5rem 0 .5rem; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: .9rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
th, td { padding: .5rem .7rem; text-align: right; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--panel-2); color: var(--muted); font-weight: 600; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }

.aug { color: var(--warm); }
.sep { color: var(--cool); }
td.wu { white-space: nowrap; font-size: .82rem; }
.report table a { color: var(--accent); }
.coast { color: var(--cool); }
.inland { color: var(--warm); }
.dim { color: var(--muted); }
caption { caption-side: top; text-align: left; color: var(--muted); font-size: .82rem; margin-bottom: .4rem; }

.legend { color: var(--muted); font-size: .82rem; margin-top: -.5rem; }

/* ---- Map ---- */
.map-wrap { margin: 1rem 0 1.5rem; }
#map {
  height: 460px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}
.map-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .6rem;
}
.seg label { margin-right: .9rem; color: var(--muted); font-size: .9rem; cursor: pointer; }
.seg input { accent-color: var(--accent); vertical-align: middle; margin-right: .2rem; }
.legend2 { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--muted); }
.legend2 .bar {
  display: inline-block;
  width: 140px;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to right,
    hsl(210, 70%, 55%), hsl(111, 70%, 55%), hsl(12, 70%, 55%));
}

/* Leaflet dark-theme overrides */
.leaflet-container { font: inherit; background: var(--panel); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.leaflet-popup-content { margin: .6rem .8rem; font-size: .82rem; }
.pop strong { font-size: .95rem; }
.pop table { margin: .35rem 0 .25rem; background: none; border: none; }
.pop th, .pop td { border: none; padding: .08rem .45rem; text-align: right; }
.pop th:first-child, .pop td:first-child { text-align: left; }
.pop .wu a { color: var(--accent); }
.leaflet-control-attribution {
  background: rgba(15, 17, 21, .7) !important;
  color: var(--muted) !important;
}
.leaflet-control-attribution a { color: var(--accent) !important; }

@media (max-width: 620px) { #map { height: 340px; } }

@media (max-width: 620px) {
  table { font-size: .8rem; }
  th, td { padding: .4rem .45rem; }
}
