:root {
    --bg: #f4f4f0; /* Warm off-white paper color */
    --panel: #ffffff;
    --border: #000000;
    --text: #000000;
    --muted: #525252;
    --accent: #2563eb; /* Strong utility blue */
    --good: #16a34a;
    --danger: #dc2626;
    --highlight: #fef08a; /* Bright marker yellow for hover states */
    --shadow-color: #000000;
    --font: 'Outfit', system-ui, sans-serif;
    --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;

    /* The signature Neo-Brutalist shadows */
    --hard-shadow: 6px 6px 0px var(--shadow-color);
    --hard-shadow-sm: 4px 4px 0px var(--shadow-color);
    --hard-shadow-hover: 2px 2px 0px var(--shadow-color);

    /* Surface aliases. --card is kept as an alias because feature pages use it. */
    --card: var(--panel);
    --subtle: rgba(0, 0, 0, 0.04);
    --subtle-border: rgba(0, 0, 0, 0.12);

    /* Semantic alert severity ramp, theme-aware */
    --sev-warning: #dc2626;
    --sev-warning-bg: #fee2e2;
    --sev-watch: #b45309;
    --sev-watch-bg: #fef3c7;
    --sev-advisory: #1d4ed8;
    --sev-advisory-bg: #dbeafe;
    --sev-other: #c2410c;
    --sev-other-bg: #ffedd5;
    --on-severity: #ffffff;
}

/* --- DARK MODE OVERRIDES --- */
[data-theme="dark"] {
    --bg: #0a0a0a;       /* Deepest black for the background */
    --panel: #171717;    /* Slightly lighter for cards */
    --border: #333333;   /* Medium grey for borders, NOT white */
    --text: #ededed;
    --muted: #a3a3a3;
    --accent: #3b82f6;
    --good: #4ade80;
    --danger: #f87171;
    --highlight: #262626; /* Deep grey for hover states, not bright blue */
    --shadow-color: #000000; /* Pitch black shadows for subtle, real depth */

    --card: var(--panel);
    --subtle: rgba(255, 255, 255, 0.05);
    --subtle-border: rgba(255, 255, 255, 0.12);

    --sev-warning: #f87171;
    --sev-warning-bg: #3f0d0d;
    --sev-watch: #fbbf24;
    --sev-watch-bg: #3b2506;
    --sev-advisory: #60a5fa;
    --sev-advisory-bg: #10214a;
    --sev-other: #fb923c;
    --sev-other-bg: #3a1e08;
    --on-severity: #0a0a0a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 12px;
    z-index: 100000;
    padding: 10px 14px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 800;
    text-decoration: none;
    border-radius: 8px;
}

.skip-link:focus {
    left: 12px;
}

/* Available to assistive tech only */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

body.radar-lock {
    overflow: hidden;
}

.page {
    width: min(1320px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 50px;
}

/* Header & Nav */
.app-header {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto;
    align-items: center;
    gap: 22px;
    min-height: 96px;
    margin-bottom: 18px;
}

.brand {
    display: flex;
    align-items: center;
    min-width: 0;
}

.logo-link {
    display: inline-flex;
    align-items: center;
    max-width: min(420px, 52vw);
    height: clamp(74px, 8vw, 108px);
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: left center;
    display: block;
}

/* --- LOGO SWITCHING LOGIC --- */
.logo-dark {
    display: none;
}
.logo-light {
    display: block;
}

[data-theme="dark"] .logo-light {
    display: none;
}
[data-theme="dark"] .logo-dark {
    display: block;
}
/* ---------------------------- */

.main-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.main-nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    font-size: 0.95rem;
    padding: 9px 13px;
    border-radius: 8px;
    border: 3px solid transparent;
    transition: 0.1s ease;
    white-space: nowrap;
    text-transform: uppercase;
}

.main-nav a:hover {
    background: var(--highlight);
    border-color: var(--border);
    box-shadow: var(--hard-shadow-sm);
    transform: translate(-2px, -2px);
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #000000;
    background: #bbf7d0;
    border: 3px solid var(--border);
    border-radius: 8px;
    padding: 9px 13px;
    font-weight: 900;
    font-size: 0.8rem;
    white-space: nowrap;
    box-shadow: var(--hard-shadow-sm);
    text-transform: uppercase;
}

/* Fix the Live Data pill to look sleek in dark mode */
[data-theme="dark"] .status {
    background: rgba(34, 197, 94, 0.1);
    color: var(--good);
    border-color: rgba(34, 197, 94, 0.25);
    box-shadow: var(--hard-shadow-sm);
}

[data-theme="dark"] .status .dot {
    background: var(--good);
    border-color: var(--bg);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--good);
    border: 2px solid var(--border);
    animation: pulse 2s infinite;
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--panel);
    border: 3px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 8px 12px;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: var(--hard-shadow-sm);
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    transform: translate(2px, 2px);
    box-shadow: var(--hard-shadow-hover);
    background: var(--highlight);
}

[data-theme="light"] .theme-toggle .icon-light { display: none; }
[data-theme="light"] .theme-toggle .icon-dark { display: block; }

[data-theme="dark"] .theme-toggle .icon-light { display: block; }
[data-theme="dark"] .theme-toggle .icon-dark { display: none; }

/* Unit system toggle (imperial / metric) */
.unit-toggle {
    display: inline-flex;
    border: 3px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--hard-shadow-sm);
    overflow: hidden;
}

.unit-btn {
    padding: 9px 13px;
    background: var(--panel);
    border: none;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 900;
    cursor: pointer;
    transition: background 0.1s ease;
}

.unit-btn + .unit-btn {
    border-left: 3px solid var(--border);
}

.unit-btn:hover {
    background: var(--highlight);
}

.unit-btn[aria-pressed="true"] {
    background: var(--accent);
    color: #ffffff;
}

.unit-btn:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
}

@media (max-width: 720px) {
    .unit-btn {
        padding: 8px 10px;
        font-size: 0.78rem;
    }
}

/* Base Panel Styles */
.search-card,
.card,
.smart-panel,
.forecast-detail,
.archive-section,
.radar-section,
.current-card,
.chart-card,
.archive-year-card,
.selected-nws-card {
    background: var(--panel);
    border: 3px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--hard-shadow);
}

/* Search Area */
.search-card {
    padding: 16px;
    margin-bottom: 16px;
    position: relative;
    z-index: 30;
}

.search-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 800;
    padding: 0 4px 12px;
}

.search-form {
    display: flex;
    gap: 12px;
    position: relative;
}

.search-form input[type="text"] {
    flex: 1;
    border: 3px solid var(--border);
    background: #ffffff;
    color: var(--text);
    border-radius: 8px;
    padding: 16px 18px;
    font-size: 1.05rem;
    font-weight: 600;
    outline: none;
    font-family: var(--font);
    box-shadow: inset 4px 4px 0px rgba(0,0,0,0.05);
}

[data-theme="dark"] .search-form input[type="text"] {
    background: var(--bg);
    box-shadow: inset 4px 4px 0px rgba(0, 0, 0, 0.6);
}

.search-form input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: inset 0px 0px 0px 2px var(--accent), var(--hard-shadow-sm);
}

/* Core Buttons */
.search-form button,
.radar-controls button,
.radar-map-tool-btn,
.suggestion {
    background: var(--accent);
    color: #ffffff;
    border: 3px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--hard-shadow-sm);
    text-transform: uppercase;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

/* Ensure buttons keep their text color readable */
[data-theme="dark"] .search-form button,
[data-theme="dark"] .radar-controls button,
[data-theme="dark"] .radar-map-tool-btn,
[data-theme="dark"] .suggestion {
    color: #ffffff;
}

.search-form button {
    padding: 0 22px;
}

.search-form button:hover,
.radar-controls button:hover,
.radar-map-tool-btn:hover {
    transform: translate(2px, 2px);
    box-shadow: var(--hard-shadow-hover);
}

/* Autocomplete Suggestions */
.suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 116px;
    background: var(--panel);
    border: 3px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--hard-shadow);
    z-index: 100;
}

.suggestion {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    color: var(--text);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
    font-family: var(--font);
}

.suggestion:last-child {
    border-bottom: none;
}

.suggestion:hover,
.suggestion.active {
    background: var(--highlight);
    color: var(--text);
    transform: none;
    box-shadow: none;
}

.suggestion-main {
    font-weight: 800;
}

.suggestion-sub {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
}

/* Alerts */
.error-box {
    border: 3px solid var(--border);
    background: #fecaca;
    color: var(--danger);
    padding: 16px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 800;
    box-shadow: var(--hard-shadow-sm);
}

.alert-top {
    margin-bottom: 16px;
    padding: 18px 20px;
    background: var(--highlight);
    border: 3px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--hard-shadow);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    color: var(--text);
}

[data-theme="dark"] .alert-top:not(.is-warning):not(.is-watch):not(.is-advisory) {
    background: #450a0a;
    border-color: #7f1d1d;
    color: #fecaca;
}

.alert-top:hover {
    transform: translate(2px, 2px);
    box-shadow: var(--hard-shadow-hover);
}

.alert-top-inner {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
}

.alert-pill {
    display: inline-flex;
    border-radius: 4px;
    padding: 5px 11px;
    background: var(--danger);
    border: 2px solid var(--border);
    box-shadow: 2px 2px 0px var(--border);
    color: white;
    font-size: 0.72rem;
    font-weight: 900;
    margin-bottom: 8px;
    text-transform: uppercase;
}

[data-theme="dark"] .alert-pill {
    background: var(--danger);
    border-color: #7f1d1d;
    box-shadow: 2px 2px 0px #000000;
}

.alert-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 900;
    text-transform: uppercase;
}

.alert-copy {
    display: block;
    color: var(--muted);
    margin-top: 4px;
    font-weight: 600;
}

/* The banner is a real button so it is keyboard reachable; strip the UA chrome. */
button.alert-top {
    display: block;
    width: 100%;
    text-align: left;
    font: inherit;
}

/* Author display:block above must not override the hidden attribute, or the
   empty SSR placeholder ("ACTIVE NWS ALERT") shows when there are no alerts. */
button.alert-top[hidden],
.alert-top[hidden] {
    display: none !important;
}

/* Severity tints read from the shared token ramp, so each theme is handled by
   the tokens themselves rather than a parallel set of dark-mode overrides. */
.alert-top.is-warning,
.alert-stack-item.is-warning {
    background: var(--sev-warning-bg);
    border-color: var(--sev-warning);
}

.alert-top.is-watch,
.alert-stack-item.is-watch {
    background: var(--sev-watch-bg);
    border-color: var(--sev-watch);
}

.alert-top.is-advisory,
.alert-stack-item.is-advisory {
    background: var(--sev-advisory-bg);
    border-color: var(--sev-advisory);
}

.alert-top.is-alert,
.alert-stack-item.is-alert {
    background: var(--sev-other-bg);
    border-color: var(--sev-other);
}

.alert-top.is-warning .alert-pill,
.alert-stack-item.is-warning .alert-pill {
    background: var(--sev-warning);
    color: var(--on-severity);
}

.alert-top.is-watch .alert-pill,
.alert-stack-item.is-watch .alert-pill {
    background: var(--sev-watch);
    color: var(--on-severity);
}

.alert-top.is-advisory .alert-pill,
.alert-stack-item.is-advisory .alert-pill {
    background: var(--sev-advisory);
    color: var(--on-severity);
}

.alert-top.is-alert .alert-pill,
.alert-stack-item.is-alert .alert-pill {
    background: var(--sev-other);
    color: var(--on-severity);
}

.alerts-stack {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.alert-stack-item {
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.alert-stack-item:hover {
    transform: translate(2px, 2px);
    box-shadow: var(--hard-shadow-hover);
}

/* Main Grid & Hero Weather */
.main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(390px, 0.95fr);
    gap: 20px;
    align-items: start;
}

.current-card {
    padding: 30px;
    min-height: 430px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 22px;
}

.location {
    color: var(--muted);
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.hero-middle {
    display: grid;
    grid-template-columns: minmax(220px, auto) 1fr;
    align-items: center;
    gap: 28px;
    min-height: 210px;
}

.temp-lockup {
    display: flex;
    align-items: center;
    gap: 22px;
}

.temp {
    font-size: clamp(6.5rem, 11vw, 9.5rem);
    line-height: 0.82;
    font-weight: 900;
    letter-spacing: -0.09em;
    color: var(--text);
}

.icon {
    font-size: clamp(3.4rem, 5vw, 4.8rem);
    line-height: 1;
    filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.15));
}

[data-theme="dark"] .icon {
    filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.8));
}

.condition-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.condition {
    font-size: clamp(2rem, 3vw, 2.8rem);
    font-weight: 900;
    line-height: 1;
    color: var(--text);
}

.summary {
    color: var(--muted);
    margin-top: 12px;
    font-size: 1.08rem;
    line-height: 1.5;
    font-weight: 600;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 11px;
}

/* Interactive Cards (Hero stats, Days, Briefings, Details) */
.day-card, .brief-line, .hero-stat, .detail-box {
    background: var(--panel);
    border: 3px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--hard-shadow-sm);
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.hero-stat {
    padding: 13px 14px;
}

.hero-stat label, .brief-line label, .detail-box label {
    display: block;
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.hero-stat strong {
    display: block;
    font-size: 1.12rem;
    line-height: 1.1;
    font-weight: 900;
}

/* Briefing Panel */
.briefing-card {
    padding: 22px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    margin-bottom: 14px;
}

.section-head h2,
.section-head h3 {
    margin: 0;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.section-head span {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
}

.brief-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 11px;
}

.brief-line {
    padding: 14px;
    cursor: pointer;
    min-height: 86px;
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
    appearance: none;
}

.day-card {
    width: 100%;
    text-align: center;
    cursor: pointer;
    font: inherit;
    color: inherit;
    appearance: none;
}

.day-card:hover, .day-card.selected,
.brief-line:hover, .brief-line.active {
    background: var(--highlight);
    transform: translate(2px, 2px);
    box-shadow: var(--hard-shadow-hover);
    border-color: var(--border);
}

/* Soften the hovered day cards so they don't blast the user with bright colors */
[data-theme="dark"] .day-card:hover,
[data-theme="dark"] .day-card.selected,
[data-theme="dark"] .brief-line:hover,
[data-theme="dark"] .brief-line.active {
    background: #1e293b; /* A subtle slate blue/grey */
    border-color: #334155;
}

.brief-line strong {
    font-size: 0.98rem;
    line-height: 1.25;
    font-weight: 900;
}

.smart-panel {
    margin-top: 14px;
    padding: 18px;
}

.smart-panel h3 {
    margin: 0 0 8px;
    font-size: 1.35rem;
    font-weight: 900;
}

.smart-panel p {
    color: var(--muted);
    line-height: 1.55;
    margin: 0 0 14px;
    font-weight: 600;
    font-size: 1.05rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 11px;
}

.detail-box {
    padding: 12px;
}

.detail-box div {
    font-weight: 900;
    font-size: 1rem;
}

/* Today Grid */
.today-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
    gap: 20px;
    margin-top: 20px;
    align-items: stretch;
}

.today-grid .chart-card,
.today-grid .radar-section {
    margin-top: 0;
    min-height: 100%;
}

.chart-card {
    margin-top: 20px;
    padding: 24px;
}

.chart-area {
    height: 320px;
}

.today-grid .chart-area {
    height: 390px;
}

/* Forecast Section */
.forecast-section {
    margin-top: 20px;
}

.forecast-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 6px 16px;
    scrollbar-width: none;
}

.day-card {
    min-width: 150px;
    flex: 1;
    padding: 16px;
    text-align: center;
    cursor: pointer;
}

.day-name {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
}

.day-icon {
    font-size: 2rem;
    margin: 8px 0;
}

.day-temp {
    font-weight: 900;
    font-size: 1.08rem;
}

.day-rain {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 900;
    margin-top: 5px;
}

.forecast-detail {
    margin-top: 12px;
    padding: 22px;
}

.forecast-detail h3 {
    margin: 0 0 8px;
    font-weight: 900;
    text-transform: uppercase;
}

.forecast-detail p {
    color: var(--muted);
    line-height: 1.55;
    font-weight: 600;
    font-size: 1.05rem;
}

.forecast-detail strong {
    color: var(--text);
}

.selected-nws-box {
    margin-top: 18px;
    display: grid;
    gap: 12px;
}

.selected-nws-card {
    padding: 15px;
}

.selected-nws-card h4 {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 900;
    text-transform: uppercase;
}

.selected-nws-card .nws-meta {
    color: var(--accent);
    font-weight: 900;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.selected-nws-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    font-weight: 500;
}

/* Local Radar */
.radar-section {
    margin-top: 20px;
    padding: 24px;
    position: relative;
    overflow: visible;
}

.radar-section .section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.radar-pro-launch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-radius: 10px;
    border: 3px solid var(--border);
    background: var(--accent);
    color: #ffffff;
    text-decoration: none;
    font-weight: 900;
    white-space: nowrap;
    box-shadow: var(--hard-shadow-sm);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.radar-pro-launch:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--hard-shadow);
}

.radar-section .section-header h2 {
    margin: 0 0 4px;
    font-size: clamp(1.45rem, 2vw, 2rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    text-transform: uppercase;
}

.radar-section .section-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
    font-weight: 600;
}

#radarFullscreenShell {
    width: 100%;
    position: relative;
}

#radarMap {
width: 100%;
height: 420px;
border-radius: 8px;
overflow: hidden;
border: 3px solid var(--border);
background: #e5e5e5;
box-shadow: inset 4px 4px 0px rgba(0,0,0,0.1);
z-index: 1;
}

[data-theme="dark"] #radarMap {
    background: #000000;
    box-shadow: inset 4px 4px 0px rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] #radarMap .leaflet-control-zoom a,
[data-theme="dark"] #radarMap .leaflet-control-attribution {
    background: var(--bg);
}

.today-grid #radarMap {
    height: 330px;
}

#radarMap .leaflet-control-container {
font-family: var(--font);
}

#radarMap .leaflet-control-zoom {
border: 2px solid var(--border);
border-radius: 8px;
overflow: hidden;
box-shadow: 4px 4px 0px var(--border);
}

#radarMap .leaflet-control-zoom a {
background: #ffffff;
color: var(--text);
border-bottom: 2px solid var(--border);
font-weight: 900;
}

#radarMap .leaflet-control-zoom a:hover {
background: var(--highlight);
color: var(--text);
}

#radarMap .leaflet-control-attribution {
background: #ffffff;
color: var(--text);
border-top: 2px solid var(--border);
border-left: 2px solid var(--border);
border-radius: 8px 0 0 0;
font-size: 0.72rem;
font-weight: 800;
padding: 2px 6px;
}

#radarMap .leaflet-control-attribution a {
color: var(--accent);
font-weight: 900;
}

.radar-map-tools {
    display: grid;
    gap: 8px;
}

.radar-map-tool-btn {
    background: #ffffff;
    color: var(--text);
}

[data-theme="dark"] .radar-map-tool-btn {
    background: var(--bg);
    color: var(--text);
}

.radar-controls {
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr) auto;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
    padding: 14px;
    border-radius: 8px;
    background: var(--panel);
    border: 3px solid var(--border);
    box-shadow: var(--hard-shadow-sm);
}

.radar-controls button {
    padding: 10px 18px;
    font-family: var(--font);
    white-space: nowrap;
}

.radar-controls input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
}

#radarTimeLabel {
font-size: 0.95rem;
color: var(--text);
font-weight: 800;
min-width: 150px;
text-align: right;
}

.radar-note {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.45;
    font-weight: 600;
}

.radar-loading {
    position: absolute;
    inset: auto 16px 16px 16px;
    z-index: 500;
    display: grid;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    border: 3px solid var(--border);
    box-shadow: var(--hard-shadow-sm);
}

[data-theme="dark"] .radar-loading {
    background: rgba(23, 23, 23, 0.92);
}

.radar-loading-bar {
    width: 100%;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    border: 2px solid var(--border);
}

.radar-loading-bar span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #0ea5e9);
    transition: width 0.25s ease;
}

#radarLoadingText {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text);
}

.radar-smooth-layer {
    opacity: 0;
    will-change: opacity;
}

.nws-alert-popup .leaflet-popup-content {
    margin: 12px;
    font-family: var(--font, system-ui);
    font-size: 0.9rem;
    color: #000;
}

.nws-alert-popup strong {
    display: block;
    font-size: 1.1rem;
    text-transform: uppercase;
    border-bottom: 2px solid #000;
    margin-bottom: 6px;
    padding-bottom: 4px;
}

.glass-legend {
    display: none;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    color: #f8fafc;
    padding: 14px;
    border-radius: 12px;
    font-family: var(--font, system-ui);
    font-size: 0.8rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    min-width: 160px;
}

.radar-popup-panel .glass-legend {
    display: block;
}

.glass-legend h4 {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    padding-bottom: 4px;
    color: #94a3b8;
}

.legend-alert-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    font-weight: 500;
}

.legend-color-box {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    margin-right: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.legend-tornado { background: #dc2626; }
.legend-storm { background: #facc15; }
.legend-flood { background: #22c55e; }
.legend-winter { background: #3b82f6; }

.legend-divider {
    margin: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.dbz-bar {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #01f702, #00bd01, #ffff00, #d5a000, #ff0000, #a00000, #ff00ff, #e5aaff);
    margin: 8px 0 6px 0;
}

.dbz-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #cbd5e1;
    font-weight: 500;
}

.current-card-top,
.forecast-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.data-badges {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.data-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 2px solid var(--border);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.data-badge-live {
    background: #bbf7d0;
    color: #000000;
}

.data-badge-forecast {
    background: #dbeafe;
    color: #000000;
}

[data-theme="dark"] .data-badge-live {
    background: rgba(34, 197, 94, 0.15);
    color: var(--good);
}

[data-theme="dark"] .data-badge-forecast {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
}

.updated-at,
.forecast-model-note {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.forecast-condition {
    font-size: 1.35rem;
}

.empty-state {
    padding: 34px;
    margin-top: 18px;
}

.empty-state h2 {
    margin-top: 0;
}

.empty-state p {
    line-height: 1.7;
    color: var(--muted);
}

.example-cities {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 18px;
}

.example-cities-label {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 800;
}

.city-chip {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    border: 3px solid var(--border);
    background: var(--panel);
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    box-shadow: var(--hard-shadow-sm);
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.city-chip:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--hard-shadow);
    background: var(--highlight);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin: 10px 0 14px;
}

.footer-links a {
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.82rem;
}

.footer-links a:hover {
    color: var(--accent);
}

.alert-action {
    color: var(--muted);
    font-weight: 800;
}

.brief-line:focus-visible,
.day-card:focus-visible,
.city-chip:focus-visible,
.theme-toggle:focus-visible,
.search-form button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* Radar Popup */
.radar-popup-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    padding: 28px;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
}

.radar-popup-backdrop.open {
    display: grid;
    place-items: center;
}

.radar-popup-panel {
    width: min(1180px, 96vw);
    height: min(760px, 88vh);
    border-radius: 12px;
    overflow: hidden;
    background: var(--panel);
    border: 4px solid var(--border);
    box-shadow: 12px 12px 0px var(--shadow-color);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
}

.radar-popup-panel #radarMap {
    width: 100% !important;
    height: auto !important;
    flex: 1;
    min-height: 0;
    border-radius: 8px;
    border: 3px solid var(--border);
    box-shadow: inset 4px 4px 0px rgba(0,0,0,0.1);
}

.radar-controls-popup {
    width: 100%;
    margin-top: 0;
    background: var(--panel);
    border: 3px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    box-shadow: var(--hard-shadow-sm);
}

/* On This Day / Archive */
.empty-state {
    border: 3px solid var(--border);
    background: var(--panel);
    border-radius: 8px;
    padding: 22px;
    color: var(--muted);
    line-height: 1.5;
    font-weight: 600;
    box-shadow: var(--hard-shadow-sm);
}

#archiveSection.archive-section {
margin-top: 24px;
padding: 28px;
}

.archive-title-row,
#archiveSection .section-title-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin-bottom: 20px;
}

#archiveSection h2 {
margin: 0;
font-size: clamp(1.65rem, 2.4vw, 2.35rem);
font-weight: 900;
letter-spacing: -0.04em;
text-transform: uppercase;
}

#archiveStatus {
color: var(--muted);
font-weight: 800;
font-size: 0.95rem;
text-transform: uppercase;
}

#archiveLoading.archive-loading-card {
display: grid;
grid-template-columns: auto 1fr;
align-items: center;
gap: 24px;
padding: 28px;
border-radius: 8px;
background: var(--panel);
border: 3px solid var(--border);
box-shadow: var(--hard-shadow-sm);
}

.archive-loading-icon {
    font-size: 4.2rem;
    line-height: 1;
}

.archive-loading-card h3 {
    margin: 0 0 8px;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    font-weight: 900;
    letter-spacing: -0.05em;
    text-transform: uppercase;
}

.archive-loading-card p {
    margin: 0;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.5;
    font-weight: 600;
}

#archiveResults.archive-results {
display: grid;
grid-template-columns: repeat(5, minmax(0, 1fr));
gap: 14px;
}

.archive-year-card {
    min-height: 245px;
    padding: 18px;
    display: flex;
    flex-direction: column;
}

.archive-year-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 900;
    margin-bottom: 16px;
    text-transform: uppercase;
}

.archive-year-icon {
    font-size: 2.6rem;
    line-height: 1;
    margin-bottom: 10px;
}

.archive-year-condition {
    font-size: 1.12rem;
    font-weight: 900;
    margin-bottom: 16px;
    min-height: 44px;
    color: var(--text);
}

.archive-year-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: auto;
}

.archive-year-stats div {
    padding: 10px;
    border-radius: 6px;
    background: var(--bg);
    border: 2px solid var(--border);
}

.archive-year-stats span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.archive-year-stats strong {
    display: block;
    font-size: 0.98rem;
    font-weight: 900;
    color: var(--text);
}

.archive-note {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 20px 0 0;
    line-height: 1.55;
    font-weight: 600;
}

/* Footer */
.site-footer {
    margin-top: 34px;
    padding: 18px 0 8px;
    color: var(--muted);
    text-align: center;
    font-size: 0.82rem;
    line-height: 1.55;
    font-weight: 600;
}

.footer-inner {
    max-width: 980px;
    margin: 0 auto;
    padding-top: 18px;
    border-top: 3px solid var(--border);
}

.footer-brand-line {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.footer-brand-line strong {
    color: var(--text);
    font-weight: 900;
    text-transform: uppercase;
}

.footer-brand-line span {
    color: var(--muted);
}

.footer-meta {
    color: var(--muted);
    margin-bottom: 6px;
}

.footer-company {
    color: var(--muted);
    font-size: 0.78rem;
    opacity: 0.8;
}

/* Modal */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    padding: 18px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    overflow-y: auto;
}

.modal-backdrop.open {
    display: grid;
    place-items: center;
}

.modal {
    width: min(760px, 100%);
    background: var(--panel);
    border: 4px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 12px 12px 0px var(--shadow-color);
}

.modal-top {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 12px;
    align-items: center;
}

.modal h2 {
    margin: 0;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--text);
}

.modal-content {
    color: var(--text);
    line-height: 1.6;
    font-weight: 500;
    font-size: 1.05rem;
}

.close-modal {
    width: 42px;
    height: 42px;
    border: 3px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: var(--hard-shadow-sm);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    display: grid;
    place-items: center;
}

.close-modal:hover {
    background: var(--highlight);
    transform: translate(2px, 2px);
    box-shadow: var(--hard-shadow-hover);
}

::-webkit-scrollbar {
    display: none;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.15); }
    100% { opacity: 1; transform: scale(1); }
}

/* Media Queries */
@media (max-width: 1180px) {
    #archiveResults.archive-results {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .today-grid {
        grid-template-columns: minmax(0, 1fr) minmax(330px, 0.75fr);
    }
}

@media (max-width: 1020px) {
    .app-header {
        grid-template-columns: 1fr;
        justify-items: start;
        min-height: unset;
    }
    .main-nav {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .logo-link {
        max-width: min(360px, 82vw);
        height: 88px;
    }
    .main-grid,
    .today-grid {
        grid-template-columns: 1fr;
    }
    .today-grid #radarMap {
        height: 420px;
    }
    .today-grid .chart-area {
        height: 320px;
    }
}

@media (max-width: 780px) {
    #archiveResults.archive-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .hero-middle {
        grid-template-columns: 1fr;
        gap: 8px;
        min-height: auto;
    }
    .temp-lockup {
        justify-content: flex-start;
    }
    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .radar-controls {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .radar-controls-popup {
        grid-template-columns: 1fr;
    }
    #radarTimeLabel {
    text-align: left;
    min-width: 0;
    }
    #radarMap,
    .today-grid #radarMap {
        height: 400px;
    }
    .radar-popup-backdrop {
        padding: 10px;
    }
    .radar-popup-panel {
        width: 100%;
        height: 86vh;
        border-radius: 12px;
        padding: 10px;
    }
}

@media (max-width: 640px) {
    .page {
        width: min(100% - 20px, 1320px);
        padding-top: 18px;
    }
    .logo-link {
        max-width: 84vw;
        height: 72px;
    }
    .search-title,
    .search-form,
    .alert-top-inner {
        flex-direction: column;
        align-items: stretch;
    }
    .current-card {
        padding: 28px;
        min-height: unset;
    }
    .temp {
        font-size: clamp(5.4rem, 22vw, 7rem);
    }
    .search-form button {
        padding: 15px;
    }
    .suggestions {
        right: 0;
    }
    .brief-buttons,
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .radar-section {
        padding: 18px;
        border-radius: 12px;
    }
    #radarMap,
    .today-grid #radarMap {
        height: 370px;
    }
    .radar-section .section-header {
        flex-direction: column;
    }
    .footer-brand-line {
        flex-direction: column;
        gap: 2px;
    }
    .footer-meta {
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
    }
    #archiveSection.archive-section {
    padding: 20px;
    }
    .archive-title-row,
    #archiveSection .section-title-row {
    align-items: flex-start;
    flex-direction: column;
    }
    #archiveLoading.archive-loading-card,
    #archiveResults.archive-results {
    grid-template-columns: 1fr;
    }
}
