/* MIP deck kit — interactive HTML version of the Canva PDF
   Layout: every layer is positioned in % of a 1361.25 x 765 stage (the PDF page size). */

:root {
  --ratio: 1.7794118;           /* 1361.25 / 765 */
  --ink: #1d1d1f;
  --paper: #e8e8ec;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.77, 0, .18, 1);
  --ease-soft-back: cubic-bezier(.3, 1.35, .6, 1);
  --ui-bg: rgba(29, 29, 31, .78);
  --ui-fg: #f5f5f7;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  touch-action: pan-y;
}

body.is-idle { cursor: none; }

.sr {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

.deck { position: fixed; inset: 0; }

.slide {
  position: absolute;
  inset: 0;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  background: var(--paper);
}
.slide.is-current {
  visibility: visible;
  opacity: 1;
  z-index: 2;
  transition: opacity .6s ease;
}
.slide.is-prev {
  visibility: visible;
  opacity: 1;
  z-index: 1;
}

/* blurred copy of the page background, fills the bands around the stage */
.ambient {
  position: absolute;
  inset: -8%;
  width: 116%;
  height: 116%;
  object-fit: cover;
  filter: blur(42px) saturate(1.05);
  pointer-events: none;
}

.stage {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(100vw, calc(100vh * var(--ratio)));
  height: min(100vh, calc(100vw / var(--ratio)));
  width: min(100vw, calc(100dvh * var(--ratio)));
  height: min(100dvh, calc(100vw / var(--ratio)));
  container-type: size;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, .06);
}

.stage > img.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.el, .chrome, .hot { position: absolute; }
.el img, .chrome img {
  display: block;
  width: 100%;
  height: 100%;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* ---------- entrance animations (state before build) ---------- */

.a-up   { opacity: 0; transform: translate3d(0, 1.1cqw, 0); }
.a-rise { overflow: hidden; }
.a-rise img { transform: translate3d(0, 104%, 0); }
.a-reveal { clip-path: inset(0 100% 0 0); }
.a-reveal img { transform: scale(1.08); transform-origin: 50% 50%; }
.a-draw   { clip-path: inset(0 100% 0 0); }
.a-draw.is-v { clip-path: inset(0 0 100% 0); }
.a-pop  { opacity: 0; transform: scale(.82); }
.a-fade { opacity: 0; }

.slide:not(.is-built) .a-pump { opacity: 0; }
/* special effect (prompted in the admin): start state from variables set per layer */
.a-fx {
  opacity: var(--fo, 1);
  transform: translate3d(var(--fx, 0), var(--fy, 0), 0) scale(var(--fs, 1)) rotate(var(--fr, 0deg));
  filter: var(--fb, none);
  clip-path: var(--fc, inset(0 0 0 0));
}

/* live counters (slide "Les chiffres") */
.count {
  font-family: "DeckCount", "Aspekta", sans-serif;
  font-weight: 700;
  font-kerning: normal;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
}
.count .cnt { display: inline-block; }
.count .cnt i { display: inline-block; width: 0; height: 0; vertical-align: baseline; }

/* ---------- built state ---------- */

.is-built .a-pump { animation: pump .9s linear var(--d) both; }
.is-built .a-fx {
  opacity: 1;
  transform: none;
  filter: none;
  clip-path: inset(0 0 0 0);
  transition: opacity var(--fd) var(--fe) var(--d), transform var(--fd) var(--fe) var(--d),
    filter var(--fd) var(--fe) var(--d), clip-path var(--fd) var(--fe) var(--d);
}
@keyframes pump {
  0%   { opacity: 0; transform: scale(.35); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  40%  { opacity: 1; transform: scale(1.16); animation-timing-function: cubic-bezier(.5, 0, .5, 1); }
  62%  { transform: scale(.94); animation-timing-function: cubic-bezier(.5, 0, .5, 1); }
  80%  { transform: scale(1.03); animation-timing-function: cubic-bezier(.5, 0, .5, 1); }
  100% { opacity: 1; transform: scale(1); }
}

.is-built .a-up {
  opacity: 1; transform: none;
  transition: opacity .9s ease var(--d), transform 1.1s var(--ease) var(--d);
}
.is-built .a-rise img {
  transform: none;
  transition: transform 1.15s var(--ease) var(--d);
}
.is-built .a-reveal {
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.25s var(--ease-io) var(--d);
}
.is-built .a-reveal img {
  transform: none;
  transition: transform 2.2s var(--ease) var(--d);
}
.is-built .a-draw, .is-built .a-draw.is-v {
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.2s var(--ease-io) var(--d);
}
.is-built .a-pop {
  opacity: 1; transform: none;
  transition: opacity .6s ease var(--d), transform .8s var(--ease-soft-back) var(--d);
}
.is-built .a-fade {
  opacity: 1;
  transition: opacity 1.8s ease var(--d);
}

/* photo that opens a video: soft zoom on hover (after the entrance is over) */
.is-ready .el.is-main img { transition: transform .9s var(--ease), filter .6s ease; }
.is-ready:has(.hot-video:hover) .el.is-main img { transform: scale(1.025); filter: brightness(.92); }

/* ---------- hotspots ---------- */

.hot {
  display: block;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 2px;
  -webkit-tap-highlight-color: transparent;
}
.hot:focus-visible { outline: 2px solid #3a6cf4; outline-offset: 3px; }
.hot-link:hover { background: rgba(29, 29, 31, .05); }

.hot-play { z-index: 3; }
.hot-play::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 1.5px solid rgba(29, 29, 31, .55);
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
}
.is-ready .hot-play::after { animation: ring 2.8s var(--ease) .2s infinite; }
.hot-play:hover::after { border-color: rgba(29, 29, 31, .9); }
@keyframes ring {
  0%   { opacity: .75; transform: scale(1); }
  70%  { opacity: 0;   transform: scale(1.9); }
  100% { opacity: 0;   transform: scale(1.9); }
}

.hot-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -40%);
  display: inline-flex;
  align-items: center;
  gap: .9cqw;
  padding: .9cqw 1.6cqw .9cqw 1.3cqw;
  border-radius: 999px;
  background: rgba(20, 20, 22, .72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 1.05cqw;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .35s ease, transform .5s var(--ease);
  pointer-events: none;
}
.hot-label svg { width: 1.1cqw; height: 1.1cqw; }
.hot-main:hover .hot-label, .hot-main:focus-visible .hot-label { opacity: 1; transform: translate(-50%, -50%); }

/* ---------- HUD ---------- */

.hud {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border-radius: 999px;
  background: var(--ui-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  color: var(--ui-fg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s ease, transform .5s var(--ease);
  pointer-events: none;
}
.hud.is-on { opacity: 1; transform: none; pointer-events: auto; }

.hud button {
  display: grid;
  place-items: center;
  height: 34px;
  min-width: 34px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.hud button:hover { background: rgba(255, 255, 255, .14); }
.hud button:focus-visible { outline: 2px solid #8fb0ff; outline-offset: 1px; }
.hud button[hidden] { display: none; }
.hud svg { width: 16px; height: 16px; }
.hud .count {
  min-width: 62px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  opacity: .9;
}
.hud .btn-video {
  gap: 7px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px 0 11px;
  background: rgba(255, 255, 255, .14);
  font-weight: 600;
}
.hud .btn-video:hover { background: rgba(255, 255, 255, .24); }
.hud .btn-video svg { width: 12px; height: 12px; }
.hud .sep { width: 1px; height: 18px; margin: 0 3px; background: rgba(255, 255, 255, .18); }

.progress {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  z-index: 19;
  pointer-events: none;
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: rgba(29, 29, 31, .45);
  transition: width .6s var(--ease);
}

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

.overview {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow-y: auto;
  padding: 28px clamp(16px, 4vw, 56px) 56px;
  background: rgba(232, 232, 236, .9);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  backdrop-filter: blur(22px) saturate(1.2);
  opacity: 0;
  transition: opacity .35s ease;
}
.overview[hidden] { display: none; }
.overview.is-open { opacity: 1; }
.overview header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin: 0 0 22px;
}
.overview h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.overview .keys { margin: 0; font-size: 12px; color: #55555a; line-height: 2; }
.overview kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .12);
  font: 600 11px/18px ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 22px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.grid button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.grid img {
  display: block;
  width: 100%;
  aspect-ratio: 1361.25 / 765;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 6px 18px rgba(0, 0, 0, .06);
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.grid button:hover img, .grid button:focus-visible img {
  transform: translateY(-3px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .08), 0 14px 30px rgba(0, 0, 0, .12);
}
.grid button:focus-visible { outline: none; }
.grid button:focus-visible img { outline: 2px solid #3a6cf4; outline-offset: 3px; }
.grid .meta {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.3;
}
.grid .meta b { font-variant-numeric: tabular-nums; color: #8a8a90; font-weight: 600; }
.grid .meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid .is-here img { outline: 2px solid var(--ink); outline-offset: 3px; }
.grid .has-video .meta span::after { content: "  ▶"; font-size: 10px; color: #8a8a90; }
.overview.is-open .grid li { animation: tile .6s var(--ease) both; animation-delay: calc(var(--i) * 12ms); }
@keyframes tile { from { opacity: 0; transform: translateY(10px); } }

/* ---------- video theatre ---------- */

.theatre {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vh, 48px) clamp(16px, 4vw, 64px);
  background: rgba(14, 14, 16, .9);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  opacity: 0;
  transition: opacity .4s ease;
}
.theatre[hidden] { display: none; }
.theatre.is-open { opacity: 1; }
.theatre figure {
  margin: 0;
  width: min(100%, calc((100vh - 140px) * 16 / 9));
  width: min(100%, calc((100dvh - 140px) * 16 / 9));
  transform: translateY(14px) scale(.975);
  transition: transform .7s var(--ease);
}
.theatre.is-open figure { transform: none; }
.theatre .screen { position: relative; }
.theatre video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 6px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.theatre figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  color: #f5f5f7;
  font-size: 14px;
}
.theatre figcaption strong { font-weight: 600; letter-spacing: .01em; }
.theatre figcaption span { color: #a1a1a6; font-size: 12px; }
.theatre .close {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
}
.theatre .close:hover { background: rgba(255, 255, 255, .22); }
.theatre .close svg { width: 18px; height: 18px; }
.theatre .error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  border-radius: 6px;
  background: #111;
  color: #f5f5f7;
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
}
.theatre .error[hidden] { display: none; }

/* ---------- blackout (presenter "B" key) ---------- */

.blackout {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease;
}
.blackout.is-on { opacity: 1; pointer-events: auto; cursor: none; }

/* ---------- live sync (?pilote / ?suivre) ---------- */

.live-badge {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 7px 13px 7px 11px;
  border-radius: 999px;
  background: var(--ui-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--ui-fg);
  font-size: 12px;
  letter-spacing: .01em;
  pointer-events: none;
  opacity: .9;
}
.live-badge[hidden] { display: none; }
.live-badge i, .live-on i {
  width: 8px; height: 8px;
  flex: none;
  border-radius: 50%;
  background: #9a9aa0;
}
.live-badge[data-state="live"] i, .live-on i { background: #ff3b30; animation: blink 1.6s ease-in-out infinite; }
.live-badge[data-state="error"] i { background: #ff9f0a; }
@keyframes blink { 50% { opacity: .35; } }

.live {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
  font-size: 13px;
}
.live:empty { display: none; }
.live-on { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.live button {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font: 600 13px/32px inherit;
  font-family: inherit;
  cursor: pointer;
}
.live .live-stop { background: #e5e5ea; color: var(--ink); }
.live-hint { color: #6e6e73; font-size: 12px; }
.live-err { flex-basis: 100%; color: #c4320a; font-size: 12px; }
.live-link {
  flex: 1 1 280px;
  min-width: 0;
  height: 32px;
  padding: 0 12px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  background: #f5f5f7;
  color: var(--ink);
  font: 13px ui-monospace, SFMono-Regular, Menlo, monospace;
  -webkit-user-select: all;
  user-select: all;
}

/* spectators: no local navigation, only fullscreen */
.is-follower .hud > :not(#btnFs):not(.sep) { display: none; }
.is-follower .hud .sep { display: none; }
.is-follower .hot { cursor: default; }
.is-follower .hot-label, .is-follower .hot-play::after { display: none; }
.is-follower .theatre .close { display: none; }
.is-follower .grid button { cursor: default; }

.join {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(232, 232, 236, .82);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  backdrop-filter: blur(24px) saturate(1.2);
  transition: opacity .45s ease;
}
.join.is-gone { opacity: 0; pointer-events: none; }
.join-card {
  max-width: 460px;
  padding: 32px 32px 28px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .12);
  text-align: center;
}
.join-kicker {
  margin: 0 0 10px;
  color: #ff3b30;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.join h1 { margin: 0 0 12px; font-size: 22px; line-height: 1.2; }
.join p { margin: 0 0 22px; color: #55555a; font-size: 14px; line-height: 1.5; }
.join button, .tap-play {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 22px 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.join button svg, .tap-play svg { width: 13px; height: 13px; }
.join button:focus-visible { outline: 2px solid #3a6cf4; outline-offset: 3px; }
.tap-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
.tap-play[hidden] { display: none; }

/* ---------- ?static : final state, no motion (tests, print) ---------- */

.is-static .slide, .is-static .slide * { transition: none !important; animation: none !important; }
.is-static .hud, .is-static .progress { display: none; }

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

@media (prefers-reduced-motion: reduce) {
  .a-up, .a-pop { transform: none; }
  .a-rise img, .a-reveal img { transform: none; }
  .a-reveal, .a-draw, .a-draw.is-v { clip-path: none; opacity: 0; }
  .a-rise { opacity: 0; }
  .is-built .a-up, .is-built .a-pop, .is-built .a-fade,
  .is-built .a-rise, .is-built .a-reveal, .is-built .a-draw {
    opacity: 1;
    transition: opacity .4s ease;
  }
  .is-ready .hot-play::after { animation: none; }
  .is-built .a-pump { animation: none; opacity: 1; }
  .a-fx { transform: none; filter: none; clip-path: none; opacity: 0; }
  .is-built .a-fx { opacity: 1; transform: none; filter: none; clip-path: none; transition: opacity .4s ease var(--d); }
  .slide.is-current { transition: opacity .3s ease; }
}
