/*
 * Modern NWS Weather Display (CLR-NWS) — front-end styles.
 * Extracted verbatim from 6.0.0's inline get_modern_styles(). The two
 * colour variables below are defaults; each site's header colour is printed
 * as a small inline :root override (see CLR_NWS_Shortcodes::enqueue_assets).
 */
:root {
    --weather-primary: #6366f1;
    --weather-secondary: #8e63f1;
    --weather-accent: #06b6d4;
    --weather-gradient: linear-gradient(135deg, var(--weather-primary) 0%, var(--weather-secondary) 100%);
    --weather-surface: #ffffff;
    --weather-surface-alt: #f8fafc;
    --weather-text: #1e293b;
    --weather-text-muted: #64748b;
    --weather-border: #e2e8f0;
    --weather-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --weather-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --weather-radius: 16px;
    --weather-radius-sm: 8px;
}

/* ========== Text Size Variants ========== */

.weather-size-small {
    --weather-font-size-xs: 0.875rem;
    --weather-font-size-sm: 1rem;
    --weather-font-size-base: 1.125rem;
    --weather-font-size-lg: 1.25rem;
    --weather-font-size-xl: 1.5rem;
    --weather-font-size-2xl: 1.875rem;
    --weather-font-size-3xl: 2.25rem;
    --weather-icon-size: 2rem;
    --weather-icon-size-lg: 2.5rem;
}

.weather-size-medium {
    --weather-font-size-xs: 1rem;
    --weather-font-size-sm: 1.125rem;
    --weather-font-size-base: 1.25rem;
    --weather-font-size-lg: 1.5rem;
    --weather-font-size-xl: 1.875rem;
    --weather-font-size-2xl: 2.25rem;
    --weather-font-size-3xl: 2.75rem;
    --weather-icon-size: 2.5rem;
    --weather-icon-size-lg: 3rem;
}

.weather-size-large {
    --weather-font-size-xs: 1.125rem;
    --weather-font-size-sm: 1.25rem;
    --weather-font-size-base: 1.5rem;
    --weather-font-size-lg: 1.875rem;
    --weather-font-size-xl: 2.25rem;
    --weather-font-size-2xl: 2.75rem;
    --weather-font-size-3xl: 3.25rem;
    --weather-icon-size: 3rem;
    --weather-icon-size-lg: 3.5rem;
}

.weather-size-xlarge {
    --weather-font-size-xs: 1.25rem;
    --weather-font-size-sm: 1.5rem;
    --weather-font-size-base: 1.875rem;
    --weather-font-size-lg: 2.25rem;
    --weather-font-size-xl: 2.75rem;
    --weather-font-size-2xl: 3.25rem;
    --weather-font-size-3xl: 4rem;
    --weather-icon-size: 3.5rem;
    --weather-icon-size-lg: 4.5rem;
}

/* Default to medium if no size class */
.modern-weather-widget:not([class*="weather-size-"]) {
    --weather-font-size-xs: 1rem;
    --weather-font-size-sm: 1.125rem;
    --weather-font-size-base: 1.25rem;
    --weather-font-size-lg: 1.5rem;
    --weather-font-size-xl: 1.875rem;
    --weather-font-size-2xl: 2.25rem;
    --weather-font-size-3xl: 2.75rem;
    --weather-icon-size: 2.5rem;
    --weather-icon-size-lg: 3rem;
}

.modern-weather-widget,
.modern-weather-widget *,
.precipitation-widget,
.precipitation-widget * {
    box-sizing: border-box;
}

.modern-weather-widget {
    background: var(--weather-surface);
    border-radius: var(--weather-radius);
    box-shadow: var(--weather-shadow);
    margin: 2rem 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-size: var(--weather-font-size-base);
    max-width: 100%;
}

.modern-weather-widget:hover {
    box-shadow: var(--weather-shadow-lg);
    transform: translateY(-2px);
}

.weather-header-modern {
    background: var(--weather-gradient);
    color: white;
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.weather-header-modern::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width=\"60\" height=\"60\" viewBox=\"0 0 60 60\" xmlns=\"http://www.w3.org/2000/svg\"%3E%3Cg fill=\"none\" fill-rule=\"evenodd\"%3E%3Cg fill=\"%23ffffff\" fill-opacity=\"0.05\"%3E%3Ccircle cx=\"30\" cy=\"30\" r=\"2\"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    opacity: 0.3;
}

.weather-location {
    font-size: var(--weather-font-size-2xl);
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.weather-updated {
    font-size: var(--weather-font-size-sm);
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.weather-alerts-modern {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #92400e;
    padding: 1rem 1.5rem;
    margin: 0;
    border-left: 4px solid #d97706;
    font-weight: 500;
    position: relative;
    animation: pulse 2s infinite;
    font-size: var(--weather-font-size-base);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* ========== Precipitation Widget Styles ========== */

.precipitation-widget {
    /* Full width like the main weather widget */
}

.precip-header {
    /* Uses the same gradient as main weather widget from --weather-gradient */
}

.precip-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
}

.precip-stat-card {
    background: var(--weather-surface-alt);
    border-radius: var(--weather-radius-sm);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all 0.3s ease;
    border: 1px solid var(--weather-border);
}

.precip-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.precip-stat-icon {
    font-size: var(--weather-icon-size-lg);
    line-height: 1;
}

.precip-stat-content {
    flex: 1;
}

.precip-stat-label {
    font-size: var(--weather-font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--weather-text-muted);
    margin-bottom: 0.25rem;
}

.precip-stat-value {
    font-size: var(--weather-font-size-xl);
    font-weight: 700;
    color: var(--weather-text);
}

.precip-stat-value.snow-value {
    color: #3b82f6;
}

.precip-stat-value.rain-value {
    color: #06b6d4;
}

.precip-stat-detail {
    font-size: var(--weather-font-size-sm);
    color: var(--weather-text-muted);
    margin-top: 0.25rem;
}

.comparison-higher {
    color: #059669;
}

.comparison-lower {
    color: #dc2626;
}

.comparison-same {
    color: var(--weather-text-muted);
}

/* ========== On This Day Section ========== */

.on-this-day-section {
    border-top: 1px solid var(--weather-border);
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--weather-surface-alt) 0%, var(--weather-surface) 100%);
}

.on-this-day-header {
    margin-bottom: 1rem;
}

.on-this-day-header h3 {
    font-size: var(--weather-font-size-lg);
    font-weight: 700;
    color: var(--weather-text);
    margin: 0;
}

.on-this-day-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.on-this-day-card {
    background: var(--weather-surface);
    border-radius: var(--weather-radius-sm);
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border-left: 4px solid var(--weather-primary);
}

.on-this-day-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.otd-year {
    font-size: var(--weather-font-size-2xl);
    font-weight: 800;
    color: var(--weather-primary);
    line-height: 1;
}

.otd-years-ago {
    font-size: var(--weather-font-size-xs);
    color: var(--weather-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.otd-weather {
    margin-top: 0.75rem;
}

.otd-precip {
    font-size: var(--weather-font-size-lg);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.otd-precip.snow {
    color: #3b82f6;
}

.otd-precip.rain {
    color: #06b6d4;
}

.otd-precip.none {
    color: var(--weather-text-muted);
    font-size: var(--weather-font-size-base);
}

.otd-temp {
    font-size: var(--weather-font-size-base);
    margin-bottom: 0.5rem;
}

.otd-temp .temp-high {
    color: #dc2626;
    font-weight: 600;
}

.otd-temp .temp-low {
    color: #2563eb;
    font-weight: 600;
}

.otd-conditions {
    font-size: var(--weather-font-size-sm);
    color: var(--weather-text-muted);
}

.on-this-day-insights {
    margin-top: 1.25rem;
    padding: 1.25rem;
    background: var(--weather-surface);
    border-radius: var(--weather-radius-sm);
    border-left: 4px solid var(--weather-secondary);
}

.insight-item {
    font-size: var(--weather-font-size-base);
    color: var(--weather-text);
    line-height: 1.5;
}

.insight-item.secondary {
    font-size: var(--weather-font-size-sm);
    color: var(--weather-text-muted);
    margin-top: 0.5rem;
}

/* Daily breakdown table */
.precip-daily-breakdown {
    border-top: 1px solid var(--weather-border);
}

.precip-breakdown-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    font-size: var(--weather-font-size-base);
    color: var(--weather-text);
    background: var(--weather-surface-alt);
    transition: background 0.2s ease;
}

.precip-breakdown-header:hover {
    background: var(--weather-border);
}

.precip-breakdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.precip-breakdown-content.expanded {
    max-height: 3000px;
}

/* Daily breakdown with expandable hourly */
.precip-days-list {
    padding: 0;
}

.precip-day-row {
    border-bottom: 1px solid var(--weather-border);
}

.precip-day-row:last-child {
    border-bottom: none;
}

/* When hourly is expanded, add visual separation */
.precip-day-row:has(.precip-hourly-content.expanded) {
    background: var(--weather-surface-alt);
    margin-bottom: 0.5rem;
    border-radius: var(--weather-radius-sm);
    border: 1px solid var(--weather-border);
}

.precip-day-header-row .precip-day-header {
    background: var(--weather-surface-alt);
    font-weight: 600;
    font-size: var(--weather-font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--weather-text-muted);
    cursor: default;
}

.precip-day-header-row .precip-day-header:hover {
    background: var(--weather-surface-alt);
}

.precip-day-header {
    display: grid;
    grid-template-columns: 100px 1fr 60px 60px 80px 30px;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    align-items: center;
    font-size: var(--weather-font-size-sm);
    color: var(--weather-text);
    transition: background 0.2s ease;
}

.precip-day-header.expandable {
    cursor: pointer;
}

.precip-day-header.expandable:hover {
    background: var(--weather-surface-alt);
}

.precip-day-date {
    font-weight: 600;
    white-space: nowrap;
}

.precip-day-conditions {
    color: var(--weather-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.precip-day-precip,
.precip-day-snow {
    text-align: center;
}

.precip-day-temp {
    text-align: right;
    white-space: nowrap;
}

.precip-day-temp .temp-high {
    color: #dc2626;
    font-weight: 600;
}

.precip-day-temp .temp-low {
    color: #2563eb;
    font-weight: 600;
}

.precip-day-temp .temp-low::before {
    content: "/";
    color: var(--weather-text-muted);
    margin: 0 0.125rem;
}

.precip-day-expand {
    text-align: center;
    color: var(--weather-text-muted);
}

.hourly-expand-icon {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

/* Hourly data section */
.precip-hourly-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--weather-surface-alt);
}

.precip-hourly-content.expanded {
    max-height: 600px;
    overflow-y: auto;
}

.hourly-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
    padding: 1rem;
}

.hourly-item {
    background: var(--weather-surface);
    border-radius: var(--weather-radius-sm);
    padding: 0.625rem;
    text-align: center;
    font-size: var(--weather-font-size-xs);
    border: 1px solid var(--weather-border);
    transition: all 0.2s ease;
}

.hourly-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.hourly-item.has-snow {
    border-color: #3b82f6;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, var(--weather-surface) 100%);
}

.hourly-item.has-rain {
    border-color: #06b6d4;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, var(--weather-surface) 100%);
}

.hourly-time {
    font-weight: 600;
    color: var(--weather-text);
    margin-bottom: 0.25rem;
}

.hourly-temp {
    font-size: var(--weather-font-size-lg);
    font-weight: 700;
    color: var(--weather-text);
}

.hourly-precip {
    margin-top: 0.25rem;
    color: var(--weather-text-muted);
}

.hourly-precip.snow {
    color: #3b82f6;
    font-weight: 600;
}

.hourly-precip.rain {
    color: #06b6d4;
    font-weight: 600;
}

.hourly-conditions {
    margin-top: 0.25rem;
    color: var(--weather-text-muted);
    font-size: 0.65rem;
    line-height: 1.2;
}

.precip-attribution,
.forecast-attribution {
    padding: 0.75rem 1.5rem;
    font-size: var(--weather-font-size-xs);
    color: var(--weather-text-muted);
    text-align: center;
    border-top: 1px solid var(--weather-border);
}

.precip-attribution a,
.forecast-attribution a {
    color: var(--weather-primary);
    text-decoration: none;
}

.precip-attribution a:hover,
.forecast-attribution a:hover {
    text-decoration: underline;
}

/* ========== Original Weather Widget Styles ========== */

.weather-forecast-grid {
    display: grid;
    gap: 0;
}

.weather-day-card {
    border-bottom: 1px solid var(--weather-border);
    transition: all 0.3s ease;
    position: relative;
}

.weather-day-card:last-child {
    border-bottom: none;
}

.weather-day-header {
    padding: 1.5rem 2rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--weather-surface);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.weather-day-header:hover {
    background: var(--weather-surface-alt);
    transform: translateX(4px);
}

.weather-day-header::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--weather-gradient);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.weather-day-header:hover::before {
    transform: scaleY(1);
}

.weather-day-info h3 {
    font-size: var(--weather-font-size-lg);
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    color: var(--weather-text);
}

/* Show full day names on desktop, short on mobile */
.weather-day-info h3 .day-short {
    display: none;
}

.weather-day-info h3 .day-full {
    display: inline;
}

.weather-day-date {
    font-size: var(--weather-font-size-sm);
    color: var(--weather-text-muted);
    margin: 0;
}

.weather-day-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.weather-icon-modern {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--weather-surface-alt);
    padding: 8px;
    transition: transform 0.3s ease;
}

.weather-day-header:hover .weather-icon-modern {
    transform: scale(1.1) rotate(5deg);
}

.weather-temps {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.temp-high {
    font-size: var(--weather-font-size-xl);
    font-weight: 700;
    color: #dc2626;
}

.temp-low {
    font-size: var(--weather-font-size-lg);
    font-weight: 500;
    color: #2563eb;
    margin-top: 0.25rem;
}

.weather-expand-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--weather-surface-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: 1rem;
}

.weather-expand-icon svg {
    width: 16px;
    height: 16px;
    color: var(--weather-text-muted);
    transition: transform 0.3s ease;
}

.weather-day-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
}

.weather-day-content.expanded {
    max-height: 800px;
}

.weather-day-content.expanded .weather-expand-icon svg {
    transform: rotate(180deg);
}

.weather-periods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
}

.weather-period-card {
    background: white;
    border-radius: var(--weather-radius-sm);
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.weather-period-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--weather-gradient);
}

.weather-period-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -4px rgba(0, 0, 0, 0.15);
}

.period-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.period-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--weather-radius-sm);
    background: var(--weather-surface-alt);
    padding: 8px;
}

.period-title {
    font-size: var(--weather-font-size-xl);
    font-weight: 600;
    color: var(--weather-text);
    margin: 0;
}

.period-temp {
    font-size: var(--weather-font-size-3xl);
    font-weight: 700;
    background: var(--weather-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.period-summary {
    font-size: var(--weather-font-size-base);
    color: var(--weather-text);
    font-weight: 500;
    margin: 0.5rem 0;
}

.period-details {
    font-size: var(--weather-font-size-sm);
    color: var(--weather-text-muted);
    line-height: 1.6;
    margin: 0;
}

.weather-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    flex-direction: column;
    gap: 1rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--weather-border);
    border-top: 3px solid var(--weather-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.weather-error-modern {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-left: 4px solid #dc2626;
    color: #991b1b;
    padding: 1.5rem;
    margin: 1rem;
    border-radius: var(--weather-radius-sm);
    font-weight: 500;
}

/* Tablet styles (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Prevent horizontal overflow on tablets */
    .modern-weather-widget,
    .precipitation-widget {
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    /* Force 2x2 grid for precipitation stat cards on tablets */
    .precip-summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 1.25rem;
    }

    .precip-stat-card {
        padding: 1rem;
    }

    .precip-stat-icon {
        font-size: 1.5rem;
    }

    .precip-stat-value {
        font-size: var(--weather-font-size-lg);
    }

    .precip-stat-label {
        font-size: 0.65rem;
    }

    .precip-stat-detail {
        font-size: var(--weather-font-size-xs);
    }

    /* Fix forecast period cards on tablets */
    .weather-periods-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }

    .weather-period-card {
        padding: 1.25rem;
    }

    .period-header {
        min-height: 70px;
        gap: 1rem;
    }

    .period-temp {
        font-size: var(--weather-font-size-2xl);
        line-height: 1.3;
        min-height: 1.5em;
    }

    .period-icon {
        width: 60px;
        height: 60px;
    }

    /* Ensure expanded content has enough space */
    .weather-day-content.expanded {
        max-height: none;
        padding: 1rem;
    }

    /* Prevent day rows from overflowing */
    .weather-day-card {
        max-width: 100%;
        overflow: hidden;
    }

    .weather-day-header {
        padding: 1.25rem 1rem;
    }

    .weather-day-header:hover {
        transform: none;
    }
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    /* Prevent horizontal overflow on mobile */
    .modern-weather-widget,
    .precipitation-widget {
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .weather-header-modern {
        padding: 1.5rem 1rem;
    }

    .weather-header-modern .weather-location {
        font-size: var(--weather-font-size-xl);
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }
    
    .weather-header-modern .weather-updated {
        font-size: var(--weather-font-size-sm);
    }
    
    .weather-day-card {
        max-width: 100%;
        overflow: hidden;
    }
    
    .weather-day-header {
        padding: 1rem;
        max-width: 100%;
    }

    .weather-day-header:hover {
        transform: none;
    }
    
    .weather-day-summary {
        gap: 0.5rem;
        flex-shrink: 0;
    }

    .weather-day-info {
        flex: 1;
        min-width: 0;
    }
    
    .weather-day-info h3 {
        font-size: var(--weather-font-size-sm);
    }

    /* Show short day names on mobile */
    .weather-day-info h3 .day-full {
        display: none;
    }

    .weather-day-info h3 .day-short {
        display: inline;
    }

    .weather-day-date {
        font-size: var(--weather-font-size-xs);
    }

    .weather-temps {
        gap: 0.5rem;
    }

    .weather-temps .temp-high {
        font-size: var(--weather-font-size-lg);
    }

    .weather-temps .temp-low {
        font-size: var(--weather-font-size-base);
        margin-top: 0.25rem;
    }
    
    .weather-icon-modern {
        width: 44px;
        height: 44px;
    }
    
    .weather-periods-grid {
        grid-template-columns: 1fr;
        padding: 0.75rem;
        gap: 1rem;
    }
    
    .weather-period-card {
        padding: 1rem;
        max-width: 100%;
        overflow: hidden;
    }

    .weather-period-card:hover {
        transform: none;
    }

    /* Fix period header overflow on mobile */
    .period-header {
        min-height: 50px;
        gap: 0.75rem;
        flex-wrap: wrap;
        max-width: 100%;
    }

    .period-icon {
        width: 50px;
        height: 50px;
        flex-shrink: 0;
    }

    .period-title {
        font-size: var(--weather-font-size-base);
    }

    .period-temp {
        font-size: var(--weather-font-size-xl);
        line-height: 1.2;
    }

    /* Ensure expanded content does not overlap */
    .weather-day-content.expanded {
        max-height: none;
        padding-bottom: 1rem;
    }

    /* Precipitation header spacing on mobile */
    .precip-header {
        padding: 1.5rem 1rem;
    }

    .precip-header .weather-location {
        font-size: var(--weather-font-size-lg);
        margin-bottom: 0.5rem;
    }

    .precip-header .weather-updated {
        font-size: var(--weather-font-size-sm);
    }

    /* Stack stat cards in single column on mobile */
    .precip-summary-grid {
        grid-template-columns: 1fr;
        padding: 0.75rem;
        gap: 0.75rem;
        max-width: 100%;
    }

    .precip-stat-card {
        padding: 1rem;
        flex-direction: row;
        align-items: center;
        max-width: 100%;
        overflow: hidden;
    }

    .precip-stat-icon {
        font-size: 1.25rem;
        min-width: 2rem;
        flex-shrink: 0;
    }

    .precip-stat-content {
        min-width: 0;
        overflow: hidden;
    }

    .precip-stat-label {
        font-size: var(--weather-font-size-xs);
    }

    .precip-stat-value {
        font-size: var(--weather-font-size-base);
    }

    .precip-stat-detail {
        font-size: var(--weather-font-size-xs);
    }

    /* Mobile daily breakdown improvements */
    .precip-day-header {
        display: flex;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.75rem;
        font-size: var(--weather-font-size-xs);
    }

    .precip-day-date {
        flex: 1;
        min-width: 40px;
    }

    /* Hide conditions column on mobile */
    .precip-day-conditions {
        display: none !important;
    }

    .precip-day-precip,
    .precip-day-snow {
        flex: 1;
        min-width: 45px;
        text-align: center;
    }

    .precip-day-temp {
        flex: 1.2;
        min-width: 55px;
        text-align: right;
    }

    .precip-day-expand {
        flex: 0 0 20px;
        text-align: center;
    }

    /* Use short date format on mobile via CSS content replacement */
    .precip-day-date {
        font-size: 0;
    }

    .precip-day-date::after {
        content: attr(data-short);
        font-size: var(--weather-font-size-xs);
    }
    
    /* Keep header row date visible */
    .precip-day-header-row .precip-day-date {
        font-size: var(--weather-font-size-xs);
    }
    
    .precip-day-header-row .precip-day-date::after {
        content: none;
    }

    .precip-day-temp .temp-high,
    .precip-day-temp .temp-low {
        font-size: var(--weather-font-size-xs);
    }

    .precip-breakdown-header {
        padding: 1rem;
        font-size: var(--weather-font-size-base);
    }

    .precip-breakdown-content.expanded {
        max-height: 4000px;
    }

    /* Mobile hourly section - ensure it does not overlap */
    .precip-hourly-content {
        margin: 0.5rem 0;
        border-radius: var(--weather-radius-sm);
    }

    .precip-hourly-content.expanded {
        max-height: 500px;
        padding: 0.5rem 0;
    }

    /* Mobile hourly grid */
    .hourly-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
        padding: 1rem;
    }

    .hourly-item {
        padding: 0.5rem 0.25rem;
    }

    .hourly-time {
        font-size: 0.65rem;
    }

    .hourly-temp {
        font-size: var(--weather-font-size-base);
    }

    .hourly-precip {
        font-size: 0.65rem;
    }

    .hourly-conditions {
        display: none;
    }

    /* On This Day mobile styles */
    .on-this-day-section {
        padding: 1.25rem 1rem;
    }

    .on-this-day-header h3 {
        font-size: var(--weather-font-size-base);
    }

    .on-this-day-grid {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }

    .on-this-day-card {
        padding: 1.25rem;
    }

    .otd-year {
        font-size: var(--weather-font-size-xl);
    }

    .otd-years-ago {
        font-size: var(--weather-font-size-xs);
    }

    .otd-precip {
        font-size: var(--weather-font-size-base);
    }

    .otd-temp {
        font-size: var(--weather-font-size-sm);
    }

    .otd-conditions {
        font-size: var(--weather-font-size-xs);
    }

    .on-this-day-insights {
        padding: 1rem;
        margin-top: 1rem;
    }

    .insight-item {
        font-size: var(--weather-font-size-sm);
    }

    .insight-item.secondary {
        font-size: var(--weather-font-size-xs);
    }

    .precip-attribution {
        font-size: var(--weather-font-size-xs);
        padding: 0.75rem 1rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --weather-surface: #1e293b;
        --weather-surface-alt: #334155;
        --weather-text: #f1f5f9;
        --weather-text-muted: #94a3b8;
        --weather-border: #475569;
    }
    
    .weather-day-content {
        background: linear-gradient(135deg, #334155 0%, #475569 100%);
    }
    
    .weather-period-card {
        background: var(--weather-surface);
    }

    .on-this-day-section {
        background: linear-gradient(135deg, #1e3a5f 0%, #1e293b 100%);
    }

    .on-this-day-card {
        background: var(--weather-surface-alt);
    }

    .on-this-day-insights {
        background: var(--weather-surface-alt);
    }
}

/* Animation for initial load */
.modern-weather-widget {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================================
   [nws_forecast] — Day card grid styles
   Scoped to .nws-forecast-block so nothing bleeds into the theme.
   ========================================================================= */

.nws-forecast-block {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.nws-forecast-block * {
    box-sizing: border-box;
}

/* Alert banner */
.nws-alert {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.4;
}
.nws-alert--extreme,
.nws-alert--severe   { background: #fde8e8; color: #b91c1c; border-left: 4px solid #dc2626; }
.nws-alert--moderate { background: #fef3c7; color: #92400e; border-left: 4px solid #f59e0b; }
.nws-alert--minor,
.nws-alert--unknown  { background: #e0f2fe; color: #0369a1; border-left: 4px solid #0284c7; }
.nws-alert__icon     { flex-shrink: 0; }

/* Day card grid */
.nws-forecast-grid {
    display: grid;
    gap: .85rem;
    grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 600px) {
    .nws-forecast-grid[data-columns="2"] { grid-template-columns: repeat(2, 1fr); }
    .nws-forecast-grid[data-columns="3"] { grid-template-columns: repeat(3, 1fr); }
}

/* Individual day card */
.nws-day-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: .85rem .75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: .35rem;
}
.nws-day-card--today {
    border-color: var(--weather-primary, #6366f1);
    box-shadow: 0 0 0 1px var(--weather-primary, #6366f1);
}
.nws-day-card__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.nws-day-card__label {
    font-weight: 700;
    font-size: .9rem;
    line-height: 1.2;
}
.nws-day-card__date {
    font-size: .75rem;
    color: #6b7280;
}
.nws-day-card__icon-wrap { line-height: 0; }
.nws-day-card__icon {
    width: 56px;
    height: 56px;
    object-fit: contain;
}
.nws-day-card__temps {
    display: flex;
    gap: .6rem;
    align-items: baseline;
    justify-content: center;
}
.nws-day-card__high {
    font-size: 1.2rem;
    font-weight: 800;
    color: #111;
}
.nws-day-card__low {
    font-size: .95rem;
    font-weight: 500;
    color: #6b7280;
}
.nws-day-card__short {
    font-size: .78rem;
    color: #374151;
    margin: 0;
    line-height: 1.3;
}
.nws-day-card__meta {
    display: flex;
    gap: .5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: .1rem;
}
.nws-day-card__wind,
.nws-day-card__precip {
    font-size: .72rem;
    color: #6b7280;
}
.nws-day-card__detail {
    font-size: .72rem;
    color: #6b7280;
    line-height: 1.4;
    margin: .2rem 0 0;
    text-align: left;
}

/* Footer */
.nws-forecast-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .85rem;
    font-size: .72rem;
    color: #9ca3af;
}
.nws-forecast-attribution a {
    color: inherit;
    text-decoration: underline;
}
.nws-forecast-more {
    font-size: .8rem;
    font-weight: 600;
    color: var(--weather-primary, #6366f1);
    text-decoration: none;
    white-space: nowrap;
}
.nws-forecast-more:hover { text-decoration: underline; }

.nws-forecast-error {
    padding: .75rem 1rem;
    background: #fde8e8;
    border-left: 4px solid #dc2626;
    color: #b91c1c;
    border-radius: 4px;
    font-size: .875rem;
}
