/* CORA Flood Stack — Mesoflow */

:root {
  --tide:       #4e79a7;   /* steel blue */
  --surge-wave: #e15759;   /* red-orange */
  --residual:   #bab0ac;   /* warm gray */
  --total:      #333333;
  --threshold:  #e15759;
  --bg:         #f8f9fa;
  --card:       #ffffff;
  --border:     #dee2e6;
  --text:       #212529;
  --muted:      #6c757d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

header {
  background: #1a2332;
  color: white;
  padding: 1.5rem 2rem;
}
header .logo { font-size: 0.85rem; letter-spacing: 0.1em; opacity: 0.7; margin-bottom: 0.25rem; }
header h1    { font-size: 1.6rem; font-weight: 700; }
header .subtitle { opacity: 0.8; font-size: 0.95rem; margin-top: 0.25rem; }

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Storm picker */
.storm-picker label { font-weight: 600; display: block; margin-bottom: 0.5rem; }
#storm-select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}
.storm-desc { color: var(--muted); font-size: 0.9rem; }

/* Charts */
#area-chart, #bar-chart { width: 100%; }
#area-chart svg, #bar-chart svg { width: 100%; }

/* Total readout */
#total-readout {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 0.75rem;
}
#total-readout .above-threshold { color: var(--surge-wave); }

/* Sliders */
.slider-row {
  display: grid;
  grid-template-columns: 140px 1fr 60px;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.slider-row label { font-size: 0.9rem; font-weight: 500; }
.slider-row input[type=range] { width: 100%; accent-color: var(--total); }
.slider-value {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.primary-slider { margin-top: 1rem; }
.slr-row input[type=range] { accent-color: var(--tide); }

.hint { font-size: 0.875rem; color: var(--muted); margin-bottom: 1rem; }

#reset-btn {
  margin-top: 0.5rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-size: 0.875rem;
}
#reset-btn:hover { background: var(--bg); }

/* Legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
}
.legend-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.875rem; }
.swatch {
  width: 14px; height: 14px;
  border-radius: 2px;
  display: inline-block;
}
.swatch.tide       { background: var(--tide); }
.swatch.surge-wave { background: var(--surge-wave); }
.swatch.residual   { background: var(--residual); }
.swatch.threshold  { background: none; border: 2px dashed var(--threshold); }

/* Error message */
.error {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 1rem;
  color: #664d03;
}

footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}
footer a { color: var(--muted); }

/* Mobile */
@media (max-width: 600px) {
  header { padding: 1rem; }
  header h1 { font-size: 1.3rem; }
  .slider-row { grid-template-columns: 110px 1fr 50px; }
  .legend { gap: 0.6rem; }
}
