/* Shul Board — public display styles. Variant C layout, two themes. */

/* THEME TOKENS ------------------------------------------------------------- */
:root, .stage.theme-light {
  --bg:#1a232f; --board-bg:#f7f5f0; --ink:#1d2733; --ink-soft:#4a5868; --ink-mute:#8593a4;
  --line:#e3dfd4; --line-soft:#ede9de; --accent:#b88746; --accent-2:#3e6b8a; --rust:#b15a3f; --sage:#6b8a6e;
  --hi-bg:#fdf3d7; --hi-ink:#6b4f1f;
  --day-label:#8593a4;
  --font-serif:'Fraunces',serif; --font-sans:'Inter',system-ui,sans-serif;
  --font-heb:'Noto Serif Hebrew',serif; --font-heb2:'Heebo',sans-serif;
}
.stage.theme-dark {
  --board-bg:#14223f; --ink:#f4ecdb; --ink-soft:#c5beb0; --ink-mute:#8b8678;
  --line:#2a3a5e; --line-soft:#1f2c4a; --accent:#e6b94d; --accent-2:#6cb1e2; --rust:#e07b5b; --sage:#8eb088;
  --hi-bg:#2a3a5e; --hi-ink:#ffe28a;
  --day-label:#a8c7e0;
  --font-serif:'Fraunces',serif; --font-sans:'Inter',system-ui,sans-serif;
  --font-heb:'Frank Ruhl Libre',serif; --font-heb2:'Heebo',sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font-sans); overflow: hidden; }

/* Time displays use sans tabular nums with slashed-zero variants disabled. */
.clock, .srv td.time, .zmanim .zval, .shiur-row .when {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "zero" 0, "ss01" 0, "ss02" 0, "cv01" 0, "cv02" 0;
}

/* Fit container: 1920×1080 stage scaled to viewport while preserving 16:9. */
.fit { position: fixed; inset: 0; overflow: hidden; background: var(--bg); }
.stage {
  position: absolute; top: 0; left: 0;
  width: 1920px; height: 1080px; transform-origin: top left;
  background: var(--board-bg); color: var(--ink); font-family: var(--font-sans);
  --fs: 1;   /* content font multiplier — 1 in windowed/online views */
}
/* On the full-screen shul display only (Full-page mode or the ?kiosk URL) the
   four content zones scale up by the configured kiosk font size. The header is
   never scaled. --fs-kiosk is set inline on .stage from the cookie/admin value. */
body.kiosk-mode .stage, body.kiosk-page .stage { --fs: var(--fs-kiosk, 1); }

/* BOARD LAYOUT (Variant C) ------------------------------------------------- */
/* Rows: header (auto), announcements (content-sized), right-row + services
   bottom span (1fr — absorbs leftover height). Light announcements days let
   yahrzeits/shiurim breathe; heavy days push them down to a sane minimum. */
.board {
  width: 100%; height: 100%; display: grid; padding: 28px 30px;
  grid-template-columns: 4.4fr 11.6fr;
  grid-template-rows: auto minmax(0, 1fr) minmax(440px, 1fr);
  column-gap: 30px; row-gap: 18px; background: var(--board-bg); color: var(--ink);
}
.board > .announcements { padding-bottom: 18px; }
.board > .header { grid-column: 1/-1; }
.board > .services { grid-column: 1; grid-row: 2/span 2; border-right: 1px solid var(--line); padding-right: 26px; }
.board > .announcements { grid-column: 2; grid-row: 2; }
.board > .right-row {
  grid-column: 2; grid-row: 3;
  display: grid; grid-template-columns: 1.25fr 1fr; column-gap: 30px;
  border-top: 1px solid var(--line); padding-top: 18px;
}
.board .right-row .yahrzeits { border-right: 1px solid var(--line); padding-right: 22px; }

/* HEADER ------------------------------------------------------------------- */
/* Date + learning columns top-align (so the seasonal-tefillot line sits level
   with the date); the clock and parsha stay vertically centred. */
.header { display: flex; align-items: flex-start; justify-content: space-between; gap: 32px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.header > * { flex: 0 0 auto; min-width: 0; }
.header > .parsha { flex-shrink: 1; }
/* All four header cells (date, learning, clock, parsha) top-aligned. */

.logo { display: flex; align-items: flex-start; }
.logo-img { height: 110px; width: auto; display: block; }
/* Dark theme's board is a dark navy, so the logo's dark green is brightened
   to stay legible; every other theme has a light board-bg. */
.stage.theme-dark .logo-img { filter: brightness(2.2); }

.date-en { font-family: var(--font-serif); font-size: 44px; font-weight: 700; color: var(--ink); line-height: 1.15; white-space: nowrap; }
.date-en .heb { display: block; font-family: var(--font-heb); font-size: 44px; font-weight: 800; color: var(--accent); margin-top: 6px; direction: rtl; text-align: left; white-space: nowrap; }

/* Learning column: seasonal tefillot on top, then Daf/Mishna/Omer rows. */
.learning { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.learning .seasonal { font-family: var(--font-heb2); direction: rtl; font-size: 24px; color: var(--ink-soft); font-weight: 500; text-align: left; white-space: nowrap; }
.learning-rows { display: grid; grid-template-columns: max-content max-content; column-gap: 20px; row-gap: 2px; align-items: baseline; }
/* Shema/Shkiah line: both pairs inline on one row, in the same label/val font
   as Daf Yomi (it carries .learning-rows too, so override the grid to flex). */
.learning-zmanim { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.learning-zmanim .zpair { display: inline-flex; align-items: baseline; gap: 8px; }
.learning .label { color: var(--ink-mute); text-transform: uppercase; letter-spacing: .1em; font-size: 14px; font-weight: 700; white-space: nowrap; }
.learning .val { font-weight: 700; color: var(--ink); font-size: 20px; white-space: nowrap; }

.clock { font-size: 104px; font-weight: 700; color: var(--ink); text-align: center; letter-spacing: -3px; line-height: 1; white-space: nowrap; }
.clock .sec { font-size: 60px; vertical-align: super; color: var(--ink-mute); margin-left: 6px; letter-spacing: 0; font-weight: 600; }

.parsha { text-align: right; direction: rtl; font-family: var(--font-heb); }
.parsha .name { font-size: 76px; font-weight: 700; color: var(--ink); line-height: 1.05; }
.parsha .haft { font-size: 28px; color: var(--ink-soft); margin-top: 10px; font-family: var(--font-heb2); font-weight: 500; }
.parsha .haft-he { font-family: var(--font-heb); font-weight: 600; margin-top: 12px; }
.parsha .haft-he + .haft { margin-top: 2px; font-size: 24px; }
/* Start-only Torah/Haftarah reference shown inline after the name / opening. */
.parsha .cite { font-family: var(--font-heb2); font-size: 24px; font-weight: 500; color: var(--ink-mute); white-space: nowrap; }

/* SECTION HEADINGS --------------------------------------------------------- */
.eyebrow { font-family: var(--font-serif); font-weight: 600; color: var(--accent-2); font-size: calc(30px * var(--fs)); margin: 0 0 16px; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 14px; }
.eyebrow::after { content: ""; flex: 1; height: 1px; background: var(--line); margin-left: 4px; }
.eyebrow.small { font-size: calc(26px * var(--fs)); margin-bottom: 14px; }

/* SERVICES ----------------------------------------------------------------- */
.services { display: flex; flex-direction: column; min-height: 0; }
.srv { width: 100%; border-collapse: collapse; }
.srv td { padding: 8px 0; font-size: calc(32px * var(--fs)); font-weight: 600; color: var(--ink); vertical-align: baseline; }
.srv td.time { text-align: left; font-weight: 800; color: var(--accent-2); width: 130px; padding-right: 22px; white-space: nowrap; }
.updated-badge { display: inline-block; background: var(--accent-2); color: #fff; font-size: calc(13px * var(--fs)); font-weight: 800; letter-spacing: .10em; padding: 3px 10px; border-radius: 999px; margin-left: 6px; text-transform: uppercase; vertical-align: middle; }
.srv tr.spacer td { padding: 7px 0; border-top: 1px solid var(--line-soft); }
.srv .qual { font-size: calc(18px * var(--fs)); color: var(--ink-mute); font-weight: 500; margin-left: 8px; }
.zmanim { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: row; align-items: baseline; gap: 28px; }
/* Shema & Shkiah in one row — compact, single muted colour. */
.zmanim .zman { display: flex; align-items: baseline; gap: 8px; }
.zmanim .zval { font-size: calc(18px * var(--fs)); font-weight: 700; color: var(--ink-soft); }
.zmanim .zlabel { font-size: calc(18px * var(--fs)); font-weight: 600; color: var(--ink-soft); }
.history-note { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.history-note .when { font-size: 14px; color: var(--sage); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.history-note .title { font-family: var(--font-serif); font-size: 24px; font-weight: 600; color: var(--ink); margin: 6px 0 8px; line-height: 1.2; border-left: 3px solid var(--sage); padding-left: 14px; }
.history-note .body { font-size: 18px; line-height: 1.5; color: var(--ink-soft); padding-left: 17px; }

/* Coming Shabbat sub-region — Thursday morning through Saturday night. */
.services-extra { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.extra-eyebrow { font-family: var(--font-serif); font-weight: 600; color: var(--accent); font-size: calc(24px * var(--fs)); margin: 0 0 10px; letter-spacing: -0.01em; }
.srv-extra td { padding: 9px 0; font-size: calc(26px * var(--fs)); font-weight: 500; color: var(--ink); }
.srv-extra td.time { font-size: calc(26px * var(--fs)); font-weight: 800; color: var(--accent-2); width: 130px; padding-right: 22px; }

/* Squeeze — applied by board.js when a panel overflows by only 1–2 lines,
   so it fits without scrolling. Kept modest so text doesn't feel cramped. */
.services.squeeze .srv td { padding: 4px 0; }
.services.squeeze .srv-extra td { padding: 5px 0; }
.services.squeeze .srv tr.spacer td { padding: 4px 0; }
.services.squeeze .zmanim { margin-top: 8px; padding-top: 8px; }
.services.squeeze .services-extra { margin-top: 10px; padding-top: 8px; }
.services.squeeze .extra-eyebrow { margin: 0 0 6px; }
.announcements.squeeze p { margin-bottom: 12px; }
.yahrzeits.squeeze .yarz-row { padding: 8px 0; }

/* ANNOUNCEMENTS ------------------------------------------------------------ */
/* Each announcement leads with a category emoji (mazal_tov 🥂, condolences 🕯,
   event/kiddush 🍷, notice 📢). Body and strong stay in --ink per the spec —
   only the leading icon distinguishes categories. */
.announcements { min-height: 0; }
.announcements p { margin: 0 0 20px; font-size: calc(30px * var(--fs)); line-height: 1.4; color: var(--ink); font-weight: 500; padding-left: calc(48px * var(--fs)); position: relative; }
.announcements p .ico { position: absolute; left: 0; top: 0; font-size: calc(30px * var(--fs)); line-height: 1.4; }
.announcements p strong { color: var(--ink); font-weight: 700; }

/* YAHRZEITS ---------------------------------------------------------------- */
.yahrzeits { display: flex; flex-direction: column; min-height: 0; }
.yarz-row { display: grid; grid-template-columns: 34px 1fr; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.yarz-row:last-child { border-bottom: none; }
.yarz-row .candle { font-size: calc(28px * var(--fs)); padding-top: 2px; }
.yarz-row .name-en { font-size: calc(32px * var(--fs)); font-weight: 700; color: var(--ink); line-height: 1.2; }
.yarz-row .name-en em { font-style: normal; color: var(--ink-soft); font-weight: 600; }
.yarz-row .line2 { display: flex; align-items: baseline; gap: 14px; margin-top: 4px; }
.yarz-row .name-he { font-family: var(--font-heb); direction: rtl; font-size: calc(24px * var(--fs)); font-weight: 600; color: var(--ink-soft); line-height: 1.2; }
.yarz-row .name-he:empty { display: none; }
.yarz-row .when { font-size: calc(17px * var(--fs)); color: var(--ink-mute); letter-spacing: .06em; text-transform: uppercase; font-weight: 700; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.yarz-row .when .torah { font-size: calc(18px * var(--fs)); color: var(--accent); }
.today-tag { display: inline-block; background: var(--accent); color: #fff; font-size: calc(13px * var(--fs)); font-weight: 800; letter-spacing: .12em; padding: 3px 10px; border-radius: 999px; margin-left: 12px; text-transform: uppercase; vertical-align: middle; }
.today-tag.tonight-tag { background: var(--accent-2); }

/* SCROLL CONTAINERS -------------------------------------------------------- */
/* Each scrollable panel is a flex column: eyebrow (and pinned/banner) fixed,
   the .scroll-area fills the rest and clips. board.js clones the block and adds
   .is-scrolling when content overflows its frame; the marquee duration is set
   inline = rows × per-line rate (constant speed regardless of row count). */
.services, .announcements, .yahrzeits, .shiurim {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.services > .eyebrow, .announcements > .eyebrow, .yahrzeits > .eyebrow, .shiurim > .eyebrow { flex: 0 0 auto; }
.yahrzeits .pinned { flex: 0 0 auto; margin-bottom: 6px; }
.announcements .chair-banner { flex: 0 0 auto; }

.scroll-area { flex: 1 1 0; min-height: 0; overflow: hidden; position: relative; }
/* When balanceRows() collapses the announcements row to its content, the
   scroll-area must size to its content instead of flexing to 0 (which clipped
   short announcements to nothing). */
.announcements.ann-fit .scroll-area { flex: 0 0 auto; }
/* Soft top/bottom fade only while actually scrolling. */
.scroll-area.is-scrolling {
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}
.scroll-track { will-change: transform; }
.scroll-area.is-scrolling .scroll-track { animation: scroll-y 30s linear infinite; }  /* duration set inline by board.js */
.scroll-area.is-scrolling .scroll-block + .scroll-block { padding-top: 24px; }
@keyframes scroll-y { from { transform: translateY(0); } to { transform: translateY(-50%); } }

/* SHIURIM ------------------------------------------------------------------ */
.shiurim { display: flex; flex-direction: column; min-height: 0; }
.shiur-row { display: grid; grid-template-columns: minmax(180px, max-content) 1fr; gap: 8px 20px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.shiur-row:last-child { border-bottom: none; }
.shiur-row .when { font-size: calc(32px * var(--fs)); color: var(--accent); font-weight: 700; letter-spacing: .02em; }
.shiur-row .when .day { display: block; color: var(--day-label); font-size: calc(32px * var(--fs)); letter-spacing: .03em; margin-bottom: 2px; text-transform: uppercase; font-family: var(--font-sans); font-weight: 700; line-height: 1.2; }
.shiur-row .title { font-size: calc(32px * var(--fs)); color: var(--ink); font-weight: 600; line-height: 1.2; }
.shiur-row .teacher { font-size: calc(22px * var(--fs)); color: var(--ink-soft); font-weight: 500; }

/* Empty-state placeholder for sections with no DB data yet */
.empty-note { color: var(--ink-mute); font-style: italic; font-size: calc(22px * var(--fs)); padding: 8px 0; }

.board > .right-row > section { overflow: hidden; min-height: 0; }

/* Offline indicator — small, unobtrusive badge bottom-right of the screen */
#offline-badge {
  position: fixed;
  right: 18px;
  bottom: 14px;
  z-index: 50;
  background: rgba(168, 74, 47, 0.92); /* rust accent */
  color: #fff;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 7px 14px;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
#offline-badge[hidden] { display: none; }

/* ════════════════════════════════════════════════════════════════════════
   ADDITIONAL THEME SETS (committee review). Cream(light) + dark are above.
   Themes are CSS-variable swaps scoped to .stage.theme-X plus a few structural
   tweaks. board.php whitelists: light, dark, legacy, bright, vivid.
   ════════════════════════════════════════════════════════════════════════ */

/* ── LEGACY ── classic blue/white/gold framed board (the old display look) ── */
.stage.theme-legacy {
  --bg:#0e2a6b; --board-bg:#ffffff; --ink:#10245e; --ink-soft:#2a3f73; --ink-mute:#5b6b93;
  --line:#c9d3e8; --line-soft:#e6ebf6; --accent:#c79a3a; --accent-2:#16387f;
  --rust:#a83b22; --sage:#2f7a4a; --hi-bg:#36c5c0; --hi-ink:#7a1414;
  --day-label:#16387f;
  --font-serif:'Inter',system-ui,sans-serif; --font-sans:'Inter',system-ui,sans-serif;
  --font-heb:'Noto Serif Hebrew',serif; --font-heb2:'Heebo',sans-serif;
}
.theme-legacy .board { border:14px solid var(--bg); box-shadow:inset 0 0 0 3px var(--accent); }
/* section headings become centred blue-gradient gold-bordered pills */
.theme-legacy .eyebrow {
  justify-content:center; text-align:center; color:#fff; font-weight:700;
  background:linear-gradient(#2a4a96, #15387f);
  border:2px solid var(--accent); border-radius:9px; padding:7px 20px;
  box-shadow:0 2px 5px rgba(8,22,60,.3), inset 0 1px 0 rgba(255,255,255,.25);
  letter-spacing:.01em;
}
.theme-legacy .eyebrow::after { display:none; }
.theme-legacy .eyebrow.small { padding:6px 16px; }
.theme-legacy .extra-eyebrow { color:#fff; background:linear-gradient(#2a4a96,#15387f);
  border:2px solid var(--accent); border-radius:8px; padding:5px 14px; }
.theme-legacy .clock { color:var(--accent-2); }

/* ── BRIGHT ── max readability across the room: high contrast + bigger type ── */
.stage.theme-bright {
  --bg:#0a0a0a; --board-bg:#ffffff; --ink:#0a0a0a; --ink-soft:#1f2937; --ink-mute:#374151;
  --line:#9aa3af; --line-soft:#c9cfd8; --accent:#b21e1e; --accent-2:#0b3d91;
  --rust:#9a2b14; --sage:#15692f; --hi-bg:#fff09a; --hi-ink:#5a3d00;
  --day-label:#0b3d91;
  --font-serif:'Inter',system-ui,sans-serif; --font-sans:'Inter',system-ui,sans-serif;
  --font-heb:'Noto Serif Hebrew',serif; --font-heb2:'Heebo',sans-serif;
}
/* scale content up for distance reading (less fits → more scrolling, as desired) */
.theme-bright .clock { font-size:104px; }
.theme-bright .eyebrow { font-size:35px; font-weight:700; }
.theme-bright .srv td { font-size:35px; font-weight:700; padding:13px 0; }
.theme-bright .srv td.time { width:158px; }
.theme-bright .announcements p { font-size:37px; font-weight:600; }
.theme-bright .yarz-row .name-en { font-size:34px; }
.theme-bright .yarz-row .name-he { font-size:29px; }
.theme-bright .shiur-row .when, .theme-bright .shiur-row .title { font-size:35px; }
.theme-bright .zmanim .zval, .theme-bright .zmanim .zlabel { font-size:31px; }
.theme-bright .parsha .name { font-size:84px; }

/* ── VIVID ── festive / special-day theme: yellow, green, purple accents ───── */
.stage.theme-vivid {
  --bg:#2d0b4e; --board-bg:#fffdf5; --ink:#2a1a4a; --ink-soft:#4a3a6a; --ink-mute:#7a6a9a;
  --line:#e7d8be; --line-soft:#f3ecdb; --accent:#c28f00; --accent-2:#15803d;
  --rust:#d23bb0; --sage:#7b2fbf; --hi-bg:#ffe14d; --hi-ink:#3a2a00;
  --day-label:#7b2fbf;
  --font-serif:'Fraunces',serif; --font-sans:'Inter',system-ui,sans-serif;
  --font-heb:'Noto Serif Hebrew',serif; --font-heb2:'Heebo',sans-serif;
}
.theme-vivid .eyebrow { color:#7b2fbf; }
.theme-vivid .eyebrow::after { height:4px; border-radius:2px;
  background:linear-gradient(90deg,#c28f00,#15803d,#7b2fbf); }
.theme-vivid .board { border-top:10px solid; border-image:linear-gradient(90deg,#c28f00,#15803d,#7b2fbf) 1; }
.theme-vivid .clock { color:#7b2fbf; }
.theme-vivid .parsha .name { color:#15803d; }
.theme-vivid .today-tag { background:#7b2fbf; }

/* UPCOMING ROSH CHODESH / YOM TOV NOTICE ----------------------------------- */
/* Sits directly under the clock, sized like the haftarah line, in the accent
   ink colour. Present only when a special day falls within the coming week. */
.clock-col { display: flex; flex-direction: column; align-items: center; margin-top: -6px; }
.upcoming-note {
  font-size: 36px; font-weight: 700; color: var(--accent);
  text-align: center; line-height: 1.15; margin-top: 8px; max-width: 460px;
}

/* FRIDAY "STACK CHAIRS" BANNER --------------------------------------------- */
/* Sits at the foot of the announcements panel, Friday mornings only. Background
   uses the theme's secondary accent so it reads as a deliberate call-out. */
.chair-banner {
  margin-top: 20px; padding: 16px 24px; border-radius: 10px;
  background: var(--accent-2); color: #fff;
  font-weight: 800; font-size: calc(32px * var(--fs)); text-align: center; letter-spacing: .01em;
}

/* Rosh Chodesh / Chag / Omer notice — a bold line in the header, tucked just
   under the clock and centered on the hh:mm digits (board.js sets the exact
   horizontal offset so the seconds don't skew it). Sage accent. In normal flow
   so it reserves its height above the header hairline; the header is not
   scaled by --fs, so sizes are fixed px. */
.clock-holiday {
  margin-top: -4px; line-height: 1.02; white-space: nowrap;
  color: var(--sage); font-weight: 800; font-size: 32px; letter-spacing: .01em;
  transform: translateX(-34px);   /* fallback; board.js refines per hh:mm width */
}
.clock-holiday.erev { font-weight: 700; font-size: 28px; opacity: .85; }

/* ── SPOTLIGHT ── rotating, extra-large single-section display ─────────────── */
/* The header (and any upcoming-day line) stays fixed at the top; the four body
   sections each take the whole area below it at ~2× bold, cycled by board.js
   on per-section timers (data-spot-* attributes, set in admin Settings). */
.stage.theme-spotlight {
  --bg:#10243e; --board-bg:#ffffff; --ink:#0c1f38; --ink-soft:#28415f; --ink-mute:#52708f;
  --line:#d4dded; --line-soft:#e9eef6; --accent:#b8862e; --accent-2:#1f5b8a;
  --rust:#b15a3f; --sage:#5f8060; --hi-bg:#fff4d6; --hi-ink:#3a2a00; --day-label:#1f5b8a;
  --font-serif:'Fraunces',serif; --font-sans:'Inter',system-ui,sans-serif;
  --font-heb:'Noto Serif Hebrew',serif; --font-heb2:'Heebo',sans-serif;
}
.theme-spotlight .board { display: flex; flex-direction: column; position: relative; padding: 30px 52px; }
.theme-spotlight .board > .header        { flex: 0 0 auto; }
.theme-spotlight .board > .right-row     { display: contents; }

/* The four rotating panels: overlaid, hidden until JS makes one active. */
.theme-spotlight .board > .services,
.theme-spotlight .board > .announcements,
.theme-spotlight .board .right-row .yahrzeits,
.theme-spotlight .board .right-row .shiurim {
  position: absolute !important;
  left: 52px; right: 52px; bottom: 40px;
  top: var(--spot-top, 230px);
  border: none !important; padding: 0 !important; margin: 0 !important;
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; visibility: hidden;
  transition: opacity .35s ease;
}
.theme-spotlight .board .spot-on { opacity: 1 !important; visibility: visible !important; }

/* Big, bold typography for whichever panel is showing. */
.theme-spotlight .eyebrow { font-size: 56px; font-weight: 700; margin: 0 0 32px; }
.theme-spotlight .eyebrow.small { font-size: 56px; }
.theme-spotlight .srv td { font-size: 58px; font-weight: 800; padding: 16px 0; }
.theme-spotlight .srv td.time { width: 280px; }
.theme-spotlight .zmanim { margin-top: 36px; gap: 64px; }
.theme-spotlight .zmanim .zval { font-size: 54px; }
.theme-spotlight .zmanim .zlabel { font-size: 34px; }
.theme-spotlight .services-extra { display: none; }          /* avoid overflow at 2× */
.theme-spotlight .announcements p { font-size: 54px; font-weight: 700; line-height: 1.3; padding-left: 76px; margin: 0 0 34px; }
.theme-spotlight .announcements p .ico { font-size: 54px; }
.theme-spotlight .chair-banner { font-size: 40px; padding: 22px; margin-top: 28px; }
.theme-spotlight .yarz-row { gap: 20px; margin-bottom: 22px; }
.theme-spotlight .yarz-row .candle { font-size: 42px; }
.theme-spotlight .yarz-row .name-en { font-size: 46px; }
.theme-spotlight .yarz-row .name-he { font-size: 38px; }
.theme-spotlight .yarz-row .when { font-size: 30px; }
.theme-spotlight .today-tag { font-size: 22px; padding: 5px 16px; }
.theme-spotlight .shiur-row { gap: 28px; margin-bottom: 24px; }
.theme-spotlight .shiur-row .when { font-size: 54px; }
.theme-spotlight .shiur-row .when .day { font-size: 34px; }
.theme-spotlight .shiur-row .title { font-size: 54px; font-weight: 800; }
.theme-spotlight .shiur-row .teacher { font-size: 36px; }
.theme-spotlight .empty-note { font-size: 44px; }

/* Spotlight overflow: a clipped flex window under the eyebrow, whose inner
   track board.js translates so a too-long section scrolls instead of clipping. */
.theme-spotlight .spot-scroll { flex: 1 1 auto; min-height: 0; overflow: hidden; }
.theme-spotlight .spot-track  { will-change: transform; }
.theme-spotlight .scroll-area { overflow: visible; }   /* let yahrzeit list flow */
.theme-spotlight .scroll-track { animation: none !important; transform: none !important; }
.theme-spotlight .scroll-block[aria-hidden="true"] { display: none; }   /* drop loop dup */

/* HOME-PAGE TOP MENU BAR --------------------------------------------------- */
/* A fixed horizontal bar above the board on the home page. The board (.fit) is
   shifted down by the bar height in board.js so nothing is hidden. "Full-page"
   (or Escape) sets body.kiosk-mode → bar hidden, board fills the screen;
   Escape / Backspace returns. Lives outside .stage so it isn't scaled. */
.home-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60; min-height: 56px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; padding: 8px 20px;
  background: #14223f; color: #f4ecdb;
  font-family: 'Inter', system-ui, sans-serif;
  box-shadow: 0 2px 14px rgba(0,0,0,.25);
}
.home-bar .hb-brand { font-family: 'Fraunces', serif; font-weight: 700; font-size: 21px; letter-spacing: .01em; }
.home-bar .hb-links { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.home-bar .hb-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.home-bar a, .home-bar .hb-full {
  color: #f4ecdb; text-decoration: none; font-size: 17px; font-weight: 600;
  padding: 8px 14px; border-radius: 8px; white-space: nowrap;
}
.home-bar a:hover, .home-bar .hb-full:hover { background: rgba(255,255,255,.12); }
.home-bar .hb-full { background: transparent; border: 1px solid rgba(244,236,219,.4); cursor: pointer; font-family: inherit; }
.home-bar .hb-cta { background: #b88746; color: #fff; }
.home-bar .hb-cta:hover { background: #a2763a; }

body.kiosk-mode .home-bar, body.kiosk-mode .disp-panel { display: none !important; }

/* Full-page return hotspot. Hidden in normal mode (the bar's Full-page button +
   Esc handle everything); in kiosk-mode it's a deliberate top-left corner target
   that is fully invisible at rest — no chip, no icon — but still fully clickable
   (44px), so an accidental board tap can never hide the board yet the menu can be
   recovered by clicking the corner. A faint hamburger chip fades in only on
   hover/focus so a mouse operator can still locate the target. */
#menu-hotspot { display: none; }
body.kiosk-mode #menu-hotspot {
  display: block; position: fixed; top: 8px; left: 8px; width: 44px; height: 44px;
  z-index: 9999; padding: 0; margin: 0; border: 0; border-radius: 10px; cursor: pointer;
  background: transparent; transition: background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
body.kiosk-mode #menu-hotspot:hover, body.kiosk-mode #menu-hotspot:focus-visible { background: rgba(18,26,42,.34); }
body.kiosk-mode #menu-hotspot::before {
  content: ""; position: absolute; top: 15px; left: 12px; width: 20px; height: 14px;
  border-top: 2.5px solid #fff; border-bottom: 2.5px solid #fff;
  box-shadow: 0 5.75px 0 -1.25px #fff;   /* middle bar of the hamburger */
  opacity: 0; transition: opacity .15s ease;
}
body.kiosk-mode #menu-hotspot:hover::before, body.kiosk-mode #menu-hotspot:focus-visible::before { opacity: 1; }

/* Print chooser options */
.print-opts { display: flex; flex-direction: column; gap: 8px; margin: 4px 0; }
.print-opt { display: block; text-align: left; text-decoration: none; cursor: pointer;
  background: #fff; border: 1px solid #cfd6e0; border-radius: 10px; padding: 12px 14px;
  font: inherit; color: #1d2733; }
.print-opt:hover { background: #f3efe6; border-color: #b88746; }
.print-opt b { display: block; font-size: 17px; font-weight: 700; }
.print-opt span { display: block; color: #6b7685; font-size: 13px; margin-top: 2px; }

/* Per-viewer Display settings panel (modal) */
.disp-panel { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center;
  background: rgba(10,15,25,.5); font-family: 'Inter', system-ui, sans-serif; }
.disp-panel[hidden] { display: none; }
.disp-card { background: #fff; color: #1d2733; width: min(520px, 92vw); max-height: 90vh; overflow: auto;
  border-radius: 14px; padding: 24px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.disp-card h3 { margin: 0 0 6px; font-family: 'Fraunces', serif; font-size: 24px; }
.disp-note { margin: 0 0 16px; color: #6b7685; font-size: 14px; line-height: 1.45; }
.disp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; margin-bottom: 14px; }
.disp-row select { font: inherit; font-size: 16px; padding: 7px 10px; }
.disp-fs { border: 1px solid #e3dfd4; border-radius: 10px; padding: 10px 14px 12px; margin: 0 0 14px; }
.disp-fs legend { padding: 0 6px; color: #6b7685; font-size: 13px; }
.disp-fs label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; margin: 7px 0; }
.disp-fs input { width: 84px; font: inherit; font-size: 15px; padding: 5px 8px; }
.disp-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.disp-actions button { font: inherit; font-size: 15px; font-weight: 600; padding: 9px 16px; border-radius: 8px;
  border: 1px solid #cfd6e0; background: #fff; cursor: pointer; }
.disp-primary { background: #14223f !important; color: #fff; border-color: #14223f !important; }

/* "Press Esc" toast shown briefly on entering full-page */
.kiosk-toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 71;
  background: rgba(20,28,42,.92); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-family: 'Inter', system-ui, sans-serif; font-size: 18px; box-shadow: 0 6px 24px rgba(0,0,0,.3); }
.kiosk-toast[hidden] { display: none; }
.kiosk-toast kbd { background: #fff; color: #14223f; border-radius: 4px; padding: 1px 7px; font-weight: 700; font-family: inherit; }

/* Touch-friendly exit from full-page (no Esc on phones). Only shown in full-page. */
.kiosk-exit { position: fixed; top: 14px; left: 14px; z-index: 62; display: none;
  align-items: center; gap: 6px; background: rgba(20,28,42,.55); color: #fff;
  border: none; border-radius: 10px; padding: 10px 16px; font-size: 16px; font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif; cursor: pointer; }
.kiosk-exit:hover { background: rgba(20,28,42,.78); }
body.kiosk-mode .kiosk-exit { display: inline-flex; }

/* PRINT --------------------------------------------------------------------- */
/* The board is a fixed 1920×1080 px canvas, so to fit one sheet we transform-
   scale the whole stage down and clip it inside a small, fixed-size, in-flow
   box (.fit). Because that box is only ~960×540 px, the browser sees a single-
   page element — no overflow onto extra sheets, regardless of dialog scale. */
@media print {
  /* A4 landscape by default; the box below also fits Letter landscape if chosen. */
  @page { size: A4 landscape; margin: 6mm; }
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important;
               width: auto !important; height: auto !important; overflow: hidden !important; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .home-bar, .disp-panel, .kiosk-toast, .kiosk-exit, #offline-badge { display: none !important; }

  /* One-page snapshot: scale 1920×1080 → 980×551px (≈259mm × 146mm). Fits the
     printable area of both A4 landscape (~285×198mm) and Letter landscape
     (~267×204mm) with margins to spare. */
  .fit { position: relative !important; inset: auto !important; margin: 0 auto !important;
         width: 980px !important; height: 551px !important; overflow: hidden !important;
         background: #fff !important; }
  .stage { position: absolute !important; top: 0 !important; left: 0 !important;
           transform: scale(0.5104) !important; transform-origin: top left !important; }
  /* Freeze marquees at the top; drop the duplicate loop blocks. Panels stay
     clipped to their frames (a faithful snapshot of the board). */
  .scroll-track { animation: none !important; transform: none !important; }
  .scroll-block[aria-hidden="true"] { display: none !important; }

  /* Spotlight: show all four panels in the normal grid (not the 2× rotation),
     with type back at base sizes so it fits the cells. */
  .theme-spotlight .board { display: grid !important; }
  .theme-spotlight .board > .right-row { display: grid !important; }
  .theme-spotlight .board > .services,
  .theme-spotlight .board > .announcements,
  .theme-spotlight .board > .right-row,
  .theme-spotlight .board .right-row .yahrzeits,
  .theme-spotlight .board .right-row .shiurim {
    position: static !important; opacity: 1 !important; visibility: visible !important;
    top: auto !important; left: auto !important; right: auto !important; bottom: auto !important; }
  .theme-spotlight .spot-scroll { overflow: hidden !important; }
  .theme-spotlight .spot-track { transform: none !important; }
  .theme-spotlight .eyebrow { font-size: 30px !important; }
  .theme-spotlight .srv td { font-size: 28px !important; }
  .theme-spotlight .zmanim .zval, .theme-spotlight .zmanim .zlabel { font-size: 22px !important; }
  .theme-spotlight .announcements p { font-size: 30px !important; }
  .theme-spotlight .yarz-row .name-en { font-size: 28px !important; }
  .theme-spotlight .yarz-row .name-he { font-size: 24px !important; }
  .theme-spotlight .shiur-row .when, .theme-spotlight .shiur-row .title { font-size: 30px !important; }
  .theme-spotlight .shiur-row .teacher { font-size: 22px !important; }

  /* "Print pages": don't scale — flow each section full-size onto its own page. */
  body.print-split .fit { position: static !important; width: auto !important; height: auto !important;
                          overflow: visible !important; margin: 0 !important; }
  body.print-split .stage { position: static !important; transform: none !important;
                            width: 1000px !important; height: auto !important; }
  body.print-split .board { display: block !important; height: auto !important; }
  body.print-split .scroll-area { overflow: visible !important;
                                  -webkit-mask-image: none !important; mask-image: none !important; }
  body.print-split .board > .header,
  body.print-split .board > .services,
  body.print-split .board > .announcements,
  body.print-split .board > .right-row { break-after: page; page-break-after: always; }
}

/* ════════════════════════════════════════════════════════════════════════
   MOBILE / PORTRAIT-TABLET RESPONSIVE VIEW (≤820px). ADDITIVE ONLY — scoped to
   the normal home board (body.has-bar) and never the kiosk: the wall (?kiosk →
   body.kiosk-page), Full-page (.kiosk-mode), and admin previews (?date/?theme,
   no .has-bar) all keep the exact fixed 1920×1080 board. Here the board
   un-scales and its sections stack into a normal, scrolling page + a hamburger.
   MUST be `screen and` — otherwise these rules (esp. `.stage {transform:none
   !important}`, specificity 0,3,0) also apply when the print surface is ≤820px
   wide and cancel the @media print one-page scale, printing the board full-size
   and clipping it to the top-left corner. Print is handled solely by @media print.
   ════════════════════════════════════════════════════════════════════════ */
@media screen and (max-width: 820px) {
  /* Base rule sets html,body{overflow:hidden} for the fixed kiosk; on the flow
     view the WHOLE document must scroll, so release html too (iOS locks the page
     otherwise — you'd only see one screenful). */
  html { overflow: visible; height: auto; }
  .has-bar:not(.kiosk-mode) { overflow: visible; background: var(--board-bg); height: auto; }

  /* Un-fix and un-scale the fixed canvas → natural document flow. */
  .has-bar:not(.kiosk-mode) .fit {
    position: static; inset: auto; overflow: visible; height: auto;
    background: var(--board-bg); padding-top: 54px;   /* clear the fixed bar */
  }
  .has-bar:not(.kiosk-mode) .stage {
    position: static; width: 100%; height: auto; transform: none !important;
    --fs: 0.72;   /* shrink the content zones to phone-readable sizes */
  }

  /* Single-column stacked board. */
  .has-bar:not(.kiosk-mode) .board { display: block; height: auto; padding: 14px 16px 40px; }
  .has-bar:not(.kiosk-mode) .board > .services,
  .has-bar:not(.kiosk-mode) .board > .announcements,
  .has-bar:not(.kiosk-mode) .board > .right-row {
    grid-column: auto; grid-row: auto; margin: 0 0 22px; padding: 0; border: none;
  }
  .has-bar:not(.kiosk-mode) .board > .services { border-right: none; padding-right: 0; }
  .has-bar:not(.kiosk-mode) .right-row { display: block; border-top: none; padding-top: 0; }
  .has-bar:not(.kiosk-mode) .right-row .yahrzeits { border-right: none; padding-right: 0; margin-bottom: 22px; }
  .has-bar:not(.kiosk-mode) .board > .announcements { padding-bottom: 0; }

  /* Sections flow at natural height; kill the marquee/clip so the PAGE scrolls. */
  .has-bar:not(.kiosk-mode) .services,
  .has-bar:not(.kiosk-mode) .announcements,
  .has-bar:not(.kiosk-mode) .yahrzeits,
  .has-bar:not(.kiosk-mode) .shiurim { overflow: visible; min-height: 0; }
  .has-bar:not(.kiosk-mode) .board > .right-row > section { overflow: visible; }
  .has-bar:not(.kiosk-mode) .scroll-area {
    overflow: visible; height: auto; flex: none;
    -webkit-mask-image: none !important; mask-image: none !important;
  }
  .has-bar:not(.kiosk-mode) .scroll-track { animation: none !important; transform: none !important; }
  .has-bar:not(.kiosk-mode) .scroll-block[aria-hidden="true"] { display: none !important; }

  /* Header: stack the four cells; shrink the display-sized fonts. */
  .has-bar:not(.kiosk-mode) .header { flex-direction: column; align-items: flex-start; gap: 8px; padding-bottom: 14px; }
  .has-bar:not(.kiosk-mode) .header > .parsha { align-self: flex-start; text-align: right; }
  .has-bar:not(.kiosk-mode) .logo-img { height: 62px; }
  .has-bar:not(.kiosk-mode) .clock-col { align-items: flex-start; }
  .has-bar:not(.kiosk-mode) .date-en { font-size: 24px; }
  .has-bar:not(.kiosk-mode) .date-en .heb { font-size: 22px; }
  .has-bar:not(.kiosk-mode) .clock { font-size: 52px; text-align: left; }
  .has-bar:not(.kiosk-mode) .clock .sec { font-size: 28px; }
  .has-bar:not(.kiosk-mode) .parsha .name { font-size: 34px; }
  .has-bar:not(.kiosk-mode) .parsha .haft, .has-bar:not(.kiosk-mode) .parsha .cite { font-size: 15px; }
  .has-bar:not(.kiosk-mode) .learning .val { font-size: 16px; }
  .has-bar:not(.kiosk-mode) .learning .seasonal { font-size: 16px; }

  /* Shiurim: give the title room (drop the 180px min day column). */
  .has-bar:not(.kiosk-mode) .shiur-row { grid-template-columns: max-content 1fr; }

  /* Top bar → hamburger. Brand + toggle on one line; links drop down when open. */
  .home-bar { flex-wrap: wrap; }
  .home-bar .hb-toggle { display: inline-flex; align-items: center; justify-content: center; margin-left: auto;
    width: 44px; height: 40px; font-size: 24px; line-height: 1; background: transparent;
    color: #f4ecdb; border: 1px solid rgba(244,236,219,.4); border-radius: 8px; cursor: pointer; }
  .home-bar .hb-links, .home-bar .hb-right { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 2px; margin: 4px 0 0; }
  .home-bar.hb-open .hb-links, .home-bar.hb-open .hb-right { display: flex; }
  .home-bar.hb-open .hb-right { margin-left: 0; }
  .home-bar a, .home-bar .hb-full { width: 100%; text-align: left; }
}
.hb-toggle { display: none; }   /* hidden on wide screens (shown only in the mobile query) */
