/* board.css: layout, panels, motion, per-theme structure
   Part of crash-board board-web. Generated from the design bench, then
   maintained by hand. Plain classic scripts, no build step, same as the
   parent project. */

/* The board carries its own reset: embed.html loads this file on its own,
   without the page chrome that used to provide it. */
.stage, .board, .board *, .board *::before, .board *::after { box-sizing: border-box; }

/* ==========================================================================
   BOARD REPLICA
   Authored at a true 1600x900 and scaled to fit, so proportions match the
   1080p kiosk instead of being re-guessed at page width.
   ========================================================================== */
.stage { position: relative; overflow: hidden; border: 1px solid var(--rule-hard); background: #000; }

.board {
    /* board-scoped tokens, overwritten per theme by JS */
    --b-ground:#000; --b-panel:#000; --b-ink:#fff; --b-dim:#888;
    --b-accent:#ff8800; --b-accent-2:#ff8800; --b-accent-3:#fff;
    --b-on-accent:#000; --b-rule:#333; --b-edge:#ff8800;
    --b-border:3px; --b-radius:0px; --b-track:0em; --b-glow:none;
    --b-display:"Helvetica Neue", Helvetica, Arial, sans-serif;
    --b-body:"Helvetica Neue", Helvetica, Arial, sans-serif;
    --b-data:"Sixtyfour", monospace;

    width: 1600px; height: 900px;
    transform-origin: top left; position: relative;
    background: var(--b-ground); color: var(--b-ink);
    font-family: var(--b-body);
    overflow: hidden; display: flex; flex-direction: column;
    transition: background .35s ease, color .35s ease;
}

/* FX canvases. Back sits under the panels, front rides over everything. */
#fx-back  { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
#fx-front { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
#fx-back, #fx-front { image-rendering: pixelated; }

/* Content sits between the two canvases. */
.top-row, .bottom-row, .info-bar { position: relative; z-index: 2; }

.top-row {
    display: grid; grid-template-columns: repeat(6, 1fr);
    gap: 13px; padding: 17px 17px 9px; height: 560px;
}
.bottom-row {
    display: grid; grid-template-columns: 1fr 1fr 1fr;
    gap: 13px; padding: 9px 17px; height: 258px;
}

.panel {
    background: var(--b-panel);
    border: var(--b-border) solid var(--b-edge);
    border-radius: var(--b-radius);
    padding: 15px; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: var(--b-glow);
    transition: border-color .35s ease, background .35s ease, box-shadow .35s ease;
}
.panel-title {
    font-family: var(--b-display);
    font-size: 21px; font-weight: 700;
    letter-spacing: calc(.06em + var(--b-track));
    text-transform: uppercase; color: var(--b-accent);
    border-bottom: 2px solid var(--b-rule);
    padding-bottom: 8px; margin-bottom: 10px;
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 8px; flex: none;
}
.panel-title .aux { font-family: var(--b-data); font-size: 12px; color: var(--b-dim); letter-spacing: 0; }

/* ===== Event cards ===== */
.ev {
    background: var(--b-panel);
    border: var(--b-border) solid var(--b-edge);
    border-radius: var(--b-radius);
    padding: 16px 14px;
    display: flex; flex-direction: column;
    position: relative; overflow: hidden;
    box-shadow: var(--b-glow);
    transition: border-color .35s ease, background .35s ease, box-shadow .35s ease;
}
.ev-time { font-family: var(--b-data); font-size: 27px; color: var(--b-accent); line-height: 1.15; }
.ev-date { font-size: 17px; color: var(--b-dim); font-weight: 600; margin-top: 5px; letter-spacing: var(--b-track); }
.ev-title { font-size: 29px; font-weight: 700; line-height: 1.1; margin-top: 11px; letter-spacing: var(--b-track); }
.ev-desc { font-size: 16px; color: var(--b-dim); line-height: 1.35; margin-top: 9px; }
.ev-tags { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; }
.tag {
    font-size: 13px; font-weight: 700; text-transform: uppercase;
    letter-spacing: calc(.05em + var(--b-track));
    padding: 4px 8px 3px;
    border: 2px solid var(--b-accent); color: var(--b-accent);
    border-radius: var(--b-radius);
}
.tag.alt { border-color: var(--b-accent-2); color: var(--b-accent-2); }

/* The board's core inversion rule: live means accent fill, ground-colored text. */
.ev.live { background: var(--b-accent); color: var(--b-on-accent); }
.ev.live .ev-time, .ev.live .ev-date, .ev.live .ev-desc { color: var(--b-on-accent); opacity: .82; }
.ev.live .ev-time { opacity: 1; }
.ev.live .tag, .ev.live .tag.alt { border-color: var(--b-on-accent); color: var(--b-on-accent); }

/* ===== Printers ===== */
.printers .rows { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.pr {
    flex: 1 1 0; display: flex; flex-direction: column; justify-content: center;
    gap: 3px; border-bottom: 1px solid var(--b-rule); padding: 6px 0;
}
.pr:last-child { border-bottom: none; }
.pr-name { font-size: 25px; font-weight: 700; line-height: 1.05; letter-spacing: var(--b-track); }
.pr-model { font-size: 14px; color: var(--b-dim); }
.pr-state { font-size: 18px; font-weight: 700; color: var(--b-dim); }
.pr-eta { font-family: var(--b-data); font-size: 15px; }
.pr.active { background: var(--b-accent); color: var(--b-on-accent); margin: 0 -15px; padding: 10px 15px; border-bottom: none; }
.pr.active .pr-model { color: var(--b-on-accent); opacity: .62; }

/* ===== Buses ===== */
.buses .rows { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.bus {
    flex: 1 1 0; display: flex; flex-direction: column; justify-content: center;
    border-bottom: 1px solid var(--b-rule); padding: 8px 0; gap: 3px;
}
.bus:last-child { border-bottom: none; }
.bus-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.bus-route { font-size: 30px; font-weight: 700; color: var(--b-accent); line-height: 1; letter-spacing: var(--b-track); }
.bus-route.alt { color: var(--b-accent-2); }
.bus-sub { font-size: 19px; font-weight: 600; letter-spacing: var(--b-track); }
.bus-stop { font-size: 13px; color: var(--b-dim); width: 100%; }
.bus-line { font-size: 16px; color: var(--b-dim); display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.num { font-family: var(--b-data); font-size: 19px; color: var(--b-ink); display: inline-block; font-variant-numeric: tabular-nums; }
.num.hot { color: var(--b-accent); }
.bus-line.following .num { font-size: 15px; }

/* ===== Future events ===== */
.future .rows { display: flex; flex-direction: column; overflow: hidden; flex: 1; }
.fe {
    display: grid; grid-template-columns: 30px 58px 54px 1fr;
    gap: 8px; align-items: baseline; font-size: 17px;
    padding: 5px 0; border-bottom: 1px solid var(--b-rule);
}
.fe .n { color: var(--b-dim); font-family: var(--b-data); font-size: 12px; }
.fe .d { color: var(--b-dim); font-weight: 600; }
.fe .t { font-family: var(--b-data); font-size: 14px; color: var(--b-accent); }
.fe .ti { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: var(--b-track); }

/* ===== Weather ===== */
.weather .wx-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.wx-cond { font-size: 22px; font-weight: 700; line-height: 1.15; letter-spacing: var(--b-track); }
.wx-hilo { font-size: 17px; color: var(--b-dim); margin-top: 3px; }
.wx-det { font-size: 14px; color: var(--b-dim); margin-top: 3px; }
.wx-temp { font-family: var(--b-data); font-size: 46px; color: var(--b-accent); line-height: 1; }
.wx-fc { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; margin-top: auto; padding-top: 8px; }
.wx-cell { display: flex; justify-content: space-between; font-size: 15px; gap: 8px; }
.wx-cell b { font-weight: 600; }
.wx-cell span { font-family: var(--b-data); font-size: 13px; color: var(--b-accent-2); }

/* ===== Mesh panel ===== */
.mesh .rows { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.mesh-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--b-accent); display: inline-block; margin-right: 5px; }
.nd {
    display: grid; grid-template-columns: 62px 1fr 62px 44px;
    gap: 8px; align-items: baseline; padding: 6px 0;
    border-bottom: 1px solid var(--b-rule); font-size: 15px;
}
.nd:last-child { border-bottom: none; }
.nd .short { font-family: var(--b-data); font-size: 16px; color: var(--b-accent); }
.nd .long { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: var(--b-track); }
.nd .snr, .nd .age { font-family: var(--b-data); font-size: 12px; color: var(--b-dim); text-align: right; }
.nd.fresh .age { color: var(--b-accent-2); }
.pk {
    display: grid; grid-template-columns: 74px 58px 1fr 40px;
    gap: 8px; align-items: baseline; padding: 5px 0;
    border-bottom: 1px solid var(--b-rule); font-size: 15px;
}
.pk:last-child { border-bottom: none; }
.pk .ts { font-family: var(--b-data); font-size: 12px; color: var(--b-dim); }
.pk .who { font-family: var(--b-data); font-size: 14px; color: var(--b-accent); }
.pk .kind { font-weight: 700; font-size: 15px; letter-spacing: calc(.04em + var(--b-track)); }
.pk .hops { font-family: var(--b-data); font-size: 12px; color: var(--b-dim); text-align: right; }
.pk.text .kind { color: var(--b-accent-2); }

/* Display face is for headings and labels only; running text uses --b-body. */
.panel-title, .ev-title, .bus-route, .info-date, .pr-name, .wx-cond, .tag {
    font-family: var(--b-display);
}

/* ===== Info bar ===== */
.info-bar {
    margin-top: auto; height: 84px;
    border-top: var(--b-border) solid var(--b-accent);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 34px; flex: none;
}
/* Open/closed, sized to read from the far end of the room. Closed is an
   outline, open is a filled block: the board's inversion rule, again. */
.info-status {
    font-family: var(--b-display);
    font-size: 30px; font-weight: 700;
    letter-spacing: calc(.05em + var(--b-track));
    padding: 7px 18px 5px;
    border: var(--b-border) solid var(--b-accent);
    border-radius: var(--b-radius);
    color: var(--b-accent);
    white-space: nowrap;
}
.info-status.open { background: var(--b-accent); color: var(--b-on-accent); }
.info-status.closed { color: var(--b-dim); border-color: var(--b-rule); }

.info-date { font-size: 35px; font-weight: 600; letter-spacing: var(--b-track); }
.info-clock { font-family: var(--b-data); font-size: 53px; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   MOTION
   Four data moments. Split-flap is the board's native vocabulary, so values
   flip rather than fade.
   ========================================================================== */
@keyframes flap-in  { 0% { transform: rotateX(-92deg); opacity: 0; } 60% { transform: rotateX(8deg); opacity: 1; } 100% { transform: rotateX(0); opacity: 1; } }
@keyframes flap-out { 0% { transform: rotateX(0); opacity: 1; } 100% { transform: rotateX(92deg); opacity: 0; } }
@keyframes row-enter { 0% { max-height: 0; opacity: 0; transform: translateY(-6px); } 100% { max-height: 90px; opacity: 1; transform: translateY(0); } }
@keyframes row-leave { 0% { max-height: 90px; opacity: 1; } 100% { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; } }
@keyframes brd-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes flash-accent { 0% { background: var(--b-accent); color: var(--b-on-accent); } 100% { background: transparent; } }

.flap { display: inline-block; transform-origin: top center; backface-visibility: hidden; }
/* Per-character cells, so only the digits that actually changed turn over. */
.cell { display: inline-block; transform-origin: top center; backface-visibility: hidden; }
.cell.turn { animation: flap-in .22s cubic-bezier(.2,.9,.3,1.15); }
.flap.out { animation: flap-out .16s ease-in forwards; }
.flap.in  { animation: flap-in .28s cubic-bezier(.2,.9,.3,1.2) forwards; }
.row-in { animation: row-enter .42s cubic-bezier(.2,.9,.3,1.05); overflow: hidden; }
.pk.row-in { animation: row-enter .34s ease-out, flash-accent .9s ease-out .1s; }
.num.brd { animation: brd-pulse 1s ease-in-out infinite; color: var(--b-accent); }

.ev .drain {
    position: absolute; inset: 0; background: var(--b-panel);
    transform: scaleX(0); transform-origin: left center;
    z-index: 1; pointer-events: none;
}
.ev.ending .drain { animation: drain-wipe .85s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes drain-wipe { to { transform: scaleX(1); } }
.ev .stamp {
    position: absolute; inset: 0; z-index: 3; opacity: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 40px; font-weight: 700; letter-spacing: .1em;
    color: var(--b-accent);
    border: var(--b-border) solid var(--b-accent);
    background: color-mix(in srgb, var(--b-ground) 78%, transparent);
    pointer-events: none;
}
.ev.ending .stamp { animation: stamp-land 1.5s ease-out .55s forwards; }
@keyframes stamp-land {
    0% { opacity: 0; transform: scale(1.35); } 18% { opacity: 1; transform: scale(1); }
    72% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1); }
}
.ev-body { display: flex; flex-direction: column; flex: 1; position: relative; z-index: 2; }
.ev.advancing .ev-body { animation: advance .5s cubic-bezier(.2,.9,.3,1); }
@keyframes advance { 0% { opacity: 0; transform: translateY(26px); } 100% { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
    .flap.in, .flap.out, .row-in, .pk.row-in, .num.brd,
    .ev.ending .drain, .ev.ending .stamp, .ev.advancing .ev-body { animation: none !important; }
    .board, .board * { animation: none !important; }
}

/* ==========================================================================
   PER-THEME STRUCTURE
   Colors and fonts arrive as tokens. What lives here is the structural
   flourish each family needs that a token cannot carry. Everything moving
   is drawn on the two canvases instead.
   ========================================================================== */

/* --- Cyberpunk: the glitch displacement, driven by a class from JS --- */
.board.glitch .top-row    { animation: glitch-a .16s steps(2) both; }
.board.glitch .bottom-row { animation: glitch-b .16s steps(2) both; }
.board.glitch .info-bar   { animation: glitch-a .12s steps(2) both; }
@keyframes glitch-a { 0% { transform: translate3d(0,0,0); } 50% { transform: translate3d(calc(-6px * var(--gx,1)),0,0); } 100% { transform: none; } }
@keyframes glitch-b { 0% { transform: none; } 50% { transform: translate3d(calc(9px * var(--gx,1)),0,0); } 100% { transform: none; } }
.board.glitch .panel-title, .board.glitch .ev-title {
    text-shadow: calc(-2px * var(--gx,1)) 0 var(--b-accent), calc(2px * var(--gx,1)) 0 var(--b-accent-2);
}

/* --- Retro: chunky notched corners read as pixel art at any scale --- */
.board[data-pixel="1"] .panel, .board[data-pixel="1"] .ev {
    clip-path: polygon(
        8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px),
        calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
    border-radius: 0;
}
.board[data-pixel="1"] .tag { border-radius: 0; }
.board[data-pixel="1"] .panel-title { font-size: 15px; letter-spacing: 0; }
.board[data-pixel="1"] .ev-title { font-size: 20px; line-height: 1.35; }
.board[data-pixel="1"] .bus-sub { font-size: 14px; }
.board[data-pixel="1"] .pr-name { font-size: 17px; line-height: 1.3; }
.board[data-pixel="1"] .wx-cond { font-size: 15px; line-height: 1.4; }
.board[data-pixel="1"] .fe .ti, .board[data-pixel="1"] .nd .long { font-size: 13px; }
.board[data-pixel="1"] .info-date { font-size: 22px; }
.board[data-pixel="1"] .tag { font-size: 9px; padding: 5px 7px 4px; }
/* VT323 sets small for its point size, so body copy gets a bump back up. */
.board[data-pixel="1"] .ev-desc { font-size: 19px; line-height: 1.2; }
.board[data-pixel="1"] .bus-line, .board[data-pixel="1"] .fe,
.board[data-pixel="1"] .nd, .board[data-pixel="1"] .pk { font-size: 19px; }
.board[data-pixel="1"] .pr-model, .board[data-pixel="1"] .bus-stop,
.board[data-pixel="1"] .wx-det { font-size: 16px; }
.board[data-pixel="1"] .ev-date, .board[data-pixel="1"] .pr-state { font-size: 19px; }

/* --- Games: voxel, cel and vector are not pixel art, so they keep normal type
       and get their weight from edges and offsets instead --- */
.board[data-theme="gam-voxel"] .panel, .board[data-theme="gam-voxel"] .ev {
    border-width: 5px; border-radius: 0;
}
.board[data-theme="gam-cel"] .panel, .board[data-theme="gam-cel"] .ev {
    border-width: 5px; border-radius: 3px;
}
.board[data-theme="gam-cel"] .panel-title, .board[data-theme="gam-cel"] .ev-title {
    -webkit-text-stroke: 0.6px var(--b-ground);
}
.board[data-theme="gam-vector"] .panel, .board[data-theme="gam-vector"] .ev {
    border-width: 2px; border-radius: 0;
}

/* --- Programming: mock window controls, only ever shown here --- */
.wctl { display: none; gap: 5px; align-items: center; }
.wctl i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.wctl i:nth-child(1) { background: var(--b-accent-3); }
.wctl i:nth-child(2) { background: var(--b-accent-2); }
.wctl i:nth-child(3) { background: var(--b-accent); }
.board[data-fam="programming"] .wctl { display: flex; }
.panel-title > span:first-child { flex: 1; }

/* --- Circuitry: the border is drawn as a trace on canvas, so hide the CSS one --- */
.board[data-fam="circuitry"] .panel-title::after {
    content: attr(data-ref);
    font-family: "IBM Plex Mono", monospace; font-size: 12px;
    color: var(--b-dim); letter-spacing: 0;
}

/* --- Programming: titles are line comments, and the caret blinks --- */
.board[data-fam="programming"] .panel-title::before { content: "// "; }
.board[data-fam="programming"] .panel-title span:first-child::after {
    content: "\2588"; margin-left: 4px; color: var(--b-accent-2);
    animation: caret 1.06s step-end infinite;
}
.board[data-fam="programming"] .ev-title::after { content: ";"; color: var(--b-dim); }
@keyframes caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* --- Plant: softer geometry, and the vine border replaces the hard edge --- */
.board[data-fam="plant"] .panel, .board[data-fam="plant"] .ev { border-width: 2px; }

/* --- Teaching: hand-drawn edges, and chalk is never quite opaque --- */
.board[data-theme="tch-chalk"] .panel, .board[data-theme="tch-chalk"] .ev {
    border-radius: 255px 12px 225px 15px / 15px 225px 15px 255px;
    border-width: 2px;
}
.board[data-theme="tch-white"] .panel, .board[data-theme="tch-white"] .ev {
    border-radius: 4px; border-width: 3px;
}
.board[data-theme="tch-chalk"] .panel-title, .board[data-theme="tch-chalk"] .ev-title,
.board[data-theme="tch-chalk"] .info-date, .board[data-theme="tch-chalk"] .pr-name {
    text-shadow: 0 0 1.5px currentColor; opacity: .93;
}
.board[data-fam="teaching"] .panel-title { font-size: 26px; letter-spacing: .02em; }
.board[data-fam="teaching"] .ev-title { font-size: 34px; }
.board[data-fam="teaching"] .info-date { font-size: 40px; }

/* --- Party: everything wants to move a little --- */
.board[data-theme="par-neon"] .panel-title, .board[data-theme="par-neon"] .bus-route {
    animation: party-hue 7s linear infinite;
}
@keyframes party-hue { 0% { filter: hue-rotate(0deg); } 100% { filter: hue-rotate(360deg); } }



/* ==========================================================================
   SOLO / EMBED
   One panel filling the frame, for iframe widgets. The panel keeps its own
   type scale, so a small frame simply scales the whole thing down.
   ========================================================================== */
.board.solo { display: block; padding: 0; }
.board.solo .solo-wrap { position: relative; z-index: 2; width: 100%; height: 100%; padding: 14px; }
.board.solo .solo-wrap > .panel,
.board.solo .solo-wrap > .ev { width: 100%; height: 100%; }
.board.solo .solo-grid {
    display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
    gap: 12px; width: 100%; height: 100%;
}
.board.solo .solo-grid > .ev { width: auto; height: auto; }

/* Embed pages have no page chrome at all. */
body.embed { margin: 0; background: transparent; overflow: hidden; }
body.embed .stage { border: none; }
