:root {
  --ink: #102a43;
  --muted: #526b7a;
  --sea: #0b4f6c;
  --sea-2: #0f766e;
  --sky: #eaf4f7;
  --paper: #ffffff;
  --line: #d8e4ea;
  --soft: #f5f9fb;
  --warning: #9a6700;
  --danger: #9b2c2c;
  --shadow: 0 12px 28px rgba(16, 42, 67, .08);
  --radius: 20px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: #edf5f7;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(42, 157, 143, .10), transparent 24rem),
    #edf5f7;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

button, input { font: inherit; }

a { color: inherit; }

.skip-link {
  position: fixed;
  top: .5rem;
  left: .5rem;
  transform: translateY(-150%);
  z-index: 9999;
  background: #fff;
  padding: .75rem 1rem;
  border-radius: .75rem;
  box-shadow: var(--shadow);
}

.skip-link:focus { transform: translateY(0); }

.public-header {
  background: linear-gradient(135deg, #073b4c, #0b5f78 62%, #148a8a);
  color: #fff;
  padding: 1rem max(1rem, env(safe-area-inset-left)) 1.15rem max(1rem, env(safe-area-inset-right));
}

.header-inner,
.page-shell,
.public-footer p {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.header-inner {
  display: flex;
  flex-direction: column;
  gap: .9rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .85rem;
}

.brand h1 {
  margin: .12rem 0 0;
  font-size: clamp(1.35rem, 5vw, 2rem);
  line-height: 1.08;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .72rem;
  font-weight: 800;
  opacity: .82;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 4px;
  padding: 9px;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.24);
}

.brand-mark span {
  display: block;
  border-radius: 999px;
  background: #fff;
}

.brand-mark span:nth-child(1) { height: 42%; }
.brand-mark span:nth-child(2) { height: 72%; }
.brand-mark span:nth-child(3) { height: 100%; }

.update-box {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: .7rem .85rem;
  border-radius: 14px;
  background: rgba(255,255,255,.11);
  border: 1px solid rgba(255,255,255,.18);
}

.update-box span {
  font-size: .75rem;
  opacity: .82;
}

.update-box strong { font-size: .96rem; }

.page-shell {
  padding: 1rem 1rem 6.4rem;
}

.hero {
  display: grid;
  gap: 1rem;
  padding: 1.1rem .2rem 1.25rem;
}

.hero h2 {
  margin: .35rem 0 .55rem;
  font-size: clamp(1.7rem, 7vw, 2.8rem);
  line-height: 1.05;
  letter-spacing: -.025em;
}

.hero-copy {
  margin: 0;
  max-width: 48rem;
  color: var(--muted);
  font-size: 1rem;
}

.public-status {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 42px;
  padding: .58rem .8rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(16,42,67,.06);
  font-size: .84rem;
  font-weight: 700;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #18a66a;
  box-shadow: 0 0 0 4px rgba(24,166,106,.12);
}

.summary-card,
.public-panel,
.about-card {
  background: var(--paper);
  border: 1px solid rgba(129, 162, 177, .28);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.summary-card {
  padding: 1rem;
  margin-bottom: 1rem;
}

.summary-heading,
.panel-heading,
.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
}

.summary-heading h2,
.panel-heading h2,
.about-card h2 {
  margin: .18rem 0 0;
  line-height: 1.15;
}

.summary-heading h2 { font-size: 1.35rem; }

.cycle-badge,
.unit-pill,
.small-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: .42rem .65rem;
  background: var(--sky);
  color: var(--sea);
  font-size: .75rem;
  font-weight: 800;
}

.summary-grid {
  display: grid;
  gap: .7rem;
  margin-top: .95rem;
}

.summary-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: .75rem;
  align-items: center;
  padding: .85rem;
  background: var(--soft);
  border: 1px solid #e3edf1;
  border-radius: 16px;
}

.summary-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: #e1f1f4;
  color: var(--sea);
  font-size: 1.35rem;
  font-weight: 800;
}

.summary-label,
.summary-item small {
  display: block;
  color: var(--muted);
}

.summary-label {
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: .12rem;
}

.summary-item strong {
  display: block;
  font-size: 1.45rem;
  letter-spacing: -.02em;
}

.summary-item small { font-size: .72rem; }

.public-panel {
  margin-top: 1rem;
  padding: 1rem;
  scroll-margin-top: 1rem;
}

.panel-heading {
  align-items: flex-start;
}

.panel-heading h2 {
  font-size: clamp(1.35rem, 5.5vw, 1.85rem);
}

.panel-description {
  margin: .7rem 0 1rem;
  color: var(--muted);
  font-size: .94rem;
}

.map-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: #dce9ed;
  border: 1px solid var(--line);
}

.public-map {
  width: 100%;
  height: 340px;
  min-height: 340px;
}

.public-map-bay {
  height: 360px;
  min-height: 360px;
}

.map-overlay {
  position: absolute;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
  background: rgba(245,249,251,.92);
  color: var(--danger);
  font-weight: 700;
}

.timeline-card {
  margin-top: .75rem;
  padding: .8rem;
  border-radius: 15px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.timeline-head strong {
  font-size: .9rem;
}

.touch-button {
  min-height: 44px;
  min-width: 104px;
  padding: .55rem .85rem;
  border-radius: 12px;
  border: 1px solid #b7ccd6;
  background: #fff;
  color: var(--sea);
  font-weight: 800;
  cursor: pointer;
}

.touch-button:active { transform: translateY(1px); }

.time-slider {
  display: block;
  width: 100%;
  margin: .8rem 0 .25rem;
  accent-color: var(--sea-2);
  min-height: 28px;
}

.timeline-label {
  display: block;
  color: var(--muted);
  font-size: .76rem;
}

.chart {
  width: 100%;
  min-height: 225px;
  overflow: hidden;
}

.chart-compact {
  margin-top: .7rem;
  min-height: 210px;
}

.chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-empty {
  padding: 1rem;
  border-radius: 12px;
  background: var(--soft);
  color: var(--muted);
}

.grid-line {
  stroke: #e0eaee;
  stroke-width: 1;
}

.axis-label {
  fill: #607887;
  font-size: 10px;
}

.t0-line {
  stroke: #7a8f9b;
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.t0-label {
  fill: #526b7a;
  font-size: 10px;
  font-weight: 700;
}

.plain-details {
  margin-top: .8rem;
  border-top: 1px solid var(--line);
  padding-top: .75rem;
}

.plain-details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--sea);
  font-weight: 800;
}

.plain-details p {
  margin: .45rem 0 .2rem;
  color: var(--muted);
  font-size: .9rem;
}

.about-card {
  margin-top: 1rem;
  padding: 1.1rem;
}

.about-card h2 {
  margin-top: .28rem;
  font-size: 1.35rem;
}

.about-card p {
  margin: .65rem 0 0;
  color: var(--muted);
  font-size: .92rem;
}

.mobile-nav {
  position: fixed;
  z-index: 1200;
  left: .75rem;
  right: .75rem;
  bottom: calc(.7rem + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .35rem;
  padding: .4rem;
  border: 1px solid rgba(124, 157, 171, .35);
  border-radius: 18px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(16,42,67,.18);
}

.mobile-nav a {
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .1rem;
  text-decoration: none;
  border-radius: 13px;
  font-size: .72rem;
  font-weight: 800;
  color: var(--sea);
}

.mobile-nav a:active {
  background: var(--sky);
}

.mobile-nav span {
  font-size: 1.1rem;
  line-height: 1;
}

.public-footer {
  padding: 1.5rem 1rem 6.5rem;
  color: #6b7f8a;
  font-size: .78rem;
  text-align: center;
}

/* Leaflet — keep public controls compact and touchable */
.leaflet-control-zoom a {
  width: 38px !important;
  height: 38px !important;
  line-height: 38px !important;
}

.leaflet-control-attribution {
  font-size: 9px !important;
}

@media (min-width: 700px) {
  .public-header { padding-top: 1.25rem; padding-bottom: 1.25rem; }

  .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .update-box {
    min-width: 235px;
    text-align: right;
  }

  .page-shell {
    padding: 1.4rem 1.4rem 2.2rem;
  }

  .hero {
    grid-template-columns: 1fr auto;
    align-items: end;
    padding: 1.8rem .2rem;
  }

  .public-status { justify-self: end; }

  .summary-card,
  .public-panel,
  .about-card {
    padding: 1.35rem;
  }

  .summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .public-map,
  .public-map-bay {
    height: 480px;
    min-height: 480px;
  }

  .mobile-nav { display: none; }

  .public-footer { padding-bottom: 2rem; }
}

@media (min-width: 980px) {
  .summary-item { padding: 1rem; }
  .public-map,
  .public-map-bay {
    height: 520px;
    min-height: 520px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.map-overlay[hidden] {
  display: none;
}
/* F18 PUBLIC MOBILE R2A - dynamic FEWS precipitation legend */
.map-legend {
  position: absolute;
  left: .55rem;
  right: .55rem;
  bottom: 1.8rem;
  z-index: 450;
  pointer-events: none;
  padding: .38rem .48rem .32rem;
  border: 1px solid rgba(126,154,166,.70);
  border-radius: 10px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 2px 8px rgba(14,47,61,.16);
  backdrop-filter: blur(2px);
}

.map-legend[hidden] {
  display: none;
}

.map-legend-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .22rem;
  color: #173b4a;
  font-size: .66rem;
  font-weight: 800;
  line-height: 1.1;
}

.map-legend-unit {
  color: var(--muted);
  font-weight: 700;
}

.map-legend-bar {
  display: flex;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(71,102,114,.38);
  border-radius: 4px;
  background: #fff;
}

.map-legend-segment {
  flex: 1 1 0;
  min-width: 0;
}

.map-legend-ticks {
  position: relative;
  height: 14px;
  margin-top: 2px;
  color: #385767;
  font-size: .56rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.map-legend-tick {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.map-legend-tick.is-first {
  transform: none;
}

.map-legend-tick.is-last {
  transform: translateX(-100%);
}

@media (max-width: 430px) {
  .map-legend {
    left: .4rem;
    right: .4rem;
    bottom: 1.7rem;
    padding: .32rem .4rem .28rem;
  }

  .map-legend-head {
    font-size: .62rem;
  }

  .map-legend-ticks {
    font-size: .53rem;
  }
}
/* F18 PUBLIC MOBILE R2BC - spatial point inspection */
.map-point-inspector {
  margin-top: .75rem;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fbfdfe;
}

.map-point-inspector[hidden] {
  display: none;
}

.point-inspector-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .8rem;
}

.point-inspector-kicker {
  margin: 0 0 .18rem;
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  font-weight: 800;
}

.point-inspector-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

.point-inspector-value {
  flex: 0 0 auto;
  color: var(--sea);
  font-size: 1.3rem;
  font-weight: 850;
  white-space: nowrap;
}

.point-inspector-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .26rem .55rem;
  margin: .65rem 0 0;
  font-size: .78rem;
}

.point-inspector-meta dt {
  color: var(--muted);
}

.point-inspector-meta dd {
  margin: 0;
  color: var(--ink);
  font-weight: 650;
}

.point-inspector-status {
  margin: .55rem 0 0;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.4;
}

.point-series-chart {
  min-height: 0;
  margin-top: .7rem;
  overflow: visible;
}

.point-series-chart svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.point-series-chart .axis-label {
  fill: #607887;
  font-size: 10px;
}

.point-series-chart .grid-line {
  stroke: #e0eaee;
  stroke-width: 1;
}

.point-series-chart .t0-line {
  stroke: #7a8f9b;
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.point-series-chart .t0-label {
  fill: #526b7a;
  font-size: 10px;
  font-weight: 700;
}

.point-series-chart .series-line {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-width: 2.5;
}

@media (max-width: 430px) {
  .map-point-inspector {
    padding: .75rem;
  }

  .point-inspector-head {
    gap: .55rem;
  }

  .point-inspector-value {
    font-size: 1.12rem;
  }

  .point-inspector-meta {
    grid-template-columns: 1fr;
    gap: .08rem;
  }

  .point-inspector-meta dd {
    margin-bottom: .28rem;
  }
}

/* F18 PUBLIC MOBILE R3B - institutional identity */
.prototype-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.7rem;
  margin-top: 0.55rem;
}

.prototype-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.institution-line {
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.35;
  opacity: 0.9;
}

.public-footer .footer-inner {
  width: min(100% - 2rem, 1120px);
  margin: 0 auto;
  text-align: left;
}

.public-footer .footer-inner p {
  width: auto;
  margin-left: 0;
  margin-right: 0;
}

.public-footer .footer-system {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 0.76rem;
  line-height: 1.4;
  opacity: 0.72;
}

.public-footer .footer-title {
  margin-top: 0;
  margin-bottom: 0.2rem;
  font-weight: 800;
  line-height: 1.35;
}

.public-footer .footer-responsible {
  margin-top: 0;
  margin-bottom: 0;
  font-size: 0.86rem;
  line-height: 1.4;
}

.public-footer .footer-disclaimer {
  max-width: 78ch;
  margin-top: 0.85rem;
  margin-bottom: 0;
  font-size: 0.76rem;
  line-height: 1.55;
  opacity: 0.82;
}

@media (max-width: 640px) {
  .prototype-identity {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.4rem;
  }

  .institution-line {
    font-size: 0.74rem;
  }

  .public-footer .footer-inner {
    width: min(100% - 2rem, 1120px);
  }
}


/* F18 PUBLIC MOBILE R3C - typographic finish */
.institution-line {
  font-size: 0.82rem;
  opacity: 0.96;
}

.public-footer .footer-disclaimer {
  opacity: 0.94;
}

@media (max-width: 640px) {
  .institution-line {
    font-size: 0.78rem;
  }
}
