/* ═══════════════════════════════════════════════════════════════════════════
   Bullpen — a departure board for an agency bullpen.

   The reference is transit signage: read from across a room, never clicked,
   on all day. Condensed caps for structure, mono for anything numeric,
   one amber accent spent only on things that are *live* (the watchlist, the
   bell that actually rang, today's column).

   Chart colors are validated for CVD separation and contrast:
   under #4098CB / over #DD5F52 — ΔE 18.1 protan, 31.8 tritan, both >4.5:1.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --ground:   #0E1420;
  --panel:    #161E2E;
  --panel-2:  #1C2639;
  --rule:     #26314A;
  --rule-2:   #33405E;

  --ink:      #EEF2F8;
  --ink-2:    #9AA8C0;
  --ink-3:    #7C8BA6;

  --amber:    #F5B23C;
  --amber-dim:#7A5A1E;
  --under:    #4098CB;
  --over:     #DD5F52;

  /* Wordmark only. Kept separate from --over so the chart's "over the line"
     red keeps meaning one thing. 5.2:1 on --ground, clears AA. */
  --brand-red: #DD5F52;

  --display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --body:    'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --gap: 0.7rem;
  --pad: 1.1rem;
  --ui-scale: 1;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  /* Read from the middle of the bullpen, not from a desk. The `+`/`-` keys
     still scale on top of this for the room's actual viewing distance. */
  font-size: calc(clamp(15px, 0.95vw + 5px, 26px) * var(--ui-scale));
  background: var(--ground);
}

body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

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

/* ── Top rail ─────────────────────────────────────────────────────────────
   The one horizontal band that ties the three panels together, and the only
   place the live clock lives. */

.rail {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 0.5rem var(--pad) 0.45rem;
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
}

.rail__mark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
}

.rail__mark-accent { color: var(--brand-red); }

.rail__rule {
  flex: 1;
  height: 1px;
  background: var(--rule-2);
  align-self: center;
}

.rail__date,
.rail__status {
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.rail__status { color: var(--ink-3); min-width: 9ch; text-align: right; }
.rail__status[data-state="stalled"] { color: var(--over); }

.rail__clock {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--ink);
}

/* ── Deck: the three-panel grid ───────────────────────────────────────────
   Wire is a full-height column; bell and menu stack beside it. */

.deck {
  display: grid;
  grid-template-columns: minmax(21rem, 37fr) 31.5fr 31.5fr;
  grid-template-rows: 1.3fr 1fr;
  grid-template-areas:
    "wire bell spot"
    "wire mess mess";
  gap: var(--gap);
  padding: var(--gap);
  height: calc(100vh - 2.6rem);
  height: calc(100dvh - 2.6rem);
}

.panel--wire { grid-area: wire; }
.panel--bell { grid-area: bell; }
.panel--spot { grid-area: spot; }
.panel--mess { grid-area: mess; }

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;   /* lets the inner scroller actually scroll */
  min-width: 0;
  padding: var(--pad);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 3px;
}

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0.7rem;
  border-bottom: 1px solid var(--rule);
}

.panel__title {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.panel__meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  white-space: nowrap;
}

/* ── Watchlist ────────────────────────────────────────────────────────────
   The signature element. The brief exists because an ad-platform launch got
   missed, so keyword-matched items are lifted out of the flow and held here
   in amber instead of scrolling past. */

.watch {
  margin-bottom: 0.8rem;
  padding: 0.55rem 0.7rem 0.6rem;
  background: linear-gradient(180deg, rgba(245,178,60,0.10), rgba(245,178,60,0.02));
  border: 1px solid var(--amber-dim);
  border-left: 3px solid var(--amber);
  border-radius: 2px;
}

.watch__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.watch__label {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
}

.watch__hint {
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.03em;
  color: var(--ink-3);
}

.watch__list { list-style: none; margin: 0; padding: 0; }

.watch__list li + li {
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(245,178,60,0.18);
}

.watch__title {
  display: block;
  font-size: 1.14rem;
  font-weight: 500;
  line-height: 1.28;
  color: var(--ink);
}

.watch__src {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--amber);
}

/* ── The wire ─────────────────────────────────────────────────────────── */

.wire {
  flex: 1;
  min-height: 0;
  overflow: hidden;          /* auto-scrolled by app.js, never by a scrollbar */
  position: relative;
  mask-image: linear-gradient(180deg, transparent 0, #000 1.4rem, #000 calc(100% - 1.8rem), transparent 100%);
}

.wire__list {
  list-style: none;
  margin: 0;
  padding: 0.2rem 0 2rem;
  perspective: 800px;
}

.wire__item {
  padding: 0.62rem 0;
  border-bottom: 1px solid var(--rule);
  transform-origin: 50% 0;
}

.wire__top {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin-bottom: 0.18rem;
}

.tag {
  flex: none;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.13em;
  padding: 0.05rem 0.32rem;
  border: 1px solid currentColor;
  border-radius: 2px;
  text-transform: uppercase;
}

.tag[data-topic="ADS"] { color: var(--over); }
.tag[data-topic="AI"]  { color: var(--amber); }
.tag[data-topic="DEV"] { color: var(--under); }
.tag[data-topic="SEO"] { color: var(--ink-2); }

.wire__src {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wire__age {
  margin-left: auto;
  flex: none;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.wire__title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink);
}

/* The split-flap arrival. Only new items get it, and only in the wire —
   this is the one place motion is spent. */
@keyframes flap-in {
  0%   { transform: rotateX(-90deg); opacity: 0; }
  60%  { transform: rotateX(10deg);  opacity: 1; }
  80%  { transform: rotateX(-4deg); }
  100% { transform: rotateX(0);      opacity: 1; }
}

.wire__item--new { animation: flap-in 420ms cubic-bezier(0.2, 0.7, 0.3, 1) both; }

/* ── Lunch bell ───────────────────────────────────────────────────────── */

.chip {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  color: var(--ink-2);
  white-space: nowrap;
}

.chip[data-state="rung"] {
  color: var(--amber);
  border-color: var(--amber-dim);
  background: rgba(245,178,60,0.08);
}

.stats {
  display: flex;
  gap: 1.6rem;
  margin-bottom: 0.5rem;
}

.stat { display: flex; flex-direction: column; gap: 0.1rem; }

.stat__label {
  font-family: var(--display);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.stat__value {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.1;
  color: var(--ink);
}

.stat--accent .stat__value { color: var(--amber); }
.stat--accent .stat__value[data-pending="true"] { color: var(--ink-3); }

.chart {
  flex: 1;
  min-height: 0;
  position: relative;
  margin-top: 0.2rem;
}

.chart svg { display: block; width: 100%; height: 100%; }

.empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-3);
}

/* `display:grid` above outranks the UA's [hidden]{display:none}, so restate it. */
.empty[hidden] { display: none; }

.history {
  flex: none;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--rule);
}

.history__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.15rem;
}

.history__label {
  font-family: var(--display);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.history__meta {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-3);
}

#history-svg { width: 100%; height: 2.5rem; }

/* ── Menu ─────────────────────────────────────────────────────────────── */

.mess {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--gap);
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: none;
}

.mess__day {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.6rem 0.7rem;
  background: var(--panel-2);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--rule-2);
  border-radius: 2px;
}

.mess__day[data-today="true"] {
  border-top-color: var(--amber);
  background: linear-gradient(180deg, rgba(245,178,60,0.08), rgba(245,178,60,0.01)), var(--panel-2);
}

.mess__day[data-past="true"] { opacity: 0.45; }

.mess__name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.35rem;
}

.mess__day[data-today="true"] .mess__name { color: var(--amber); }

/* Breakfast sits above lunch, split by a hairline so the two tiers read as
   separate meals rather than one long dish name. */
.mess__tier { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.mess__tier + .mess__tier {
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--rule);
}

.mess__meal {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.15rem;
}

.mess__dish {
  font-family: var(--display);
  font-size: 1.38rem;
  font-weight: 600;
  line-height: 1.12;
  color: var(--ink);
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.mess__blank {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-3);
}

/* ── Spare tile ───────────────────────────────────────────────────────────
   Whatever lands here gets the panel's full body and is centred. Media is
   contained rather than cropped so a swapped-in gif of any ratio still fits. */

.spot {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spot__media {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ── Refetch: hold the last render, dim it. Never a skeleton flash. ────── */
.is-refreshing { opacity: 0.62; transition: opacity 140ms ease; }

/* ═══ Phone page ══════════════════════════════════════════════════════════ */

.page {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.2rem 1.1rem 4rem;
}

.page__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 0.15rem;
}

.page__sub {
  margin: 0 0 1.4rem;
  font-size: 0.92rem;
  color: var(--ink-2);
}

.card {
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 3px;
}

.card__title {
  margin: 0 0 0.8rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.field { margin-bottom: 0.8rem; }

.field__label {
  display: block;
  margin-bottom: 0.25rem;
  font-family: var(--display);
  font-size: 0.9rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.field__hint {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-3);
}

.input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font-family: var(--body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--ground);
  border: 1px solid var(--rule-2);
  border-radius: 2px;
}

.input:focus-visible { border-color: var(--amber); }

.menu-grid__meal {
  display: block;
  margin: 0.5rem 0 0.2rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.row { display: flex; gap: 0.6rem; }
.row > .field { flex: 1; margin-bottom: 0.8rem; }

.btn {
  width: 100%;
  padding: 0.7rem 1rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ground);
  background: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 2px;
  cursor: pointer;
}

.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: default; filter: none; }

.btn--quiet {
  color: var(--ink);
  background: transparent;
  border-color: var(--rule-2);
}

.note {
  margin: 0.7rem 0 0;
  padding: 0.55rem 0.7rem;
  font-size: 0.88rem;
  border-radius: 2px;
  border-left: 3px solid var(--rule-2);
  background: var(--panel-2);
  color: var(--ink-2);
}

.note[data-tone="ok"]   { border-left-color: var(--under); color: var(--ink); }
.note[data-tone="bad"]  { border-left-color: var(--over);  color: var(--ink); }
.note[hidden] { display: none; }

.standings { list-style: none; margin: 0; padding: 0; }

.standings li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.95rem;
}

.standings li:last-child { border-bottom: 0; }

.standings__time {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.standings li[data-side="under"] .standings__time { color: var(--under); }
.standings li[data-side="over"]  .standings__time { color: var(--over); }
.standings li[data-winner="true"] { color: var(--amber); font-weight: 600; }

.details { margin-bottom: 1rem; }

.details > summary {
  cursor: pointer;
  padding: 0.6rem 0;
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.menu-grid { display: grid; gap: 0.6rem; }

@media (max-width: 600px) {
  .row { flex-direction: column; gap: 0; }
}

/* ── Motion & contrast preferences ───────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .wire__item--new { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

@media (forced-colors: active) {
  .panel, .card, .mess__day { border: 1px solid CanvasText; }
  .tag { border: 1px solid CanvasText; }
}
