* {
    box-sizing: border-box;
}

:root {
    --page-gutter: clamp(12px, 3vw, 28px);
    --panel-border: rgba(255, 255, 255, 0.20);
    --panel-background: rgba(20, 20, 25, 0.30);
    --soft-background: rgba(255, 255, 255, 0.08);
}

html,
body {
    margin: 0;
    min-height: 100%;
}

.app-layout {
    display: grid;
    grid-template-columns: minmax(210px, 270px) minmax(0, 960px);
    align-items: start;
    gap: clamp(14px, 2vw, 24px);
    width: min(1260px, 100%);
}

.app-layout > .card:only-child {
    grid-column: 1 / -1;
    justify-self: center;
}

.location-sidebar {
    position: sticky;
    top: var(--page-gutter);
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 18px;
    background: rgba(12, 18, 27, 0.42);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.location-sidebar h2 {
    margin: 0 0 10px;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.58;
}

.location-sidebar-list {
    display: grid;
    gap: 5px;
}

.location-summary {
    display: grid;
    width: 100%;
    gap: 4px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    color: white;
    background: transparent;
    text-align: left;
}

.location-summary:hover,
.location-summary:focus-visible,
.location-summary.active {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.09);
    outline: none;
}

.location-summary-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
}

.location-summary-weather {
    display: flex;
    gap: 7px;
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
}

.location-flag,
.location-weather-icon {
    display: block;
    width: 1.15em;
    height: 1.15em;
    flex: 0 0 1.15em;
    object-fit: contain;
}

body {
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding:
        max(var(--page-gutter), env(safe-area-inset-top))
        max(var(--page-gutter), env(safe-area-inset-right))
        max(var(--page-gutter), env(safe-area-inset-bottom))
        max(var(--page-gutter), env(safe-area-inset-left));
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: white;
    background-color: #20252b;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.50)),
        var(--background-image);
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
}

/* Provenance and generation prompts: docs/assets.md */
.period-morning {
    --background-image: url("../images/morning.jpg?v=2");
}

.period-day {
    --background-image: url("../images/day.jpg?v=2");
}

.period-evening {
    --background-image: url("../images/evening.jpg?v=2");
}

.period-night {
    --background-image: url("../images/night.jpg?v=2");
}

.ui-icon,
.inline-icon,
.detail-icon {
    display: inline-block;
    width: 1.25em;
    height: 1.25em;
    flex: 0 0 1.25em;
    object-fit: contain;
    vertical-align: -0.22em;
}

.card {
    width: min(960px, 100%);
    padding: clamp(22px, 5vw, 60px);
    overflow-wrap: anywhere;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: clamp(20px, 4vw, 32px);
    background: var(--panel-background);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.35);
}

.app-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.app-claim {
    grid-column: 2;
    margin: 0;
    text-align: center;
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    font-weight: 600;
    letter-spacing: 0.015em;
    opacity: 0.82;
}

.language-switcher {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    opacity: 0.72;
}

.language-switcher button {
    padding: 3px 4px;
    border: 0;
    cursor: pointer;
    color: inherit;
    background: transparent;
    font: inherit;
    opacity: 0.62;
}

.language-switcher button[aria-current="true"] {
    font-weight: 700;
    opacity: 1;
}

.language-switcher button:hover,
.language-switcher button:focus-visible {
    text-decoration: underline;
    outline: none;
    opacity: 1;
}

.location-picker {
    position: relative;
    max-width: 620px;
    margin-inline: auto;
    font-size: 0.9rem;
}

.location-picker > summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 7px;
    padding: 5px;
    cursor: pointer;
    list-style: none;
    text-align: center;
    opacity: 0.85;
}

.location-picker > summary::-webkit-details-marker {
    display: none;
}

.location-picker > summary:hover,
.location-picker > summary:focus-visible {
    opacity: 1;
    outline: none;
}

.location-change {
    font-size: 0.75rem;
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0.6;
}

.location-panel {
    display: grid;
    gap: 14px;
    margin-top: 10px;
    padding: 16px;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: rgba(7, 12, 20, 0.58);
}

.location-search,
.coordinate-entry form {
    display: grid;
    gap: 8px;
}

.location-search label,
.coordinate-grid label {
    font-weight: 600;
}

.location-form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.location-picker input,
.location-picker button {
    min-height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 9px;
    font: inherit;
}

.location-picker input {
    min-width: 0;
    padding: 9px 11px;
    color: white;
    background: rgba(0, 0, 0, 0.24);
}

.location-picker input::placeholder {
    color: rgba(255, 255, 255, 0.48);
}

.location-picker button {
    padding: 9px 14px;
    cursor: pointer;
    color: white;
    background: rgba(255, 255, 255, 0.12);
}

.location-picker button:hover,
.location-picker button:focus-visible {
    border-color: rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.18);
    outline: none;
}

.location-message,
.location-privacy {
    margin: 0;
    line-height: 1.4;
}

.location-message {
    padding: 9px 11px;
    border-radius: 9px;
    background: rgba(181, 116, 76, 0.22);
}

.location-results {
    display: grid;
    gap: 7px;
}

.location-result {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.location-result small,
.location-privacy {
    opacity: 0.62;
}

.coordinate-entry {
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.coordinate-entry > summary {
    padding-block: 7px;
    cursor: pointer;
    font-weight: 600;
}

.coordinate-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.coordinate-grid label {
    display: grid;
    gap: 6px;
}

.location-reset {
    width: 100%;
}

.location-privacy {
    font-size: 0.72rem;
}

#clock {
    margin-top: clamp(10px, 2vw, 16px);
    text-align: center;
    font-size: clamp(3.25rem, 15vw, 9rem);
    font-weight: 650;
    line-height: 1;
    letter-spacing: -0.06em;
    font-variant-numeric: tabular-nums;
}

.date {
    margin-top: clamp(14px, 3vw, 20px);
    text-align: center;
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    opacity: 0.9;
}

.holiday {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
    text-align: center;
    font-size: clamp(0.88rem, 2vw, 1rem);
    font-weight: 600;
    opacity: 0.88;
}

.period {
    margin-top: 8px;
    text-align: center;
    opacity: 0.65;
}

.weather {
    margin-top: clamp(26px, 5vw, 38px);
    padding-top: clamp(22px, 4vw, 28px);
    border-top: 1px solid var(--panel-border);
}

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

.weather-icon {
    display: block;
    width: clamp(2.75rem, 7vw, 3.5rem);
    height: clamp(2.75rem, 7vw, 3.5rem);
    flex: 0 0 auto;
    object-fit: contain;
}

.temperature {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: clamp(2.35rem, 7vw, 3rem);
    font-weight: 600;
    line-height: 1;
}

.feels-like {
    font-size: 0.95rem;
    font-weight: 400;
    opacity: 0.65;
}

.description {
    margin-top: 6px;
    opacity: 0.8;
}

.minmax {
    display: flex;
    justify-content: center;
    gap: 26px;
    margin-top: 22px;
    font-size: 1.1rem;
    opacity: 0.85;
}

.recommendation {
    display: flex;
    justify-content: center;
    gap: 9px;
    margin-top: 22px;
    padding: 13px 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    background: var(--soft-background);
    font-size: 0.95rem;
    line-height: 1.45;
}

.forecast-chart-details {
    margin-top: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.10);
}

.forecast-chart-details > summary {
    padding: 13px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.86;
}

.forecast-chart-ranges {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 0 16px 8px;
    padding: 3px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.18);
}

.forecast-chart-ranges button {
    flex: 1;
    max-width: 180px;
    padding: 7px 12px;
    border: 0;
    border-radius: 8px;
    color: inherit;
    background: transparent;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.64;
}

.forecast-chart-ranges button.active {
    background: rgba(255, 255, 255, 0.12);
    opacity: 1;
}

.forecast-chart {
    width: 100%;
    padding: 0 10px;
}

.forecast-chart svg {
    display: block;
    width: 100%;
    height: auto;
    min-height: 180px;
    overflow: visible;
}

.chart-grid {
    stroke: rgba(255, 255, 255, 0.13);
    stroke-width: 1;
}

.chart-grid-hour {
    stroke: rgba(255, 255, 255, 0.055);
}

.chart-grid-hour-major {
    stroke: rgba(255, 255, 255, 0.11);
}

.chart-night {
    fill: rgba(8, 17, 35, 0.28);
}

.chart-daylight {
    fill: rgba(255, 222, 151, 0.035);
}

.chart-day-separator {
    stroke: rgba(255, 255, 255, 0.25);
    stroke-width: 1;
}

.chart-axis-y,
.chart-axis-x,
.chart-rain-scale {
    fill: rgba(255, 255, 255, 0.58);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.chart-strip-label {
    text-anchor: end;
    fill: rgba(255, 255, 255, 0.58);
    font-size: 9px;
}

.chart-axis-y {
    text-anchor: end;
}

.chart-axis-x {
    text-anchor: middle;
}

.chart-rain-scale {
    text-anchor: end;
    fill: rgba(105, 199, 255, 0.75);
}

.chart-rain {
    fill: rgba(70, 178, 243, 0.42);
}

.chart-day-label {
    text-anchor: middle;
    fill: rgba(255, 255, 255, 0.78);
    font-size: 10px;
    font-weight: 600;
}

.chart-weather-icon {
    opacity: 0.92;
}

.chart-wind-direction {
    text-anchor: middle;
    fill: rgba(255, 255, 255, 0.62);
    font-size: 13px;
}

.chart-line {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
}

.chart-line-temperature {
    stroke: #f4d4a3;
}

.chart-line-feels {
    stroke: rgba(183, 220, 255, 0.78);
    stroke-dasharray: 6 5;
    stroke-width: 2;
}

.chart-bft-0,
.chart-bft-1 {
    fill: rgba(127, 169, 199, 0.50);
}

.chart-bft-2,
.chart-bft-3 {
    fill: rgba(91, 196, 185, 0.62);
}

.chart-bft-4,
.chart-bft-5 {
    fill: rgba(211, 205, 83, 0.72);
}

.chart-bft-6,
.chart-bft-7 {
    fill: rgba(242, 164, 62, 0.80);
}

.chart-bft-8,
.chart-bft-9 {
    fill: rgba(224, 78, 78, 0.84);
}

.chart-bft-10,
.chart-bft-11,
.chart-bft-12 {
    fill: rgba(163, 70, 145, 0.90);
}

.forecast-chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 16px;
    padding: 0 14px 14px;
    font-size: 0.72rem;
    opacity: 0.72;
}

.forecast-chart-resolution {
    margin: -2px 14px 10px;
    text-align: center;
    font-size: 0.68rem;
    opacity: 0.58;
}

.forecast-chart-legend span::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 3px;
    margin-right: 5px;
    border-radius: 2px;
    vertical-align: middle;
}

.legend-temperature::before {
    background: #f4d4a3;
}

.legend-feels::before {
    background: rgba(183, 220, 255, 0.78);
}

.legend-rain::before {
    background: rgba(70, 178, 243, 0.65);
}

.legend-wind::before,
.legend-gusts::before,
.legend-beaufort::before {
    background: linear-gradient(
        90deg,
        #7fa9c7,
        #5bc4b9,
        #d3cd53,
        #f2a43e,
        #e04e4e,
        #a34691
    );
}

.model-note {
    margin-top: 3px;
    padding-left: 9px;
    border-left: 2px solid rgba(245, 211, 91, 0.55);
}

.meteorological-assessment {
    display: flex;
    justify-content: center;
    gap: 9px;
    margin-top: 12px;
    padding: 13px 16px;
    border-left: 3px solid rgba(143, 204, 255, 0.75);
    border-radius: 12px;
    background: rgba(76, 141, 181, 0.14);
    font-size: 0.9rem;
    line-height: 1.45;
}

.detail-assessment {
    grid-column: 1 / -1;
    justify-content: flex-start;
    margin-top: 0;
}

.weather-details {
    margin-top: 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.12);
}

.weather-details summary {
    padding: 13px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    list-style-position: inside;
    opacity: 0.86;
}

.weather-details summary:hover,
.weather-details summary:focus-visible,
.intelligence-debug summary:hover,
.intelligence-debug summary:focus-visible {
    background: rgba(255, 255, 255, 0.06);
    outline: none;
}

.intelligence-debug {
    margin-top: 14px;
    border: 1px dashed rgba(255, 211, 91, 0.42);
    border-radius: 14px;
    background: rgba(35, 28, 10, 0.22);
    font-size: 0.78rem;
}

.intelligence-debug > summary {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 700;
}

.intelligence-debug-content {
    display: grid;
    gap: 12px;
    padding: 0 16px 16px;
}

.intelligence-debug-content section,
.intelligence-debug-content p,
.intelligence-debug-content ul,
.intelligence-debug-content ol {
    margin: 0;
}

.intelligence-debug-content ul,
.intelligence-debug-content ol {
    padding-left: 20px;
}

.intelligence-debug-content li + li {
    margin-top: 5px;
}

.intelligence-debug-content em {
    display: block;
    opacity: 0.65;
}

.weather-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 0 16px 16px;
}

.detail-item {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
    line-height: 1.4;
}

.detail-item span {
    opacity: 0.75;
}

.detail-title {
    display: flex;
    align-items: center;
    gap: 7px;
}

.detail-title .detail-icon {
    width: 1.25em;
    flex: 0 0 1.25em;
    height: 1.25em;
    object-fit: contain;
    opacity: 1;
}

.detail-source {
    grid-column: 1 / -1;
}

.weather-status {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.65;
}

.unavailable {
    text-align: center;
    opacity: 0.7;
}

.footer {
    margin-top: 30px;
    text-align: center;
    font-size: 0.75rem;
    opacity: 0.42;
}

.source-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: currentcolor;
    text-underline-offset: 2px;
}

.app-about {
    max-width: 620px;
    margin: 10px auto 0;
}

.app-about summary {
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.app-about p {
    margin: 8px 0 0;
    line-height: 1.5;
}

@media (max-width: 620px) {
    .location-form-row,
    .coordinate-grid {
        grid-template-columns: 1fr;
    }

    .location-result {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .weather-main {
        gap: clamp(12px, 4vw, 18px);
    }

    .temperature {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .recommendation,
    .meteorological-assessment {
        justify-content: flex-start;
    }

    .weather-details-grid {
        grid-template-columns: 1fr;
    }

    .detail-source {
        grid-column: auto;
    }

    .detail-assessment {
        grid-column: auto;
    }
}

@media (max-width: 980px) {
    .app-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .location-sidebar {
        position: static;
        padding: 10px;
    }

    .location-sidebar h2 {
        margin-inline: 4px;
    }

    .location-sidebar-list {
        display: flex;
        overflow-x: auto;
        padding-bottom: 3px;
        scrollbar-width: thin;
    }

    .location-sidebar-list form {
        flex: 0 0 min(210px, 72vw);
    }
}

@media (max-width: 400px) {
    .card {
        padding: 20px 16px;
    }

    .app-header {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .app-claim {
        grid-column: 1;
        text-align: left;
    }

    .language-switcher {
        grid-column: 2;
    }

    #clock {
        letter-spacing: -0.07em;
    }

    .weather-main {
        align-items: flex-start;
    }

    .minmax {
        gap: 18px;
    }

    .recommendation,
    .meteorological-assessment {
        padding: 12px;
    }

    .weather-details-grid {
        padding-inline: 10px;
    }
}

@media (orientation: landscape) and (max-height: 700px) {
    body {
        place-items: start center;
    }

    .card {
        padding-block: clamp(18px, 5vh, 32px);
    }

    #clock {
        font-size: clamp(3.25rem, 13vh, 5.5rem);
    }

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