/* Shared by every page: colour tokens, base typography, top navigation, theme toggle, status dot.
   Colour is reserved for status: green up, red down, amber slow/overdue/flaky; everything else is neutral.
   Dark is the default; light follows the system setting, or the toggle (data-theme on <html>,
   saved in localStorage as "ov-theme" and applied before first paint by views/partials/head.ejs). */

:root {
    --bg: #0a0c10;
    --surface: #11151b;
    --surface-2: #171c24;
    --border: #232a35;
    --border-strong: #323b49;
    --text: #e7eaf0;
    --dim: #9aa3b2;
    --faint: #667085;
    --up: #34c27a;
    --down: #ff5a4f;
    --warn: #f5a524;
    --up-glow: rgba(52, 194, 122, 0.18);
    --down-glow: rgba(255, 90, 79, 0.22);
    --warn-glow: rgba(245, 165, 36, 0.2);
    --down-bg: #261214;
    --down-line: #6e2a2b;
    --warn-line: #5f4817;
    --bar-none: #1b212b;
    --spark: #8d98a9;
    --focus: #6ea8ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg: #f3f4f7;
        --surface: #ffffff;
        --surface-2: #f7f8fa;
        --border: #e1e5ea;
        --border-strong: #c9d0da;
        --text: #12161c;
        --dim: #566070;
        --faint: #8a94a3;
        --up: #1fa463;
        --down: #d92d20;
        --warn: #c77700;
        --up-glow: rgba(31, 164, 99, 0.16);
        --down-glow: rgba(217, 45, 32, 0.16);
        --warn-glow: rgba(199, 119, 0, 0.16);
        --down-bg: #fff1ef;
        --down-line: #f0aaa3;
        --warn-line: #ebc47c;
        --bar-none: #e8ebf0;
        --spark: #6b7686;
        --focus: #2563eb;
        --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
        color-scheme: light;
    }
}

:root[data-theme="light"] {
    --bg: #f3f4f7;
    --surface: #ffffff;
    --surface-2: #f7f8fa;
    --border: #e1e5ea;
    --border-strong: #c9d0da;
    --text: #12161c;
    --dim: #566070;
    --faint: #8a94a3;
    --up: #1fa463;
    --down: #d92d20;
    --warn: #c77700;
    --up-glow: rgba(31, 164, 99, 0.16);
    --down-glow: rgba(217, 45, 32, 0.16);
    --warn-glow: rgba(199, 119, 0, 0.16);
    --down-bg: #fff1ef;
    --down-line: #f0aaa3;
    --warn-line: #ebc47c;
    --bar-none: #e8ebf0;
    --spark: #6b7686;
    --focus: #2563eb;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
    color-scheme: light;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a {
    color: inherit;
}

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

/* ---- Top navigation ---- */

.site-nav {
    display: flex;
    align-items: center;
    gap: 28px;
    height: 46px;
    padding: 0 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 650;
    font-size: 14px;
    letter-spacing: -0.005em;
    text-decoration: none;
    color: var(--text);
}

.site-brand-mark {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--text);
}

.site-links {
    display: flex;
    gap: 2px;
    flex: 1;
}

.site-links a {
    padding: 6px 11px;
    border-radius: 6px;
    color: var(--dim);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.site-links a:hover {
    color: var(--text);
    background: var(--surface-2);
}

.site-links a.active {
    color: var(--text);
    background: var(--surface-2);
}

.theme-toggle {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: transparent;
    color: var(--dim);
    cursor: pointer;
}

.theme-toggle:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

/* Shows the icon of the theme you would switch to */
.theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: none; }
    :root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: inline; }
}
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---- Status dot: the same on tiles and on monitor cards ---- */

.dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--faint);
}

.s-up .dot { background: var(--up); }
.s-down .dot { background: var(--down); box-shadow: 0 0 0 3px var(--down-glow); animation: pulse 1.8s ease-in-out infinite; }
.s-slow .dot,
.s-overdue .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-glow); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
    .s-down .dot { animation: none; }
}

/* ---- Narrow screens: brand hides, links scroll if they must ---- */

@media (max-width: 900px) {
    .site-nav { gap: 12px; padding: 0 10px; overflow-x: auto; }
    .site-brand { display: none; }
    .site-links { flex: 1; }
    .site-links a { padding: 6px 8px; white-space: nowrap; }
}
