/* Python server demo: one stylesheet (no Bootstrap), same look as the other portfolio demos */

/* Colours: light by default, dark when the device asks for it */
:root {
    --bg: #f3f6fa;
    --surface: #ffffff;
    --text: #18222e;
    --muted: #5a6878;
    --border: #d9e1ea;
    --accent: #2f6a9a;
    --accent-strong: #1f4e75;
    --accent-soft: #e3eef8;
    --hero-from: #4b8bbe;
    --hero-to: #1b3a5c;
    --gold: #ffd43b;
    --bad: #b3261e;
    --bad-soft: #fbe5e3;
    --shadow: 0 1px 2px rgba(16, 30, 50, 0.06), 0 4px 16px rgba(16, 30, 50, 0.06);
    --radius: 14px;
    --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f151c;
        --surface: #17202a;
        --text: #e5edf5;
        --muted: #9fb0c2;
        --border: #263442;
        --accent: #7cb7e8;
        --accent-strong: #a9d1f3;
        --accent-soft: #1a2c3d;
        --hero-from: #2f6a9a;
        --hero-to: #0c1a29;
        --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);
    overflow-wrap: anywhere;
}

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

.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-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

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

.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 h3 {
    margin: 18px 0 6px;
    font-size: 1.05rem;
}

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

.card ul,
.card ol {
    padding-left: 1.3em;
}

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

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

.small {
    font-size: 0.9rem;
}

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

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

.button-ghost {
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--accent);
}

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

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

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

.hero .button-ghost {
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.hero .button-ghost:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

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

.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 {
    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 {
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    width: 100%;
}

.form-row input: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;
}

/* Weather summary above the raw JSON */
.weather-now {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 18px;
    margin-top: 16px;
}

.weather-now .temp {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
}

/* Endpoint list */
.card .endpoints {
    list-style: none;
    padding: 0;
    margin: 0;
}

.endpoints li {
    display: grid;
    grid-template-columns: minmax(150px, auto) 1fr;
    gap: 4px 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.endpoints li + li {
    margin-top: 0;
}

@media (max-width: 560px) {
    .endpoints li {
        grid-template-columns: 1fr;
    }
}

.status-dot {
    display: inline-block;
    width: 0.6em;
    height: 0.6em;
    border-radius: 50%;
    background: var(--muted);
    margin-right: 6px;
    vertical-align: 0.05em;
}

.status-dot.ok {
    background: #2e9d4f;
}

.status-dot.bad {
    background: var(--bad);
}

details summary {
    cursor: pointer;
    color: var(--accent);
}

details pre {
    margin: 10px 0 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 20px 0 28px;
    font-size: 0.9rem;
    color: var(--muted);
}
