/* Projector deck — fills viewport, no document scroll, type scales with frame */

* { box-sizing: border-box; }

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--color-background);
  background-image: var(--brand-gradient);
  color: var(--color-foreground);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
  border-radius: calc(var(--radius) - 2px);
}

/* ------------------------------------------------------------------ stage */

.presenter-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  cursor: var(--cursor-default);
}

.presenter-shell button,
.presenter-shell a.cta {
  cursor: var(--cursor-pointer);
}

.presenter-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  height: var(--presenter-bar);
  padding: 0 clamp(1.25rem, 3vw, 2rem);
  background: var(--color-card);
  /* No border — stage gap + frame shadow provide separation */
}

.presenter-sep {
  width: 1px;
  height: 1.25rem;
  background: var(--color-border);
  flex-shrink: 0;
}

.reva-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.reva-logo__img {
  display: block;
  height: 100%;
  width: auto;
  max-width: none;
}

.reva-logo__img--dark { display: none; }

[data-theme="dark"] .reva-logo__img--light { display: none; }
[data-theme="dark"] .reva-logo__img--dark { display: block; }

.reva-logo-bar { height: 1.65rem; }

.reva-logo-hero {
  height: clamp(2rem, 9cqh, 3.75rem);
  margin-bottom: clamp(0.15rem, 1cqh, 0.5rem);
}

.reva-logo-cta {
  height: clamp(2.25rem, 8cqh, 3.25rem);
}

.presenter-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: var(--stage-pad);
}

.deck-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--deck-stack-gap);
  max-width: 100%;
  max-height: 100%;
  width: min(
    calc(100vw - 2 * var(--stage-pad)),
    calc(var(--stage-available-h) * 16 / 9)
  );
}

.frame {
  position: relative;
  container-type: size;
  container-name: frame;
  width: 100%;
  height: min(
    var(--stage-available-h),
    calc((100vw - 2 * var(--stage-pad)) * 9 / 16)
  );
  aspect-ratio: 16 / 9;
  flex-shrink: 1;
  min-height: 0;
  background: var(--color-card);
  border: none;
  border-radius: var(--radius-xl);
  /* same-color ring kills subpixel AA hairline without a visible light border */
  box-shadow: 0 0 0 1px var(--color-card), var(--shadow-lg);
  overflow: hidden;
}

.slide-layer {
  position: absolute;
  inset: var(--hover-gutter);
  display: grid;
  overflow: visible;
  background: var(--color-card);
}

.slide {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(0.5rem, 2cqh, 1.25rem);
  padding: clamp(1.25rem, 5cqw, 3.25rem);
  height: 100%;
  max-height: 100%;
  overflow: visible; /* frame clips; layer inset gives hover scale room */
  font-size: clamp(1.05rem, 2.6cqmin, 1.65rem);
  background: var(--color-card);
}

/* Programmatic focus on each slide must not draw a page-sized ring */
.slide:focus,
.slide:focus-visible {
  outline: none;
}

.slide-hero {
  justify-content: center;
  align-items: flex-start;
}

.slide.closing {
  justify-content: center;
  align-items: center;
  text-align: center;
}

/* Ambient tint — mixed into card, not a floating blob */
.slide-hero::before,
.slide.closing::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 85% 75% at 18% 22%,
    color-mix(in srgb, var(--color-secondary) 10%, var(--color-card)),
    var(--color-card) 72%
  );
}

.slide.closing::before {
  background: radial-gradient(
    ellipse 80% 70% at 50% 45%,
    color-mix(in srgb, var(--color-primary) 9%, var(--color-card)),
    var(--color-card) 70%
  );
}

.slide-hero > *,
.slide.closing > * {
  position: relative;
  z-index: 1;
}

.slide.closing .lede { margin-inline: auto; }

/* -------------------------------------------------------------- typography */

.display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.25rem, 9cqh, 4.75rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
  margin: 0;
  text-wrap: balance;
  color: var(--color-foreground);
}

.display.small { font-size: clamp(1.75rem, 7cqh, 3.25rem); }
.display.xl { font-size: clamp(2.75rem, 12cqh, 6rem); letter-spacing: -0.03em; }

.eyebrow {
  margin: 0;
  font-size: clamp(0.75rem, 2.2cqh, 1rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-primary);
}

.lede {
  margin: 0;
  font-size: clamp(1.05rem, 3.8cqh, 1.65rem);
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-muted-foreground);
  max-width: 48ch;
}

.lede.wide { max-width: 60ch; }

/* ------------------------------------------------------------------ tiles (shared surface for cards, agenda, steps, callouts) */

.tile {
  border: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-muted) 28%, var(--color-card));
  box-shadow: var(--shadow-sm);
}

.card {
  padding: clamp(0.85rem, 2.5cqh, 1.35rem);
  cursor: var(--cursor-default);
}

.card h3 {
  margin: 0 0 0.35em;
  font-size: clamp(1rem, 3.6cqh, 1.35rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-foreground);
}

.card p {
  margin: 0;
  font-size: clamp(0.95rem, 3cqh, 1.2rem);
  line-height: 1.45;
  color: var(--color-muted-foreground);
}

.grid-4,
.agenda,
.steps,
.callouts {
  padding-inline: calc(var(--hover-gutter) * 0.5);
  box-sizing: border-box;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.5rem, 1.8cqh, 1rem);
  min-height: 0;
}

/* ------------------------------------------------------------------ agenda */

.agenda {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.45rem, 1.5cqh, 0.75rem);
  min-height: 0;
}

.agenda-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: clamp(0.95rem, 3.2cqh, 1.25rem);
  padding: clamp(0.55rem, 1.8cqh, 0.9rem) clamp(0.75rem, 2cqw, 1rem);
}

.agenda-num {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: clamp(1.75rem, 5cqh, 2.25rem);
  height: clamp(1.75rem, 5cqh, 2.25rem);
  border-radius: var(--radius);
  font-size: clamp(0.75rem, 2.2cqh, 0.95rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-muted));
}

/* ------------------------------------------------------------------ steps */

.steps {
  display: grid;
  gap: clamp(0.45rem, 1.6cqh, 0.85rem);
  min-height: 0;
}

.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: start;
  padding: clamp(0.65rem, 2cqh, 1rem) clamp(0.85rem, 2.5cqw, 1.1rem);
}

.step .num {
  display: grid;
  place-items: center;
  width: clamp(2rem, 5.5cqh, 2.5rem);
  height: clamp(2rem, 5.5cqh, 2.5rem);
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--color-primary) 25%, var(--color-border));
  background: color-mix(in srgb, var(--color-primary) 8%, var(--color-muted));
  color: var(--color-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: clamp(0.85rem, 2.5cqh, 1.05rem);
}

.step h3 {
  margin: 0;
  font-size: clamp(1rem, 3.5cqh, 1.3rem);
  font-weight: 600;
}

.step p {
  margin: 0.15em 0 0;
  font-size: clamp(0.95rem, 3cqh, 1.15rem);
  color: var(--color-muted-foreground);
}

/* ------------------------------------------------------------------ spec table */

.table-scroll {
  overflow: visible;
  margin-inline: calc(var(--hover-gutter) * 0.5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  min-height: 0;
}

table.spec {
  border-collapse: collapse;
  width: 100%;
  font-size: clamp(0.95rem, 3cqh, 1.2rem);
}

table.spec th,
table.spec td {
  text-align: left;
  padding: clamp(0.55rem, 1.8cqh, 0.85rem) clamp(0.75rem, 2cqw, 1rem);
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

table.spec tr:last-child th,
table.spec tr:last-child td { border-bottom: 0; }

table.spec th {
  width: 34%;
  font-weight: 500;
  color: var(--color-muted-foreground);
  background: var(--color-muted);
}

table.spec td { color: var(--color-foreground); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ callouts */

.callouts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(0.4rem, 1.4cqh, 0.7rem);
  min-height: 0;
}

.callout {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: clamp(0.65rem, 2cqh, 1rem) clamp(0.85rem, 2.5cqw, 1.1rem);
  font-size: clamp(0.95rem, 3.2cqh, 1.25rem);
  line-height: 1.45;
  color: var(--color-foreground);
  list-style: none;
}

.callout::before {
  content: "";
  flex-shrink: 0;
  width: 0.35rem;
  height: 0.35rem;
  margin-top: 0.55em;
  border-radius: 999px;
  background: var(--color-primary);
}

/* ------------------------------------------------------------------ enter (CSS — no anime.js) */

@keyframes enter-item {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.is-entering [data-enter] {
  animation: enter-item 0.44s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: calc(50ms + var(--enter-i, 0) * 55ms);
}

.overlay.is-entering [data-enter] {
  animation-name: enter-fade;
}

@keyframes enter-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .is-entering [data-enter] {
    animation: none;
  }
}

/* ------------------------------------------------------------------ hover — lift + scale (pointer devices only) */

@media (hover: hover) and (pointer: fine) {
  .presenter-shell .tile,
  .presenter-shell .overlay button,
  .presenter-shell .hud button,
  .presenter-shell a.cta,
  .presenter-shell table.spec tbody tr {
    position: relative;
    transform-origin: center center;
    transition:
      transform var(--motion-hover),
      box-shadow var(--motion-hover),
      border-color var(--motion-hover),
      background var(--motion-hover),
      color var(--motion-hover);
  }

  .presenter-shell .tile:hover,
  .presenter-shell .hud button:hover,
  .presenter-shell table.spec tbody tr:hover {
    transform: translateY(var(--hover-lift-y)) scale(var(--hover-scale));
    box-shadow: var(--shadow-md);
    border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
    background: var(--color-card);
    color: var(--color-foreground);
    z-index: 2;
  }

  /* Modal rows are full-width inside a clip; lift only — scale shaves the edges */
  .presenter-shell .overlay button:hover {
    transform: translateY(var(--hover-lift-y));
    box-shadow: var(--shadow-md);
    border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
    background: var(--color-card);
    color: var(--color-foreground);
    z-index: 2;
  }

  .presenter-shell a.cta:hover {
    transform: translateY(var(--hover-lift-y)) scale(var(--hover-scale));
    background: color-mix(in srgb, var(--color-primary) 92%, black);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
    color: var(--color-on-primary);
  }

  .presenter-shell .overlay button[aria-current="true"] {
    border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border));
    background: color-mix(in srgb, var(--color-primary) 6%, var(--color-card));
  }

  .presenter-shell .tile:active,
  .presenter-shell .hud button:active,
  .presenter-shell a.cta:active,
  .presenter-shell table.spec tbody tr:active {
    transform: scale(1.02);
    transition-duration: var(--motion-press);
  }

  .presenter-shell .overlay button:active {
    transform: none;
    transition-duration: var(--motion-press);
  }

  table.spec tbody tr:hover th {
    background: color-mix(in srgb, var(--color-primary) 8%, var(--color-muted));
  }

  table.spec tbody tr:hover td {
    background: color-mix(in srgb, var(--color-primary) 4%, var(--color-card));
  }

  .cta::after {
    display: inline-block;
    transition: transform var(--motion-hover);
  }

  .cta:hover::after { transform: translateX(4px); }

  .eyebrow { transition: color var(--motion-hover); }
}

/* ------------------------------------------------------------------ CTA */

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
  min-height: clamp(2.75rem, 7cqh, 3.5rem);
  padding: 0 1.5rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--color-primary);
  color: var(--color-on-primary);
  font: inherit;
  font-size: clamp(1rem, 3.2cqh, 1.25rem);
  font-weight: 500;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.cta::after {
  content: "→";
  font-size: 1.15em;
  line-height: 1;
  opacity: 0.9;
}

.cta-logo {
  padding: 0.35rem 0.5rem;
  min-height: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: inherit;
}

.cta-logo::after { content: none; }

@media (hover: hover) and (pointer: fine) {
  .presenter-shell a.cta-logo:hover {
    background: color-mix(in srgb, var(--color-primary) 6%, transparent);
    border-color: transparent;
    box-shadow: none;
    color: inherit;
  }
}

/* ------------------------------------------------------------------ chrome */

.hud {
  position: static;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  min-height: var(--presenter-hud);
  padding: 0 0.1rem;
}

.hud button,
.hud .count {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  min-height: 2.5rem;
  min-width: 2.5rem;
  padding: 0 0.85rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--color-border) 65%, transparent);
  background: var(--color-card);
  color: var(--color-muted-foreground);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
}

.hud .count { font-variant-numeric: tabular-nums; }

.overlay[hidden] { display: none !important; }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--color-background) 78%, transparent);
  backdrop-filter: blur(10px);
  color: var(--color-foreground);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  gap: 0.5rem;
  padding: clamp(1.25rem, 5cqh, 2.25rem) clamp(1.25rem, 4cqw, 2.25rem) clamp(1.5rem, 4cqh, 2rem);
  overflow: hidden;
}

.overlay h2 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
  font-size: clamp(1.35rem, 5cqh, 2rem);
}

.overlay ol {
  list-style: none;
  margin: 0;
  padding: 0.2rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  scrollbar-gutter: stable;
}

.overlay li { min-width: 0; }

.empty .reva-logo-hero { margin-bottom: 0.25rem; }

.overlay button {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-align: left;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: inherit;
  font: inherit;
  font-size: clamp(0.85rem, 2.8cqh, 1.05rem);
  padding: 0.5rem 0.65rem;
  min-height: 2.5rem;
  display: flex;
  gap: 0.65rem;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.overlay button span:last-child {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

.overlay button[aria-current="true"] {
  border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border));
  background: color-mix(in srgb, var(--color-primary) 6%, var(--color-card));
}

.overlay .n {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-muted));
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.empty {
  display: grid;
  place-content: center;
  text-align: center;
  gap: 0.8rem;
  height: 100%;
  padding: 2rem;
}

/* ------------------------------------------------------------- fullscreen */

.presenter-shell:fullscreen,
.presenter-shell:-webkit-full-screen {
  height: 100%;
  max-height: none;
}

.presenter-shell:fullscreen .presenter-bar,
.presenter-shell:-webkit-full-screen .presenter-bar {
  display: none;
}

.presenter-shell:fullscreen .stage,
.presenter-shell:-webkit-full-screen .stage {
  padding: 0;
  --stage-available-h: calc(100dvh - var(--presenter-hud) - var(--deck-stack-gap));
}

.presenter-shell:fullscreen .deck-stack,
.presenter-shell:-webkit-full-screen .deck-stack {
  width: min(100vw, calc(var(--stage-available-h) * 16 / 9));
}

.presenter-shell:fullscreen .frame,
.presenter-shell:-webkit-full-screen .frame {
  height: min(var(--stage-available-h), calc(100vw * 9 / 16));
  border-radius: 0;
  box-shadow: none;
}

/* --------------------------------------------------------------- reduced */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 767px) {
  .overlay ol { grid-template-columns: 1fr; }
  .grid-4,
  .agenda { grid-template-columns: 1fr; }
}
