/* The Pulse Live — full-screen rotating headline board.
   Sibling of css/pulse.css but deliberately separate: the board commits to
   one dark look in both themes and never scrolls. Typography and rhythm
   studied from brutalist.mov (Inter 900 display, wide-tracked mono labels,
   tab-bar chips); the palette is Btown Brief's own — orange / cream /
   brown / teal, with teal reserved for LOCAL. */

@font-face {
  font-family: 'InterBlack';
  src: url('../assets/fonts/inter-900-latin.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

html, body { height: 100%; }

body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #000;
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  --display: 'InterBlack', -apple-system, BlinkMacSystemFont, "Segoe UI",
             Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  /* Btown Brief brand */
  --orange: #fc560a;
  --cream: #efd9b9;
  --brown: #4e342e;
  --teal: #077f80;
  --ink: #140d08;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

button { font: inherit; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; }

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

/* ---------- masthead ---------- */

.bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 8px 14px;
  padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 3px solid var(--orange);
  white-space: nowrap;
}

.brand {
  justify-self: start;
  font-family: var(--display);
  font-weight: 900;
  font-size: 13px;
  letter-spacing: .3em;
  color: var(--cream);
  text-decoration: none;
  text-transform: uppercase;
}
.brand b { color: var(--orange); font-weight: 900; }

.broadcast {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 16px;
}
.dayrow {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}
.day {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .26em;
  color: var(--cream);
  line-height: 1.1;
}
.date {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--cream);
  opacity: .55;
  margin-top: 2px;
}
.clock-wrap { display: inline-flex; align-items: baseline; gap: 5px; }
.clock {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: .04em;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.ampm {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--orange);
  opacity: .75;
}

.status {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 14px;
}
/* the queue is the board's score: big, orange, counting down to zero.
   On a clear it inverts and briefly becomes the widen button. */
.queue-top {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  font-family: var(--mono);
  font-weight: 700;
  background: none;
  border: 1.5px solid rgba(252, 86, 10, .4);
  padding: 5px 10px;
  color: var(--orange);
  cursor: default;
  letter-spacing: .14em;
}
.queue-top b {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.queue-top .q-lbl { font-size: 9px; opacity: .85; }
.queue-top .q-min { display: none; }
.queue-top.clear {
  background: var(--orange);
  border-color: var(--orange);
  color: #000;
  cursor: pointer;
}

/* ⟲ recap + ? help — square icons riding the top bar together */
.ic-bar {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(252, 86, 10, .4);
  color: var(--orange);
  opacity: .85;
}
.ic-bar:hover { opacity: 1; }

/* READ | WATCH — the same switch the Pulse masthead carries */
.modes {
  display: flex;
  border: 1px solid rgba(252, 86, 10, .4);
  overflow: hidden;
}
.mode {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .14em;
  padding: 6px 9px;
  color: var(--orange);
  opacity: .75;
  text-decoration: none;
}
.mode + .mode { border-left: 1px solid rgba(252, 86, 10, .4); }
.mode.on { background: var(--orange); color: var(--ink); opacity: 1; }
a.mode:hover { opacity: 1; }

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 900;
  font-size: 11px;
  letter-spacing: .3em;
  background: var(--orange);
  color: var(--ink);
  text-decoration: none;
  padding: 6px 10px 5px;
}
.live-badge { cursor: pointer; }
.live-badge i {
  width: 8px; height: 8px;
  background: var(--ink);
  animation: blink 1.2s steps(2) infinite;
}
@keyframes blink { 50% { opacity: .12; } }
/* clicked: the board holds its breath */
.live-badge.frozen { background: var(--cream); }
.live-badge.frozen i { animation: none; }

/* ---------- topic chips: a tab bar, like the reference ---------- */

.chipwrap { position: relative; display: flex; align-items: stretch; }

/* the row scrolls — say so */
.chips-more {
  position: absolute;
  top: 0; right: 0; bottom: 1px;
  width: 40px;
  display: none;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  background: linear-gradient(to right, rgba(0,0,0,0), #000 60%);
  color: var(--orange);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.chipwrap.more .chips-more { display: flex; }

/* iPhone-style scroll indicator: a thumb sized to the visible fraction
   that rides along with the scroll position */
.chipbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(252, 86, 10, .12);
  pointer-events: none;
}
.chipbar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: var(--orange);
  opacity: .6;
}

.chips {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid rgba(252, 86, 10, .28);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  /* grow to fill wide screens, but never shrink into a clipped label —
     the row scrolls (and the chipbar says so) once space runs out */
  flex: 1 1 auto;
  min-width: max-content;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--orange);
  border-left: 1px solid rgba(252, 86, 10, .18);
  padding: 0 12px;
  height: 38px;
  white-space: nowrap;
  text-align: center;
  opacity: .95;
  touch-action: pan-x;
  transition: opacity .18s ease, background .18s ease, color .18s ease;
}
.chip:first-child { border-left: none; }

/* the whole-row switch — never struck, never soloed; kept small so the
   first real topics fit on a phone before any scrolling */
.chip-all {
  flex: 0 0 auto;
  color: var(--cream);
  opacity: .85;
  font-size: 9px;
  padding: 0 8px;
}
.chip-all:hover { opacity: 1; }

/* OFF: dimmed AND struck through — unmistakable at a glance */
.chip[aria-pressed="false"] {
  opacity: .45;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}
/* ON: filled orange, dark text */
.chip[aria-pressed="true"] {
  background: var(--orange);
  color: var(--ink);
  font-weight: 900;
}
/* SOLO: teal — the held-down state reads as its own mode */
.chip.solo {
  background: var(--teal);
  color: var(--cream);
  font-weight: 900;
  text-decoration: none;
  opacity: 1;
}
/* the topic a channel-surf is visiting */
.chip.surfing { box-shadow: inset 0 -3px 0 var(--cream); }

@media (max-width: 1100px) {
  .chip { flex: 0 0 auto; }
}

/* phones: pack the row so LOCAL through NEWS shows before any scrolling */
@media (max-width: 720px) {
  .chip { padding: 0 8px; letter-spacing: .12em; font-size: 10px; }
  .chip-all { padding: 0 6px; font-size: 8.5px; }
}

.hint {
  margin: 0;
  padding: 5px 14px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  color: #7a6c58;
}
.hint b { color: var(--orange); font-weight: 700; }

/* ---------- the board ---------- */

.board {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 2px;
  background: #000;
}

/* portrait: full-width rows, lead on top */
.board[data-o="p"][data-n="2"] { grid-template-rows: 1.5fr 1fr; }
.board[data-o="p"][data-n="3"] { grid-template-rows: 1.5fr 1fr 1fr; }
.board[data-o="p"][data-n="4"] { grid-template-rows: 1.5fr 1fr 1fr 1fr; }

/* landscape: lead column left, rail stack right */
.board[data-o="l"] { grid-template-columns: 1.58fr 1fr; }
.board[data-o="l"] .lead { grid-column: 1; grid-row: 1 / -1; }
.board[data-o="l"][data-n="2"] { grid-template-rows: 1fr; }
.board[data-o="l"][data-n="3"] { grid-template-rows: 1fr 1fr; }
.board[data-o="l"][data-n="4"] { grid-template-rows: 1fr 1fr 1fr; }

.board[data-n="2"] [data-slot="r2"],
.board[data-n="2"] [data-slot="r3"],
.board[data-n="3"] [data-slot="r3"] { display: none; }

/* ---------- cells ---------- */

.cell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  row-gap: clamp(8px, 1.6vh, 18px);
  min-height: 0;
  min-width: 0;
  position: relative;
  overflow: hidden;
  padding: clamp(12px, 2.6vw, 32px) clamp(14px, 3vw, 40px) clamp(10px, 2.2vw, 24px);
  text-decoration: none;
  color: inherit;
  transition: background-color .6s cubic-bezier(.45,.05,.25,1),
              color .6s cubic-bezier(.45,.05,.25,1);
}

.bg-orange      { background: var(--orange); color: var(--ink); }
.bg-cream       { background: var(--cream);  color: var(--brown); }
.bg-brown       { background: var(--brown);  color: var(--cream); }
.bg-teal        { background: var(--teal);   color: var(--cream); }
.bg-black       { background: #0d0d0d;       color: var(--orange); }
.bg-black-cream { background: #0d0d0d;       color: var(--cream); }

/* video cells wear their thumbnail — dimmed, grayscale, unmistakably a
   broadcast still — plus a big play watermark */
.cellbg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: grayscale(1) contrast(1.05);
  opacity: 0;
  transition: opacity .5s ease;
  pointer-events: none;
}
.cell.video-cell .cellbg { opacity: .38; }
.cell.video-cell::before {
  content: "▶";
  position: absolute;
  right: clamp(14px, 3vw, 40px);
  top: 50%;
  transform: translateY(-50%);
  font-size: clamp(44px, 7vw, 110px);
  line-height: 1;
  opacity: .16;
  pointer-events: none;
}
.cell .top, .cell .body, .cell .meta { position: relative; }

.cell .top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(10px, 1.1vw, 13px);
  letter-spacing: .26em;
  text-transform: uppercase;
}
.cell .topic-tag::before {
  content: "";
  display: inline-block;
  width: .55em; height: .55em;
  background: currentColor;
  margin-right: .7em;
  vertical-align: 1px;
}
.cell .age-tag { opacity: .65; }

.cell .tr { display: inline-flex; align-items: baseline; gap: 12px; }
.cell .trrow { display: inline-flex; align-items: baseline; gap: 12px; }

/* ▶ release and SHARE float on ink plates OVER the cell (same treatment
   as the TAP AGAIN chip) — they must never take layout space, or the
   headline gets refit-clipped the moment a hold makes them appear */
.cell .cellgo,
.cell .cellshare {
  display: none;
  position: absolute;
  right: clamp(14px, 3vw, 40px);
  z-index: 3;
  font-family: var(--mono);
  font-weight: 700;
  line-height: 1;
  background: #0d0d0d;
  color: var(--cream);
  border: 1.5px solid var(--orange);
  cursor: pointer;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .35);
}
.cell .cellgo {
  top: calc(clamp(12px, 2.6vw, 32px) + 26px);
  font-size: 12px;
  padding: 5px 10px;
}
.cell .cellshare {
  top: calc(clamp(12px, 2.6vw, 32px) + 26px);
  font-size: 9px;
  letter-spacing: .14em;
  padding: 6px 9px;
}
.cell .celllisten {
  display: none;
  position: absolute;
  right: clamp(14px, 3vw, 40px);
  z-index: 3;
  font-family: var(--mono);
  font-weight: 700;
  line-height: 1;
  background: #0d0d0d;
  color: var(--cream);
  border: 1.5px solid var(--orange);
  cursor: pointer;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .35);
  top: calc(clamp(12px, 2.6vw, 32px) + 62px);
  font-size: 9px;
  letter-spacing: .14em;
  padding: 6px 9px;
}
.cell.held .cellgo { display: inline-block; }
/* while the ▶ is up, share steps down a row — listen a row further */
.cell.held .cellshare { display: inline-block; top: calc(clamp(12px, 2.6vw, 32px) + 62px); }
.cell.has-audio.held .celllisten { display: inline-block; top: calc(clamp(12px, 2.6vw, 32px) + 98px); }
.cell.playing .celllisten { display: inline-block; }
@media (hover: hover) {
  .cell:hover .cellshare { display: inline-block; }
  .cell.has-audio:hover .celllisten { display: inline-block; }
}

.lfreeze { flex: none; }
.lfreeze[aria-pressed="true"] {
  background: var(--cream);
  color: var(--ink);
  border-color: var(--cream);
}

.cell .body {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  display: block;
  position: relative;
}

.cell .head {
  display: block;
  font-family: var(--display);
  font-weight: 900;
  /* headlines run mixed case — easier to read at a glance and narrower,
     so autoFit buys a bigger size; the chrome stays uppercase */
  line-height: .95;
  letter-spacing: -.02em;
  hyphens: manual;
  -webkit-font-smoothing: antialiased;
  will-change: opacity, transform;
}

.cell .meta {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
  gap: 0;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(9px, 1vw, 12px);
  letter-spacing: .2em;
  text-transform: uppercase;
  padding-top: clamp(10px, 1.4vh, 16px);
  min-height: 14px;
}
.lead .meta { font-size: clamp(10px, 1.25vw, 15px); letter-spacing: .16em; }
.meta .dot {
  display: inline-block;
  width: 4px; height: 4px;
  background: currentColor;
  margin: 0 12px;
  flex: none;
}
.meta .ptrack {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: currentColor;
  opacity: .22;
}
.meta .pbar {
  position: absolute;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: currentColor;
  pointer-events: none;
}

/* touch: first tap arms + pauses, second tap opens. Solid ink plate with
   an orange key line so it reads on every cell color. */
.cell::after {
  content: "TAP AGAIN TO OPEN ↗";
  position: absolute;
  right: clamp(14px, 3vw, 40px);
  bottom: clamp(44px, 8vh, 72px);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .2em;
  background: #0d0d0d;
  color: var(--cream);
  border: 1.5px solid var(--orange);
  padding: 8px 12px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.cell.armed::after { opacity: 1; }

/* ---------- bottom bar ---------- */

.lbarwrap { position: relative; }

.lbar-more {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 36px;
  display: none;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  padding-bottom: env(safe-area-inset-bottom);
  background: linear-gradient(to right, rgba(0,0,0,0), #000 60%);
  color: var(--orange);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.lbarwrap.more .lbar-more { display: flex; }

.lbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 14px;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  color: #7a6c58;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.lbar::-webkit-scrollbar { display: none; }

.lgroup { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.llbl { margin-right: 6px; }

.lopt {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  border: 1px solid transparent;
  color: #7a6c58;
  padding: 3px 6px;
}
.lopt[aria-pressed="true"] {
  color: var(--orange);
  border-color: rgba(252, 86, 10, .4);
}

.lright {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex: none;
}
.lexit { color: #a08a6d; text-decoration: none; letter-spacing: .14em; }
.lexit:hover { color: var(--cream); }

.noscript { font-family: var(--mono); color: var(--cream); padding: 20px; }

/* ---------- bottom-sheet panels: how-to + recap ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  z-index: 30;
}

.panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-height: 74dvh;
  overflow-y: auto;
  background: #0d0d0d;
  border-top: 3px solid var(--orange);
  z-index: 31;
  padding: 14px 16px max(16px, env(safe-area-inset-bottom));
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.panel-title {
  font-family: var(--display);
  font-weight: 900;
  font-size: 13px;
  letter-spacing: .24em;
  color: var(--orange);
}
.panel-close {
  font-size: 15px;
  line-height: 1;
  padding: 5px 9px;
  color: var(--cream);
  border: 1px solid rgba(239, 217, 185, .3);
}
.panel-close:hover { border-color: var(--cream); }
.panel-note {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  color: #7a6c58;
}

.help-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 11px;
}
.help-list li {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .05em;
  line-height: 1.6;
  color: var(--cream);
}
.help-list b { color: var(--orange); }

.recap-list { list-style: none; margin: 0; padding: 0; }
.recap-list li { border-top: 1px solid rgba(239, 217, 185, .12); }
.recap-list li.recap-empty {
  border-top: none;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  color: #7a6c58;
  padding: 12px 2px;
}
.recap-list a {
  display: grid;
  grid-template-columns: 64px 76px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 9px 2px;
  text-decoration: none;
  color: var(--cream);
  font-family: var(--mono);
  font-size: 11px;
}
.recap-list a:hover .r-title { color: var(--orange); }
.r-when { color: #7a6c58; font-size: 9px; letter-spacing: .06em; white-space: nowrap; }
.r-topic { color: var(--orange); font-size: 9px; letter-spacing: .14em; }
.r-title { line-height: 1.45; }
.r-src { color: #7a6c58; font-size: 9px; letter-spacing: .08em; }

@media (max-width: 560px) {
  .recap-list a { grid-template-columns: 56px 1fr; }
  .r-topic, .r-src { display: none; }
}

/* ---------- TV / cast mode (?tv=1): nothing but the board ---------- */

body.tv .chipwrap,
body.tv .hint,
body.tv .lbarwrap { display: none; }
body.tv.idle, body.tv.idle .cell { cursor: none; }

/* ---------- narrow portrait (phone upright) ---------- */

@media (max-width: 720px) {
  .bar { grid-template-columns: 1fr auto auto; gap: 10px; }
  .dayrow, .modes { display: none; }
  .clock { font-size: 17px; }
  .brand { font-size: 11px; letter-spacing: .22em; }
  .status { gap: 8px; }
}
@media (max-width: 460px) {
  /* the queue stays on phones — number only, the box says the rest;
     everything else in the bar tightens to make its room */
  .queue-top { padding: 4px 7px; gap: 4px; }
  .queue-top b { font-size: 14px; }
  .queue-top .q-lbl { display: none; }
  .queue-top.clear .q-min { display: inline; }
  .status { gap: 6px; }
  .bar { gap: 6px; }
  .ampm { display: none; }
  .lright #updated { display: none; }
  /* the full wordmark overflows the layout viewport here — the page zooms
     out and fixed elements drift; the short mark keeps the bar honest */
  .brand-pre { display: none; }
}

/* ---------- cramped landscape (phone on its side) ---------- */

@media (orientation: landscape) and (max-height: 480px) {
  .bar { padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 4px; border-bottom-width: 2px; }
  .dayrow { display: none; }
  .queue-top { padding: 3px 7px; }
  .queue-top b { font-size: 13px; }
  .queue-top .q-full { display: none; }
  .queue-top .q-min { display: inline; }
  .clock { font-size: 16px; }
  .chip { height: 30px; font-size: 9px; padding: 0 10px; }
  .hint { display: none; }
  .cell { padding: clamp(8px, 1.6vw, 14px) clamp(10px, 2vw, 18px); row-gap: 6px; }
  .cell .top { font-size: 9px; }
  .cell .meta, .lead .meta { font-size: 9px; padding-top: 8px; }
  .lbar { padding-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .live-badge i { animation: none; }
  .cell { transition: none; }
}
