/* Shared by the home page (index.html) and the benchmark results page (/weatherbenchmark) */

/* Colours: light by default, dark when the device asks for it */
:root {
    --bg: #f3f7f7;
    --surface: #ffffff;
    --text: #1a2a2e;
    --muted: #5a6d72;
    --border: #d9e4e5;
    --accent: #0b7f78;
    --accent-strong: #08615b;
    --accent-soft: #e0f3f1;
    --hero-from: #14a89d;
    --hero-to: #0b4f6c;
    --good: #1e7d3c;
    --good-soft: #e3f4e8;
    --warn: #9a6200;
    --warn-soft: #fbf0d9;
    --bad: #b3261e;
    --bad-soft: #fbe5e3;
    --shadow: 0 1px 2px rgba(16, 40, 44, 0.06), 0 4px 16px rgba(16, 40, 44, 0.06);
    --radius: 14px;
    --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e1719;
        --surface: #162326;
        --text: #e4eeef;
        --muted: #97abaf;
        --border: #25373b;
        --accent: #4fd8cc;
        --accent-strong: #8ce8df;
        --accent-soft: #123331;
        --hero-from: #0a7a72;
        --hero-to: #0a2a38;
        --good: #6fd68f;
        --good-soft: #15321f;
        --warn: #f0b955;
        --warn-soft: #3a2c10;
        --bad: #ff8a80;
        --bad-soft: #3d1a17;
        --shadow: none;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

a {
    color: var(--accent);
}

a:hover {
    color: var(--accent-strong);
}

code {
    font-family: var(--mono);
    font-size: 0.9em;
    background: var(--accent-soft);
    padding: 0.1em 0.35em;
    border-radius: 5px;
    word-break: break-word;
}

.wrap {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
.hero {
    background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
    color: #fff;
    padding: 44px 0 40px;
}

.hero a {
    color: #fff;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: clamp(1.9rem, 5vw, 2.6rem);
    line-height: 1.15;
}

.eyebrow {
    margin: 0 0 8px;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.85;
}

.lead {
    margin: 0;
    max-width: 700px;
    font-size: 1.1rem;
    opacity: 0.95;
}

.hero .button {
    margin-top: 18px;
}

/* Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
    gap: 20px;
    margin-top: -20px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    min-width: 0;
}

.card-wide {
    grid-column: 1 / -1;
}

.card h2 {
    margin: 0 0 6px;
    font-size: 1.25rem;
}

.card h2 small {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--muted);
}

.card h3 {
    margin: 20px 0 6px;
    font-size: 1.05rem;
}

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

.card ul {
    padding-left: 1.2em;
}

.card li + li {
    margin-top: 6px;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 0.9rem;
}

/* Notices */
.notice {
    border-radius: 10px;
    padding: 12px 16px;
    margin: 12px 0;
    border: 1px solid transparent;
}

.notice-info {
    background: var(--accent-soft);
}

.notice-warn {
    background: var(--warn-soft);
    border-color: var(--warn);
}

.notice-bad {
    background: var(--bad-soft);
    border-color: var(--bad);
}

/* Buttons and forms */
.button {
    display: inline-block;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 8px;
    padding: 9px 18px;
    cursor: pointer;
    text-decoration: none;
}

.button:hover {
    color: #fff;
    background: var(--accent-strong);
}

.hero .button {
    color: var(--hero-to);
    background: #fff;
}

.hero .button:hover {
    color: var(--hero-to);
    background: var(--accent-soft);
}

@media (prefers-color-scheme: dark) {
    .button,
    .button:hover {
        color: #0e1719;
    }
}

.presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
}

.chip {
    font: inherit;
    font-size: 0.9rem;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 4px 14px;
    cursor: pointer;
    text-decoration: none;
}

.chip:hover {
    border-color: var(--accent);
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.form-row label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
    color: var(--muted);
    flex: 1 1 140px;
}

.form-row input,
.form-row textarea {
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    width: 100%;
}

.form-row textarea {
    font-family: var(--mono);
    font-size: 0.9rem;
    resize: vertical;
}

.form-row input:focus,
.form-row textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.result {
    margin: 16px 0 0;
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px dashed var(--border);
    font-family: var(--mono);
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 56px;
}

/* Steps (numbered how-it-works list) */
.steps {
    list-style: none;
    counter-reset: step;
    margin: 12px 0 0;
    padding: 0;
}

.steps li {
    counter-increment: step;
    position: relative;
    padding: 0 0 0 40px;
    min-height: 28px;
}

.steps li + li {
    margin-top: 12px;
}

.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
    display: grid;
    place-items: center;
}

/* Facts (label / value list) */
.facts {
    margin: 12px 0 0;
}

.facts div {
    padding: 8px 0;
    border-top: 1px solid var(--border);
}

.facts div:first-child {
    border-top: 0;
}

.facts dt {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.facts dd {
    margin: 0;
    word-break: break-word;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    margin: 12px 0;
    border: 1px solid var(--border);
    border-radius: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

th,
td {
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
    border-top: 1px solid var(--border);
}

tr:first-child th {
    border-top: 0;
}

th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    background: var(--bg);
    white-space: nowrap;
}

td.num,
th.num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

td.win {
    color: var(--good);
    background: var(--good-soft);
    font-weight: 600;
    white-space: nowrap;
}

td.lose {
    color: var(--warn);
    background: var(--warn-soft);
    font-weight: 600;
    white-space: nowrap;
}

td.tie {
    white-space: nowrap;
}

/* Diagram */
.diagram {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
}

.footer {
    padding-top: 28px;
    padding-bottom: 40px;
    color: var(--muted);
    font-size: 0.9rem;
}

/* Setting names stay on one line */
td code {
    white-space: nowrap;
    word-break: normal;
}

/* Text-heavy tables become stacked, labelled blocks on phones */
@media (max-width: 640px) {
    table.stack tr:first-child {
        display: none;
    }

    table.stack tr {
        display: block;
        padding: 10px 12px;
        border-top: 1px solid var(--border);
    }

    table.stack tr:nth-child(2) {
        border-top: 0;
    }

    table.stack td {
        display: block;
        border: 0;
        padding: 2px 0;
    }

    table.stack td.stack-title {
        font-weight: 700;
        padding-bottom: 4px;
    }

    table.stack td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--muted);
    }
}

/* Expandable extra detail */
details {
    margin: 8px 0;
}

summary {
    cursor: pointer;
    color: var(--accent);
    font-weight: 600;
}

details .result {
    margin-top: 8px;
}
