/* Layout only — every colour is a custom property set by apply_theme
   (web/src/themes/apply.ts) at each seam transition. Call sites never name a
   colour (AGENTS.md). Ported from mvp/src/app.css. */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--surface, #fff);
  color: var(--body, #333);
  font-family: var(--display, ui-sans-serif, system-ui, sans-serif);
  /* Per-mode body weight (apply_theme sets --wt-body): 400 light, 500 dark, so
     copy doesn't read thin on the dark ground. The wordmark keeps its own 300. */
  font-weight: var(--wt-body, 400);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background-color .45s ease, color .45s ease;
  overflow: hidden;
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 32px 18px;
  gap: 18px;
}

/* ---------------------------------------------------------------- head */
#hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex: 0 0 auto;
}
#hdr h1 {
  margin: 0;
  font-size: clamp(20px, 2.2vw, 30px);
  color: var(--ink);
  font-weight: 700;
  text-transform: var(--caps);
  letter-spacing: .01em;
  text-align: right;
  min-width: 0;
  /* The header now carries the poll's QUESTION, which can be long. Cap it to two lines
     so it can never grow the header (flex: 0 0 auto) and squish the stage below —
     especially in kiosk, where the brand is larger and leaves the title less width. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================ brand marks =
   ONE brand at a time, alternating — on EVERY flavour. Ported verbatim from
   mvp/src/app.css; see there for the full sizing/lockup rationale (the deck's
   stacked lockup vs. the presents-strip vs. side-by-side variants). */
.brand-marks {
  display: block;
  position: relative;
  height: 58px;
  width: 471px;
  color: var(--ink);
}
.brand-mark {
  display: block;
  position: absolute;
  left: 0;
  top: 50%;
  width: auto;
  overflow: visible;
  transform: translateY(-50%);
  animation: 4s ease-in-out infinite;
}
.mark-conf {
  height: 58px;
  aspect-ratio: 289.6 / 81.30;
  animation-name: brand-a;
}
.mark-cahill {
  height: 36px;
  aspect-ratio: 287.3 / 21.95;
  animation-name: brand-b;
}
.mark-cahill-stacked {
  display: none;
  aspect-ratio: 102.5 / 32.9;
}

body.kiosk .brand-marks {
  height: 72px;
  width: 584px;
}
body.kiosk .mark-conf {
  height: 72px;
}
body.kiosk .mark-cahill {
  height: 44px;
}

@keyframes brand-a {
  0%,
  44% {
    opacity: 1;
  }
  50%,
  94% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
@keyframes brand-b {
  0%,
  44% {
    opacity: 0;
  }
  50%,
  94% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* westgate-duo: both marks at once, side by side. */
body[data-flavour="westgate-duo"] .brand-marks {
  display: flex;
  align-items: center;
  gap: 24px;
  width: auto;
}
body[data-flavour="westgate-duo"] .brand-mark {
  position: static;
  top: auto;
  transform: none;
  animation: none;
  opacity: 1;
  flex: 0 0 auto;
}
body[data-flavour="westgate-duo"] .mark-cahill {
  order: 0;
  height: 35px;
}
body[data-flavour="westgate-duo"] .mark-conf {
  order: 1;
  height: 58px;
}
body.kiosk[data-flavour="westgate-duo"] .brand-marks {
  gap: 26px;
}
body.kiosk[data-flavour="westgate-duo"] .mark-cahill {
  height: 44px;
}
body.kiosk[data-flavour="westgate-duo"] .mark-conf {
  height: 72px;
}

/* westgate-presented: the deck's stacked lockup, marks swapped. */
body[data-flavour="westgate-presented"] .brand-marks {
  display: flex;
  align-items: flex-end;
  gap: 24px;
}
body[data-flavour="westgate-presented"] .brand-mark {
  position: static;
  top: auto;
  transform: none;
  animation: none;
  opacity: 1;
}
body[data-flavour="westgate-presented"] .mark-conf {
  order: 0;
  height: 58px;
}
body[data-flavour="westgate-presented"] .mark-cahill {
  display: none;
}
body[data-flavour="westgate-presented"] .mark-cahill-stacked {
  display: block;
  order: 1;
  height: 54px;
}
body.kiosk[data-flavour="westgate-presented"] .brand-marks {
  gap: 26px;
}
body.kiosk[data-flavour="westgate-presented"] .mark-conf {
  height: 72px;
}
body.kiosk[data-flavour="westgate-presented"] .mark-cahill-stacked {
  height: 66px;
}

/* ---- backdrop: sits UNDER the panels and never under data. Static gradient
   layer; only the ribbon (westgate flavours only) drifts. Panels stay opaque,
   so every contrast pair validate_palette.js checked against a flat --surface
   still holds. */
#backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: var(--backdrop-base, none);
  background-size: cover;
  background-position: center;
  transition: background-image .45s ease;
}
#backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--backdrop, none);
  background-size: cover;
  background-position: center;
  opacity: var(--backdrop-opacity, 0);
  transition: opacity .45s ease;
  will-change: transform;
}
#app {
  position: relative;
  z-index: 1;
}

body[data-flavour^="westgate"] #backdrop::after {
  animation: wg-drift 84s ease-in-out infinite alternate;
}
@keyframes wg-drift {
  from {
    transform: scale(1.06) translate3d(-1.6%, 0.8%, 0);
  }
  to {
    transform: scale(1.15) translate3d(1.6%, -1.2%, 0);
  }
}

/* ---- hollow display type: hero figure only (a proportional stroke on the
   22px board title would be a hairline that disappears across a room). */
body[data-flavour^="westgate"] .hero .num {
  color: transparent;
  -webkit-text-stroke: 0.021em var(--ink);
  paint-order: stroke fill;
}

body[data-flavour^="westgate"] #ticks i.on {
  background: var(--s1);
}

/* The deck's dark lockup puts a specular point at the arrow's tail and
   another behind the middle plus, held at opacity 0 in the sprite; this is
   the switch (see the mark colour note in mvp/src/app.css for why a custom
   property is the only way in — the sprite fills live in a <use> shadow tree
   that document CSS cannot select through). */
body[data-mode="dark"] {
  --wg-spark: 1;
}

/* --------------------------------------------------------------- stage */
#stage {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}
/* Seams stay laid out (display: grid) always and hide via opacity, NOT display:none.
   Two reasons: (1) a chart container that resizes 0↔full on every seam switch fires its
   ResizeObserver, whose resize() cancels the entry animation just started by setOption;
   keeping it full-size means the observer only fires on real window resizes. (2) opacity
   can't transition from display:none, so the crossfade needs the element rendered. */
.seam {
  position: absolute;
  inset: 0;
  display: grid;
  grid-gap: 20px;
  opacity: 0;
  pointer-events: none;
  /* Duration is set from config (crossfade_ms) by main.ts on :root. */
  transition: opacity var(--seam-fade, 600ms) ease;
}
.seam.on {
  opacity: 1;
  pointer-events: auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.panel > h2 {
  margin: 0 0 10px;
  /* The chart question/caption reads from across the room like a headline, so it
     matches the seam-3 board title (.bd-title) rather than a small caption size. */
  font-size: clamp(16px, 1.6vw, 22px);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--chart-font);
  font-weight: 700;
  font-family: var(--mono);
}
.panel > .chart {
  flex: 1 1 auto;
  min-height: 0;
}

/* Grids are keyed by the view's data-layout, not its id (docs/plans/decoupling.md
   step 3), so layouts that share a shape share one rule. */

.hero {
  overflow: hidden;
}
.hero-body {
  margin: auto 0;
  min-width: 0;
}
.hero .num {
  font-family: var(--display);
  font-size: clamp(56px, 8vw, 132px);
  line-height: .92;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: proportional-nums;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.hero .cap {
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--mono);
}
.hero .rate {
  margin-top: 22px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--body);
}
.hero .rate b {
  /* Contrasting warm accent so the count pops off the blue field (was --num, the same
     blue as the number above it). See docs/plans/defaults-and-accent.md. */
  color: var(--accent);
  font-size: 20px;
}

/* single-panel views (agenda) */
.seam[data-layout="single"] {
  grid-template-columns: 1fr;
}

/* overview — pan-poll totals: the hero column, then the %-per-poll bar over the response
   pulse in the second column. */
.seam[data-layout="overview"] {
  grid-template-columns: 330px 1fr;
  grid-template-rows: 1fr 190px;
}
.seam[data-layout="overview"] .hero {
  grid-row: 1 / span 2;
}
.seam[data-layout="overview"] .shares {
  grid-column: 2;
}
.seam[data-layout="overview"] .pulse {
  grid-column: 2;
}

/* poll seams — the bar race is the base on every poll; the curated extras share the
   second column (docs/plans/archive/seam-per-poll.md). Grids are keyed by panel count.
   poll-2: race + one extra, side by side. */
.seam[data-layout="poll-2"] {
  grid-template-columns: 1.6fr 1fr;
}
/* poll-3: the race spans the full height on the left; two extras stack on the right. */
.seam[data-layout="poll-3"] {
  grid-template-columns: 1.6fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.seam[data-layout="poll-3"] .race {
  grid-column: 1;
  grid-row: 1 / span 2;
}
/* poll-cal: a compact nightingale on the left, the activity heatmap in the WIDE right
   column so it reads at room scale (the calendar seams — attention, growth). */
.seam[data-layout="poll-cal"] {
  grid-template-columns: 1fr 1.7fr;
}

/* --------------------------------------------------------------- board */
.board {
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 22px;
  font-family: var(--mono);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.bd-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 32px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.bd-title {
  font-size: clamp(16px, 1.6vw, 22px);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: var(--wt-ui, 600);
  min-width: 0;
}
.bd-meta {
  display: flex;
  gap: 20px;
  align-items: baseline;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 13px;
  letter-spacing: .1em;
  color: var(--muted);
}
.bd-clock {
  color: var(--body);
  font-variant-numeric: tabular-nums;
}

.bd-cols,
.bd-row {
  display: grid;
  grid-template-columns: 12% minmax(0, 1fr) 16%;
  gap: 24px;
  align-items: center;
}
.bd-cols {
  padding: 12px 0 8px;
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}
.bd-cols span,
.bd-cell {
  white-space: pre;
  overflow: hidden;
}

.bd-rows {
  flex: 1 1 auto;
  overflow: hidden;
  padding-top: 6px;
  display: flex;
  flex-direction: column;
}
.bd-row {
  /* Fill leftover height (grow), but NEVER shrink below the wrapped content — a fixed
     row height clips/overlaps a two-line session title. */
  flex: 1 0 auto;
  min-height: 44px;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
  font-size: clamp(14px, 1.5vw, 22px);
  color: var(--body);
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
}
.bd-row .bd-cell[data-k="session"] {
  color: var(--ink);
  /* The session is a full title, not a fixed-width flap cell — let it wrap instead of
     clipping. Uppercase to keep the board idiom; capped to 3 lines so a very long name
     can't blow out the row height. */
  white-space: normal;
  text-transform: uppercase;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
/* NOW: the whole row lifts to primary ink + bold. NEXT: the immediately-upcoming
   session is flagged in the positive accent. UPCOMING is muted; PAST fades back. */
.bd-row[data-status="NOW"] .bd-cell {
  color: var(--ink);
  font-weight: var(--wt-ui, 600);
}
.bd-row[data-status="NEXT"] .bd-cell[data-k="status"] {
  color: var(--stat-pos);
}
.bd-row[data-status="UPCOMING"] .bd-cell[data-k="status"] {
  color: var(--muted);
}
.bd-row[data-status="PAST"] {
  opacity: .5;
}
.bd-cell span.flipping {
  opacity: .55;
}

/* ---------------------------------------------------------------- foot */
#foot {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

#status {
  color: var(--neg);
  opacity: 0;
  transition: opacity .3s;
  white-space: nowrap;
  flex: 0 0 auto;
}
#status.on {
  opacity: 1;
}

/* Build + motion stamp: inherits the footer's muted mono; hidden in kiosk. */
#buildstamp {
  white-space: nowrap;
  flex: 0 0 auto;
}
body.kiosk #buildstamp {
  display: none;
}

/* ---- news-strip ticker ------------------------------------------- */
#ticker {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: var(--wt-ui, 600);
  color: var(--body);
  mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent);
}
body[data-mode="light"] #ticker {
  text-shadow: 0 1px 2px rgba(0, 0, 0, .38);
}
body[data-mode="dark"] #ticker {
  text-shadow: 0 0 6px rgba(255, 255, 255, .34);
}
body.kiosk #ticker {
  font-size: 28px;
  letter-spacing: .1em;
}

#ticker-track {
  display: flex;
  width: max-content;
  animation: ticker 110s linear infinite;
}
#ticker-track span {
  white-space: pre;
  padding-right: 3em;
}
#ticker-track span:empty {
  display: none;
}
@keyframes ticker {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}
#ticks {
  display: flex;
  gap: 7px;
  flex: 0 0 auto;
}
#ticks i {
  width: 22px;
  height: 3px;
  background: var(--rule);
  display: block;
  transition: background-color .3s;
}
#ticks i.on {
  background: var(--ink);
}

/* -------------------------------------------------------------- picker */
#picker {
  display: flex;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
}
#picker button {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 5px 9px;
  cursor: pointer;
  text-transform: uppercase;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
}
#picker button:hover {
  color: var(--ink);
}
#picker button.on {
  color: var(--ink);
  border-color: var(--ink);
}
#picker .sep {
  width: 1px;
  background: var(--rule);
  margin: 0 4px;
}

body.kiosk #picker {
  display: none;
}
body.kiosk #app {
  padding: 40px 48px 26px;
}
body.kiosk {
  font-size: 20px;
}
body.kiosk .bd-row {
  font-size: clamp(20px, 2.1vw, 32px);
}
body.kiosk .hero .num {
  font-size: clamp(80px, 11vw, 190px);
}
/* The hero caption and rate stay small by default, which reads as a footnote under the
   room-scale kiosk number — scale them up so "total submissions" and the last-minute
   count carry to the back of the room too. */
body.kiosk .hero .cap {
  font-size: 18px;
}
body.kiosk .hero .rate {
  font-size: 22px;
}
body.kiosk .hero .rate b {
  font-size: 30px;
}
/* The header carries the poll's QUESTION; in kiosk the larger brand leaves the title
   less width, so give it a third line before it clips (still bounded, so the stage
   below is not squished). */
body.kiosk #hdr h1 {
  -webkit-line-clamp: 3;
}

/* No prefers-reduced-motion block: the display machines report "reduce"
   spuriously — see .claude/skills/chart-dev "Motion". */
