:root {
  --ink: #1d1e20;
  --ink-soft: #33353d;
  --muted: #6d7081;
  --line: #e4e5f1;
  --blue: #06619c;
  --blue-deep: #04456f;
  --bg-soft: #f5f7fb;
  --card: #ffffff;
  --accent-orange: #eb6834;
  --accent-green: #1baf7a;
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0;
  color: var(--ink);
  background: var(--bg-soft);
  line-height: 1.6;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }

header.hero {
  background: linear-gradient(160deg, var(--blue) 0%, var(--blue-deep) 100%);
  color: #fff;
  padding: 56px 0 64px;
}
header.hero .wrap { text-align: center; }
header.hero.compact { padding: 28px 0 40px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0.95;
  text-decoration: none;
  color: inherit;
}
.brand svg { width: 22px; height: 22px; flex-shrink: 0; }
h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 18px 0 10px;
  font-weight: 800;
}
header.hero.compact h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); margin: 12px 0 6px; }
.tagline { font-size: 1.05rem; color: #d8e7f5; max-width: 540px; margin: 0 auto 28px; }
.cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  font-size: 0.95rem;
}
.btn-primary { background: #fff; color: var(--blue-deep); }
.btn-secondary { background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.5); }

main { margin-top: -32px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(20,20,40,0.04);
}
.card h2 { margin-top: 0; font-size: 1.25rem; }
.card p { color: var(--ink-soft); }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.feature {
  padding: 16px;
  border-radius: 10px;
  background: var(--bg-soft);
}
.feature .dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; margin-right: 8px;
}
.feature h3 { margin: 0 0 6px; font-size: 0.98rem; }
.feature p { margin: 0; font-size: 0.88rem; color: var(--muted); }

.source-box {
  background: #fff4e5;
  border: 1px solid #f0c987;
  border-radius: 10px;
  padding: 18px 20px;
}
.source-box code { background: #fffaf0; padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }

.links-row a { color: var(--blue); text-decoration: none; font-weight: 600; }
.links-row a:hover { text-decoration: underline; }

footer { text-align: center; padding: 40px 20px 56px; color: var(--muted); font-size: 0.85rem; }
footer a { color: var(--muted); }

/* Live data card */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-box {
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 14px 16px;
}
.stat-box .label { font-size: 0.78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.stat-box .value { font-size: 1.5rem; font-weight: 800; margin-top: 2px; }
.as-of { font-size: 0.82rem; color: var(--muted); margin: -8px 0 20px; }

.bar-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 0.85rem;
  text-decoration: none; color: inherit; padding: 3px 6px; margin-left: -6px; margin-right: -6px;
  border-radius: 8px; transition: background 0.12s ease;
}
a.bar-row:hover { background: var(--bg-soft); }
a.bar-row:hover .bar-name { color: var(--blue); text-decoration: underline; }
.bar-row .bar-name { width: 130px; flex-shrink: 0; color: var(--ink-soft); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .bar-track { flex: 1; background: var(--bg-soft); border-radius: 6px; height: 18px; overflow: hidden; }
.bar-row .bar-fill { display: block; height: 100%; border-radius: 6px; min-width: 2px; }
.bar-row .bar-pct { width: 46px; flex-shrink: 0; font-weight: 700; color: var(--ink-soft); }

.legend-row { display: flex; gap: 18px; flex-wrap: wrap; margin: 14px 0 22px; font-size: 0.82rem; color: var(--muted); }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.range-chip {
  font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer;
  background: var(--bg-soft); color: var(--ink-soft); border: 1px solid var(--line);
  border-radius: 20px; padding: 6px 14px;
}
.range-chip:hover { background: #e7f0f8; }
.range-chip.active { background: var(--blue); color: #fff; border-color: var(--blue); }

.trend-wrap { margin-top: 4px; }
.trend-wrap svg { width: 100%; height: auto; display: block; }
.trend-wrap text { font-size: 10px; fill: var(--muted); }

.chart-loading, .chart-error { color: var(--muted); font-size: 0.9rem; padding: 20px 0; text-align: center; }

/* Breadcrumb (dam detail pages) */
.breadcrumb { font-size: 0.85rem; color: rgba(255,255,255,0.8); margin-bottom: 6px; }
.breadcrumb a { color: #fff; text-decoration: none; opacity: 0.85; }
.breadcrumb a:hover { text-decoration: underline; opacity: 1; }

/* Dam detail stat grid */
.dam-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}
.dam-stat-grid .stat-box .value small { font-size: 0.85rem; font-weight: 600; color: var(--muted); }

/* Plain data table (no-JS fallback / crawlable content) */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-top: 10px; }
.data-table th, .data-table td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; }

.reservoir-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.reservoir-nav a {
  font-size: 0.82rem; color: var(--blue); text-decoration: none;
  background: var(--bg-soft); padding: 6px 12px; border-radius: 20px;
}
.reservoir-nav a:hover { background: #e7f0f8; }
.reservoir-nav a.current { background: var(--blue); color: #fff; }

/* App promo / screenshot gallery */
.shot-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.shot-gallery img {
  width: 100%; height: auto; display: block;
  border-radius: 12px; border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(20,20,40,0.06);
}
