/* Layout ("Full Height"): a fixed 1920×1080 stage scaled to fit the screen, three full-height columns.
   Left: shul logo, zmanim, Hebrew/English date. Middle: rotating feature panel (flyers, announcements,
   Shabbat). Right: clock and parsha, schedule, candle lighting/havdalah. Deep shul-blue ground,
   parchment text, one gold accent reserved for "what's next" and candle lighting. */
:root {
  --ground: #0d2131;
  --panel: #132e45;
  --panel-edge: #23476a;
  --text: #f2ecdf;
  --muted: #9db1c4;
  --gold: #e2bb62;
  --sky: #7fb3d3;
  --warn: #f08c6a;
  --display: 'Frank Ruhl Libre', 'Times New Roman', 'David', serif;
  --body: 'Assistant', 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;
  color-scheme: dark;
}

html, body { height: 100%; margin: 0; }
body { background: var(--ground); color: var(--text); font-family: var(--body); overflow: hidden; }
body.kiosk { cursor: none; }
body.preview {
  overflow: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 16px;
  box-sizing: border-box;
}

#fit { position: relative; width: 100%; height: 100%; overflow: hidden; }
body.preview #fit { height: auto; aspect-ratio: 16 / 9; max-width: 100%; border-radius: 6px; }

#stage {
  position: absolute; left: 0; top: 0;
  width: 1920px; height: 1080px;
  box-sizing: border-box;
  transform-origin: 0 0;
  display: grid;
  grid-template-columns: 480px minmax(0, 1fr) 480px;
  grid-template-rows: minmax(0, 1fr);
  gap: 26px;
  padding: 30px 40px;
  background:
    radial-gradient(1400px 700px at 10% -300px, rgba(38, 143, 193, 0.22), transparent 70%),
    var(--ground);
  font-variant-numeric: tabular-nums;
}
#stage > * { min-width: 0; }

/* ---------- side columns: logo · zmanim · dates  |  clock · schedule · Shabbat times ---------- */
.col { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 20px; min-height: 0; }
.brand svg { display: block; height: 150px; width: auto; }
.dates { display: grid; gap: 2px; padding: 0 6px; }
.hebdate { font-family: var(--display); font-weight: 700; font-size: 40px; line-height: 1.1; direction: rtl; text-align: left; unicode-bidi: plaintext; }
.engdate { font-size: 26px; color: var(--muted); letter-spacing: 0.01em; }
.when { display: grid; gap: 6px; justify-items: end; text-align: right; }
.clock { font-family: var(--body); font-weight: 700; font-size: 116px; line-height: 0.95; letter-spacing: -0.02em; white-space: nowrap; }
.clock small { font-size: 40px; font-weight: 600; color: var(--muted); margin-left: 8px; letter-spacing: 0.02em; }
.parsha { font-family: var(--display); font-size: 40px; font-weight: 700; line-height: 1.1; display: flex; gap: 16px; align-items: baseline; justify-content: flex-end; flex-wrap: wrap; }
.parsha .he { color: var(--gold); direction: rtl; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip { font-size: 21px; padding: 2px 12px; border: 1px solid var(--panel-edge); border-radius: 999px; color: var(--text); background: var(--panel); }
.next-light {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "lbl big" "day big"; align-items: center;
  border: 1px solid var(--panel-edge); border-radius: 12px; padding: 10px 18px; background: var(--panel);
}
.next-light .lbl { grid-area: lbl; font-size: 19px; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; }
.next-light .day { grid-area: day; font-size: 26px; font-weight: 600; }
.next-light .big { grid-area: big; font-size: 52px; font-weight: 700; line-height: 1.05; color: var(--gold); }
.next-light .big small { font-size: 26px; color: var(--muted); margin-left: 4px; font-weight: 600; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  padding: 22px 26px;
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.panel h2 {
  margin: 0 0 14px; display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--display); font-weight: 700; font-size: 40px; line-height: 1.1;
}
.panel h2 .he { font-size: 30px; color: var(--muted); direction: rtl; font-weight: 500; }

.rows { display: flex; flex-direction: column; min-height: 0; }
.row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 16px;
  padding: 8px 0 8px 22px; border-top: 1px solid rgba(157, 177, 196, 0.16);
  position: relative;
}
.row:first-child { border-top: 0; }
.row .name { font-size: 36px; font-weight: 600; line-height: 1.05; }
.row .sub { font-family: var(--display); font-size: 22px; line-height: 1.15; color: var(--muted); direction: rtl; text-align: left; unicode-bidi: plaintext; }
.row .time { font-size: 42px; font-weight: 700; text-align: right; white-space: nowrap; }
.row .time small { font-size: 0.6em; font-weight: 600; color: var(--muted); margin-left: 4px; }
.row.past { opacity: 0.42; }
.row.next .name, .row.next .time { color: var(--gold); }
.row.next::before {
  content: ''; position: absolute; left: 0; top: 50%; width: 10px; height: 10px; margin-top: -5px;
  border-radius: 50%; background: var(--gold);
}

/* schedule */
.sched-wrap { flex: 1; min-height: 0; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 48px), transparent);
          mask-image: linear-gradient(180deg, #000 calc(100% - 48px), transparent); }
.sched-wrap.fits { -webkit-mask-image: none; mask-image: none; }
.sched { display: flex; flex-direction: column; gap: 18px; transition: transform 1.2s ease; }
.day h3 {
  margin: 0 0 4px; display: flex; justify-content: space-between; align-items: baseline;
  font-size: 28px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--sky); font-weight: 700;
}
.day h3 .he { font-family: var(--display); letter-spacing: 0; text-transform: none; font-size: 28px; color: var(--muted); font-weight: 500; direction: rtl; }
.sched .row { grid-template-columns: 150px 1fr; padding-left: 22px; }
.sched .row .time { text-align: left; font-size: 36px; }
/* Wrap between words (and after a slash, see escName in app.js); a word is split only if it can't fit on a line by itself. */
.sched .row .name { font-size: 32px; font-weight: 600; line-height: 1.1; overflow-wrap: break-word; min-width: 0; }
.status { margin-top: 10px; font-size: 18px; color: var(--muted); }
.status.stale { color: var(--warn); }
.empty { font-size: 28px; color: var(--muted); padding: 8px 0; }

/* schedule changes from the weekly email */
.tag { font-family: var(--body); font-size: 0.62em; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 1px 8px; border-radius: 999px; border: 1px solid var(--muted); color: var(--muted); vertical-align: middle; white-space: nowrap; }
.tag.new { border-color: var(--gold); color: var(--gold); }
.row.cancelled .time, .row.cancelled .name { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); }
.row.cancelled .tag { text-decoration: none; display: inline-block; }

/* ---------- feature panel ---------- */
.feature { position: relative; padding: 0; background: linear-gradient(180deg, #16344f, var(--panel)); }
.slide {
  position: absolute; inset: 0; padding: 36px 46px 60px;
  display: flex; flex-direction: column; gap: 20px; overflow: hidden;
  /* Each slide carries the panel's background, so the one fading in covers the one underneath. */
  background: linear-gradient(180deg, #16344f, var(--panel));
  opacity: 0;
}
/* Only the incoming slide animates; the one underneath just hides once it's covered. */
.slide.on { opacity: 1; z-index: 2; transition: opacity 1s ease-in-out; }
.slide.prev { opacity: 1; z-index: 1; }
.ftitle { font-family: var(--display); font-weight: 900; font-size: 68px; line-height: 1.05; margin: 0; text-wrap: balance; }

.ann-body { font-size: 44px; line-height: 1.4; max-width: 30ch; white-space: pre-line; color: var(--text); }


/* Flyers fill the full-height panel; a blurred copy of the flyer fills the space around it. */
.slide.flyer-slide { padding: 0; }
.flyer { margin: 0; position: absolute; inset: 0; overflow: hidden; }
.flyer .bg { position: absolute; inset: -60px; width: calc(100% + 120px); height: calc(100% + 120px); object-fit: cover;
  filter: blur(38px) saturate(1.1) brightness(0.55); }
.flyer .fg { position: absolute; inset: 22px 22px 48px; width: calc(100% - 44px); height: calc(100% - 70px); object-fit: contain;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.45)); }
.progress { position: absolute; z-index: 3; left: 46px; right: 46px; bottom: 26px; display: flex; gap: 10px; }
.progress i { flex: 1; height: 4px; border-radius: 2px; background: rgba(157, 177, 196, 0.22); overflow: hidden; }
.progress i b { display: block; height: 100%; width: 0; background: var(--sky); }
.progress i.done b { width: 100%; }
.progress i.run b { animation: fill linear forwards; }
@keyframes fill { to { width: 100%; } }

@media (prefers-reduced-motion: reduce) {
  .slide.on, .sched { transition: none; }
  .progress i.run b { animation: none; width: 100%; }
}

/* ---------- paged slides (welcome, yahrzeits, learning) ----------
   --k scales the text and --cols sets the column count; app.js picks them so each page fits. */
.slide { --k: 1; --cols: 1; }
.fitbox { flex: 1; min-height: 0; overflow: hidden; }
.flow { column-count: var(--cols); column-gap: 48px; column-fill: balance; }
.flow h4 {
  margin: 0 0 6px; display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  font-size: calc(24px * var(--k)); letter-spacing: 0.18em; text-transform: uppercase; color: var(--sky); font-weight: 700;
}
.flow h4 .he { font-family: var(--display); letter-spacing: 0; text-transform: none; color: var(--muted); font-weight: 500; font-size: calc(26px * var(--k)); direction: rtl; }
.flow h4 .d { letter-spacing: 0.04em; color: var(--muted); font-weight: 600; text-transform: none; }

/* Welcome */
.slide.welcome .ftitle, .slide.learning .ftitle { font-size: 52px; margin-top: -14px; white-space: nowrap; }
.he-eyebrow { font-family: var(--display); font-weight: 700; font-size: 32px; color: var(--gold); direction: rtl; text-align: left; unicode-bidi: plaintext; line-height: 1; }
.grp { margin-bottom: calc(26px * var(--k)); }
.flow h4 { break-after: avoid; }
.grp > .ann { break-inside: avoid; }
.ann { padding: calc(8px * var(--k)) 0 calc(10px * var(--k)); border-top: 1px solid rgba(157, 177, 196, 0.16); }
.grp h4 + .ann { border-top: 0; padding-top: 2px; }
.ann-title { font-family: var(--display); font-weight: 700; font-size: calc(40px * var(--k)); line-height: 1.15; color: var(--gold); }
.ann-text { font-size: calc(36px * var(--k)); line-height: 1.3; color: var(--text); }
.ann-text p { margin: 0; }
.ann-text p + p { margin-top: 0.6em; }

/* Yahrzeits: centered like the printed list */
.slide.yahrzeits { text-align: center; }
.yz-head { display: grid; gap: 6px; justify-items: center; }
.yz-range { font-family: var(--display); font-size: 38px; font-weight: 700; color: var(--gold); }
.yz-note { font-size: 24px; color: var(--muted); }
.flow.yz h4 { justify-content: center; margin-bottom: 2px; }
.yz-day { break-inside: avoid; padding: calc(10px * var(--k)) 0 calc(14px * var(--k)); }
.yz-name { font-size: calc(36px * var(--k)); line-height: 1.32; white-space: var(--wrap, nowrap); }

/* Learning, by day */
.lr-day { break-inside: avoid; margin-bottom: calc(22px * var(--k)); }
.lr-row { display: grid; grid-template-columns: calc(225px * var(--k)) 1fr; column-gap: 18px; align-items: baseline;
  padding: calc(6px * var(--k)) 0; border-top: 1px solid rgba(157, 177, 196, 0.16); }
.lr-day h4 + .lr-row { border-top: 0; }
.lr-row .time { font-size: calc(34px * var(--k)); font-weight: 700; white-space: nowrap; }
.lr-row .time small { font-size: 0.62em; font-weight: 600; color: var(--muted); margin-left: 3px; }
.lr-row .name { font-size: calc(34px * var(--k)); font-weight: 600; line-height: 1.22; }

.slide.probe { visibility: hidden; pointer-events: none; }
