:root {
    --tr-bg: #f4f7fa;
    --tr-splash-text: #52606d;
    --tr-cold: #3b82f6;
    --tr-cool: #06b6d4;
    --tr-warm: #f59e0b;
    --tr-hot: #ef4444;
    --tr-none: #9aa5b1;
}

/* Dark values apply to a pinned Dark theme and, unless Light is pinned, to a dark operating system. */
:root[data-theme="dark"] {
    --tr-bg: #0e1620;
    --tr-splash-text: #9fb0c0;
    --tr-cold: #60a5fa;
    --tr-cool: #22d3ee;
    --tr-warm: #fbbf24;
    --tr-hot: #f87171;
    --tr-none: #6b7a89;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --tr-bg: #0e1620;
        --tr-splash-text: #9fb0c0;
        --tr-cold: #60a5fa;
        --tr-cool: #22d3ee;
        --tr-warm: #fbbf24;
        --tr-hot: #f87171;
        --tr-none: #6b7a89;
    }
}

html, body {
    background: var(--tr-bg);
    font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

body { margin: 0; }

/* Shown until the interactive circuit has rendered the layout. */
#splash {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--tr-splash-text);
    background: var(--tr-bg);
    z-index: 0;
}
body:has(.mud-layout) #splash { display: none; }

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 1.25rem;
    background: #b91c1c;
    color: #fff;
    z-index: 2000;
}
#blazor-error-ui .reload { color: #fff; margin-left: 12px; text-decoration: underline; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.app-bar .brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-height: 40px; }
.app-bar .brand img { width: 28px; height: 28px; border-radius: 7px; }

.station-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-left: 4px solid var(--tr-none);
    transition: box-shadow 120ms ease-out, transform 120ms ease-out;
}
.station-card:hover { transform: translateY(-1px); }
.station-card.band-cold { border-left-color: var(--tr-cold); }
.station-card.band-cool { border-left-color: var(--tr-cool); }
.station-card.band-warm { border-left-color: var(--tr-warm); }
.station-card.band-hot { border-left-color: var(--tr-hot); }
.station-card a.card-link { color: inherit; text-decoration: none; display: block; flex: 1; }

.temp-value { font-variant-numeric: tabular-nums; font-weight: 600; line-height: 1.1; }
.band-cold .temp-value { color: var(--tr-cold); }
.band-cool .temp-value { color: var(--tr-cool); }
.band-warm .temp-value { color: var(--tr-warm); }
.band-hot .temp-value { color: var(--tr-hot); }

.mono { font-family: "Cascadia Mono", Consolas, "Courier New", monospace; }
.wrap-anywhere { overflow-wrap: anywhere; }

/* The page never scrolls sideways; wide content scrolls in its own box. */
.mud-main-content { overflow-x: hidden; }
.scroll-x { overflow-x: auto; max-width: 100%; }

/* Touch targets of at least 40 px. */
.mud-icon-button, .mud-button-root { min-height: 40px; }
.mud-icon-button { min-width: 40px; }

.chart-box { width: 100%; min-height: 260px; }
.chart-box .mud-chart { width: 100%; }

.fade-up { animation: fade-up 220ms ease-out both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    .fade-up { animation: none; }
    .station-card { transition: none; }
}

.log-line { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }
.log-line .log-exception { white-space: pre-wrap; opacity: .8; }

/* Static pages without the MudBlazor layout (sign-in). */
.plain-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; color: var(--tr-text, #16202b); }
:root[data-theme="dark"] .plain-page { --tr-text: #e6edf3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .plain-page { --tr-text: #e6edf3; } }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 8px; }
.login-card h1 { font-size: 20px; margin: 8px 0 12px; }
.login-card form { display: flex; flex-direction: column; gap: 6px; }
.login-card label { font-size: 13px; opacity: .75; }
.login-card input { font: inherit; padding: 10px 12px; min-height: 40px; border-radius: 8px; border: 1px solid rgba(128,128,128,.4); background: transparent; color: inherit; }
.login-card button { font: inherit; margin-top: 10px; min-height: 44px; border: 0; border-radius: 8px; background: #0B6FB3; color: #fff; cursor: pointer; }
.login-card a { color: inherit; opacity: .75; margin-top: 12px; padding: 8px 0; }
.login-error { color: #dc2626; margin: 4px 0; }

/* SVG temperature chart. Colours come from the MudBlazor palette so both themes work. */
.tr-chart-wrap { position: relative; width: 100%; }
.tr-chart { width: 100%; height: auto; display: block; touch-action: pan-y; }
.tr-chart .grid { stroke: var(--mud-palette-lines-default); stroke-width: 1; }
.tr-chart .grid-x { stroke: var(--mud-palette-lines-default); stroke-width: 1; stroke-dasharray: 2 4; }
.tr-chart .axis { fill: var(--mud-palette-text-secondary); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.tr-chart .line { fill: none; stroke: var(--mud-palette-primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tr-chart .area { fill: var(--mud-palette-primary); opacity: .12; stroke: none; }
.tr-chart .cursor-line { stroke: var(--mud-palette-text-secondary); stroke-width: 1; }
.tr-chart .cursor-dot { fill: var(--mud-palette-primary); stroke: var(--mud-palette-surface); stroke-width: 2; }
.tr-chart-tip { position: absolute; top: 0; pointer-events: none; padding: 4px 8px; border-radius: 6px; font-size: 12px; line-height: 1.3;
    display: flex; flex-direction: column; background: var(--mud-palette-surface); color: var(--mud-palette-text-primary);
    border: 1px solid var(--mud-palette-lines-default); box-shadow: 0 2px 8px rgba(0,0,0,.18); white-space: nowrap; }
.tr-chart-tip[hidden] { display: none; }
.tr-chart-tip span { color: var(--mud-palette-text-secondary); font-size: 11px; }
