:root {
  --bg: #f4f7f5;
  --surface: #ffffff;
  --text: #17332c;
  --muted: #67766f;
  --line: #d9e2de;
  --green: #0f6b52;
  --green-2: #247663;
  --green-soft: #eaf4f0;
  --blue: #7fc3e5;
  --shadow: 0 10px 30px rgba(26, 54, 45, 0.07);
  --radius: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

.topbar {
  min-height: 80px;
  padding: 12px 24px;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto minmax(240px, 1fr);
  align-items: center;
  gap: 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 35%, #fff 0 7%, transparent 8%),
    linear-gradient(180deg, #126b50 0 62%, #80c4d2 62% 100%);
  color: white;
  font-weight: 900;
  font-size: 1.4rem;
  border: 3px solid #dcebe6;
}

.brand h1 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1;
  letter-spacing: .03em;
  color: var(--green);
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: .87rem;
}

.main-nav {
  display: flex;
  gap: 28px;
  align-self: stretch;
}

.main-nav a {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #364942;
  font-size: .82rem;
  font-weight: 800;
  text-transform: uppercase;
  border-bottom: 3px solid transparent;
  padding: 0 2px;
}

.main-nav a.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.source-badges {
  justify-self: end;
  display: grid;
  text-align: right;
  color: #566760;
  font-size: .75rem;
  font-weight: 700;
}

.dashboard-shell {
  width: min(1500px, calc(100% - 30px));
  margin: 20px auto;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 18px;
  display: grid;
  gap: 16px;
  position: sticky;
  top: 100px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--green);
}

.field {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
}

.field > span {
  font-size: .78rem;
  font-weight: 800;
}

select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #cfdad5;
  border-radius: 8px;
  background: white;
  color: var(--text);
}

.sidebar-copy,
.subtle,
.small-note,
.chart-caption,
.about-card p {
  color: var(--muted);
}

.sidebar-copy {
  font-size: .82rem;
  margin: 18px 0 0;
}

.metric-list {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #eef7f4, #f7fbfa);
}

.metric {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 7px;
}

.metric-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid #c7d9d2;
  border-radius: 7px;
  color: var(--green);
  font-size: .75rem;
}

.metric strong {
  display: block;
  font-size: .88rem;
}

.metric small {
  color: var(--muted);
  font-size: .72rem;
}

.legend-panel,
.howto-panel,
.future-panel {
  padding: 12px;
  border: 1px solid #e1e8e5;
  border-radius: 12px;
}

.legend-item {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 9px;
  align-items: center;
  margin: 8px 0;
}

.swatch {
  width: 24px;
  height: 24px;
  border-radius: 5px;
}

.fresh { background: #cde9f5; }
.brackish { background: #d9efd9; }
.saline-brackish { background: #f9e7b2; }
.saline { background: #f7d1ce; }

.legend-item strong,
.legend-item small {
  display: block;
}

.legend-item strong { font-size: .78rem; }
.legend-item small { font-size: .7rem; color: var(--muted); }

.howto-panel {
  background: #f1f7f5;
  font-size: .78rem;
}

.howto-panel p:last-child,
.future-panel p:not(.eyebrow) { margin: 0; }

.future-panel { font-size: .78rem; }

.status-chip {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e5f2ed;
  color: var(--green);
  font-weight: 800;
  font-size: .68rem;
}

.content-column {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.hero-card {
  padding: 18px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.45rem;
}

.panel-heading p {
  margin: 4px 0 0;
  color: #344c43;
}

.gradient-layout {
  display: grid;
  grid-template-columns: 220px minmax(620px, 1fr) 130px;
  gap: 18px;
  margin-top: 14px;
  align-items: stretch;
}

.geo-strip {
  position: relative;
  min-height: 670px;
  border-radius: 12px;
  overflow: hidden;
  background:
    linear-gradient(rgba(240,250,246,.75), rgba(240,250,246,.75)),
    radial-gradient(circle at 65% 20%, #b6e0bb 0 5%, transparent 6%),
    radial-gradient(circle at 30% 70%, #cfe6c8 0 4%, transparent 5%),
    #edf6ef;
}

.north-label,
.south-label {
  position: absolute;
  left: 12px;
  font-size: .72rem;
  font-weight: 900;
  color: #2c4b41;
  z-index: 2;
}

.north-label { top: 10px; }
.south-label { bottom: 10px; }

.gradient-chart-wrap {
  position: relative;
  min-width: 0;
}

#gradient-chart {
  display: block;
  width: 100%;
  height: 670px;
}

.salinity-zones {
  display: grid;
  grid-template-rows: 5fr 13fr 7fr 15fr;
  min-height: 670px;
  border-radius: 10px;
  overflow: hidden;
}

.zone {
  display: grid;
  place-items: center;
  text-align: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: .77rem;
  font-weight: 800;
}

.zone b { font-weight: 900; }

.zone.fresh { background: #e7f4fb; color: #1d6a95; }
.zone.brackish { background: #eff8e9; color: #287548; }
.zone.saline-brackish { background: #fff2c9; color: #9b6b0d; }
.zone.saline { background: #fde1dd; color: #a33e32; }

.chart-caption {
  margin: 8px 0 0;
  font-size: .76rem;
  font-style: italic;
}

.tooltip {
  position: absolute;
  z-index: 10;
  pointer-events: none;
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(21, 51, 43, .94);
  color: #fff;
  font-size: .78rem;
  box-shadow: var(--shadow);
}

.station-label {
  fill: #243c34;
  font-size: 12px;
}

.station-value {
  fill: #142d26;
  font-size: 12px;
  font-weight: 800;
}

.axis text {
  fill: #54655e;
  font-size: 11px;
}

.axis path,
.axis line {
  stroke: #becbc6;
}

.grid line {
  stroke: #edf2ef;
}

.gradient-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 2.6;
}

.gradient-point {
  fill: var(--green);
  stroke: #fff;
  stroke-width: 2.2;
}

.dam-divider {
  stroke: #75877f;
  stroke-width: 1.6;
  stroke-dasharray: 6 5;
}

.dam-text {
  fill: #1d2f29;
  font-size: 11px;
  font-weight: 900;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.25fr);
  gap: 16px;
}

.compact-card {
  padding: 16px;
}

.compact-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.compact-heading .eyebrow {
  font-size: .88rem;
}

.subtle {
  margin: -4px 0 8px;
  font-size: .72rem;
}

.inline-field {
  max-width: 320px;
}

.mini-chart {
  display: block;
  width: 100%;
  height: 300px;
}

.mini-legend {
  display: flex;
  gap: 22px;
  font-size: .72rem;
  font-weight: 700;
}

.dash-key {
  display: inline-block;
  width: 22px;
  border-top: 2px dashed #778881;
  margin-right: 6px;
  vertical-align: middle;
}

.point-key {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #536b62;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -2px;
}

.small-note {
  font-size: .7rem;
  font-style: italic;
  margin: 10px 0 0;
}

.plankton-heading {
  align-items: start;
}

.source-mini {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 800;
}

.plankton-controls {
  display: grid;
  grid-template-columns: .8fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 6px;
}

.plankton-controls select {
  font-size: .75rem;
  padding: 7px 8px;
}

.plankton-chart { height: 360px; }

.about-card {
  padding: 18px;
}

.about-card h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.about-card p {
  margin: 4px 0;
  font-size: .82rem;
}

.footer {
  width: min(1500px, calc(100% - 30px));
  margin: 0 auto 22px;
  padding: 15px 4px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: .72rem;
}

.footer strong { color: var(--green); }

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .source-badges { display: none; }

  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gradient-layout {
    grid-template-columns: 150px minmax(560px, 1fr) 100px;
  }
}

@media (max-width: 820px) {
  .topbar {
    position: static;
    display: block;
  }

  .main-nav {
    margin-top: 12px;
    gap: 14px;
    overflow-x: auto;
  }

  .dashboard-shell {
    width: min(100% - 16px, 1500px);
  }

  .sidebar {
    display: block;
  }

  .sidebar > section {
    margin-bottom: 14px;
  }

  .gradient-layout {
    display: block;
    overflow-x: auto;
  }

  .geo-strip,
  .salinity-zones {
    display: none;
  }

  .gradient-chart-wrap {
    min-width: 760px;
  }

  .lower-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    width: min(100% - 16px, 1500px);
    display: block;
  }

  .footer strong {
    display: block;
    margin-top: 6px;
  }
}


/* --- USGS hydrography map --- */
.geo-strip {
  position: relative;
  background: linear-gradient(180deg, #eef7f0 0%, #f7faf8 100%);
}
#guana-map {
  display: block;
  width: 100%;
  height: 670px;
}
.hydro-waterbody {
  fill: #a9d6ee;
  stroke: #7bb8d7;
  stroke-width: 0.8;
}
.hydro-waterbody.guana-feature {
  fill: #88c9e7;
  stroke: #4e9fc6;
  stroke-width: 1.2;
}
.hydro-flowline {
  fill: none;
  stroke: #a4cfe3;
  stroke-width: 1.1;
  stroke-linecap: round;
}
.hydro-flowline.guana-feature {
  stroke: #63afd0;
  stroke-width: 2.2;
}
.map-station {
  fill: #0f6b52;
  stroke: #ffffff;
  stroke-width: 1.8;
  cursor: pointer;
}
.map-station.is-highlighted,
.gradient-point.is-highlighted {
  fill: #f0a51b !important;
  stroke: #ffffff;
  stroke-width: 3;
}
.map-dam {
  stroke: #273c35;
  stroke-width: 2.3;
  stroke-linecap: round;
}
.map-credit {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 6px;
  padding: 3px 5px;
  border-radius: 5px;
  background: rgba(255,255,255,.82);
  color: #66766f;
  font-size: .58rem;
  line-height: 1.2;
  text-align: center;
}
.map-unavailable {
  fill: #67766f;
  font-size: 11px;
  text-anchor: middle;
}


/* --- Explore Guana full hydrography map --- */
.explore-card {
  padding: 18px;
}
.explore-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.explore-heading h2 {
  margin: 0 0 5px;
  font-size: 1.3rem;
}
.explore-heading p:not(.eyebrow) {
  margin: 0;
  color: var(--muted, #67766f);
  max-width: 760px;
  font-size: .84rem;
}
.explore-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: .76rem;
  color: #40564e;
}
.explore-controls label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.explore-map-wrap {
  position: relative;
  border: 1px solid #dbe4e0;
  border-radius: 12px;
  overflow: hidden;
  background: #edf5ef;
}
#explore-map {
  display: block;
  width: 100%;
  height: 680px;
  cursor: grab;
}
#explore-map:active { cursor: grabbing; }
.explore-land {
  fill: #edf5ef;
}
.explore-waterbody {
  fill: #9fd2e8;
  fill-opacity: .72;
  stroke: #72b3d1;
  stroke-width: .65;
  vector-effect: non-scaling-stroke;
}
.explore-flowline {
  fill: none;
  stroke: #4f9fbe;
  stroke-width: 1.15;
  stroke-opacity: .76;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.explore-station {
  fill: #0f6b52;
  stroke: #fff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.explore-map-hud {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 2px 10px rgba(20,50,40,.08);
  font-size: .7rem;
}
.explore-map-hud button {
  border: 1px solid #bdd0c8;
  background: #fff;
  border-radius: 6px;
  padding: 5px 8px;
  color: #164c3d;
  cursor: pointer;
  font-weight: 700;
}
.explore-note {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f5f8f6;
  border-radius: 9px;
  color: #5c6d66;
  font-size: .76rem;
}
@media (max-width: 820px) {
  .explore-heading { display: block; }
  .explore-controls { margin-top: 12px; }
  #explore-map { height: 560px; }
}


/* --- Linked station highlighting: map points <-> gradient bars --- */
.gradient-bar {
  fill: #2c7a67;
  opacity: .82;
  cursor: pointer;
  transition: opacity .12s ease, filter .12s ease, stroke-width .12s ease;
}
.gradient-bar:hover,
.gradient-bar.is-highlighted {
  fill: #f0a51b;
  opacity: 1;
  stroke: #9d6500;
  stroke-width: 1.5px;
}
.map-station,
.explore-station {
  cursor: pointer;
  transition: r .12s ease, fill .12s ease, stroke-width .12s ease;
}
.map-station.is-highlighted,
.explore-station.is-highlighted {
  fill: #f0a51b !important;
  stroke: #ffffff !important;
  stroke-width: 3px !important;
}
