:root {
  --bg: #f7f2ea;
  --bg-elevated: rgba(255, 253, 249, 0.92);
  --panel: rgba(255, 252, 247, 0.96);
  --panel-border: rgba(25, 46, 63, 0.1);
  --panel-shadow: 0 10px 26px rgba(35, 41, 45, 0.07);
  --text: #17212b;
  --muted: #687784;
  --accent: #285f7a;
  --accent-soft: rgba(31, 103, 143, 0.1);
  --good: #2b8a6b;
  --warn: #b6863f;
  --danger: #b65f4b;
  --surface: #f6f2eb;
  --surface-strong: #ece5da;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
  --content-width: 1380px;
  --body-font: 'IBM Plex Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display-font: 'IBM Plex Sans', system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--body-font);
  background: linear-gradient(180deg, #fbf8f2 0%, #f2eadf 100%);
}

a {
  color: var(--accent);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-shell {
  width: min(calc(100% - 32px), var(--content-width));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero,
.dashboard {
  display: grid;
  gap: 24px;
}

.hero {
  grid-template-columns: 1fr;
  align-items: stretch;
  margin-bottom: 28px;
}

.hero-copy,
.panel {
  animation: rise-in 560ms ease forwards;
}

.hero-copy {
  padding: 18px 4px 10px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 12px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: #5f7486;
}

.hero h1,
.panel h2 {
  margin: 0;
  font-family: var(--display-font);
}

.hero h1 {
  max-width: none;
  font-size: clamp(2.1rem, 4vw, 3.9rem);
  line-height: 1.04;
}

.lead {
  max-width: 920px;
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.dashboard {
  grid-template-columns: 1fr;
  align-items: start;
  gap: 20px;
}

.panel {
  position: relative;
  overflow: visible;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow);
}

.panel-head {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 26px 0;
}

.panel-head-compact {
  padding-bottom: 18px;
}

.panel-head h2 {
  font-size: clamp(1.34rem, 2vw, 1.8rem);
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.weather-search-actions {
  position: relative;
  width: min(100%, 640px);
}

.search-form {
  display: flex;
  width: 100%;
  gap: 10px;
}

.search-input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(26, 49, 66, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  outline: 0;
}

.search-input:focus {
  border-color: rgba(31, 103, 143, 0.45);
  box-shadow: 0 0 0 4px rgba(31, 103, 143, 0.08);
}

.search-button {
  white-space: nowrap;
}

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  max-height: 310px;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(25, 46, 63, 0.12);
  border-radius: var(--radius-md);
  background: #fffdf8;
  box-shadow: 0 16px 34px rgba(28, 36, 44, 0.12);
}

.suggestions[hidden] {
  display: none;
}

.suggestion-button {
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 10px 12px;
  color: inherit;
  text-align: left;
}

.suggestion-button:hover,
.suggestion-button:focus-visible {
  background: var(--surface);
}

.suggestion-title {
  display: block;
  font-weight: 800;
}

.suggestion-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill[data-tone='neutral'] {
  background: rgba(23, 33, 43, 0.04);
  border-color: rgba(23, 33, 43, 0.08);
  color: var(--text);
}

.status-pill[data-tone='loading'] {
  background: rgba(31, 103, 143, 0.1);
  border-color: rgba(31, 103, 143, 0.22);
  color: #174b68;
}

.status-pill[data-tone='success'] {
  background: rgba(43, 138, 107, 0.1);
  border-color: rgba(43, 138, 107, 0.22);
  color: #1c6a51;
}

.status-pill[data-tone='warning'] {
  background: rgba(182, 134, 63, 0.1);
  border-color: rgba(182, 134, 63, 0.22);
  color: #7a5b2a;
}

.status-pill[data-tone='danger'] {
  background: rgba(182, 95, 75, 0.1);
  border-color: rgba(182, 95, 75, 0.2);
  color: #8f4230;
}

.refresh-button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid #26485b;
  border-radius: 10px;
  background: #26485b;
  color: #f8f4ee;
  font-weight: 800;
  transition: transform 180ms ease, filter 180ms ease, opacity 180ms ease;
}

.refresh-button:hover:not(:disabled),
.refresh-button:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.72;
}


.map-helper-text {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.map-panel {
  padding-bottom: 20px;
  overflow: hidden;
}

.map-frame {
  position: relative;
  margin: 22px 26px 0;
  border-radius: calc(var(--radius-lg) - 8px);
  overflow: hidden;
  border: 1px solid rgba(25, 46, 63, 0.12);
  background: #d9e2e7;
}

.map-canvas {
  width: 100%;
  min-height: 720px;
}

.leaflet-container {
  background: #d9e2e7;
  font-family: var(--body-font);
}

.leaflet-overlay-pane svg {
  filter: drop-shadow(0 10px 18px rgba(21, 33, 44, 0.1));
}

.weather-location-icon {
  pointer-events: none;
  background: transparent;
  border: 0;
}

.weather-location-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  border: 4px solid #ffffff;
  border-radius: 999px;
  background: #285f7a;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 0 2px rgba(23, 33, 43, 0.42),
    0 0 14px rgba(255, 255, 255, 0.98),
    0 0 26px rgba(23, 33, 43, 0.32);
}

.weather-location-dot::after {
  content: '';
  position: absolute;
  inset: -9px;
  border: 2px solid rgba(40, 95, 122, 0.35);
  border-radius: inherit;
  animation: weather-pulse 1.5s ease-in-out infinite;
}

.leaflet-control-attribution,
.leaflet-control-scale-line,
.leaflet-bar a {
  border: 0;
}

.leaflet-control-attribution {
  background: rgba(255, 252, 247, 0.92) !important;
  color: #536473;
}

.leaflet-control-attribution a {
  color: #1f678f;
}

.leaflet-bar {
  box-shadow: 0 8px 18px rgba(26, 36, 45, 0.08);
}

.leaflet-control-zoom a {
  width: 42px;
  height: 42px;
  line-height: 42px;
  font-size: 1.45rem;
  font-weight: 800;
}

.leaflet-bar a {
  background: rgba(255, 252, 247, 0.96);
  color: #17212b;
}

.leaflet-bar a:hover,
.leaflet-bar a:focus-visible {
  background: #f2ece3;
  color: #17212b;
}

.leaflet-popup-content-wrapper {
  border-radius: 18px;
  max-width: min(88vw, 360px);
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 14px 16px;
  width: min(300px, calc(88vw - 44px)) !important;
  max-width: calc(88vw - 44px);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.leaflet-popup-tip,
.leaflet-popup-content-wrapper {
  background: #fffdf8;
  color: #17212b;
}

.leaflet-popup-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
}

.leaflet-popup-card p {
  margin: 8px 0 0;
  color: #687784;
  line-height: 1.55;
}

.leaflet-popup-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.leaflet-popup-row {
  display: grid;
  grid-template-columns: minmax(86px, max-content) minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  font-size: 0.94rem;
}

.leaflet-popup-row span {
  color: #70808d;
}

.leaflet-popup-row strong {
  color: #17212b;
  text-align: right;
}

.map-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, rgba(245, 241, 233, 0.18), rgba(245, 241, 233, 0.84));
  transition: opacity 220ms ease, visibility 220ms ease;
}

.map-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.overlay-card {
  max-width: 420px;
  padding: 22px 24px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(25, 46, 63, 0.1);
  background: rgba(255, 252, 247, 0.95);
  text-align: center;
  box-shadow: 0 16px 34px rgba(28, 36, 44, 0.1);
}

.overlay-title {
  margin: 0;
  font-family: var(--display-font);
  font-size: 1.2rem;
}

.overlay-copy {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.map-overlay[data-tone='loading'] .overlay-title { color: #1f678f; }
.map-overlay[data-tone='warning'] .overlay-title { color: #8d6832; }
.map-overlay[data-tone='danger'] .overlay-title { color: #9f4d3a; }

.map-caption,
.summary-footnote,
.site-footer p {
  color: var(--muted);
}

.map-caption {
  position: relative;
  z-index: 1;
  margin: 16px 26px 0;
  line-height: 1.6;
}

.summary-panel,
.forecast-panel,
.charts-panel {
  padding-bottom: 24px;
}

.summary-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 0 26px;
}

.summary-card {
  padding: 18px 18px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(25, 46, 63, 0.08);
}

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

.summary-value {
  display: block;
  margin-top: 10px;
  font-family: var(--display-font);
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  line-height: 1;
}

.summary-value-small {
  font-size: clamp(1.2rem, 3vw, 1.65rem);
  line-height: 1.25;
}

.summary-detail {
  display: block;
  margin-top: 12px;
  color: #536473;
  line-height: 1.55;
}

.summary-footnote {
  position: relative;
  z-index: 1;
  margin: 18px 26px 0;
  line-height: 1.6;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 12px;
  padding: 0 26px;
}

.forecast-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(25, 46, 63, 0.08);
}

.forecast-day {
  margin: 0;
  font-weight: 800;
}

.forecast-condition {
  min-height: 44px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.forecast-temp {
  margin-top: 14px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.forecast-temp strong {
  font-size: 2rem;
  line-height: 1;
}

.forecast-temp span {
  color: var(--muted);
}

.forecast-attributes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.weather-attribute {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(246, 242, 235, 0.92);
  border: 1px solid rgba(25, 46, 63, 0.08);
  color: #415462;
  font-size: 0.86rem;
  line-height: 1.35;
}

.weather-attribute strong {
  color: #17212b;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 0 26px;
}

.chart-card {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(25, 46, 63, 0.08);
}

.chart-card h3 {
  margin: 0 0 8px;
  font-size: 0.94rem;
}

.chart-card canvas {
  display: block;
  width: 100%;
  min-height: 205px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 30px;
  padding: 18px 4px 8px;
  border-top: 1px solid rgba(25, 46, 63, 0.08);
}

.site-footer p {
  margin: 0;
  line-height: 1.7;
}

.footer-visit-counter,
.footer-copyright {
  flex: 1 1 100%;
}

.footer-visit-counter strong {
  display: inline-flex;
  align-items: center;
  min-width: 3ch;
  color: var(--accent);
  font-weight: 800;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes weather-pulse {
  0%, 100% { opacity: 0.86; transform: scale(0.82); }
  50% { opacity: 0.14; transform: scale(1.9); }
}

@media (max-width: 1160px) {
  .hero,
  .dashboard {
    grid-template-columns: 1fr;
  }

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

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

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

  .map-canvas {
    min-height: 620px;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(calc(100% - 20px), var(--content-width));
    padding-top: 18px;
  }

  .panel-head,
  .summary-grid,
  .map-frame,
  .forecast-grid,
  .charts-grid {
    margin-left: 18px;
    margin-right: 18px;
  }

  .panel-head {
    padding-left: 0;
    padding-right: 0;
  }

  .panel-head,
  .panel-actions,
  .site-footer,
  .search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .weather-search-actions,
  .status-pill,
  .refresh-button,
  .search-button {
    width: 100%;
    justify-content: center;
  }

  .summary-panel,
  .forecast-panel,
  .charts-panel,
  .map-panel {
    padding-bottom: 18px;
  }

  .summary-grid,
  .forecast-grid,
  .charts-grid {
    padding-left: 0;
    padding-right: 0;
  }

  .forecast-grid,
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .chart-card canvas {
    min-height: 190px;
  }

  .summary-footnote,
  .map-caption {
    margin-left: 18px;
    margin-right: 18px;
  }

  .map-canvas {
    min-height: 520px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0ms !important;
    scroll-behavior: auto !important;
  }
}

.forecast-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.forecast-weather-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(40, 95, 122, 0.1);
  border: 1px solid rgba(25, 46, 63, 0.08);
  font-size: 1.45rem;
  line-height: 1;
}

.major-city-weather-icon {
  background: transparent;
  border: 0;
}

.major-city-weather-badge {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    "icon temp"
    "name name";
  align-items: center;
  justify-content: center;
  gap: 1px 5px;
  min-width: 70px;
  padding: 5px 7px;
  border-radius: 12px;
  background: rgba(255, 252, 247, 0.96);
  border: 1px solid rgba(25, 46, 63, 0.12);
  box-shadow: 0 4px 10px rgba(21, 33, 44, 0.12);
  color: #17212b;
  text-align: center;
  transform: translateY(-2px);
}

.major-city-weather-symbol {
  grid-area: icon;
  font-size: 1rem;
  line-height: 1;
}

.major-city-weather-temp {
  grid-area: temp;
  font-weight: 800;
  font-size: 0.86rem;
  line-height: 1;
}

.major-city-weather-name {
  grid-area: name;
  max-width: 64px;
  overflow: hidden;
  color: #536473;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .major-city-weather-badge {
    grid-template-columns: auto auto;
    min-width: 46px;
    padding: 3px 5px;
    border-radius: 9px;
    gap: 0 3px;
    box-shadow: 0 2px 6px rgba(21, 33, 44, 0.12);
    transform: translateY(-1px);
  }

  .major-city-weather-symbol {
    font-size: 0.78rem;
  }

  .major-city-weather-temp {
    font-size: 0.68rem;
  }

  .major-city-weather-name {
    max-width: 46px;
    font-size: 0.48rem;
    line-height: 1;
  }

  .major-city-weather-badge.is-regional .major-city-weather-name {
    max-width: 52px;
  }
}

@media (max-width: 480px) {
  .major-city-weather-badge {
    min-width: 38px;
    padding: 2px 4px;
    border-radius: 8px;
  }

  .major-city-weather-symbol {
    font-size: 0.66rem;
  }

  .major-city-weather-temp {
    font-size: 0.58rem;
  }

  .major-city-weather-name {
    max-width: 38px;
    font-size: 0.42rem;
  }

  .major-city-weather-badge.is-regional .major-city-weather-name {
    max-width: 42px;
  }
}

.major-city-weather-badge.is-fallback {
  opacity: 0.86;
}

.major-city-weather-badge.is-regional {
  border-color: rgba(40, 95, 122, 0.28);
  background: rgba(255, 253, 249, 0.98);
  box-shadow: 0 5px 12px rgba(21, 33, 44, 0.14);
}

.major-city-weather-badge.is-regional .major-city-weather-name {
  max-width: 88px;
  color: #285f7a;
}

.satellite-panel {
  padding-bottom: 24px;
}

.satellite-frame {
  position: relative;
  margin: 0 26px;
  min-height: 640px;
  overflow: hidden;
  border: 1px solid rgba(25, 46, 63, 0.12);
  border-radius: calc(var(--radius-lg) - 8px);
  background: #d9e2e7;
}

.satellite-map {
  width: 100%;
  min-height: 640px;
  background: #0b1720;
}

.satellite-map .leaflet-control-attribution {
  max-width: min(88vw, 620px);
}

.satellite-caption {
  margin: 16px 26px 0;
  color: var(--muted);
  line-height: 1.6;
}

.satellite-refresh-button {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .satellite-frame,
  .satellite-caption {
    margin-left: 18px;
    margin-right: 18px;
  }

  .satellite-frame,
  .satellite-map {
    min-height: 520px;
  }
}

.legal-panel {
  padding-bottom: 24px;
}

.legal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 26px;
}

.legal-card {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(25, 46, 63, 0.08);
  color: var(--text);
}

.legal-card h3,
.legal-card summary {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
}

.legal-card summary {
  cursor: pointer;
  list-style-position: outside;
}

.legal-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.legal-copy {
  margin-top: 8px;
}

.data-source-card {
  grid-column: 1 / -1;
  background: rgba(31, 103, 143, 0.06);
}

.footer-legal-links {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 8px;
}

.footer-legal-links a {
  font-weight: 700;
  text-decoration: none;
}

.footer-legal-links a:hover,
.footer-legal-links a:focus-visible {
  text-decoration: underline;
}

@media (max-width: 760px) {
  .legal-grid {
    grid-template-columns: 1fr;
    margin-left: 18px;
    margin-right: 18px;
    padding-left: 0;
    padding-right: 0;
  }

  .footer-legal-links {
    flex-direction: column;
  }
}


.legal-page-main {
  max-width: 980px;
  margin: 0 auto;
}

.legal-document {
  padding: 30px;
}

.legal-document h2 {
  margin-top: 0;
}

.legal-document h3 {
  margin: 28px 0 8px;
  font-size: 1.12rem;
}

.legal-document p,
.legal-document li {
  color: var(--muted);
  line-height: 1.75;
}

.legal-document ul {
  margin: 12px 0 0;
  padding-left: 22px;
}

.back-home-link {
  display: inline-flex;
  margin-top: 18px;
  font-weight: 800;
  text-decoration: none;
}

.back-home-link:hover,
.back-home-link:focus-visible {
  text-decoration: underline;
}
