/* L'Avent des GCUM, version grenat.
   Idée : le faste d'une cérémonie municipale, pris très au sérieux. Un seul coup d'éclat : la porte qui pivote. */

@font-face {
  font-family: "Bodoni Moda";
  src: url("fonts/bodoni-moda-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Bodoni Moda";
  src: url("fonts/bodoni-moda-italic.woff2") format("woff2");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Public Sans";
  src: url("fonts/public-sans.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --grenat: #6b1424;
  --grenat-nuit: #3f0a15;
  --grenat-porte: #8a2237;
  --grenat-porte-haut: #9d2c43;
  --rose: #f8e8e5;
  --rose-voile: rgb(248 232 229 / 0.66);
  --trait: rgb(248 232 229 / 0.3);
  --serif: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --marge: clamp(16px, 4vw, 48px);
  --rayon-photo: 6px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--grenat);
  color: var(--rose);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.fige { overflow: hidden; }
a { color: inherit; }

/* ---------- En-tête ---------- */

.entete, .contenu, .pied {
  width: min(100%, 1120px);
  margin-inline: auto;
  padding-inline: var(--marge);
}

.entete { padding-block: clamp(40px, 8vw, 96px) clamp(28px, 5vw, 56px); }

h1 {
  margin: 0 0 clamp(20px, 3vw, 32px);
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(3.1rem, 11vw, 8rem);
  line-height: 0.92;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.chapeau {
  max-width: 54ch;
  margin: 0 0 28px;
  font-size: clamp(1.02rem, 1.6vw, 1.2rem);
  line-height: 1.55;
  text-wrap: pretty;
}

.ligne-statut {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}
.statut { margin: 0; font-weight: 600; }

.bouton-son {
  padding: 8px 16px;
  border: 1px solid var(--trait);
  border-radius: 999px;
  background: transparent;
  color: var(--rose);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}
.bouton-son:hover { background: rgb(248 232 229 / 0.1); }
.bouton-son:focus-visible, .fermer:focus-visible, .pied a:focus-visible {
  outline: 3px solid var(--rose);
  outline-offset: 3px;
}

/* ---------- Grille des portes ---------- */

.contenu { padding-bottom: clamp(48px, 8vw, 96px); }

.grille {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(10px, 1.8vw, 22px);
}
@media (min-width: 560px) { .grille { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 920px) { .grille { grid-template-columns: repeat(6, 1fr); } }

.door {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.door:focus-visible { outline: 3px solid var(--rose); outline-offset: 4px; }
.door.is-ouverture { visibility: hidden; }

/* La face d'une porte : même dessin dans la grille et sur la scène, pour que le passage de l'un à l'autre ne se voie pas. */
.face {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 4px;
  background: var(--grenat-porte);
  color: var(--rose);
  container-type: inline-size;
  transition: background-color 0.25s, transform 0.25s;
}
.face::before {
  content: "";
  position: absolute;
  inset: 7%;
  border: 1px solid var(--trait);
  border-radius: 2px;
}
.face::after {
  content: "";
  position: absolute;
  right: 15%;
  top: 50%;
  width: 6%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--rose);
  opacity: 0.75;
  transform: translateY(-50%);
}
.face__num {
  position: relative;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2rem;
  font-size: 40cqw;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: lining-nums;
}

.door:hover:not(.is-locked) .face {
  background: var(--grenat-porte-haut);
  transform: translateY(-3px);
}

.door.is-locked { cursor: not-allowed; }
.door.is-locked .face {
  background: rgb(0 0 0 / 0.2);
  color: rgb(248 232 229 / 0.5);
}
.door.is-locked .face::after { display: none; }

.door.is-today .face { box-shadow: inset 0 0 0 2px var(--rose); }
.pulse {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  pointer-events: none;
  animation: onde 2.6s ease-out infinite;
}
@keyframes onde {
  0% { box-shadow: 0 0 0 0 rgb(248 232 229 / 0.5); }
  70%, 100% { box-shadow: 0 0 0 16px rgb(248 232 229 / 0); }
}

/* Case déjà ouverte : la photo reste visible en miniature. */
.door.is-opened .face { background: var(--grenat-nuit); }
.door.is-opened .face::before,
.door.is-opened .face::after { display: none; }
.door.is-opened .face__num {
  position: absolute;
  left: 7%;
  bottom: 5%;
  z-index: 1;
  padding: 0.06em 0.3em;
  border-radius: 3px;
  background: rgb(63 10 21 / 0.82);
  font-size: 1.1rem;
  font-size: 20cqw;
}
.door.is-opened.no-photo .face {
  background: repeating-linear-gradient(135deg, rgb(248 232 229 / 0.07) 0 8px, transparent 8px 16px), var(--grenat-nuit);
}
.door__thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Scène d'ouverture ---------- */

.scene { position: fixed; inset: 0; z-index: 10; }
.scene__fond {
  position: absolute;
  inset: 0;
  background: rgb(33 4 11 / 0.92);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.scene.is-on .scene__fond { opacity: 1; }

.carte { position: fixed; margin: 0; z-index: 2; }
.carte__photo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  background: var(--grenat-nuit);
}
.carte__photo::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 70px rgb(0 0 0 / 0.6);
  pointer-events: none;
  transition: opacity 0.7s ease;
}
.scene.is-revele .carte__photo::after { opacity: 0; }
.carte__zoom { position: absolute; inset: 0; }
.carte__zoom img { display: block; width: 100%; height: 100%; object-fit: cover; }

.carte__porte {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
  border-radius: inherit;
  transform-origin: left center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 14px 40px rgb(0 0 0 / 0.4);
}

.vide {
  display: grid;
  place-content: center;
  gap: 8px;
  height: 100%;
  padding: 20px;
  text-align: center;
  background: repeating-linear-gradient(135deg, rgb(248 232 229 / 0.06) 0 10px, transparent 10px 20px);
}
.vide p { margin: 0; }
.vide__titre { font-family: var(--serif); font-style: italic; font-size: 1.5rem; }
.vide__idee { max-width: 36ch; margin-inline: auto; color: var(--rose-voile); }
.vide__fichier { font-size: 0.85rem; color: var(--rose-voile); }

.legende {
  position: fixed;
  z-index: 2;
  margin: 0;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.legende.is-on { opacity: 1; transform: none; }
.legende p { margin: 0; }
.legende__texte {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.4rem, 4vw, 2rem);
  line-height: 1.22;
  text-wrap: pretty;
}
.legende__lieu { margin-top: 10px; color: var(--rose-voile); font-size: 0.95rem; }

.fermer {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 3;
  padding: 9px 18px;
  border: 1px solid var(--trait);
  border-radius: 999px;
  background: rgb(33 4 11 / 0.6);
  color: var(--rose);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s;
}
.fermer.is-on { opacity: 1; }
.fermer:hover { background: rgb(248 232 229 / 0.14); }

/* ---------- Divers ---------- */

.message {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--rose);
  color: var(--grenat-nuit);
  font-weight: 600;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 20px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.message.is-on { opacity: 1; transform: translate(-50%, 0); }

.pied {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 24px 40px;
  color: var(--rose-voile);
  font-size: 0.95rem;
}
.pied::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--marge);
  right: var(--marge);
  border-top: 1px solid var(--trait);
}
.pied p { margin: 0; }
.sans-js { margin: 0; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
  .face, .scene__fond, .legende, .fermer, .message, .carte__photo::after { transition: none; }
}
