/*
 * Værstasjoner – stiler for siden og modulen. Bygger på Horten kommunes tema (theme/horten/css/app.css), med
 * kommunens farger og fonter: blå #069 (topp, overskrifter, grafer), grønn #488b16 (vindpil, ferske data),
 * lenkeblå #1779ba, Roboto i overskrifter og Open Sans ellers.
 */
:root {
    --wx-blue: #006699;
    --wx-blue-dark: #0c3d5d;
    --wx-green: #488b16;
    --wx-link: #1779ba;
    --wx-ink: #1d2a35;
    --wx-muted: #56656f;
    --wx-faint: #84919a;
    --wx-line: #cdd8e1;
    --wx-line-soft: #e6ecf1;
    --wx-axis: #c4d1db;
    --wx-bg: #e3e9ef;
    --wx-tint: #e2e9ef;   /* ikke lysere: svakere toner blir hvite på skjermer med høy kontrast */
    --wx-amber: #c98a00;
    --wx-red: #b23a2b;
    --wx-red-text: #a8321f;
    --wx-red-bg: #fcefed;
    --wx-red-ink: #8a2a1c;
    --wx-radius: 8px;
    --wx-shadow: 0 1px 2px rgba(12, 61, 93, .06), 0 2px 6px rgba(12, 61, 93, .06);
}

/* ---------- Siden ---------- */

body.wx-page { background: var(--wx-bg); color: var(--wx-ink); }
.wx-container { box-sizing: border-box; margin: 0 auto; max-width: 1200px; padding: 0 32px; }

.wx-site-header { background: var(--wx-blue); color: #fff; }
.wx-site-header-inner { align-items: center; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; min-height: 76px; }
.wx-logo { display: block; line-height: 0; padding: 10px 0; }
.wx-logo img { height: 52px; width: auto; }
.wx-site-status { color: #fff; font-size: .875rem; margin: 0; }

.wx-station-nav { background: #fff; border-bottom: 1px solid var(--wx-line); }
.wx-station-nav-inner { align-items: center; display: flex; flex-wrap: wrap; gap: 0 28px; }
.wx-back { align-items: center; display: inline-flex; font-size: .875rem; font-weight: 600; gap: 6px; padding: 14px 0; text-decoration: none; }
.wx-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.wx-tab { border-bottom: 3px solid transparent; color: var(--wx-muted); font-size: .9375rem; padding: 14px 14px 11px; text-decoration: none; }
.wx-tab:hover { color: var(--wx-blue-dark); }
.wx-tab[aria-current="page"] { border-bottom-color: var(--wx-blue); color: var(--wx-blue-dark); font-weight: 600; }

.wx-main { padding-bottom: 56px; padding-top: 36px; }

.wx-arrow { fill: none; height: 16px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; width: 16px; }
.wx-arrow--back { transform: scaleX(-1); }

/* ---------- Felles ---------- */

.wx-overview, .wx-weather { color: var(--wx-ink); font-family: 'Open Sans', Helvetica, Arial, sans-serif; line-height: 1.5; }
.wx-overview [hidden], .wx-weather [hidden] { display: none !important; }
.wx-overview p, .wx-weather p { line-height: 1.5; }

.wx-page-title { color: var(--wx-blue-dark); font-family: Roboto, sans-serif; font-size: 2.25rem; font-weight: 700; line-height: 1.15; margin: 0; padding: 0; }
.wx-weather .wx-page-title { font-size: 2.5rem; }
.wx-lead { color: var(--wx-muted); margin: 8px 0 0; }
.wx-section-title { color: var(--wx-blue-dark); font-family: Roboto, sans-serif; font-size: 1.5rem; font-weight: 700; margin: 0; padding: 0; }

.wx-status { align-items: center; color: var(--wx-muted); display: inline-flex; font-size: .8125rem; gap: 6px; white-space: nowrap; }
.wx-status-dot { background: var(--wx-green); border-radius: 50%; display: inline-block; flex: none; height: 8px; width: 8px; }
.wx-status--1 .wx-status-dot { background: var(--wx-amber); }
.wx-status--2 { color: var(--wx-red-text); font-weight: 600; }
.wx-status--2 .wx-status-dot { background: var(--wx-red); }

.wx-pill { border: 1px solid var(--wx-line); border-radius: 10px; color: var(--wx-muted); font-size: .6875rem; font-weight: 400; margin-left: 4px; padding: 1px 7px; white-space: nowrap; }
.wx-pill--live { align-items: center; border-radius: 12px; display: inline-flex; font-size: .75rem; gap: 6px; margin: 0; padding: 2px 10px; }
.wx-pill--live .wx-status-dot { height: 6px; width: 6px; }

.wx-credits { color: var(--wx-muted); font-size: .8125rem; margin: 32px 0 0; }

.wx-empty { color: var(--wx-muted); font-size: .875rem; margin: 24px 0; text-align: center; }

/* Små grafer */
.wx-spark-svg, .wx-day-svg { display: block; max-width: 100%; }
.wx-spark-area { fill: var(--wx-blue); fill-opacity: .1; }
.wx-spark-line { fill: none; stroke: var(--wx-blue); stroke-linejoin: round; stroke-width: 2; }
.wx-spark-bar { fill: var(--wx-blue); }
.wx-spark-base, .wx-axis-base { stroke: var(--wx-axis); stroke-width: 1; }
.wx-axis-grid { stroke: var(--wx-line); stroke-dasharray: 3 4; stroke-width: 1; }
.wx-axis-text { fill: var(--wx-muted); font-family: 'Open Sans', sans-serif; font-size: 12px; }

/* ========== Oversikt ========== */

.wx-intro { align-items: flex-end; display: flex; flex-wrap: wrap; gap: 12px 32px; justify-content: space-between; }
.wx-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; margin: 0; padding: 0; }
.wx-legend .wx-status { font-weight: 400; }
.wx-legend .wx-status--2 { color: var(--wx-muted); }

.wx-ov-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 28px; }

.wx-ov-card {
    background: #fff;
    border: 1px solid var(--wx-line);
    border-radius: var(--wx-radius);
    color: var(--wx-ink);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-decoration: none;
    box-shadow: var(--wx-shadow);
    transition: border-color .15s, box-shadow .15s;
}
.wx-ov-card:hover, .wx-ov-card:focus-visible { border-color: var(--wx-blue); box-shadow: 0 4px 16px rgba(12, 61, 93, .14); color: var(--wx-ink); }
.wx-ov-card:focus-visible { outline: 2px solid var(--wx-blue); outline-offset: 2px; }

.wx-ov-head { align-items: center; display: flex; gap: 12px; justify-content: space-between; padding: 18px 20px 0; }
.wx-ov-name { color: var(--wx-blue-dark); font-family: Roboto, sans-serif; font-size: 1.25rem; font-weight: 700; margin: 0; padding: 0; }

.wx-ov-temp-row { display: flex; flex-direction: column; gap: 14px; padding: 6px 20px 0; }
.wx-ov-temp { align-items: center; display: flex; gap: 12px; justify-content: space-between; min-height: 4rem; }   /* samme høyde når tallet er krympet */
.wx-ov-symbol { flex: none; height: 56px; width: 56px; }
.wx-ov-temp-value { font-size: 4rem; font-weight: 300; letter-spacing: -.02em; line-height: 1; white-space: nowrap; }
/* Mindre når tallet ikke får plass ved siden av ikonet (fitTemp i weather-station.js) */
.wx-fit-1 .wx-ov-temp-value { font-size: 3.25rem; }
.wx-fit-2 .wx-ov-temp-value { font-size: 2.625rem; }
.wx-ov-temp-range { color: var(--wx-muted); display: block; font-size: .8125rem; line-height: 1.5; margin-top: 6px; white-space: nowrap; }
.wx-ov-spark > div:first-child { height: 44px; }
.wx-ov-spark-caption { color: var(--wx-muted); display: flex; font-size: .6875rem; justify-content: space-between; margin-top: 4px; }

.wx-ov-alert { background: var(--wx-red-bg); border-radius: 6px; color: var(--wx-red-ink); font-size: .8125rem; line-height: 1.45; margin: 14px 20px 0; padding: 12px 14px; }
.wx-ov-card.is-stale .wx-ov-temp-value { color: var(--wx-faint); }
.wx-ov-card.is-stale .wx-ov-rows { color: var(--wx-muted); }

.wx-ov-rows { margin: 16px 0 0; }
.wx-ov-row { align-items: center; border-top: 1px solid var(--wx-line-soft); display: flex; gap: 12px; justify-content: space-between; padding: 11px 20px; }
.wx-ov-row dt { color: var(--wx-muted); font-size: .875rem; font-weight: 400; margin: 0; white-space: nowrap; }
.wx-ov-row dd { align-items: center; display: flex; gap: 8px; margin: 0; text-align: right; }
.wx-ov-row strong { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.wx-ov-extra { color: var(--wx-muted); font-size: .8125rem; }
/* Fast plass til vindretningen (N … NNØ, «stille»), så pilen og tallet står stille når den endres */
.wx-ov-dir { min-width: 3.2em; text-align: left; }
.wx-ov-compass { display: inline-flex; height: 24px; width: 24px; }
.wx-ov-compass svg { height: 100%; width: 100%; }

.wx-ov-source { color: var(--wx-muted); font-size: .75rem; margin: auto 0 0; padding: 10px 20px 12px; }
.wx-ov-source + .wx-ov-more { margin-top: 0; }

/* Prognose fra Yr: de neste timene over «Se detaljer» */
.wx-ov-forecast { border-top: 1px solid var(--wx-line-soft); margin-top: auto; padding: 10px 14px 12px; }
.wx-ov-source + .wx-ov-forecast { margin-top: 0; }
.wx-ov-forecast:not([hidden]) + .wx-ov-more { margin-top: 0; }
.wx-ov-forecast-title { color: var(--wx-muted); font-size: .6875rem; letter-spacing: .04em; margin: 0 0 4px 6px; text-transform: uppercase; }
.wx-ov-hours { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); list-style: none; margin: 0; padding: 0; }
.wx-ov-hours li { align-items: center; display: flex; flex-direction: column; gap: 1px; margin: 0; }
.wx-ov-hours img { height: 30px; width: 30px; }
.wx-fc-hour { color: var(--wx-muted); font-size: .75rem; }
.wx-fc-temp { font-size: .875rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.wx-fc-wind { align-items: center; color: var(--wx-muted); display: inline-flex; font-size: .6875rem; gap: 2px; }
.wx-fc-arrow { fill: var(--wx-green); height: 10px; width: 10px; }
.wx-ov-more { align-items: center; border-top: 1px solid var(--wx-line-soft); color: var(--wx-link); display: flex; font-size: .875rem; font-weight: 600; justify-content: space-between; margin-top: auto; padding: 14px 20px; }
.wx-ov-card:hover .wx-ov-more { color: var(--wx-blue-dark); }

/* Mobil: temperatur og graf side om side, målingene i tre kolonner */
@media (max-width: 39.99875em) {
    .wx-container { padding: 0 16px; }
    .wx-main { padding-top: 24px; }
    .wx-page-title { font-size: 1.75rem; }
    .wx-weather .wx-page-title { font-size: 2rem; }
    .wx-logo img { height: 40px; }
    .wx-site-header-inner { min-height: 60px; }
    .wx-ov-grid { gap: 16px; margin-top: 20px; }
    .wx-ov-head { padding: 16px 16px 0; }
    .wx-ov-temp-row { align-items: center; flex-direction: row; justify-content: space-between; padding: 4px 16px 0; }
    .wx-ov-temp-value { font-size: 3.5rem; }
    .wx-ov-temp { min-height: 3.5rem; }
    .wx-fit-1 .wx-ov-temp-value { font-size: 2.875rem; }
    .wx-fit-2 .wx-ov-temp-value { font-size: 2.375rem; }
    .wx-ov-temp-range { font-size: .75rem; margin-top: 2px; }
    .wx-ov-temp-block { flex: 1; min-width: 0; }
    .wx-ov-symbol { height: 44px; width: 44px; }
    .wx-ov-spark { flex: 0 0 110px; width: 110px; }
    .wx-ov-spark-caption { display: none; }
    .wx-ov-alert { margin: 8px 16px 16px; }
    .wx-ov-rows { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); border-top: 1px solid var(--wx-line-soft); }
    .wx-ov-row { align-items: flex-start; border-top: 0; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }
    .wx-ov-row:first-child { padding-left: 16px; }
    .wx-ov-row + .wx-ov-row { border-left: 1px solid var(--wx-line-soft); }
    .wx-ov-row dt { font-size: .75rem; }
    .wx-ov-row dd { flex-wrap: wrap; gap: 4px 6px; text-align: left; }
    .wx-ov-row .wx-pill, .wx-ov-row .wx-ov-extra { display: none; }
    .wx-ov-compass { height: 20px; width: 20px; }
    .wx-ov-more { display: none; }
    .wx-ov-source { padding: 8px 16px 12px; }
}

/* ========== Detaljside ========== */

.wx-title-row { align-items: baseline; display: flex; flex-wrap: wrap; gap: 8px 32px; justify-content: space-between; }
.wx-measured { margin: 0; }
.wx-measured .wx-status { font-size: .875rem; }

.wx-alert { background: var(--wx-red-bg); border-radius: var(--wx-radius); color: var(--wx-red-ink); font-weight: 600; margin-top: 20px; padding: 14px 18px; }
.wx-weather.is-stale .wx-now { opacity: .6; }

.wx-card { background: #fff; border: 1px solid var(--wx-line); border-radius: var(--wx-radius); box-shadow: var(--wx-shadow); box-sizing: border-box; min-width: 0; }
.wx-card-label { color: var(--wx-muted); font-family: 'Open Sans', sans-serif; font-size: .8125rem; font-weight: 600; letter-spacing: .08em; margin: 0; padding: 0; text-transform: uppercase; }
.wx-card-head { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.wx-unit { color: var(--wx-muted); }
.wx-unit--big { font-size: 1.25rem; }
.wx-value-row { align-items: baseline; display: flex; gap: 6px; }

.wx-hero { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); margin-top: 24px; }
.wx-card--hero { padding: 24px 28px; }
.wx-big-row { align-items: flex-end; display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 8px; }
.wx-big { font-size: 6rem; font-weight: 300; letter-spacing: -.03em; line-height: 1; white-space: nowrap; }
.wx-wind-text .wx-big { font-size: 4.5rem; }
.wx-big-side { color: var(--wx-muted); font-size: .875rem; line-height: 1.6; padding-bottom: 10px; }
.wx-symbol { align-self: center; flex: none; height: 96px; width: 96px; }
.wx-day-chart { margin-top: 20px; min-height: 190px; }
.wx-day-chart:has(> .wx-empty) { min-height: 0; }

.wx-wind-row { align-items: center; display: flex; flex-wrap: wrap; gap: 24px 36px; margin-top: 16px; }
.wx-wind-text { flex: 1 1 200px; min-width: 0; }   /* krymper ved siden av kompasset, under det først på smale kort */
.wx-compass-host { flex: none; height: 196px; width: 196px; }
.wx-wind-force { font-size: 1.25rem; font-weight: 600; margin: 10px 0 0; }
.wx-wind-force:empty { display: none; }
.wx-wind-dir { color: var(--wx-muted); margin: 2px 0 0; }
.wx-wind-stats { border-top: 1px solid var(--wx-line-soft); color: var(--wx-muted); display: flex; flex-direction: column; font-size: .875rem; margin: 16px 0 0; padding-top: 12px; }
.wx-wind-stats span:empty { display: none; }

.wx-tiles { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-top: 24px; }
.wx-tile { padding: 20px 22px; }
.wx-mid { font-size: 2.5rem; font-weight: 300; line-height: 1.1; white-space: nowrap; }
.wx-tile-sub { color: var(--wx-muted); font-size: .875rem; margin: 4px 0 0; min-height: 1.3em; }
.wx-tile-sub strong { color: var(--wx-ink); font-weight: 600; }
.wx-tile-spark { height: 56px; margin-top: 14px; }
.wx-tile-caption { color: var(--wx-muted); font-size: .75rem; margin: 6px 0 0; }
.wx-source { color: var(--wx-muted); font-size: .75rem; font-style: italic; margin: 2px 0 0; }

/* ---------- Værvarsel (detaljsiden) ---------- */

.wx-forecast { margin-top: 24px; padding: 24px 28px; }
.wx-forecast-head { align-items: baseline; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.wx-yr-link { align-items: center; display: inline-flex; font-size: .875rem; font-weight: 600; gap: 4px; text-decoration: none; }
.wx-yr-link:hover { text-decoration: underline; }
.wx-forecast-body { display: grid; gap: 24px 48px; grid-template-columns: minmax(0, 1fr); margin-top: 16px; }
@media (min-width: 64em) {
    .wx-forecast-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.wx-fc-block .wx-card-label { margin-bottom: 10px; }

/* Timene og dagene i to like tabeller */
.wx-fc-table { border: 0; border-collapse: collapse; font-size: .9375rem; margin: 0; width: 100%; }
.wx-fc-table thead, .wx-fc-table tbody, .wx-fc-table tr, .wx-fc-table tbody tr:nth-child(even) { background: none; border: 0; }
.wx-fc-table thead th { color: var(--wx-muted); font-size: .75rem; font-weight: 400; padding: 0 8px 6px; text-align: right; }
.wx-fc-table tbody tr { border-top: 1px solid var(--wx-line-soft); }
.wx-fc-table th[scope="row"] { font-weight: 600; padding: 6px 8px 6px 0; text-align: left; white-space: nowrap; }
.wx-fc-table td { padding: 4px 8px; text-align: right; white-space: nowrap; }
.wx-fc-table td:last-child, .wx-fc-table thead th:last-child { padding-right: 0; }
.wx-fd-symbol { text-align: center !important; width: 48px; }
.wx-fd-symbol img { display: block; height: 36px; margin: 0 auto; width: 36px; }
.wx-fd-temp strong { font-weight: 600; }
.wx-fd-temp span, .wx-fd-rain, .wx-fd-wind { color: var(--wx-muted); }
.wx-fd-wind .wx-fc-wind { color: var(--wx-muted); font-size: inherit; gap: 4px; }
.wx-fd-wind .wx-fc-arrow { height: 12px; width: 12px; }
.wx-fc-credit { color: var(--wx-muted); font-size: .75rem; margin: 16px 0 0; }

@media (max-width: 39.99875em) {
    .wx-hero { grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 16px; }
    .wx-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
    .wx-card--hero { padding: 18px; }
    .wx-tile { padding: 14px; }
    .wx-big { font-size: 4.5rem; }
    .wx-wind-text .wx-big { font-size: 3.5rem; }
    .wx-mid { font-size: 2rem; }
    .wx-compass-host { height: 150px; width: 150px; }
    .wx-symbol { height: 72px; width: 72px; }
    .wx-forecast { margin-top: 16px; padding: 18px 16px; }
    .wx-fc-table { font-size: .875rem; }
    .wx-fc-table td, .wx-fc-table thead th { padding-left: 4px; padding-right: 4px; }
    .wx-wind-row { gap: 16px 24px; }
    .wx-tab { padding: 12px 10px 9px; }
}

/* ---------- Kompass ---------- */

.wx-compass { display: block; height: 100%; overflow: visible; width: 100%; }
.wx-compass-face { fill: #f7fafc; stroke: var(--wx-axis); }
.wx-compass-tick { stroke: var(--wx-axis); stroke-width: 1.5; }
.wx-compass-label { fill: var(--wx-blue-dark); font-family: Roboto, sans-serif; font-size: 15px; font-weight: 700; }
.wx-compass-sector { fill: var(--wx-green); }
.wx-compass-hub { fill: var(--wx-blue-dark); }
.wx-compass-needle { fill: var(--wx-green); transition: transform 1.2s cubic-bezier(.3, 1.4, .5, 1), opacity .3s; }
.wx-compass-needle.is-calm { opacity: .2; }
.wx-compass-ring { fill: none; stroke: var(--wx-axis); }
.wx-compass-north { stroke: var(--wx-muted); }
.wx-compass-pulse { fill: none; stroke: var(--wx-green); stroke-opacity: 0; transform-box: fill-box; transform-origin: center; }
.wx-compass-pulse.is-pulsing { animation: wx-pulse 2s ease-out; }

@keyframes wx-pulse {
    from { stroke-opacity: .9; stroke-width: 3; transform: scale(0); }
    to { stroke-opacity: 0; stroke-width: 3; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .wx-compass-needle, .wx-ov-card { transition: none; }
    .wx-compass-pulse.is-pulsing { animation: none; }
}
