/*
  Board styles.

  Sizes are expressed in vw/vh via clamp() rather than fixed pixels, so the board
  survives being moved to a screen that isn't exactly 1920x1080 — which the
  previous version did not.

  No @import, no CDN, no web font. The system font stack is always available and
  can never stop resolving. v2 imported Font Awesome Pro from a licensed CDN
  whose subscription was tied to a staff member who has since retired.
*/

:root {
  --gap: clamp(12px, 1.2vw, 24px);
  --radius: clamp(10px, 0.9vw, 20px);

  --ink: #1c1c1e;
  --ink-soft: #5c5c66;
  --surface: #ffffff;
  --line: #e2e2e8;
  --accent: #7b1e2b;
  --warn: #8a5a00;
  --warn-bg: #fdf3dc;
  --error: #9b1c1c;
  --error-bg: #fdeaea;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(135deg, #f0dede, #f5ead3 55%, #dee7f2);
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- Header */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(16px, 2vw, 40px) clamp(20px, 2.4vw, 48px) var(--gap);
  gap: var(--gap);
}

.masthead h1 {
  margin: 0;
  font-size: clamp(24px, 2.6vw, 52px);
  color: var(--accent);
  letter-spacing: -0.01em;
}

.masthead #date {
  margin: 0.15em 0 0;
  font-size: clamp(15px, 1.5vw, 30px);
  color: var(--ink-soft);
}

#time {
  margin: 0;
  font-size: clamp(34px, 4.2vw, 84px);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* ------------------------------------------------------------------ Grid */

main {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: var(--gap);
  padding: 0 clamp(20px, 2.4vw, 48px) clamp(20px, 2.4vw, 48px);
  grid-template-columns: 1fr 1.8fr 1fr;
  grid-template-rows: 1fr 1fr;
  grid-template-areas:
    "left-top    center right-top"
    "left-bottom center right-bottom";
}

/*
  Panel placement.

  These MUST be rules here rather than inline `style="grid-area: ..."` set from
  main.js. The CSP uses `style-src 'self'`, which blocks style attributes — and
  blocks them SILENTLY, with no console error. An inline grid-area looks correct
  in the source, does nothing in the browser, and every panel quietly falls back
  to auto-placement in config order.

  Adding a slot means adding it in three places: grid-template-areas above, a
  rule here, and the SLOTS list in main.js. test/layout.test.js checks all three
  agree.
*/
[data-slot="left-top"]     { grid-area: left-top; }
[data-slot="left-bottom"]  { grid-area: left-bottom; }
[data-slot="center"]       { grid-area: center; }
[data-slot="right-top"]    { grid-area: right-top; }
[data-slot="right-bottom"] { grid-area: right-bottom; }

/* ---------------------------------------------------------------- Panels */

daily-post-panel,
announcements-panel,
coming-up-panel,
absences-panel,
schedule-panel,
lunch-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5em;
  padding: 0.7em 1em;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.panel-head h2 {
  margin: 0;
  font-size: clamp(13px, 1.05vw, 21px);
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.panel-badge {
  font-size: clamp(11px, 0.85vw, 17px);
  padding: 0.25em 0.7em;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn);
  white-space: nowrap;
}

[data-status="error"] .panel-badge {
  background: var(--error-bg);
  color: var(--error);
}

.panel-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--gap);
  overflow: hidden;
}

/* A panel showing an error gets a tinted edge — legible from across a hallway,
   which is the only distance that matters here. */
[data-status="error"] { border-color: #e8bcbc; }
[data-status="stale"] { border-color: #e8d5a8; }

/* ----------------------------------------------------------- Panel states */

.panel-note {
  margin: 0;
  text-align: center;
  font-size: clamp(16px, 1.5vw, 30px);
  color: var(--ink-soft);
}

.panel-note-error { color: var(--error); font-weight: 600; }

.panel-detail {
  margin: 0.6em 0 0;
  text-align: center;
  font-size: clamp(12px, 0.95vw, 19px);
  color: var(--ink-soft);
}

/* ------------------------------------------------------- Announcements */

.scroll-window {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin: calc(var(--gap) * -1);
  padding: var(--gap);
}

/*
  Uniform spacing via `gap`, not margin-bottom with a :last-child exception.

  The Daily Post loops by rendering its content twice and translating by the
  height of one copy. Any spacing that differs at the end of a copy shows up as
  a visible hitch at the wrap, so every gap here must be identical — including
  the one between the last card of copy 1 and the first card of copy 2.
*/
.scroll-track {
  display: flex;
  flex-direction: column;
  gap: 0.7em;
  will-change: transform;
}

.card {
  background: #fbf7ef;
  border: 1px solid #ece2cf;
  border-radius: calc(var(--radius) * 0.6);
  padding: 0.8em 1em;
  flex: none;
}

.card h3 {
  margin: 0 0 0.3em;
  font-size: clamp(16px, 1.35vw, 27px);
  color: var(--accent);
}

.card > * + * { margin-top: 0.45em; }

.card-list {
  margin: 0;
  padding-left: 1.15em;
  font-size: clamp(13px, 1.1vw, 22px);
  line-height: 1.4;
}

.card-list li { margin: 0.15em 0; }

.card p {
  margin: 0;
  font-size: clamp(13px, 1.1vw, 22px);
  line-height: 1.45;
}

/* The centre column is the main reading surface, so it gets a size bump. */
daily-post-panel .card h3 { font-size: clamp(17px, 1.5vw, 30px); }
daily-post-panel .card p,
daily-post-panel .card-list { font-size: clamp(14px, 1.22vw, 25px); }

/* ------------------------------------------------------------- Absences */

.chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  justify-content: center;
}

.chip {
  background: #f5ead3;
  border: 1px solid #e6d6b4;
  border-radius: calc(var(--radius) * 0.5);
  padding: 0.45em 0.8em;
  font-size: clamp(14px, 1.2vw, 24px);
}

/* ------------------------------------------------------------- Schedule */

.schedule { text-align: center; }

.schedule-label {
  margin: 0 0 0.2em;
  font-size: clamp(12px, 1vw, 20px);
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* The headline is either the period name or, near a transition, the countdown.
   Both need to be readable from the far end of a hallway. */
.schedule-headline {
  margin: 0;
  font-size: clamp(26px, 2.9vw, 58px);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.schedule-foot {
  margin: 0.6em 0 0;
  font-size: clamp(12px, 1.05vw, 21px);
  color: var(--ink-soft);
}

/* Inside the warning window the panel shifts colour, so a passer-by registers
   "something is about to happen" before reading any words. */
.schedule[data-tone="urgent"] .schedule-headline { color: var(--accent); }
.schedule[data-tone="urgent"] .schedule-label { color: var(--accent); opacity: 0.8; }

/* ---------------------------------------------------------------- Lunch */

.lunch {
  margin: 0;
  text-align: center;
  font-size: clamp(16px, 1.5vw, 30px);
  line-height: 1.4;
}

/* ------------------------------------------------------- Embedded frame */

/* Used by the Coming Up panel. Bleeds to the panel edges, ignoring the body
   padding, so a slide deck fills the space rather than sitting in a margin. */
.panel-frame {
  flex: 1;
  min-height: 0;
  width: calc(100% + var(--gap) * 2);
  margin: calc(var(--gap) * -1);
  border: 0;
  display: block;
  background: #000;
}

/* A panel that is deliberately unfinished reads as pending, not broken. */
[data-status="static"] .panel-body { justify-content: center; }
[data-status="static"] .panel-note { color: var(--ink-soft); }

/* -------------------------------------------------------------- Credits */

/*
  A slim colophon. Deliberately quiet — present enough to be a real
  acknowledgement, small enough that it never competes with the panels.
*/
#credits {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.6em;
  padding: 0 clamp(20px, 2.4vw, 48px) clamp(10px, 1.1vw, 20px);
  font-size: clamp(10px, 0.78vw, 15px);
  color: var(--ink-soft);
  opacity: 0.75;
  letter-spacing: 0.02em;
}

#credits .credit-sep { opacity: 0.5; }

/* ---------------------------------------------------------------- Fatal */

.fatal {
  grid-area: center;
  align-self: center;
  text-align: center;
  color: var(--error);
}
