:root {
    --wx-bg-1: #0b0f1a;
    --wx-bg-2: #10182b;
    --wx-card-bg: rgba(255, 255, 255, 0.04);
    --wx-card-border: rgba(255, 255, 255, 0.08);
    --wx-text: #eef2ff;
    --wx-text-dim: #8b93ab;
    --wx-accent: #5b8cff;
    --wx-accent-2: #ff8a5b;
    --wx-live: #38d996;
    --wx-stale: #ff5b6e;
    --wx-radius: 20px;
    --wx-overlay-1: rgba(11,15,26,0.82);
    --wx-overlay-2: rgba(16,24,43,0.88);
    --wx-blob-1: rgba(91,140,255,0.28);
    --wx-blob-2: rgba(255,138,91,0.20);
    --wx-blob-3: rgba(56,217,150,0.14);
    --wx-blob-4: rgba(91,140,255,0.16);
    --wx-subnav-bg: rgba(11, 15, 26, 0.7);
}

[data-theme="light"] {
    --wx-bg-1: #eef1f7;
    --wx-bg-2: #f7f9fc;
    --wx-card-bg: rgba(255, 255, 255, 0.55);
    --wx-card-border: rgba(20, 30, 50, 0.10);
    --wx-text: #1a2033;
    --wx-text-dim: #5b6272;
    --wx-accent: #3861d6;
    --wx-accent-2: #d9660c;
    --wx-live: #17a06a;
    --wx-stale: #d6304a;
    --wx-overlay-1: rgba(255,255,255,0.80);
    --wx-overlay-2: rgba(238,241,247,0.88);
    --wx-blob-1: rgba(56,97,214,0.14);
    --wx-blob-2: rgba(217,102,12,0.12);
    --wx-blob-3: rgba(23,160,106,0.10);
    --wx-blob-4: rgba(56,97,214,0.10);
    --wx-subnav-bg: rgba(255, 255, 255, 0.7);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--wx-text);
    background:
        radial-gradient(circle at 15% -10%, var(--wx-blob-1), transparent 40%),
        radial-gradient(circle at 90% 8%, var(--wx-blob-2), transparent 38%),
        radial-gradient(circle at 30% 60%, var(--wx-blob-3), transparent 42%),
        radial-gradient(circle at 85% 75%, var(--wx-blob-4), transparent 40%),
        linear-gradient(180deg, var(--wx-overlay-1), var(--wx-overlay-2)),
        url('/img/background.jpg');
    background-size: auto, auto, auto, auto, auto, cover;
    background-position: center, center, center, center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
    background-attachment: fixed; /* Bild + Blobs bleiben beim Scrollen hinter dem Glas stehen */
    transition: color 0.2s ease;
}

/* ---------- Header ---------- */
.wx-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
}

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

.wx-logo {
    height: 32px;
    width: auto;
    display: block;
}

.wx-station-name {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

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

.wx-about-btn {
    background: var(--wx-card-bg);
    border: 1px solid var(--wx-card-border);
    color: var(--wx-text-dim);
    font-size: 0.85rem;
    padding: 7px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.wx-about-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--wx-text);
}

/* ---------- Über-uns-Modal ---------- */
.wx-modal {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 15, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.wx-modal[hidden] { display: none; }

.wx-modal-box {
    position: relative;
    background: var(--wx-bg-2);
    border: 1px solid var(--wx-card-border);
    border-radius: var(--wx-radius);
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 32px;
}

.wx-modal-box h2 {
    margin: 0 0 20px;
    font-size: 1.3rem;
}

.wx-modal-box h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--wx-accent);
    margin: 22px 0 8px;
}

.wx-modal-box h3:first-of-type { margin-top: 0; }

.wx-modal-box p,
.wx-modal-box ul {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--wx-text-dim);
    margin: 0;
}

.wx-modal-box ul {
    padding-left: 20px;
}

.wx-modal-box li { margin-bottom: 4px; }

.wx-modal-box a {
    color: var(--wx-accent);
}

.wx-modal-disclaimer {
    font-size: 0.78rem !important;
    opacity: 0.7;
    border-top: 1px solid var(--wx-card-border);
    padding-top: 14px;
}

.wx-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--wx-card-border);
    background: rgba(255,255,255,0.06);
    color: var(--wx-text);
    font-size: 0.9rem;
    cursor: pointer;
}

.wx-modal-close:hover {
    background: rgba(255,255,255,0.14);
}

/* ---------- Sticky Subnav ---------- */
.wx-subnav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    gap: 4px;
    padding: 10px 24px;
    background: var(--wx-subnav-bg);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-bottom: 1px solid var(--wx-card-border);
    overflow-x: auto;
}

.wx-subnav a {
    color: var(--wx-text-dim);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 6px 14px;
    border-radius: 999px;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.wx-subnav a:hover,
.wx-subnav a:focus-visible {
    background: rgba(255,255,255,0.06);
    color: var(--wx-text);
}

.wx-subnav-active {
    background: rgba(91,140,255,0.18) !important;
    color: var(--wx-accent) !important;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 60px; /* Subnav-Höhe, damit Sprungziel nicht dahinter verschwindet */
}

.wx-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--wx-text-dim);
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--wx-card-bg);
    border: 1px solid var(--wx-card-border);
}

.wx-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--wx-live);
    box-shadow: 0 0 8px var(--wx-live);
    animation: wx-pulse 2s infinite;
}

.wx-status--stale .wx-status-dot {
    background: var(--wx-stale);
    box-shadow: 0 0 8px var(--wx-stale);
    animation: none;
}

@keyframes wx-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* ---------- Grid ---------- */
.wx-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    padding: 0 24px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ---------- Warnungs-Banner ---------- */
.wx-warnings {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.wx-warn-banner {
    position: relative;
    border-radius: var(--wx-radius);
    padding: 16px 44px 16px 20px;
    margin-bottom: 14px;
    border: 1px solid;
}

.wx-warn-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.08);
    color: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s ease;
}

.wx-warn-close:hover {
    background: rgba(255,255,255,0.18);
}

.wx-warn-head {
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wx-warn-tag {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
}

.wx-warn-text {
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-line;
}

.wx-warn-period {
    margin-top: 10px;
    font-size: 0.78rem;
    opacity: 0.75;
}

/* Offizielle MeteoSchweiz-Gefahrenstufen-Farben, 1-5 */
.wx-warn--2 { background: rgba(255, 214, 0, 0.12); border-color: rgba(255, 214, 0, 0.4); color: #ffe066; }
.wx-warn--3 { background: rgba(255, 138, 0, 0.14); border-color: rgba(255, 138, 0, 0.45); color: #ffb066; }
.wx-warn--4 { background: rgba(255, 59, 48, 0.16); border-color: rgba(255, 59, 48, 0.5); color: #ff7a70; }
.wx-warn--5 { background: rgba(191, 0, 191, 0.18); border-color: rgba(191, 0, 191, 0.55); color: #e070e0; }

.wx-card {
    background: var(--wx-card-bg);
    border: 1px solid var(--wx-card-border);
    border-radius: var(--wx-radius);
    padding: 20px 22px;
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.09), 0 8px 24px rgba(0,0,0,0.18);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.wx-card:hover {
    transform: translateY(-2px);
    border-color: rgba(91,140,255,0.4);
}

.wx-card--hero {
    grid-column: span 2;
    background: linear-gradient(135deg, rgba(91,140,255,0.16), rgba(255,255,255,0.03));
}

.wx-card h2 {
    margin: 0 0 10px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--wx-text-dim);
}

.wx-value {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.wx-card--hero .wx-value {
    font-size: 3.4rem;
}

.wx-unit {
    font-size: 1rem;
    font-weight: 400;
    color: var(--wx-text-dim);
}

.wx-sub {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--wx-text-dim);
}

.wx-minmax {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--wx-card-border);
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 0.78rem;
    color: var(--wx-text-dim);
}

.wx-minmax-max { color: var(--wx-accent-2); }
.wx-minmax-min { color: var(--wx-accent); }
.wx-minmax-time { opacity: 0.6; margin-left: 2px; }

.wx-spark {
    width: 100%;
    height: 32px;
    margin-top: 10px;
    color: var(--wx-accent);
    opacity: 0.85;
}

.wx-spark-label {
    font-size: 0.7rem;
    color: var(--wx-text-dim);
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--wx-card-border);
}

.wx-spark-label + .wx-spark {
    margin-top: 6px;
}

.wx-value--split { font-size: 1.3rem; }

.wx-card--forecast {
    grid-column: span 2;
}

.wx-forecast-days {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.wx-forecast-day {
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    padding: 12px 10px;
    text-align: center;
}

.wx-forecast-weekday {
    font-size: 0.75rem;
    color: var(--wx-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wx-forecast-label {
    font-size: 0.75rem;
    margin: 6px 0;
    min-height: 2.2em;
}

.wx-forecast-temps { font-size: 0.95rem; }

.wx-forecast-rain {
    font-size: 0.75rem;
    color: var(--wx-text-dim);
    margin-top: 4px;
}

.wx-forecast-loading {
    color: var(--wx-text-dim);
    font-size: 0.85rem;
}

.wx-card--webcam {
    grid-column: span 2;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.wx-card--webcam h2 {
    padding: 20px 22px 0;
}

.wx-card--webcam img {
    width: 100%;
    display: block;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin-top: 10px;
    cursor: zoom-in;
}

.wx-card--webcam .wx-sub {
    padding: 10px 22px 18px;
    margin-top: 0;
    border-top: none;
}

.wx-value.wx-flash {
    animation: wx-flash 0.6s ease;
}

@keyframes wx-flash {
    0% { color: var(--wx-accent); }
    100% { color: var(--wx-text); }
}

/* ---------- Footer ---------- */
.wx-footer {
    text-align: center;
    padding: 16px;
    font-size: 0.8rem;
    color: var(--wx-text-dim);
}

@media (max-width: 640px) {
    .wx-card--hero { grid-column: span 1; }
    .wx-card--hero .wx-value { font-size: 2.6rem; }
    .wx-card--webcam { grid-column: span 1; }
    .wx-card--forecast { grid-column: span 1; }
}

/* ---------- Statistik-Tabelle (AWEKAS-Stil) ---------- */
.wx-stats-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 24px 40px;
}

.wx-stats-title {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--wx-text-dim);
    margin: 0 0 14px;
    padding-left: 16px; /* gleich wie td/th-Padding der Tabelle, sonst optisch versetzt */
}

.wx-stats-table-wrap {
    overflow-x: auto;
    background: var(--wx-card-bg);
    border: 1px solid var(--wx-card-border);
    border-radius: var(--wx-radius);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.09), 0 8px 24px rgba(0,0,0,0.18);
}

.wx-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 640px;
}

.wx-stats-table th {
    text-align: left;
    padding: 14px 16px;
    font-weight: 500;
    color: var(--wx-text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--wx-card-border);
}

.wx-stats-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: top;
}

.wx-stats-table tr:last-child td { border-bottom: none; }

.wx-stats-table tr:nth-child(even) td {
    background: rgba(255,255,255,0.015);
}

.wx-stats-row-label {
    color: var(--wx-accent);
    font-weight: 500;
    white-space: nowrap;
}

.wx-stats-max, .wx-stats-min {
    display: block;
}

.wx-stats-min { margin-top: 6px; }

.wx-stats-time {
    display: block;
    font-size: 0.72rem;
    color: var(--wx-accent-2);
    opacity: 0.85;
}

.wx-stats-na {
    color: var(--wx-text-dim);
    opacity: 0.5;
}

.wx-stats-loading {
    text-align: center;
    color: var(--wx-text-dim);
    padding: 24px;
}

/* ---------- Webcam-Lightbox ---------- */
.wx-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 15, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 40px;
    cursor: zoom-out;
}

.wx-lightbox[hidden] { display: none; }

.wx-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    cursor: default;
}

.wx-lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--wx-card-border);
    color: var(--wx-text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
}

.wx-lightbox-close:hover {
    background: rgba(255,255,255,0.16);
}
