/* Layout, cards and tables. The animated sky lives in sky.css. */

:root {
    --text: #fff;
    --text-dim: rgb(255 255 255 / 0.72);
    --card: rgb(255 255 255 / 0.14);
    --card-border: rgb(255 255 255 / 0.18);
    --warn: #ffb35c;
    --radius: 1.1rem;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: #1f3157;
}

a { color: inherit; }

.symbols {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ---------------------------------------------------------------- page */

.weather {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    isolation: isolate;
    transition: background 1.5s ease;
}

.weather__content {
    position: relative;
    z-index: 1;
    max-width: 68rem;
    margin: 0 auto;
    padding: max(1.25rem, env(safe-area-inset-top)) clamp(0.9rem, 3vw, 2rem) max(1.25rem, env(safe-area-inset-bottom));
}

.weather__content--center {
    min-height: 100vh;
    display: grid;
    place-content: center;
    text-align: center;
}

.stations {
    position: fixed;
    top: max(0.6rem, env(safe-area-inset-top));
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    pointer-events: none;
}

.stations__link {
    pointer-events: auto;
    padding: 0.25rem 0.8rem;
    border-radius: 99px;
    background: rgb(0 0 0 / 0.18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.9rem;
}

.stations__link.is-current {
    background: rgb(255 255 255 / 0.25);
    color: var(--text);
}

/* ---------------------------------------------------------------- hero */

.hero {
    text-align: center;
    padding: clamp(2.5rem, 7vh, 5rem) 0 clamp(1.5rem, 4vh, 3rem);
    text-shadow: 0 1px 3px rgb(0 0 0 / 0.18), 0 2px 18px rgb(0 0 0 / 0.22);
}

.hero--compact { padding-bottom: 1.5rem; }

.hero__place {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 500;
    letter-spacing: 0.01em;
}

.hero__temp {
    margin: 0;
    font-size: clamp(5.5rem, 17vw, 10rem);
    font-weight: 200;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}

.hero__deg {
    font-weight: 200;
    margin-left: 0.02em;
}

.hero__condition {
    margin: 0.35rem 0 0;
    font-size: clamp(1.15rem, 2.5vw, 1.5rem);
    font-weight: 500;
    color: var(--text-dim);
}

.hero__range {
    margin: 0.25rem 0 0;
    font-size: clamp(1.1rem, 2.3vw, 1.4rem);
    font-weight: 500;
}

.hero__links {
    margin: 0.6rem 0 0;
    color: var(--text-dim);
}

.hero__links a[aria-current] {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

/* ---------------------------------------------------------------- cards */

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(0.6rem, 1.4vw, 1rem);
}

.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem 1rem;
    backdrop-filter: blur(22px) saturate(1.3);
    -webkit-backdrop-filter: blur(22px) saturate(1.3);
    min-width: 0;
}

.card--wide { grid-column: span 2; }
.card--full { margin-bottom: 1rem; }

.card__title {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
}

.card__value {
    margin: 0;
    font-size: clamp(1.9rem, 3.6vw, 2.6rem);
    font-weight: 400;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.card__value--small { font-size: clamp(1.6rem, 3vw, 2.1rem); }

.card__unit {
    margin-left: 0.2em;
    font-size: 0.5em;
    color: var(--text-dim);
}

.card__label {
    margin: 0.1rem 0 0;
    font-size: 1.05rem;
    font-weight: 500;
}

.card__text {
    margin: 0.45rem 0 0;
    font-size: 0.92rem;
    line-height: 1.35;
    color: var(--text-dim);
}

/* wind */
.wind {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.compass {
    width: clamp(7rem, 14vw, 9.5rem);
    flex: none;
}

.compass__ring { fill: none; stroke: rgb(255 255 255 / 0.15); stroke-width: 1; }
.compass__tick { stroke: rgb(255 255 255 / 0.35); stroke-width: 1; }
.compass__tick--major { stroke: rgb(255 255 255 / 0.8); stroke-width: 1.5; }
.compass__label { fill: var(--text-dim); font-size: 9px; font-weight: 600; text-anchor: middle; }
.compass__dir { fill: var(--text); font-size: 12px; font-weight: 700; text-anchor: middle; }
.compass__arrow { stroke: #fff; stroke-width: 2.5; fill: #fff; stroke-linecap: round; transition: transform 1s ease; }

/* Pressure tendency: arrow rotated by class (no style attributes) */
.tendency { display: inline-block; transition: transform 0.6s ease; }
.tendency--rising-fast { transform: rotate(-60deg); }
.tendency--rising { transform: rotate(-40deg); }
.tendency--rising-slowly { transform: rotate(-20deg); }
.tendency--steady { transform: none; }
.tendency--falling-slowly { transform: rotate(20deg); }
.tendency--falling { transform: rotate(40deg); }
.tendency--falling-fast { transform: rotate(60deg); }

/* UV */
.uv-bar {
    display: block;
    width: 100%;
    height: 0.6rem;
    margin-top: 0.7rem;
}

.uv-bar__marker { fill: #fff; stroke: rgb(0 0 0 / 0.35); stroke-width: 0.8; }

/* ---------------------------------------------------------------- status */

.status {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-dim);
    text-shadow: 0 1px 4px rgb(0 0 0 / 0.3);
}

.status__warn { color: var(--warn); }

.is-stale .cards,
.is-stale .hero__temp { opacity: 0.45; }

/* ---------------------------------------------------------------- statistics */

.table-wrap { overflow-x: auto; }

.stats {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
    font-size: 0.95rem;
}

.stats th, .stats td {
    padding: 0.45rem 0.6rem;
    text-align: right;
    white-space: nowrap;
    border-bottom: 1px solid rgb(255 255 255 / 0.1);
}

.stats th:first-child { text-align: left; }
.stats thead th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); font-weight: 600; }
.stats tfoot th, .stats tfoot td { font-weight: 600; border-bottom: none; }
.stats__empty { color: rgb(255 255 255 / 0.4); }
.stats__rain { min-width: 9rem; }

.bar {
    display: inline-block;
    width: 4.5rem;
    height: 0.55rem;
    margin-right: 0.4rem;
    vertical-align: middle;
    background: rgb(255 255 255 / 0.12);
    border-radius: 2px;
}

.bar rect { fill: #7cc4ff; }

.heatmap {
    width: 100%;
    border-collapse: separate;
    border-spacing: 3px;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.heatmap th { font-weight: 600; color: var(--text-dim); font-size: 0.78rem; }
.heatmap tbody th { text-align: left; padding-right: 0.5rem; }

.heatmap__cell {
    text-align: center;
    padding: 0.45rem 0.2rem;
    border-radius: 6px;
    background: rgb(255 255 255 / 0.06);
}

.heatmap__cell--1 { background: rgb(124 196 255 / 0.2); }
.heatmap__cell--2 { background: rgb(124 196 255 / 0.35); }
.heatmap__cell--3 { background: rgb(80 160 255 / 0.5); }
.heatmap__cell--4 { background: rgb(60 130 245 / 0.65); }
.heatmap__cell--5 { background: rgb(45 100 230 / 0.85); }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 900px) {
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
    .card--wide { grid-column: span 2; }
    .wind { flex-direction: column; align-items: flex-start; }
}

@media (orientation: landscape) and (min-width: 900px) and (max-height: 820px) {
    .hero { padding-top: 2rem; padding-bottom: 1.5rem; }
    .hero__temp { font-size: clamp(5rem, 12vw, 8rem); }
}
