/* Grand écran — charte « Congrès Mallorca 2026 » (Les Grandes Tables du Monde).
   Reprise de la page 1 du PDF : illustration de la calanque en fond, logo composite centré,
   GT Pressura Bold pour les titres, Geist Mono pour les sous-titres / compteurs.
   Couleurs et polices regroupées dans :root ; assets dans public/assets/. */

@font-face {
  font-family: "GT Pressura";
  src: url("/assets/fonts/GT-Pressura-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/assets/fonts/GeistMono-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/assets/fonts/GeistMono-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --blue: #0048bc;          /* bleu du logo */
  --pink: #f03868;          /* rose des titres intérieurs du PDF */
  --orange: #f0581f;
  --orange-2: #f3911f;
  --yellow: #e8eb08;        /* eau */
  --paper: #f5f38f;         /* ciel / papier jaune */
  --text: var(--blue);
  --muted: rgba(0, 72, 188, 0.55);
  --card: #ffffff;
  --card-border: rgba(0, 72, 188, 0.14);
  --font-title: "GT Pressura", "Arial Black", Impact, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --illustration: url("/assets/illustration.jpg");       /* page de garde */
  --illustration-list: url("/assets/illustration_v2.jpg"); /* grille des binômes */
  /* Pilotés depuis les réglages du backoffice (cf. applyAppearance() dans screen.js).
     --person-a/b : couleur du cercle et du texte ; --align-a/b : alignement dans la grille. */
  --person-a: var(--blue);
  --person-b: var(--blue);
  --align-a: center;
  --align-b: center;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text);
  background: var(--paper) var(--illustration-list) center top / cover no-repeat;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: none;
}

/* ---------------- Barre de logos (listing + révélation) ---------------- */
/* LGTDM à gauche, Momentum au centre, Congrès Mallorca à droite. */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2vw;
  padding: 1.8vh 3vw 1.2vh;
}
.topbar img { display: block; width: auto; }
.topbar-lgtdm { height: 10vh; justify-self: start; }
.topbar-momentum { height: 4.5vh; }
.topbar-mallorca { height: 8vh; justify-self: end; }
/* Page de garde : logo composite seul ; listing : barre de logos seule */
body.cover > .topbar { display: none; }
body:not(.cover) > .screen-header { display: none; }

/* ---------------- En-tête de la page de garde ---------------- */
.screen-header h1 {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 3.4vh;
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.logo {
  height: 15vh;
  width: auto;
  display: block;
  justify-self: center;
}

/* ---------------- Accueil ---------------- */
/* Reprend la maquette « Ecran Plateforme Momentum » (16:9) : positions relevées sur le PDF
   et exprimées en vh pour rester calées sur l'illustration. Chaque logo est centré
   horizontalement par ses marges (le transform est réservé à l'animation d'entrée). */
.home { display: none; }
body.cover:not(.end) > .home { display: block; position: fixed; inset: 0; }
body.cover:not(.end) > .screen-header { display: none; }
.home img {
  position: absolute; left: 0; right: 0; margin: 0 auto;
  width: auto; display: block;
  animation: cover-in 1s ease-out both;
}
.home-lgtdm { top: 4.6vh; height: 17.6vh; }
.home-momentum { top: 40.3vh; height: 9.2vh; }
.home img.home-momentum { animation-delay: 0.2s; }
.home-mallorca { top: 72.8vh; height: 15.8vh; }
.home img.home-mallorca { animation-delay: 0.4s; }

/* ---------------- Page de garde : écran de fin ---------------- */
/* Reproduit la page 1 du PDF : logo composite centré, titre en dessous en petit.
   L'écran de fin est identique, sans le titre. */
body.cover {
  justify-content: center;
  background-image: var(--illustration);
  background-position: center 16%;
}
body.cover .screen-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center; /* sinon le logo est étiré sur toute la largeur */
  padding: 0 3vw;
  gap: 0;
}
body.cover .logo { order: 1; height: 58vh; animation: cover-in 1s ease-out both; }
body.cover h1 {
  order: 2;
  margin-top: 5vh;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 2.6vh;
  letter-spacing: 0.08em;
  text-align: center;
  animation: cover-in 1s 0.3s ease-out both;
}
body.cover.end h1 { display: none; }
body.cover .grid { display: none; }
@keyframes cover-in {
  from { opacity: 0; transform: translateY(1.5vh); }
  to { opacity: 1; transform: none; }
}

/* ---------------- Grille des binômes ---------------- */
.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), 1fr);
  grid-template-rows: repeat(var(--rows, 4), 1fr);
  gap: 1.3vh;
  padding: 0 3vw 2.5vh;
  min-height: 0;
}
.cell {
  --names-gap: 1vw; /* écart entre les deux colonnes d'une case */
  border-radius: 1.2vh;
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: 0 1vh 3vh rgba(0, 72, 188, 0.10);
  position: relative;
  overflow: hidden;
  min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1.1vh 0.9vw;
}
.cell.empty {
  border: 0.25vh dashed rgba(0, 72, 188, 0.35);
  background: rgba(255, 255, 255, 0.28);
  box-shadow: none;
}
.cell.empty span { font-family: var(--font-mono); font-size: 3vh; font-weight: 700; color: rgba(0, 72, 188, 0.35); }

.cell-order {
  position: absolute; top: 0.8vh; left: 0.8vh;
  font-family: var(--font-mono);
  font-size: 1.5vh; font-weight: 700; color: var(--blue);
  background: rgba(0, 72, 188, 0.10); border-radius: 999px; padding: 0.2vh 0.9vh;
}
.cell-photos { display: flex; justify-content: center; margin-bottom: 1vh; }
.cell-photo {
  width: 8.5vh; height: 8.5vh; border-radius: 50%; overflow: hidden;
  border: 0.4vh solid var(--person-a); background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cell-photo + .cell-photo { margin-left: -2.2vh; border-color: var(--person-b); }
/* Réglage « photos centrées » : plus de chevauchement, chaque cercle est centré
   au-dessus de sa colonne de texte (mêmes colonnes que .cell-names). */
body.photos-centered .cell-photos {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--names-gap); width: 100%; justify-items: center;
}
body.photos-centered .cell-photo + .cell-photo { margin-left: 0; }
.cell-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cell-photo .initials { font-family: var(--font-title); font-size: 3vh; font-weight: 700; color: var(--person-a); }
.cell-photo + .cell-photo .initials { color: var(--person-b); }
.cell-names { display: flex; gap: var(--names-gap); width: 100%; justify-content: center; }
.cell-person { flex: 1; min-width: 0; text-align: var(--align-a); display: flex; flex-direction: column; }
.cell-person + .cell-person { text-align: var(--align-b); }
.cell-person strong {
  font-family: var(--font-title); font-size: 1.8vh; font-weight: 700; line-height: 1.1;
  text-transform: uppercase; color: var(--person-a);
}
.cell-person small { font-family: var(--font-mono); font-size: 1.2vh; color: var(--person-a); line-height: 1.2; margin-top: 0.4vh; }
.cell-person + .cell-person strong,
.cell-person + .cell-person small { color: var(--person-b); }

@media screen and (max-width: 1200px) {
  .cell-photos { margin-bottom: 0.5vh; }
  .cell-photo { width: 7vh; height: 7vh; }
  .cell-person strong { font-size: 1.7vh; }
  .cell-person small { font-size: 1.1vh; }
}


/* ---------------- Overlay de révélation ---------------- */
.reveal {
  position: fixed; inset: 0; z-index: 50;
  background:
    linear-gradient(rgba(232, 235, 8, 0.82), rgba(232, 235, 8, 0.82)),
    var(--paper) var(--illustration-list) center top / cover no-repeat;
  display: flex; flex-direction: column;
  animation: fade-in 0.4s ease-out;
}
.reveal[hidden] { display: none; }
.reveal.leaving { animation: fade-out 0.6s ease-in forwards; }
/* Enchaînement de deux binômes : le fond jaune et la barre de logos restent en place,
   seules les cartes s'effacent puis le binôme suivant arrive sans fondu d'ouverture. */
.reveal.instant { animation: none; }
.reveal.swapping .reveal-inner { animation: fade-out 0.4s ease-in forwards; }
.reveal .topbar { position: relative; z-index: 1; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.reveal-inner {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding-bottom: 8vh; /* recentre visuellement sous la barre de logos */
  text-align: center; position: relative; z-index: 1;
}
.reveal-label {
  font-family: var(--font-mono);
  font-size: 3.2vh; font-weight: 700; letter-spacing: 0.25em; text-transform: uppercase; color: var(--blue);
  margin-top: 5vh;
  animation: fade-in 0.6s 1s both;
}
.reveal-cards { display: flex; align-items: center; justify-content: center; gap: 5vw; }
.reveal-card {
  width: 28vw; max-width: 46vh;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 2.4vh; padding: 4vh 2vw;
  box-shadow: 0 3vh 8vh rgba(0, 72, 188, 0.25);
}
.reveal-card.from-left { animation: slide-left 0.9s cubic-bezier(.2,1.2,.3,1) both; }
.reveal-card.from-right { animation: slide-right 0.9s cubic-bezier(.2,1.2,.3,1) both; }
@keyframes slide-left  { from { transform: translateX(-120vw) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-right { from { transform: translateX(120vw) rotate(8deg); opacity: 0; } to { transform: none; opacity: 1; } }

.reveal-photo {
  width: 30vh; height: 30vh; margin: 0 auto 3vh; border-radius: 50%; overflow: hidden;
  border: 0.8vh solid var(--person-a); background: var(--paper);
  display: flex; align-items: center; justify-content: center;
}
#reveal-b .reveal-photo { border-color: var(--person-b); }
.reveal-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reveal-photo .initials { font-family: var(--font-title); font-size: 10vh; font-weight: 700; color: var(--person-a); }
.reveal-name {
  font-family: var(--font-title); font-size: 4.2vh; font-weight: 700; line-height: 1.1;
  text-transform: uppercase; color: var(--person-a);
}
.reveal-school { font-family: var(--font-mono); font-size: 2.5vh; color: var(--person-a); margin-top: 1.2vh; }
/* L'alignement du texte ne concerne que la grille : la révélation reste centrée. */
#reveal-b .reveal-name,
#reveal-b .reveal-school,
#reveal-b .reveal-photo .initials { color: var(--person-b); }

.reveal-amp {
  font-family: var(--font-title);
  font-size: 16vh; font-weight: 700; color: var(--blue); line-height: 1;
  animation: amp-in 0.6s 0.8s cubic-bezier(.2,1.6,.4,1) both;
}
@keyframes amp-in {
  from { transform: scale(0) rotate(-30deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

/* Bandeau de perte de connexion */
.offline {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--pink); color: #fff; text-align: center; padding: 1vh; font-size: 2vh;
  font-family: var(--font-mono);
}
.offline[hidden] { display: none; }
