/* Colours: light by default, dark when the device asks for it */
:root {
    --bg: #f4f7fa;
    --surface: #ffffff;
    --text: #1b2733;
    --muted: #5b6b7b;
    --border: #dde5ec;
    --accent: #007d9c;
    --accent-strong: #00627a;
    --accent-soft: #e2f4f8;
    --hero-from: #00add8;
    --hero-to: #00627a;
    --shadow: 0 1px 2px rgba(16, 32, 48, 0.06), 0 4px 16px rgba(16, 32, 48, 0.06);
    --radius: 14px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1720;
        --surface: #17222d;
        --text: #e6edf3;
        --muted: #9aabbb;
        --border: #263544;
        --accent: #4fd1ec;
        --accent-strong: #8be3f5;
        --accent-soft: #12303a;
        --hero-from: #006f8a;
        --hero-to: #0b2a36;
        --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: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 0.9em;
    background: var(--accent-soft);
    padding: 0.1em 0.35em;
    border-radius: 5px;
}

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

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

.hero h1 {
    margin: 0 0 8px;
    font-size: clamp(2rem, 5vw, 2.75rem);
    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: 640px;
    font-size: 1.1rem;
    opacity: 0.95;
}

/* 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;
}

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

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

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

/* Weather */
.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;
}

.chip:hover,
.chip[aria-pressed="true"] {
    border-color: var(--accent);
}

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

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

.weather-form input {
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
}

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

.button {
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 8px;
    padding: 9px 18px;
    cursor: pointer;
}

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

.button:disabled {
    opacity: 0.6;
    cursor: wait;
}

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

.result {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px dashed var(--border);
    min-height: 72px;
}

.result p {
    margin: 0;
}

.temperature {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.error {
    color: #c0392b;
}

/* Endpoints and facts */
.endpoints {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.endpoints li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 10px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
}

.endpoints li:first-child {
    border-top: 0;
}

.endpoints .muted {
    grid-column: 2;
    font-size: 0.9rem;
}

.endpoints a {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    word-break: break-all;
}

.method {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 5px;
    padding: 2px 6px;
    align-self: start;
    margin-top: 2px;
}

.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;
}

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