/* Deck engine and shared visual language.
   The stage is a fixed 1920 x 1080 canvas scaled to fit; every size below is in stage pixels. */

@font-face {
  font-family: 'Archivo';
  src: url('../assets/fonts/archivo-latin-wdth-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: block;
}

@font-face {
  font-family: 'Caveat';
  src: url('../assets/fonts/caveat-latin-wght-normal.woff2') format('woff2');
  font-weight: 400 700;
  font-display: block;
}

:root {
  --blue: #1d41d1;
  --green: #35cd59;
  --red: #e5372b;
  --ink: #111111;
  --paper: #ffffff;
  --mute: #d9dce5;
  --soft: #f1f2f6;
  --line: 12px;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-pop: cubic-bezier(0.3, 1.5, 0.5, 1);
  /* Motion multiplier. ?fast=1 sets it to 0, which collapses every entrance to its last frame. */
  --t: 1;
  color-scheme: light;
}

.fast {
  --t: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------ frame */

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

.viewport {
  position: relative;
  overflow: hidden;
  background: var(--paper);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  background: var(--paper);
  transform: translate(-50%, -50%);
  view-transition-name: stage;
}

.slide {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  background: var(--paper);
}

.slide.is-active {
  display: block;
}

.notes {
  display: none;
}

.defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  background: var(--soft);
  z-index: 5;
}

.progress i {
  display: block;
  height: 100%;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform calc(450ms * var(--t)) var(--ease-out);
}

.counter {
  position: absolute;
  right: 40px;
  bottom: 28px;
  z-index: 5;
  font-size: 22px;
  font-weight: 600;
  font-stretch: 88%;
  letter-spacing: 0.02em;
  color: #b3b7c4;
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------- motion between slides */

::view-transition-group(*) {
  animation-duration: 560ms;
  animation-timing-function: cubic-bezier(0.3, 0.7, 0.1, 1);
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 180ms;
}

::view-transition-old(stage) {
  animation: vt-out 200ms ease-in both;
}

::view-transition-new(stage) {
  animation: vt-in 340ms var(--ease-out) both;
}

html[data-dir='back']::view-transition-old(stage) {
  animation-name: vt-out-back;
}

html[data-dir='back']::view-transition-new(stage) {
  animation-name: vt-in-back;
}

@keyframes vt-out {
  to {
    opacity: 0;
    transform: translateX(-28px);
  }
}

@keyframes vt-in {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
}

@keyframes vt-out-back {
  to {
    opacity: 0;
    transform: translateX(28px);
  }
}

@keyframes vt-in-back {
  from {
    opacity: 0;
    transform: translateX(-28px);
  }
}

/* Entrances. Add .in plus a flavour; --d is the delay in ms, --dur the duration. */

.slide.is-active .in {
  animation: in-up calc(var(--dur, 700ms) * var(--t)) var(--ease-out) calc((var(--d, 0) * 1ms + 140ms) * var(--t)) both;
}

.slide.is-active .in.pop {
  animation-name: in-pop;
  animation-timing-function: var(--ease-pop);
}

.slide.is-active .in.left {
  animation-name: in-left;
}

.slide.is-active .in.right {
  animation-name: in-right;
}

.slide.is-active .in.down {
  animation-name: in-down;
}

.slide.is-active .in.fade {
  animation-name: in-fade;
}

.slide.is-active .in.drop {
  animation-name: in-drop;
  animation-timing-function: cubic-bezier(0.3, 1.3, 0.5, 1);
}

.slide.is-active .in.wipe {
  animation-name: in-wipe;
  animation-timing-function: ease-in-out;
}

.slide.is-active .in.draw {
  stroke-dasharray: 1;
  animation-name: in-draw;
  animation-timing-function: ease-in-out;
}

@keyframes in-up {
  from {
    opacity: 0;
    translate: 0 44px;
  }
}

@keyframes in-down {
  from {
    opacity: 0;
    translate: 0 -44px;
  }
}

@keyframes in-left {
  from {
    opacity: 0;
    translate: -80px 0;
  }
}

@keyframes in-right {
  from {
    opacity: 0;
    translate: 80px 0;
  }
}

@keyframes in-fade {
  from {
    opacity: 0;
  }
}

@keyframes in-pop {
  from {
    opacity: 0;
    scale: 0.6;
  }
}

@keyframes in-drop {
  from {
    opacity: 0;
    translate: 0 -140px;
    rotate: -8deg;
  }
}

@keyframes in-wipe {
  from {
    clip-path: inset(-20px 100% -20px -20px);
  }
  to {
    clip-path: inset(-20px);
  }
}

@keyframes in-draw {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Bots walk on: the outer element travels, the inner one hops. */

.slide.is-active .walk {
  animation: walk-x calc(var(--walk, 1500ms) * var(--t)) cubic-bezier(0.3, 0.6, 0.3, 1) calc((var(--d, 0) * 1ms + 140ms) * var(--t)) both;
}

.slide.is-active .walk > .hop {
  display: block;
  transform-origin: 50% 100%;
  animation: walk-hop calc(var(--walk, 1500ms) / 5 * var(--t)) ease-in-out calc((var(--d, 0) * 1ms + 140ms) * var(--t)) 5 both;
}

@keyframes walk-x {
  from {
    translate: var(--from, -1500px) 0;
  }
}

@keyframes walk-hop {
  0%,
  100% {
    translate: 0 0;
    rotate: 0deg;
  }
  50% {
    translate: 0 -26px;
    rotate: 5deg;
  }
}

/* Ambient loops keep running in ?fast=1; only screenshots freeze them. */

.shot .amb,
.shot .amb * {
  animation: none !important;
}

@keyframes bob {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -14px;
  }
}

/* ------------------------------------------------------------- type & art */

.abs {
  position: absolute;
}

.h {
  margin: 0;
  color: var(--blue);
  font-size: var(--fs, 240px);
  font-weight: 860;
  font-stretch: 76%;
  line-height: 0.86;
  letter-spacing: -0.035em;
}

.h.caps {
  text-transform: uppercase;
  letter-spacing: -0.03em;
}

.h .ink,
.ink {
  color: var(--ink);
}

.h small {
  font-size: 0.5em;
  letter-spacing: -0.025em;
}

.label {
  margin: 0;
  font-size: var(--fs, 52px);
  font-weight: 700;
  font-stretch: 88%;
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.tag {
  position: absolute;
  top: 64px;
  right: 88px;
  margin: 0;
  color: var(--blue);
  font-size: 58px;
  font-weight: 860;
  font-stretch: 76%;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.hand {
  position: absolute;
  margin: 0;
  font-family: 'Caveat', 'Bradley Hand', cursive;
  font-size: var(--fs, 68px);
  font-weight: 700;
  line-height: 0.92;
  white-space: nowrap;
  rotate: var(--r, -4deg);
}

.ph-bold,
.ph,
.ph-fill {
  display: inline-block;
  font-size: var(--s, 280px);
  line-height: 1;
}

.arr {
  position: absolute;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  rotate: var(--r, 0deg);
}

.art {
  position: absolute;
  overflow: visible;
  fill: none;
  stroke: var(--ink);
  stroke-width: var(--line);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bot {
  display: block;
  width: var(--size, 240px);
  height: var(--size, 240px);
  flex: none;
}

.bot-name {
  margin: 14px 0 0;
  text-align: center;
  font-size: var(--fs, 56px);
  font-weight: 780;
  font-stretch: 80%;
  letter-spacing: -0.02em;
  line-height: 1;
}

.row {
  position: absolute;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.card {
  position: absolute;
  border: 10px solid var(--ink);
  border-radius: 40px;
  background: var(--paper);
}

.bar {
  display: block;
  height: 20px;
  border-radius: 99px;
  background: var(--mute);
}

.phone {
  position: absolute;
  border: 16px solid var(--ink);
  border-radius: 64px;
  background: var(--paper);
  overflow: hidden;
}

.phone::before {
  content: '';
  position: absolute;
  z-index: 2;
  top: 16px;
  left: 50%;
  width: 96px;
  height: 22px;
  border-radius: 99px;
  background: var(--ink);
  translate: -50% 0;
}

.strike {
  position: absolute;
  overflow: visible;
  fill: none;
  stroke: var(--red);
  stroke-width: 16;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ------------------------------------------------------- presenter notes */

.presenter {
  display: none;
  min-height: 0;
  flex-direction: column;
  gap: 18px;
  padding: 22px 26px 18px;
  border-left: 1px solid #e3e5ec;
  background: #fbfbfd;
  font-stretch: 96%;
  -webkit-user-select: text;
  user-select: text;
}

.notes-on .app {
  grid-template-columns: minmax(0, 1fr) clamp(340px, 32vw, 620px);
}

.notes-on .presenter {
  display: flex;
}

.notes-on .viewport {
  background: #eceef3;
}

.notes-on .stage {
  box-shadow: 0 10px 50px rgba(17, 17, 17, 0.12);
}

.presenter-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-variant-numeric: tabular-nums;
}

.presenter-count {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
}

.presenter-section {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8a8f9e;
}

.presenter-timer {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 700;
}

.presenter-timer b {
  font-size: 30px;
  font-stretch: 80%;
  letter-spacing: -0.01em;
}

.presenter-timer b.is-idle {
  color: #b3b7c4;
}

.presenter-timer b.is-over {
  color: var(--red);
}

.presenter-timer span {
  font-size: 14px;
  color: #8a8f9e;
}

.presenter h2 {
  margin: 0;
  font-size: clamp(22px, 2.1vw, 34px);
  font-weight: 800;
  font-stretch: 80%;
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--blue);
}

.presenter-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  font-size: clamp(20px, 1.75vw, 32px);
  font-weight: 450;
  line-height: 1.32;
}

.presenter-body p {
  margin: 0 0 0.7em;
}

.presenter-body .cue {
  padding: 0.5em 0.7em;
  border-left: 5px solid var(--blue);
  border-radius: 0 10px 10px 0;
  background: #eef1fd;
  font-size: 0.68em;
  font-weight: 600;
  line-height: 1.3;
}

.presenter-body kbd,
.presenter-keys kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0.05em 0.4em;
  border: 1px solid #cfd3de;
  border-bottom-width: 2px;
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 0.9em;
  font-weight: 700;
  text-align: center;
}

.presenter-next {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid #e3e5ec;
  font-size: 16px;
}

.presenter-next small {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a8f9e;
}

.presenter-next span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.presenter-next button,
.presenter-close {
  flex: none;
  width: 40px;
  height: 40px;
  border: 1px solid #cfd3de;
  border-radius: 10px;
  background: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.presenter-next button:hover,
.presenter-close:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.presenter-close {
  width: 30px;
  height: 30px;
  font-size: 15px;
}

.presenter-keys {
  margin: 0;
  font-size: 12px;
  line-height: 1.9;
  color: #8a8f9e;
}

@media (max-aspect-ratio: 1/1) {
  .notes-on .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .notes-on .viewport {
    aspect-ratio: 16 / 9;
  }

  .notes-on .presenter {
    border-left: 0;
    border-top: 1px solid #e3e5ec;
  }

  .presenter-keys {
    display: none;
  }
}

/* --------------------------------------------------------------- overview */

.overview {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: auto;
  padding: 28px;
  background: rgba(255, 255, 255, 0.97);
}

.overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 20px;
  font-size: 22px;
  font-weight: 800;
  font-stretch: 80%;
  color: var(--blue);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.overview-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 14px;
  border: 2px solid #e3e5ec;
  border-radius: 12px;
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.overview-item b {
  flex: none;
  min-width: 1.6em;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.overview-item:hover,
.overview-item:focus-visible,
.overview-item.is-current {
  border-color: var(--blue);
  outline: none;
}

.overview-item.is-current {
  background: #eef1fd;
}

/* ------------------------------------------------------------------- film */

.film-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
}

.film-layer video,
.film-layer iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
  background: #000;
}

.film-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 200ms;
}

.film-layer:hover .film-close,
.film-close:focus-visible {
  opacity: 1;
}

.film-unmute {
  position: absolute;
  left: 50%;
  bottom: 40px;
  z-index: 2;
  display: none;
  padding: 10px 18px;
  border-radius: 99px;
  background: #fff;
  color: #111;
  font-size: 16px;
  font-weight: 700;
  translate: -50% 0;
  pointer-events: none;
}

.film-layer.needs-unmute .film-unmute {
  display: block;
}

.film-remote {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-content: center;
  gap: 8px;
  background: rgba(17, 17, 17, 0.88);
  color: #fff;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
}

.film-remote small {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.75;
}
