/* Palomar brand tokens (colors sampled from Palomar-Logo-Blue-Full-Color_Small.svg) */
:root {
  --palomar-blue: #004261;
  --palomar-blue-dark: #003049;
  --palomar-teal: #1a9caa;
  --palomar-lime: #afd138;
  --palomar-green: #89bc6a;
  --palomar-amber: #f0b429;
  --text: #1c2b33;
  --muted: #6b7c85;
  --border: #e5e9ec;
  --bg: #ffffff;
  --bg-subtle: #f5f7f9;
}

body {
  margin: 0;
  padding: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Visually hidden until focused, so keyboard users can jump past the header. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--palomar-blue);
  color: #fff;
  padding: 10px 16px;
  z-index: 1000;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  left: 0;
}

/* Header / top banner (plmr.com pattern) */
.plmr-header {
  background: var(--palomar-blue);
}

.plmr-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 28px;
}

.plmr-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.plmr-logo img {
  height: 32px;
  display: block;
}

.plmr-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.plmr-nav a {
  color: #ffffff;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 18px;
  border: none;
  border-radius: 4px;
  background: transparent;
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

.plmr-nav a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.plmr-nav a.active {
  color: #ffffff;
  background: var(--palomar-teal);
}

/* Explicit, guaranteed-visible focus ring against the dark header background
   (the default browser outline can have poor contrast there). */
.plmr-nav a:focus-visible,
.plmr-logo:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Page hero (title strip below the header) */
.page-hero {
  background: var(--bg-subtle);
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
}

.page-container {
  max-width: 1400px;
  margin: 0 auto;
}

/* Unconditional (no media query) 28px gutter for sections that otherwise
   carry no horizontal padding of their own at any width - matches
   .page-hero/.plmr-header-inner's existing 28px exactly, so it reads as one
   consistent gutter rather than a new value. Applied to each section's
   *outer* wrapper div (not .page-container itself), so hero/header - which
   already had their own correct padding - are untouched by this. */
.page-section {
  padding-left: 28px;
  padding-right: 28px;
  box-sizing: border-box;
}

/* Responsive: tablet landscape / tablet portrait / mobile portrait.
   Desktop (>1024px) is untouched by everything below this point. */
@media (max-width: 1024px) {
  .plmr-header-inner {
    padding: 16px 20px;
  }

  .filter-col {
    flex: 1 1 30% !important; /* ~3 per row; !important needed to beat each dropdown column's inline flex ratio */
    min-width: 160px;
    box-sizing: border-box;
  }
}

@media (max-width: 768px) {
  .page-hero h1 {
    font-size: 21px;
  }

  .page-hero p {
    font-size: 13px;
  }

  .filter-col {
    flex: 1 1 45% !important; /* ~2 per row */
  }

  #choropleth-map,
  #dates-choropleth-map {
    height: 60vh !important;
    min-height: 380px !important;
  }
}

@media (max-width: 480px) {
  /* Keep mobile's gutter at the narrower width already confirmed working,
     rather than let it grow to .page-section's unconditional 28px. */
  .page-section {
    padding-left: 14px;
    padding-right: 14px;
  }

  .plmr-header-inner {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 14px 16px;
  }

  .plmr-nav {
    width: 100%;
    justify-content: center;
    gap: 6px;
  }

  .plmr-nav a {
    padding: 8px 14px;
    font-size: 13px;
  }

  .filter-col {
    flex: 1 1 100% !important; /* fully stacked */
  }

  #choropleth-map,
  #dates-choropleth-map {
    height: 50vh !important;
    min-height: 320px !important;
  }

  #dates-date-tabs .tab {
    width: 47%;
    min-height: 44px;
  }
}

.map-frame {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.page-hero h1 {
  margin: 0;
  color: var(--palomar-blue);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.page-hero p {
  margin: 6px 0 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* Significant-date tab strip: up to ~18 labels, so wrap to multiple rows.
   Dash's own dcc.Tabs CSS defaults .tab-container to flex-direction:column
   (only switching to row above its mobile_breakpoint via a media query) -
   flex-direction:row is set explicitly here so this doesn't depend on that.
   justify-content:space-between spreads each wrapped row edge-to-edge
   instead of leaving dead space after a short row's last tab. */
#dates-date-tabs.tab-container,
#dates-date-tabs .tab-container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  border-bottom: none;
}

#dates-date-tabs .tab {
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 175px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 13px;
  line-height: 1.25;
  white-space: normal;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 4px;
}

/* Unfilled filter dropdowns pulse a soft amber "needs a value" aura.
   react-select adds .has-value only when a selection exists, so
   :not(.has-value) targets the empty ones. Year is clearable=False, so it
   always has a value and never pulses. */
.dash-dropdown .Select:not(.has-value) .Select-control {
  border-color: var(--palomar-amber);
  background-color: #fffdf6;
  animation: plmr-missing-pulse 2.2s ease-in-out infinite;
}

@keyframes plmr-missing-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 2px rgba(240, 180, 41, 0.16),
      0 0 6px rgba(240, 180, 41, 0.2);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(240, 180, 41, 0.42),
      0 0 11px rgba(240, 180, 41, 0.48);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-dropdown .Select:not(.has-value) .Select-control {
    animation: none;
    box-shadow:
      0 0 0 3px rgba(240, 180, 41, 0.3),
      0 0 8px rgba(240, 180, 41, 0.3);
  }
}

/* Footer (plmr.com pattern: compact, text-only legal footer) */
.plmr-footer {
  background-image: linear-gradient(90deg, #1a9caa 0%, #004261 100%) !important;
  border-top: 1px solid var(--border);
  padding: 20px 28px;
  margin-top: 20px;
}

.plmr-footer-disclosure {
  margin: 0 0 8px 0;
  font-size: 16px;
  line-height: 1.2;
  color: #fff;
  text-align: center;
}

.plmr-footer-links {
  font-size: 16px;
  line-height: 1.5;
  color: #fff;
  text-align: center;
}

.plmr-footer-links a {
  color: #fff;
  text-decoration: underline;
}

.plmr-footer-links a:hover {
  color: #afd13a;
}
