:root {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: #1f2937;
    background: #f3f6fb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

body[data-forecast-mode="north"] {
    color: #39271f;
    background: #f5ead8;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    letter-spacing: 0.01em;
}

body[data-forecast-mode="north"] h1,
body[data-forecast-mode="north"] h2,
body[data-forecast-mode="north"] h3 {
    font-family: Georgia, "Times New Roman", serif;
    color: #603a28;
}

body[data-forecast-mode="north"] h1 {
    font-size: clamp(2rem, 8vw, 3rem);
    letter-spacing: -0.04em;
}

body[data-forecast-mode="north"] h2 {
    font-size: 1.35rem;
}

.page-shell {
    width: min(100% - 2rem, 68rem);
    margin: 0 auto;
    padding: 0.5rem 0;
}

h1,
h2,
p {
    margin-top: 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

h1 {
    margin-bottom: 0.35rem;
    font-size: 1.6rem;
    line-height: 1.15;
    text-align: center;
}

.location-panel,
.forecast-card {
    background: #ffffff;
    border: 1px solid #d8e0eb;
    border-radius: 0.75rem;
    padding: 1.25rem;
}

body[data-forecast-mode="north"] .location-panel,
body[data-forecast-mode="north"] .forecast-card {
    background: #fffaf0;
    border-color: #c9a982;
}

body[data-forecast-mode="north"] .location-panel {
    border-width: 2px;
    box-shadow: 0 0.35rem 0 #e3cfb2;
}

body[data-forecast-mode="north"] button {
    background: #70462f;
}

body[data-forecast-mode="north"] button:hover:not(:disabled) {
    background: #563321;
}

body[data-forecast-mode="north"] .forecast-verdict {
    background: #e7efdc;
    color: #405a31;
}

body[data-forecast-mode="north"] .forecast-table-heading {
    font-family: inherit;
    letter-spacing: 0.03em;
}

body[data-forecast-mode="north"] .forecast-actions,
body[data-forecast-mode="north"] .forecast-actions button,
body[data-forecast-mode="north"] .forecast-card {
    font-family: inherit;
}

body[data-forecast-mode="north"] .forecast-card {
    box-shadow: inset 0 -1px #d8c2a2;
}

body[data-forecast-mode="north"] .status {
    font-style: italic;
}

body[data-forecast-mode="north"] .status--error {
    color: #9b3027;
}

.location-panel {
    margin: 0.5rem 0;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.page-link {
    margin-top: 0.75rem;
}

.page-link a {
    color: #0f3ea8;
    font-weight: 600;
    text-decoration-thickness: 0.12em;
    text-underline-offset: 0.15em;
}

.back-button {
    margin-top: 1rem;
}

.forecast-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.forecast-table-heading {
    display: none;
}

button {
    border: 0;
    border-radius: 0.5rem;
    padding: 0.7rem 1rem;
    color: #ffffff;
    background: #155eef;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

button:hover:not(:disabled) {
    background: #004eeb;
}

button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.postcode-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.postcode-form label {
    flex: none;
    white-space: nowrap;
}

input {
    min-width: 0;
    flex: 1;
    border: 1px solid #98a2b3;
    border-radius: 0.5rem;
    padding: 0.7rem;
    font: inherit;
}

.status {
    margin: 1rem 0 0;
}

.status--error {
    color: #b42318;
}

.forecast-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
}

.forecast-card h3 {
    margin-bottom: 0.75rem;
}

.forecast-card {
    overflow: hidden;
    padding-bottom: 0.75rem;
}

.coat-visual {
    position: relative;
    width: calc(100% + 2.5rem);
    margin: 0.25rem -1.25rem 0.75rem;
}

.coat-visual img {
    display: block;
    width: 100%;
    height: auto;
}

.coat-visual--no::after {
    position: absolute;
    top: 50%;
    left: -8%;
    width: 116%;
    height: 0.7rem;
    background: #d92d20;
    content: "";
    transform: rotate(45deg);
}

.forecast-verdict {
    display: inline-block;
    margin: 0 0 0.75rem;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    background: #e9f6ea;
    color: #146c2e;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.82rem;
}

.forecast-card p {
    margin-bottom: 0.5rem;
}

.forecast-card p:last-child {
    margin-bottom: 0;
}

/* Shared visual polish for both forecast modes. */
:root {
    color-scheme: light;
    --ink: #1d2939;
    --muted: #667085;
    --line: #dbe3ee;
    --accent: #155eef;
    --surface: rgba(255, 255, 255, 0.92);
    --label: #344054;
    --body-copy: #475467;
    --focus-ring: rgba(21, 94, 239, 0.14);
    --focus-outline: rgba(21, 94, 239, 0.35);
}

body {
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(ellipse at 50% -20%, #dce9ff 0, transparent 48rem),
        #f4f7fb;
}

body[data-forecast-mode="north"] {
    --ink: #39271f;
    --muted: #765c48;
    --line: #c9a982;
    --accent: #70462f;
    --surface: #fffaf0;
    --label: #70462f;
    --body-copy: #503a2d;
    --focus-ring: rgba(112, 70, 47, 0.16);
    --focus-outline: rgba(112, 70, 47, 0.35);
    background:
        radial-gradient(ellipse at 50% -18%, #ead4b3 0, transparent 42rem),
        #f5ead8;
}

.page-shell {
    width: min(100% - 2rem, 72rem);
    padding: 2.5rem 0;
}

.intro-view header {
    max-width: 42rem;
    margin: 0 auto 1.75rem;
    text-align: center;
}

h1 {
    margin-bottom: 0.6rem;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 750;
    letter-spacing: -0.045em;
}

.intro-view header p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1.05rem;
}

.location-panel {
    width: min(100%, 42rem);
    margin: 0 auto;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: 1.1rem;
    background: var(--surface);
    box-shadow: 0 1rem 2.5rem rgba(25, 49, 89, 0.08), 0 2px 5px rgba(25, 49, 89, 0.04);
}

.location-panel h2 {
    margin-bottom: 1.15rem;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.location-panel label {
    display: block;
    color: var(--label);
    font-size: 0.92rem;
    font-weight: 650;
}

.postcode-form {
    gap: 0.65rem;
    margin-top: 0.65rem;
}

input {
    min-height: 3rem;
    border-color: #c5cfdd;
    border-radius: 0.7rem;
    background: #fff;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

input::placeholder {
    color: #98a2b3;
}

input:focus-visible {
    border-color: var(--accent);
    outline: 0;
    box-shadow: 0 0 0 4px var(--focus-ring);
}

button {
    border-radius: 0.7rem;
    padding: 0.78rem 1.1rem;
    background: var(--accent);
    box-shadow: 0 2px 4px rgba(16, 64, 160, 0.16);
    transition: background-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

button:hover:not(:disabled) {
    background: #004dcc;
    box-shadow: 0 5px 12px rgba(16, 64, 160, 0.2);
    transform: translateY(-1px);
}

button:focus-visible {
    outline: 3px solid var(--focus-outline);
    outline-offset: 3px;
}

.status {
    margin-top: 1rem;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.status--error {
    color: #b42318;
}

.forecast-view {
    padding: 1.5rem 0;
}

.forecast-view > h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    letter-spacing: -0.03em;
}

.forecast-grid {
    gap: 1rem;
}

.forecast-card {
    min-width: 0;
    padding: 1.1rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(25, 49, 89, 0.06);
}

.forecast-card h3 {
    margin-bottom: 0.85rem;
    color: var(--label);
    font-size: 1.05rem;
    letter-spacing: -0.015em;
}

.forecast-card p {
    color: var(--body-copy);
    line-height: 1.45;
}

.forecast-card p strong {
    color: var(--ink);
}

.forecast-actions {
    gap: 0.65rem;
    margin-top: 1rem;
}

body[data-forecast-mode="standard"] .forecast-actions .back-button {
    margin-top: 0;
    border: 1px solid #cbd5e1;
    color: #344054;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 2px 4px rgba(25, 49, 89, 0.05);
}

body[data-forecast-mode="standard"] .forecast-actions .back-button:hover:not(:disabled) {
    border-color: #98a9c0;
    color: #1d2939;
    background: #fff;
    box-shadow: 0 4px 10px rgba(25, 49, 89, 0.1);
}

.forecast-verdict {
    font-weight: 650;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 54rem) {
    .forecast-grid {
        grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    }
}

@media (max-width: 40rem) {
    .page-shell {
        width: 100%;
        min-height: 100vh;
        padding: 0.5rem;
    }

    .intro-view,
    .forecast-view {
        min-height: calc(100vh - 1rem);
        scroll-snap-align: start;
        display: flex;
        flex-direction: column;
    }

    .intro-view {
        justify-content: center;
    }

    .forecast-view {
        padding-top: 1rem;
    }

    body.mobile-forecast-flow {
        scroll-snap-type: y mandatory;
    }

    .postcode-form {
        flex-direction: column;
        align-items: stretch;
    }

    .forecast-grid {
        grid-template-columns: 1fr;
    }

    body[data-forecast-mode="north"] .forecast-view {
        min-height: 100svh;
        padding-top: 0.25rem;
    }

    body[data-forecast-mode="north"] .forecast-view h2 {
        margin-bottom: 0.35rem;
        text-align: center;
    }

    body[data-forecast-mode="north"] .forecast-grid {
        flex: 1;
        grid-template-columns: 1fr;
        grid-template-rows: repeat(5, minmax(0, 1fr));
        gap: 0;
        overflow: hidden;
        border: 1px solid #c9a982;
        border-radius: 0.5rem;
    }

    body[data-forecast-mode="north"] .forecast-table-heading {
        display: grid;
        grid-template-columns: minmax(2.6rem, 0.8fr) 5rem repeat(3, minmax(0, 1fr));
        column-gap: 0.35rem;
        padding: 0.25rem 0;
        font-size: 1rem;
        font-weight: 700;
        text-align: center;
        color: #70462f;
    }

    body[data-forecast-mode="north"] .forecast-card {
        display: grid;
        grid-template-columns: 5rem minmax(0, 1fr);
        grid-template-rows: repeat(5, minmax(0, 1fr));
        align-content: stretch;
        align-items: center;
        column-gap: 1rem;
        padding: 0.65rem 0.85rem;
        min-height: 0;
    }

    body[data-forecast-mode="north"] .forecast-card h3 {
        grid-column: 2;
        grid-row: 1;
        margin: 0;
        font-size: 1rem;
    }

    body[data-forecast-mode="north"] .coat-visual {
        grid-column: 1;
        grid-row: 1 / span 3;
        width: 5rem;
        height: 5rem;
        margin: 0;
    }

    body[data-forecast-mode="north"] .coat-visual img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    body[data-forecast-mode="north"] .coat-visual--no::after {
        height: 0.35rem;
    }

    body[data-forecast-mode="north"] .forecast-verdict {
        grid-column: 2;
        grid-row: 2;
        justify-self: start;
        margin: 0.15rem 0;
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }

    body[data-forecast-mode="north"] .forecast-card p:not(.forecast-verdict) {
        grid-column: 2;
        margin: 0;
        font-size: 0.9rem;
        line-height: 1.3;
    }

    body[data-forecast-mode="north"] .forecast-card p:nth-of-type(2) {
        grid-row: 3;
    }

    body[data-forecast-mode="north"] .forecast-card p:nth-of-type(3) {
        grid-row: 4;
    }

    body[data-forecast-mode="north"] .forecast-card p:nth-of-type(4) {
        grid-row: 5;
    }

    body[data-forecast-mode="north"] .forecast-card {
        grid-template-columns: minmax(2.6rem, 0.8fr) 5rem repeat(3, minmax(0, 1fr));
        grid-template-rows: 1fr;
        column-gap: 0.35rem;
        padding: 0;
        border-radius: 0;
    }

    body[data-forecast-mode="north"] .forecast-card + .forecast-card {
        border-top: 0;
    }

    body[data-forecast-mode="north"] .forecast-card h3 {
        grid-column: 1;
        grid-row: 1;
        font-size: 1rem;
        line-height: 1.25;
        text-align: center;
    }

    body[data-forecast-mode="north"] .coat-visual {
        grid-column: 2;
        grid-row: 1;
        width: 5.75rem;
        aspect-ratio: 1;
        height: auto;
        min-height: 0;
        align-self: center;
        padding: 0;
        border: 2px solid #70462f;
        background: #f5ead8;
    }

    body[data-forecast-mode="north"] .forecast-card p:not(.forecast-verdict) {
        grid-row: 1;
        min-width: 0;
        overflow-wrap: anywhere;
        text-align: center;
    }

    body[data-forecast-mode="north"] .forecast-verdict {
        display: none;
    }

    body[data-forecast-mode="north"] .forecast-card p:nth-of-type(2) {
        grid-column: 3;
        grid-row: 1;
        font-size: 1rem;
        line-height: 1.25;
    }

    body[data-forecast-mode="north"] .forecast-card p:nth-of-type(3) {
        grid-column: 5;
        grid-row: 1;
        font-size: 1rem;
        line-height: 1.25;
    }

    body[data-forecast-mode="north"] .forecast-card p:nth-of-type(4) {
        grid-column: 4;
        grid-row: 1;
        font-size: 1rem;
        line-height: 1.25;
    }

    body[data-forecast-mode="north"] .back-button {
        margin-top: 0;
        padding: 0.45rem 0.75rem;
        font-size: 0.72rem;
        line-height: 1.2;
    }

    body[data-forecast-mode="north"] .forecast-actions {
        justify-content: center;
        gap: 0.5rem;
        margin-top: 0.35rem;
    }
}
