/* ENTER27 deck app: the slides view (ui-*), the presenter view (pv-*) and the
   entrance motion (mo-*). Loaded after the deck stylesheet. Class names are
   prefixed so they never meet the deck's own (.row, .card, .text and so on). */

:root {
  /* Motion, after mesura: the 'house' out curve, the reveal, number and chart
     roles and the stagger. app.js mirrors these numbers in MOTION. */
  --mo-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --mo-stagger: 45ms;
  --mo-reveal: 533ms;
  --mo-number: 867ms;
  --mo-digit-lead: 320ms;
  --mo-chart: 867ms;

  --ui-bg: #1E1E1E;
  --ui-panel: #272727;
  --ui-raised: #333333;
  --ui-line: #414141;
  --ui-text: #F6F1E6;
  --ui-soft: #B8B4AB;
  --ui-accent: #E0A79A;
  --ui-red: #B5373C;
}

html, body { height: 100%; }

body {
  margin: 0;
  background: #000;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html[data-view="presenter"] body { background: var(--ui-bg); }

[hidden] { display: none !important; }

.ui-noscript { color: var(--ui-text); padding: 24px; font-size: 18px; }

/* The deck gives .num its own rise; the app's motion below replaces it. */
.sl .num { animation: none; }

.sl img { -webkit-user-drag: none; }

/* ---------- slides view ---------- */

.ui-view {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ui-view.is-idle { cursor: none; }

.ui-stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  transform-origin: 0 0;
}

.ui-layer { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; }

/* Slide change: the new slide fades in over the old one (MOTION.fade in app.js). */
@keyframes ui-fade { from { opacity: 0; } to { opacity: 1; } }
.ui-layer.ui-fade { animation: ui-fade 200ms ease-out backwards; }

.ui-bar {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border-radius: 10px;
  background: rgba(30, 30, 30, 0.94);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10), 0 6px 24px rgba(0, 0, 0, 0.45);
  color: var(--ui-text);
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 90ms linear;   /* leaving: nearly instant */
}

.ui-view.is-active .ui-bar { opacity: 1; pointer-events: auto; transition-duration: 150ms; }

.ui-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.ui-btn:hover { background: rgba(255, 255, 255, 0.12); }
.ui-btn:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 1px; }
.ui-btn:disabled { opacity: 0.35; cursor: default; background: transparent; }
.ui-btn svg { width: 20px; height: 20px; display: block; }

.ui-count {
  min-width: 72px;
  padding: 0 6px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ui-sep { width: 1px; height: 22px; margin: 0 6px; background: rgba(255, 255, 255, 0.18); }

.ui-hint, .ui-toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(92vw, 720px);
  padding: 12px 20px;
  border-radius: 10px;
  background: rgba(30, 30, 30, 0.94);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10), 0 6px 24px rgba(0, 0, 0, 0.45);
  color: var(--ui-text);
  font-size: 17px;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
  z-index: 20;
}

.ui-hint { top: 24px; }
.ui-toast { bottom: 84px; }
.ui-toast b { font-variant-numeric: tabular-nums; }

/* ---------- presenter view ---------- */

.pv-view {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--ui-bg);
  color: var(--ui-text);
  font-size: 15px;
  line-height: 1.35;
}

.pv-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ui-line);
}

.pv-group { display: flex; align-items: center; gap: 8px; }
.pv-spacer { flex: 1 1 0; }

.pv-timer {
  min-width: 3.1em;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.pv-timer.is-paused { color: var(--ui-soft); }

.pv-clock {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pv-label { font-size: 13px; color: var(--ui-soft); }

.pv-count { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.pv-badge {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--ui-red);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.pv-status { font-size: 13px; color: var(--ui-soft); white-space: nowrap; }
.pv-status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: #8A8780;
}
.pv-status[data-state="saved"]::before { background: #7FC79A; }
.pv-status[data-state="update"]::before { background: #E3B55B; }
.pv-status[data-state="update"] { color: var(--ui-text); cursor: pointer; text-decoration: underline; }

.pv-btn {
  appearance: none;
  -webkit-appearance: none;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--ui-line);
  border-radius: 6px;
  background: var(--ui-raised);
  color: var(--ui-text);
  font: inherit;
  font-size: 15px;
  white-space: nowrap;
  cursor: pointer;
}

.pv-btn:hover { background: #3F3F3F; }
.pv-btn:focus-visible, .pv-select:focus-visible, .pv-thumb:focus-visible, .pv-notes-body:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 1px;
}

.pv-btn-primary {
  height: 40px;
  padding: 0 18px;
  border-color: var(--ui-text);
  background: var(--ui-text);
  color: #1E1E1E;
  font-weight: 700;
}
.pv-btn-primary:hover { background: #FFFFFF; }
.pv-btn-primary.is-open { background: transparent; color: var(--ui-text); border-color: var(--ui-line); font-weight: 400; }
.pv-btn-primary.is-open:hover { background: var(--ui-raised); }

.pv-btn-quiet { border-color: transparent; background: transparent; color: var(--ui-soft); }
.pv-btn-quiet:hover { background: var(--ui-raised); color: var(--ui-text); }

.pv-btn-square { width: 44px; padding: 0; font-weight: 700; }

.pv-main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  min-height: 0;
}

.pv-left { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; }

/* A box holds one live slide. app.js sizes .pv-frame to the largest 16:9 that
   fits the box and scales the 1920 x 1080 slide inside it. */
.pv-box { position: relative; min-height: 0; }
.pv-current { flex: 0 1 auto; width: 100%; aspect-ratio: 16 / 9; }

.pv-frame {
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  border-radius: 4px;
  background: #000;
  box-shadow: 0 0 0 1px var(--ui-line);
}

.pv-frame > .sl {
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.pv-frame.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ui-panel);
  color: var(--ui-soft);
  font-size: 14px;
}

.pv-thumbs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; flex: 0 0 auto; }

.pv-thumb {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  border-radius: 4px;
  cursor: pointer;
}

.pv-thumb.is-off { cursor: default; }

.pv-thumb-label { display: flex; align-items: baseline; gap: 8px; height: 20px; line-height: 20px; font-size: 13px; color: var(--ui-soft); white-space: nowrap; overflow: hidden; }
.pv-thumb-label b { color: var(--ui-text); font-size: 15px; font-variant-numeric: tabular-nums; }
.pv-thumb-title { overflow: hidden; text-overflow: ellipsis; }

.pv-thumb-box { width: 100%; aspect-ratio: 16 / 9; max-height: 23vh; }

.pv-jump { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.pv-select {
  flex: 1 1 0;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--ui-line);
  border-radius: 6px;
  background: var(--ui-raised);
  color: var(--ui-text);
  font: inherit;
  font-size: 15px;
}

.pv-notes {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  background: var(--ui-panel);
}

.pv-notes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--ui-line);
}

.pv-notes-title { font-size: 13px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ui-soft); }

.pv-notes-body {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 22px 40px;
  font-size: var(--pv-notes-size, 22px);
  line-height: 1.5;
  color: #DDD8CC;
}

.pv-notes-body p { margin: 0 0 0.85em; }
.pv-notes-titlegroup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pv-notes-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.pv-edited { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: #E0A79A; }
.pv-editing .pv-notes-body { background: #2E2E2E; box-shadow: inset 0 0 0 2px #6A6A6A; cursor: text; }
.pv-editing .pv-notes-body:focus { outline: none; box-shadow: inset 0 0 0 2px #C9C4B8; }
.pv-notes-body em { font-style: italic; }
.pv-notes-body u { text-decoration: underline; }
.pv-notes-body ul, .pv-notes-body ol { margin: 0 0 0.85em; padding-left: 1.3em; }
.pv-notes-body li { margin: 0 0 0.3em; }
.pv-format { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--ui-line); background: #262626; }
.pv-format[hidden] { display: none; }
.pv-fmt { min-width: 40px; padding: 0 12px; }
.pv-fmt-b { font-weight: 700; }
.pv-fmt-i { font-style: italic; font-family: Georgia, serif; }
.pv-fmt-u { text-decoration: underline; }
.pv-fmt.is-on { background: #F6F1E6; color: #1E1E1E; border-color: #F6F1E6; }
.pv-notes-body strong { font-weight: 700; color: #FFFFFF; }
.pv-dir, .pv-dir strong, .pv-dir li { font-style: italic; color: #9C988F; }
.pv-notes-body .pv-dir strong { color: #B8B4AB; }
.pv-empty { color: var(--ui-soft); font-style: italic; }

@media (max-width: 860px) {
  .pv-view { position: static; min-height: 100%; }
  html[data-view="presenter"] body { overflow: auto; }
  .pv-main { grid-template-columns: minmax(0, 1fr); }
  .pv-notes-body { flex: 0 0 auto; overflow: visible; }
  .pv-thumb-box { max-height: none; }
}

/* ---------- entrance motion (slides view only) ---------- */

/* Fade up: mesura's "reveal" role. A block rises 24px on the 1920 canvas from
   the reveal blur. backwards, not both: once landed it rests on plain style. */
@keyframes mo-up {
  from { opacity: 0; transform: translateY(24px); filter: blur(8px); }
  to { opacity: 1; transform: none; filter: none; }
}

/* A block that holds a number or a bar fades and rises without the blur, so
   the blur does not fight the digits arriving inside it. */
@keyframes mo-up-clear {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

.sl .mo-up {
  animation: mo-up var(--mo-reveal) var(--mo-ease) backwards;
  animation-delay: var(--mo-d, 0ms);
}

.sl .mo-up.mo-clear { animation-name: mo-up-clear; }

/* Digit flip: mesura's DigitFlip on the "number" role. Each character rises
   out of its slot from the enter blur, one stagger after the one before. */
@keyframes mo-digit-in {
  from { opacity: 0; transform: translateY(0.62em); filter: blur(0.08em); }
  to { opacity: 1; transform: none; filter: none; }
}

/* mesura sets its numbers in tabular figures so the width holds while a value
   changes. Here a value never changes and the digits must land exactly where
   the plain text sits: this face has proportional figures by default and its
   tabular ones are wider (the 1 by 43%), so asking for them would move the
   number when the slots give way to the text. Lining figures only, which is
   what the face draws anyway; app.js gives each slot the width its character
   has in the plain text. */
.sl .mo-digits { font-variant-numeric: lining-nums; }

.mo-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.mo-word { white-space: nowrap; }

/* clip-path, not overflow, so the slot keeps its text baseline. */
.mo-slot {
  position: relative;
  display: inline-block;
  clip-path: inset(-0.08em -0.4em);
  text-align: left;
}

.mo-digit {
  display: inline-block;
  animation: mo-digit-in var(--mo-number) var(--mo-ease) backwards;
  animation-delay: calc(var(--mo-d, 0ms) + var(--mo-digit-lead, 0ms) + var(--i, 0) * var(--mo-stagger));
}

/* Bars: mesura's "chart" role. Columns grow from their base, horizontal bars
   and the segments of a stacked bar from the left. */
@keyframes mo-grow-y { from { transform: scaleY(0); } to { transform: none; } }
@keyframes mo-grow-x { from { transform: scaleX(0); } to { transform: none; } }

.sl .mo-grow-y {
  transform-origin: 50% 100%;
  animation: mo-grow-y var(--mo-chart) var(--mo-ease) backwards;
  animation-delay: var(--mo-d, 0ms);
}

.sl .mo-grow-x {
  transform-origin: 0 50%;
  animation: mo-grow-x var(--mo-chart) var(--mo-ease) backwards;
  animation-delay: var(--mo-d, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  .sl .mo-up, .mo-digit, .sl .mo-grow-x, .sl .mo-grow-y, .ui-layer.ui-fade { animation: none !important; }
  .ui-bar { transition: none; }
}

.pv-sync { font-size: 13px; }
.pv-sync[data-state="idle"] { color: #8FBF8F; }
.pv-sync[data-state="nokey"], .pv-sync[data-state="offline"] { color: var(--ui-soft); }
.pv-sync[data-state="denied"], .pv-sync[data-state="error"] { color: #E0A79A; }

/* revert confirmation and "viewing an earlier version" strip */
.pv-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--ui-line); background: #3A3226; color: #F2E6CF; font-size: 15px; }
.pv-notice[hidden] { display: none; }
.pv-notice-text { flex: 1 1 220px; }
.pv-btn-danger { background: #8E1F24; border-color: #8E1F24; color: #FFFFFF; }
.pv-btn-danger:hover { background: #A5262C; }
.pv-viewing .pv-notes-body { opacity: 0.85; box-shadow: inset 0 0 0 2px #6B5A3A; }

/* history list */
.pv-history { max-height: 45%; overflow-y: auto; border-bottom: 1px solid var(--ui-line); background: #262626; padding: 6px; }
.pv-history[hidden] { display: none; }
.pv-history-title { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ui-soft); padding: 6px 8px; }
.pv-history-row { display: flex; gap: 12px; width: 100%; text-align: left; padding: 8px; border: 0; border-radius: 6px; background: transparent; color: var(--ui-text); font: inherit; font-size: 15px; cursor: pointer; }
.pv-history-row:hover, .pv-history-row:focus-visible { background: #333333; }
.pv-history-when { flex: 0 0 120px; color: var(--ui-soft); font-variant-numeric: tabular-nums; }
.pv-history-what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-history-what.is-published { font-style: italic; color: #9C988F; }
.pv-btn.is-on { background: #F6F1E6; color: #1E1E1E; }
