/* ============================================================
   WilcoFlood — HEC-RAS Model Coverage Map
   Stylesheet — matches wilcoflood.org light/readable style
   ============================================================ */

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

:root {
  --blue-dark:   #1a3a52;
  --blue-mid:    #2a5278;
  --blue-accent: #2980b9;
  --white:       #ffffff;
  --off-white:   #f5f7fa;
  --gray-light:  #e8ecf0;
  --gray-text:   #546e7a;
  --text-dark:   #1c2b36;
  --font:        'Segoe UI', Arial, sans-serif;
  --header-h:    70px;
  --title-h:     48px;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--off-white);
  color: var(--text-dark);
  font-size: 14px;
}

/* Header */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: #1E1E1E;
  border-bottom: none;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.header-inner {
  max-width: 1400px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.brand { text-decoration: none; font-family: "Montserrat", sans-serif; font-weight: 900; font-size: 48px; letter-spacing: 0.5px; text-shadow: 1px 1px 3px #000; }
.brand-wilco { color: #AEDC2A; }
.brand-flood { color: #1CA3EC; }
.header-nav { display: flex; gap: 4px; }
.header-nav a {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 3px;
  text-decoration: none; color: #cdd8e0; font-size: 13px;
  transition: background 0.15s, color 0.15s;
}
.header-nav a:hover { background: rgba(255,255,255,0.12); color: #fff; }
.header-nav img { width: 15px; height: 15px; filter: brightness(10); opacity: 0.8; }

/* Title bar */
.page-title-bar {
  position: fixed; top: var(--header-h); left: 0; right: 0;
  height: var(--title-h);
  background: var(--blue-mid);
  border-bottom: 1px solid #3d6b8e;
  z-index: 999;
}
.page-title-inner {
  max-width: 1400px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
}
.page-title-inner h1 { font-size: 17px; font-weight: 600; color: #ffffff; }
.page-title-inner p {
  font-size: 13px; color: #a8c8e0;
  border-left: 1px solid rgba(255,255,255,0.2); padding-left: 14px;
}

/* Map */
#map-wrap {
  position: fixed;
  top: calc(var(--header-h) + var(--title-h));
  left: 0; right: 0; bottom: 70px;
}
#map { width: 100%; height: 100%; }

/* Legend */
.map-legend {
  position: absolute; bottom: 28px; right: 12px;
  background: rgba(255,255,255,0.96);
  border: 1px solid #c5d5e0; border-radius: 4px;
  padding: 10px 14px; z-index: 800;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.legend-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--gray-text); margin-bottom: 7px;
}
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dark); margin-bottom: 4px; }
.legend-item:last-child { margin-bottom: 0; }
.legend-swatch { display: inline-block; width: 26px; height: 4px; border-radius: 2px; flex-shrink: 0; }

/* Loading */
.map-loading {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(255,255,255,0.97); border: 1px solid #c5d5e0;
  border-radius: 5px; padding: 16px 24px;
  display: flex; align-items: center; gap: 12px;
  z-index: 900; font-size: 14px; color: var(--text-dark);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12); pointer-events: none;
}
.map-loading.hidden { display: none; }
.spinner {
  width: 20px; height: 20px;
  border: 3px solid #d0e4f0; border-top-color: var(--blue-accent);
  border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Popup */
.leaflet-popup-content-wrapper {
  background: #ffffff !important;
  border: 1px solid #c5d5e0 !important;
  border-radius: 5px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15) !important;
  padding: 0 !important;
  min-width: 260px;
}
.leaflet-popup-tip { background: #ffffff !important; }
.leaflet-popup-content { margin: 0 !important; width: auto !important; }

.reach-popup { font-family: var(--font); font-size: 13px; }
.reach-popup-header { background: var(--blue-dark); border-radius: 5px 5px 0 0; padding: 10px 14px; }
.reach-popup-header .label { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #a8c8e0; margin-bottom: 2px; }
.reach-popup-header .folder { font-size: 15px; font-weight: 700; color: #ffffff; word-break: break-word; }
.reach-popup-body { padding: 12px 14px; background: #ffffff; border-radius: 0 0 5px 5px; }
.reach-popup-meta { font-size: 12px; color: var(--gray-text); margin-bottom: 12px; line-height: 1.7; }
.reach-popup-meta strong { color: var(--text-dark); }
.reach-popup-download,
.reach-popup-download:link,
.reach-popup-download:visited,
.reach-popup-download:hover,
.reach-popup-download:active {
  color: #ffffff !important;
  text-decoration: none !important;
}
.reach-popup-download {
  display: block; width: 100%; padding: 10px 0;
  background: #1a6090;
  text-align: center; border-radius: 4px;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px; font-weight: 700;
  letter-spacing: 0.02em;
  padding: 10px 16px;
  transition: background 0.15s, border 0.15s;
  border: 2px solid transparent;
}
.reach-popup-download:hover { background: #0a2f4a; border: 2px solid #ffffff; }

/* Footer */
.site-footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 70px; background: #1E1E1E;
  border-top: none; z-index: 1000;
}
.footer-inner {
  max-width: 1400px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
}
.footer-logo-wrap { flex-shrink: 0; }
.footer-logo { max-height: 50px; width: auto; }
.footer-text {
  font-size: 0.92rem; color: #ffffff;
}
.footer-link { color: #1CA3EC; text-decoration: none; }
.footer-link:hover { text-decoration: underline; }

/* Layer control */
.leaflet-control-layers {
  background: rgba(255,255,255,0.97) !important;
  border: 1px solid #c5d5e0 !important;
  border-radius: 4px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
}
.leaflet-control-layers-list { padding: 4px 2px !important; }
.leaflet-control-layers label {
  font-family: var(--font) !important; font-size: 13px !important;
  color: var(--text-dark) !important; padding: 3px 6px !important;
  display: flex !important; align-items: center !important; gap: 6px !important; cursor: pointer;
}
.leaflet-control-layers label:hover { color: var(--blue-accent) !important; }
.leaflet-control-layers-separator { border-color: var(--gray-light) !important; }

/* Attribution */
.leaflet-control-attribution { font-size: 10px !important; background: rgba(255,255,255,0.8) !important; }

/* Responsive */
@media (max-width: 700px) {
  .header-nav a { font-size: 0; padding: 5px 8px; }
  .header-nav img { width: 18px; height: 18px; }
  .page-title-inner p { display: none; }
  .page-title-inner h1 { font-size: 15px; }
}
