/* smartboard: chalk-paper board, ink type, one vermilion marker. Built for a projector in a bright room. */
:root {
  --paper: #f3efe6;
  --paper-2: #e9e3d6;
  --ink: #121417;
  --ink-2: #4a4d52;
  --mark: #e2482b;
  --blue: #1d4ed8;
  --rule: rgba(18, 20, 23, 0.12);
  --font: "Avenir Next", "Segoe UI", "Helvetica Neue", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --rail: 44px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  background-image: radial-gradient(rgba(18, 20, 23, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* top rail: progress ticks + status */
.rail {
  position: fixed; inset: 0 0 auto 0; height: var(--rail); z-index: 50;
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  padding-top: env(safe-area-inset-top);
}
.mark { width: 14px; height: 14px; border-radius: 3px; background: var(--mark); transform: rotate(45deg); flex: none; }
.ticks { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; flex: 1; max-width: 520px; }
.ticks li { flex: 1; height: 5px; border-radius: 3px; background: var(--rule); transition: background .3s var(--ease); }
.ticks li.done { background: var(--ink-2); }
.ticks li.on { background: var(--mark); }
.slides-link { margin-left: auto; color: var(--ink-2); font-weight: 600; font-size: 14px; text-decoration: none; letter-spacing: .02em; }
.is-stage .slides-link { display: none; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: #c9a227; flex: none; }
.conn[data-s="live"] { background: #1f9d55; }
.conn[data-s="polling"] { background: var(--mark); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* layers */
.layer { position: fixed; inset: 0; }
.scene-layer { z-index: 1; }
.live-layer { z-index: 5; pointer-events: none; opacity: 0; transition: opacity .25s var(--ease); background: var(--ink); }
.live-layer.show { opacity: 1; pointer-events: auto; }
.overlay-layer { z-index: 10; pointer-events: none; }
.overlay-layer > * { pointer-events: auto; }

.scene, .ov-card, .ov-image {
  position: absolute; inset: 0;
  transition: opacity .28s var(--ease), transform .32s var(--ease);
}
.scene.entering { opacity: 0; transform: translateY(28px); }
.scene.leaving { opacity: 0; transform: translateY(-18px); }
.ov-card.entering, .ov-image.entering { opacity: 0; transform: scale(.96); }
.ov-card.leaving, .ov-image.leaving { opacity: 0; transform: scale(1.02); }

/* slide */
.slide, .scene > .card {
  position: absolute; inset: var(--rail) 0 0 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(20px, 6vw, 110px);
  padding-bottom: clamp(70px, 10vh, 140px);
  max-width: 1500px;
}
.count { font-weight: 700; font-size: clamp(14px, 1.5vw, 22px); letter-spacing: .14em; color: var(--ink-2); margin-bottom: clamp(10px, 2vh, 26px); font-variant-numeric: tabular-nums; }
.title {
  font-weight: 800; letter-spacing: -0.025em; line-height: 1.0;
  font-size: clamp(40px, 7.6vw, 150px); margin: 0 0 .3em; text-wrap: balance;
  overflow-wrap: anywhere;
}
.slide .title::after {
  content: ""; display: block; width: 1.4em; height: .1em; min-height: 5px; background: var(--mark);
  margin-top: .28em; border-radius: 3px;
}
.body {
  font-size: clamp(21px, 3.3vw, 60px); line-height: 1.22; margin: 0; max-width: 30ch;
  color: var(--ink); font-weight: 500; text-wrap: pretty; overflow-wrap: anywhere;
}
.pill {
  align-self: flex-start; font-weight: 800; font-size: clamp(13px, 1.4vw, 22px); letter-spacing: .12em; text-transform: uppercase;
  background: var(--mark); color: #fff; padding: .35em .8em; border-radius: 999px; margin-bottom: 1em;
}
.pill.alt { background: var(--blue); }
.tap {
  display: inline-flex; align-items: center; gap: .5em; align-self: flex-start;
  margin-top: 1.2em; padding: .6em 1em; border-radius: 12px;
  background: var(--ink); color: var(--paper); text-decoration: none;
  font-weight: 700; font-size: clamp(17px, 2vw, 32px); max-width: 100%; overflow-wrap: anywhere;
}
.tap::after { content: "\2197"; }

/* card scene + card overlay */
.card {
  background: #fff; border: 3px solid var(--ink); border-radius: 22px;
  box-shadow: 10px 10px 0 var(--ink);
}
.scene > .card {
  inset: calc(var(--rail) + 4vh) 5vw 12vh 5vw; padding: clamp(22px, 5vw, 80px);
  max-width: none;
}
.scene > .card .title { font-size: clamp(36px, 6.4vw, 124px); }
.scene > .card .body { max-width: 34ch; }
.ov-card {
  display: grid; place-items: center; padding: calc(var(--rail) + 10px) 16px 90px;
  background: rgba(243, 239, 230, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.ov-card .card { width: min(1100px, 100%); max-height: 100%; overflow: auto; padding: clamp(22px, 4vw, 64px); }
.ov-card .title { font-size: clamp(34px, 5.6vw, 104px); }
.card-img { display: block; width: 100%; max-height: 38vh; object-fit: contain; border-radius: 12px; margin-bottom: 1em; }
.links { list-style: none; margin: 1em 0 0; padding: 0; display: flex; flex-direction: column; gap: .5em; }
.links .tap { margin-top: 0; }

/* media scenes + image overlay */
.media { position: absolute; inset: var(--rail) 0 0 0; width: 100%; height: calc(100% - var(--rail)); object-fit: contain; background: var(--ink); }
.ov-image { background: var(--ink); display: grid; place-items: center; }
.ov-image img { width: 100%; height: 100%; object-fit: contain; }
.media-title {
  position: absolute; left: 16px; bottom: 16px; max-width: calc(100% - 32px);
  background: var(--paper); color: var(--ink); font-weight: 800; padding: .3em .7em; border-radius: 10px;
  font-size: clamp(18px, 2.6vw, 44px);
}

/* live feed */
.feed-wrap, .live-layer > .ov-card { position: absolute; inset: 0; opacity: 0; transition: opacity .25s var(--ease); }
.feed-wrap.show, .live-layer > .ov-card.show { opacity: 1; }
.live-layer > .ov-card { background: var(--paper); }
.feed { position: absolute; inset: 0 0 38px 0; width: 100%; height: calc(100% - 38px); object-fit: contain; background: #000; }
.addr {
  position: absolute; left: 0; right: 0; bottom: 0; height: 38px;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: 16px;
  white-space: nowrap; overflow: hidden;
}
.addr-text { overflow: hidden; text-overflow: ellipsis; }
.rec { width: 10px; height: 10px; border-radius: 50%; background: var(--mark); flex: none; animation: blink 1.4s steps(2) infinite; }
.addr.private .rec { background: #c9a227; }
body.live-on .rail { opacity: 0; pointer-events: none; }
body.live-on .caption { bottom: 52px; }

/* caption + say */
.caption {
  position: fixed; z-index: 30; left: 50%; bottom: clamp(14px, 3vh, 34px); transform: translate(-50%, 20px);
  max-width: calc(100% - 32px); width: max-content;
  background: var(--ink); color: var(--paper); border-radius: 14px;
  padding: .45em .9em; font-weight: 700; font-size: clamp(20px, 3vw, 52px); line-height: 1.15;
  opacity: 0; transition: opacity .22s var(--ease), transform .28s var(--ease); pointer-events: none;
  text-align: center; text-wrap: balance;
}
.caption.show { opacity: 1; transform: translate(-50%, 0); }
.say {
  position: fixed; z-index: 31; right: 16px; top: calc(var(--rail) + 12px);
  max-width: min(760px, calc(100% - 32px));
  background: var(--blue); color: #fff; border-radius: 22px 22px 6px 22px;
  padding: .55em .9em; font-weight: 700; font-size: clamp(20px, 2.8vw, 46px); line-height: 1.2;
  opacity: 0; transform: translateY(-10px) scale(.97); transition: opacity .22s var(--ease), transform .28s var(--ease); pointer-events: none;
}
.say.show { opacity: 1; transform: none; }

/* stage start */
.start {
  position: fixed; inset: 0; z-index: 100; border: 0; cursor: pointer;
  background: var(--ink); color: var(--paper); font-family: var(--font);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  transition: opacity .35s var(--ease);
}
.start span { font-size: clamp(56px, 12vw, 200px); font-weight: 800; letter-spacing: -0.03em; border-bottom: 10px solid var(--mark); }
.start small { font-size: clamp(16px, 2vw, 28px); opacity: .7; }
.start.gone { opacity: 0; pointer-events: none; }
.start[hidden] { display: none; }

@media (max-width: 640px) {
  :root { --rail: 40px; }
  .slide { justify-content: flex-start; padding-top: 9vh; }
  .card { box-shadow: 6px 6px 0 var(--ink); border-radius: 16px; }
  .scene > .card { inset: calc(var(--rail) + 12px) 16px 90px 16px; }
  .addr { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .scene, .ov-card, .ov-image, .caption, .say { transition-duration: .01s; }
}
