/* Shared theme engine. Themes (themes/*.css) only set the variables below. */

/* Self-hosted, latin subset, all SIL OFL: Orbitron, IBM Plex Mono, Source Serif 4. */
@font-face {
    font-family: Orbitron;
    font-weight: 500;
    font-display: swap;
    src: url("/static/fonts/orbitron-500.woff2") format("woff2");
}

@font-face {
    font-family: Orbitron;
    font-weight: 700;
    font-display: swap;
    src: url("/static/fonts/orbitron-700.woff2") format("woff2");
}

@font-face {
    font-family: "IBM Plex Mono";
    font-weight: 400;
    font-display: swap;
    src: url("/static/fonts/plex-mono-400.woff2") format("woff2");
}

@font-face {
    font-family: "IBM Plex Mono";
    font-weight: 500;
    font-display: swap;
    src: url("/static/fonts/plex-mono-500.woff2") format("woff2");
}

@font-face {
    font-family: "IBM Plex Mono";
    font-weight: 600;
    font-display: swap;
    src: url("/static/fonts/plex-mono-600.woff2") format("woff2");
}

@font-face {
    font-family: "Source Serif 4";
    font-weight: 400;
    font-display: swap;
    src: url("/static/fonts/source-serif-4-400.woff2") format("woff2");
}

@font-face {
    font-family: "Source Serif 4";
    font-weight: 400;
    font-style: italic;
    font-display: swap;
    src: url("/static/fonts/source-serif-4-400-italic.woff2") format("woff2");
}

@font-face {
    font-family: "Source Serif 4";
    font-weight: 600;
    font-display: swap;
    src: url("/static/fonts/source-serif-4-600.woff2") format("woff2");
}

:root {
    --bg: #0a0a0b;
    --bg2: var(--bg);
    --fg: #e8e6e1;
    --mut: #9f9d9a;
    --acc: #ffb000;
    --acc2: #ff5c5c;
    --h3: var(--mut);
    --ok: #6fcf97;
    --bad: #ff5c5c;
    --warn: #ffb000;
    --card: #111113;
    --line: #26262a;
    --grid: #ffffff10;
    --radius: 6px;
    --border-style: solid;
    --shadow: none;
    --font-ui: "IBM Plex Mono", monospace;
    --font-mono: "IBM Plex Mono", monospace;
    --font-display: Orbitron, sans-serif;
    --scanlines: 0;
    --grid-floor: 0;
    --glow: 0px;
    --corners: 0;
    --heading-prefix: "";
    --cursor: "";
    --upper: none;
    --tracking: 0;
    --bar-fill: linear-gradient(90deg, var(--acc), var(--bad));
    --ramp-0: var(--acc);
    --ramp-1: color-mix(in srgb, var(--acc), var(--warn));
    --ramp-2: var(--warn);
    --ramp-3: color-mix(in srgb, var(--warn) 75%, var(--bad));
    --ramp-4: color-mix(in srgb, var(--warn) 40%, var(--bad));
    --ramp-5: var(--bad);
    --bar-bg: var(--line);
    --bar-border: 0;
    --gap: 12px;
    --pad: 14px;
}
* {
    box-sizing: border-box;
    margin: 0;
}
.stage {
    min-height: calc(100vh - 45px);
    padding: 24px;
    background: linear-gradient(var(--bg) 60%, var(--bg2));
    color: var(--fg);
    font-family: var(--font-ui);
    position: relative;
    overflow: hidden;
}
.stage::before {
    content: "";
    position: absolute;
    left: -20%;
    right: -20%;
    bottom: 0;
    height: 32%;
    pointer-events: none;
    opacity: var(--grid-floor);
    background:
        repeating-linear-gradient(90deg, var(--grid) 0 1px, transparent 1px 60px),
        repeating-linear-gradient(0deg, var(--grid) 0 1px, transparent 1px 40px);
    transform: perspective(300px) rotateX(55deg);
    transform-origin: bottom;
}
.stage::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: var(--scanlines);
    background: repeating-linear-gradient(0deg, #0000 0 2px, #000 2px 3px);
}

.top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    margin-bottom: var(--gap);
    position: relative;
    z-index: 1;
}
.clock {
    font: 600 30px var(--font-display);
    letter-spacing: -0.02em;
    text-shadow: 0 0 var(--glow) var(--acc);
}
.clock::after {
    content: var(--cursor);
    color: var(--acc2);
    animation: blink 1s steps(1) infinite;
    margin-left: 6px;
    font-size: 0.6em;
}
.date {
    color: var(--mut);
    font: 14px var(--font-mono);
    text-transform: var(--upper);
    letter-spacing: var(--tracking);
}

.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--gap);
    position: relative;
    z-index: 1;
}
.card {
    grid-column: span 4;
    position: relative;
    background: var(--card);
    border: 1px var(--border-style) var(--line);
    border-radius: var(--radius);
    padding: var(--pad);
    box-shadow: var(--shadow);
    min-width: 0;
}
.card.w6 {
    grid-column: span 6;
}
.card.w3 {
    grid-column: span 3;
}
.card::before,
.card::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid var(--acc2);
    opacity: var(--corners);
}
.card::before {
    top: -2px;
    left: -2px;
    border-right: 0;
    border-bottom: 0;
}
.card::after {
    bottom: -2px;
    right: -2px;
    border-left: 0;
    border-top: 0;
}
.card h3 {
    display: block;
    font: 600 13px var(--font-mono);
    text-transform: var(--upper);
    letter-spacing: var(--tracking);
    color: var(--h3);
    margin-bottom: 12px;
}
.card hq-fragment h3:not(:first-child) {
    margin-top: 20px;
}
.card h3::before {
    content: var(--heading-prefix);
    color: var(--acc2);
}
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
}
.tile {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px var(--border-style) var(--line);
    border-radius: calc(var(--radius) * 0.8);
    font: 13px var(--font-ui);
    cursor: pointer;
    transition: 0.15s;
    position: relative;
}
.tile b {
    font: 700 19px var(--font-display);
    color: var(--acc);
    text-shadow: 0 0 var(--glow) var(--acc);
}
.tile:hover {
    border-color: var(--acc);
    transform: translateY(-2px);
}
.row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
    font-size: 15px;
    gap: 10px;
}
.row:last-child {
    border: 0;
}
.row .v {
    font: 15px var(--font-mono);
    white-space: nowrap;
}
.row > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.row .m {
    white-space: nowrap;
    color: var(--mut);
    font: 13px var(--font-mono);
}
.big {
    font: 700 40px var(--font-display);
    letter-spacing: -0.03em;
    line-height: 1;
    text-shadow: 0 0 var(--glow) var(--acc);
}
.big small {
    font: 15px var(--font-mono);
    color: var(--mut);
    letter-spacing: 0;
    margin-left: 6px;
    text-shadow: none;
}
.bar {
    height: 10px;
    background: var(--bar-bg);
    border: var(--bar-border);
    border-radius: calc(var(--radius) * 0.5);
    overflow: hidden;
    margin: 10px 0 6px;
}
.bar > i {
    display: block;
    height: 100%;
    width: 91%;
    background: var(--bar-fill);
}

.card h3 i {
    float: right;
    font-style: normal;
    color: var(--acc2);
}
svg.spark {
    width: 100%;
    height: 36px;
    display: block;
}
svg.spark path {
    fill: none;
    stroke: var(--acc);
    stroke-width: 1.6;
    vector-effect: non-scaling-stroke;
}
svg.spark path.f {
    fill: var(--acc);
    fill-opacity: 0.12;
    stroke: none;
}
.vit {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 18px;
}
.vit span {
    font: 13px var(--font-mono);
    color: var(--mut);
    display: flex;
    justify-content: space-between;
}
.vit b {
    font: 600 17px var(--font-mono);
}
.alert {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--bad);
    border-radius: calc(var(--radius) * 0.6);
    font-size: 14px;
    margin-bottom: 8px;
}
.alert.w {
    border-color: var(--warn);
}
.alert::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bad);
    animation: blink 1.6s infinite;
    flex: none;
}
.alert.w::before {
    background: var(--warn);
}
.alert u {
    margin-left: auto;
    font: 13px var(--font-mono);
    color: var(--mut);
    text-decoration: none;
    cursor: pointer;
}
.poster {
    aspect-ratio: 2 / 3;
    border-radius: calc(var(--radius) * 0.6);
    display: flex;
    align-items: flex-end;
    padding: 6px;
    font: 600 12px var(--font-ui);
    color: #fff;
    background: linear-gradient(160deg, var(--c1), var(--c2));
    text-shadow: 0 1px 4px #0008;
}
.np {
    display: flex;
    gap: 12px;
    align-items: center;
}
.np .art {
    width: 54px;
    height: 54px;
    border-radius: calc(var(--radius) * 0.7);
    background: linear-gradient(135deg, var(--acc), var(--acc2));
    flex: none;
}
.np .t {
    font-weight: 600;
    font-size: 16px;
}
.np .s {
    font: 13px var(--font-mono);
    color: var(--mut);
}
@keyframes blink {
    50% {
        opacity: 0.25;
    }
}
/* tablet: two columns, wide cards (span > 6) take the full row */
@media (max-width: 1100px) {
    .stage {
        overflow: visible;
        overflow-x: clip;
    }
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }
    .card,
    .card.w6,
    .card.w3 {
        grid-column: span 1 !important;
        grid-row: auto !important;
    }
    .card[data-wide] {
        grid-column: span 2 !important;
    }
}

/* phone: one column, rooms move to a bottom bar */
@media (max-width: 600px) {
    .stage {
        padding: 14px 14px calc(76px + env(safe-area-inset-bottom));
    }
    .grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .card,
    .card[data-wide] {
        grid-column: span 1 !important;
    }
    .clock {
        font-size: 24px;
    }
}

/* touch: iOS zooms into inputs under 16px */
@media (pointer: coarse) {
    #pal input {
        font-size: 16px;
    }
    #pal .it {
        padding: 13px 18px;
    }
}

/* command palette */
#pal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: max(14vh, env(safe-area-inset-top));
    background: #0009;
    backdrop-filter: blur(4px);
    z-index: 100;
}
#pal.on {
    display: flex;
}
#pal .box {
    width: min(620px, 92vw);
    background: var(--bg);
    border: 1px var(--border-style) var(--acc);
    border-radius: var(--radius);
    box-shadow: 0 30px 80px #000a;
    overflow: hidden;
    color: var(--fg);
    font-family: var(--font-ui);
}
#pal input {
    width: 100%;
    padding: 16px 18px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    color: var(--fg);
    font: 18px var(--font-mono);
    outline: 0;
}
#pal .it {
    padding: 10px 18px;
    display: flex;
    gap: 12px;
    font-size: 15px;
}
#pal .it.on {
    background: color-mix(in srgb, var(--acc) 18%, transparent);
}
#pal .it img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    align-self: center;
}

#pal .it small {
    margin-left: auto;
    font: 13px var(--font-mono);
    color: var(--mut);
}
