/* ==========================================================================
   Intro : première page du site = film du Colucci piloté par le défilement.
   Écran de chargement -> film (scroll) -> "Entrer dans le site".
   Tout est préfixé "ci-" pour ne pas toucher au reste du site.
   ========================================================================== */

.intro {
  --ci-coal: #0b0907;
  --ci-gold: #d9a441;
  --ci-cream: #f3e6cf;
  --ci-muted: #b6a68c;
  --ci-display: "Alfa Slab One", "Rockwell", Georgia, serif;
  --ci-text: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  background: var(--ci-coal);
  color: var(--ci-cream);
  font-family: var(--ci-text);
  -webkit-font-smoothing: antialiased;
  transition: opacity 0.7s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.intro, .intro * { box-sizing: border-box; }
.intro h2, .intro p, .intro dl, .intro dd, .intro ol, .intro small { margin: 0; }
.intro button { font-family: inherit; cursor: pointer; }

/* La classe est posée très tôt par un petit script dans <head> : l'intro couvre le site dès le premier affichage. */
html.has-intro { overflow: hidden; }
html.has-intro .intro { display: block; }
.intro.leaving { opacity: 0; transform: scale(1.04); pointer-events: none; }

/* ---------- Grain de pellicule ---------- */
.ci-grain {
  position: absolute;
  inset: -8%;
  z-index: 50;
  pointer-events: none;
  opacity: 0.05;
  background-size: 160px 160px;
  animation: ciGrain 0.9s steps(6) infinite;
}
@keyframes ciGrain {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); }
  75% { transform: translate(-2%, -1%); }
}

/* ---------- Écran de chargement ---------- */
.ci-loader {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  background: var(--ci-coal);
  transition: opacity 0.7s ease, visibility 0.7s;
}
.intro.ready .ci-loader { opacity: 0; visibility: hidden; pointer-events: none; }

.ci-logo { width: 84px; height: 84px; object-fit: contain; animation: ciBreath 2.6s ease-in-out infinite; }
@keyframes ciBreath { 50% { transform: scale(1.05); opacity: 0.85; } }
.ci-brand { font-family: var(--ci-display); font-size: 1.05rem; letter-spacing: 0.16em; text-transform: uppercase; }

.ci-barwrap {
  width: min(280px, 64vw);
  height: 3px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(243, 230, 207, 0.14);
}
.ci-bar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 3px;
  transform-origin: left;
  transform: scaleX(0.06);
  background: linear-gradient(90deg, var(--ci-gold), #f0c84b);
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.ci-pct { min-height: 1.2em; color: var(--ci-muted); font-size: 0.85rem; letter-spacing: 0.1em; font-variant-numeric: tabular-nums; }
.ci-link {
  border: 0;
  background: transparent;
  color: var(--ci-muted);
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.ci-link:hover { color: var(--ci-cream); }

/* ---------- Zone qui défile ---------- */
.ci-scroll {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ci-scroll::-webkit-scrollbar { display: none; }

.ci-scroller { position: relative; height: 560vh; }
.ci-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }

/* lumière d'ambiance : le film en très basse définition, étiré derrière */
.ci-amb { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.7; }
.ci-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 70% at 50% 50%, rgba(11, 9, 7, 0.25), rgba(11, 9, 7, 0.9) 75%),
    linear-gradient(rgba(11, 9, 7, 0.35), rgba(11, 9, 7, 0.35));
}

/* le film, au format vertical 9:16 */
.ci-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 720 / 1280;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 120px 20px rgba(0, 0, 0, 0.65);
}
.ci-film { display: block; width: 100%; height: 100%; object-fit: cover; }

/* barre segmentée : un segment par plan */
.ci-segs {
  position: absolute;
  z-index: 3;
  left: 14px;
  right: 14px;
  top: max(14px, env(safe-area-inset-top, 0px));
  display: flex;
  gap: 4px;
}
.ci-segs span { flex: var(--n) 1 0; height: 2px; overflow: hidden; border-radius: 1px; background: rgba(243, 230, 207, 0.25); }
.ci-segs span i { display: block; height: 100%; background: var(--ci-gold); transform-origin: left; transform: scaleX(0); }

/* textes des plans */
.ci-caps { position: absolute; z-index: 4; pointer-events: none; }
.ci-cap {
  position: absolute;
  inset: auto 0 0 0;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.ci-cap.on { opacity: 1; transform: none; transition-delay: 0.08s; }
.ci-cap .ci-tag { margin-bottom: 0.6em; color: var(--ci-gold); font-size: 0.95rem; font-weight: 600; letter-spacing: 0.02em; }
.ci-cap h2 { font-family: var(--ci-display); font-weight: 400; font-size: clamp(2.2rem, 4.4vw, 4.4rem); line-height: 1; color: var(--ci-cream); }
.ci-cap.big h2 { font-size: clamp(2.8rem, 6vw, 6rem); line-height: 0.95; }
.ci-cap p { max-width: 30ch; margin-top: 0.8em; color: var(--ci-muted); font-size: clamp(1rem, 1.2vw, 1.15rem); line-height: 1.5; }

/* chapitres (ordinateur) */
.ci-chapters { position: absolute; z-index: 4; display: grid; gap: 4px; padding: 0; list-style: none; }
.ci-chapters button {
  all: unset;
  cursor: pointer;
  display: grid;
  grid-template-columns: 2.2em 1fr;
  align-items: baseline;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--ci-muted);
  font-size: 0.95rem;
  transition: color 0.3s ease;
}
.ci-chapters button small { color: rgba(182, 166, 140, 0.55); font-variant-numeric: tabular-nums; transition: color 0.3s ease; }
.ci-chapters button:hover,
.ci-chapters button[aria-current="step"] { color: var(--ci-cream); }
.ci-chapters button[aria-current="step"] small { color: var(--ci-gold); }
.ci-chapters button:focus-visible { outline: 2px solid var(--ci-gold); outline-offset: 2px; }

.ci-hint {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  display: grid;
  justify-items: center;
  gap: 8px;
  transform: translateX(-50%);
  color: var(--ci-muted);
  font-size: 0.9rem;
  white-space: nowrap;
  pointer-events: none;
}
.ci-hint i { display: block; width: 1px; height: 32px; background: var(--ci-gold); transform-origin: top; animation: ciDrip 1.8s ease-in-out infinite; }
@keyframes ciDrip { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- ordinateur : film au centre, texte à gauche, chapitres à droite ---------- */
@media (min-width: 1000px) and (min-aspect-ratio: 1/1) {
  .ci-caps {
    left: clamp(28px, 5vw, 80px);
    top: 50%;
    width: calc(50% - 28.125vh - clamp(28px, 5vw, 80px) - 32px);
    width: calc(50% - 28.125svh - clamp(28px, 5vw, 80px) - 32px);
    height: 0;
  }
  .ci-cap { inset: auto 0 auto 0; top: 0; transform: translateY(-50%) translateY(14px); }
  .ci-cap.on { transform: translateY(-50%); }
  .ci-chapters { right: clamp(28px, 4vw, 64px); top: 50%; transform: translateY(-50%); }
}

/* ---------- téléphone / écran vertical : film plein écran, texte en bas ---------- */
@media (max-width: 999px), (max-aspect-ratio: 1/1) {
  .ci-amb, .ci-shade { display: none; }
  .ci-panel { width: 100%; height: 100%; aspect-ratio: auto; box-shadow: none; }
  .ci-panel::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 45%;
    pointer-events: none;
    background: linear-gradient(transparent, rgba(11, 9, 7, 0.85));
  }
  .ci-caps { left: 22px; right: 22px; bottom: calc(max(22px, env(safe-area-inset-bottom, 0px)) + 54px); height: 0; }
  .ci-cap { bottom: 0; }
  .ci-cap h2 { font-size: clamp(2rem, 9vw, 3rem); }
  .ci-cap.big h2 { font-size: clamp(2.6rem, 12vw, 4rem); }
  .ci-chapters { display: none; }
  .ci-hint i { display: none; }
}

/* ---------- fin du film : prix + entrée dans le site ---------- */
.ci-outro {
  position: relative;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2rem;
  min-height: 100vh;
  min-height: 100svh;
  padding: 12svh 20px calc(12svh + env(safe-area-inset-bottom, 0px));
  text-align: center;
  background: var(--ci-coal);
}
.ci-outro h2 { font-family: var(--ci-display); font-weight: 400; font-size: clamp(2rem, 5vw, 3.6rem); }
.ci-compo { max-width: 46ch; color: var(--ci-muted); line-height: 1.55; }
.ci-prices { display: flex; flex-wrap: wrap; justify-content: center; gap: 2rem 3.5rem; }
.ci-prices div { display: grid; gap: 0.25rem; }
.ci-prices dt { color: var(--ci-muted); }
.ci-prices dd { color: var(--ci-gold); font-family: var(--ci-display); font-size: clamp(1.8rem, 4vw, 2.6rem); }
.ci-outro small { color: var(--ci-muted); font-size: 0.95rem; }
.ci-actions { display: grid; gap: 12px; width: min(100%, 360px); margin-top: 0.5rem; }

.ci-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.ci-btn:hover { transform: translateY(-1px); }
.ci-btn-gold { background: linear-gradient(120deg, #f0c84b, var(--ci-gold)); color: #15110a; }
.ci-btn-gold:hover { box-shadow: 0 10px 28px rgba(217, 164, 65, 0.3); }
.ci-btn-ghost { border-color: rgba(217, 164, 65, 0.45); background: transparent; color: var(--ci-cream); }
.ci-btn-ghost:hover { border-color: var(--ci-gold); }

/* ---------- Passer l'intro (toujours accessible) ---------- */
.ci-skip {
  position: absolute;
  z-index: 60;
  top: calc(max(14px, env(safe-area-inset-top, 0px)) + 18px);
  right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(243, 230, 207, 0.28);
  border-radius: 999px;
  background: rgba(11, 9, 7, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--ci-cream);
  font-size: 0.85rem;
  font-weight: 600;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.ci-skip:hover { border-color: var(--ci-gold); background: rgba(11, 9, 7, 0.8); }
.ci-skip::after {
  content: "";
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 1.8px 1.8px 0 0;
  transform: rotate(45deg);
}
.intro :focus-visible { outline: 2px solid var(--ci-gold); outline-offset: 3px; }

/* Le hero du site rejoue son entrée au moment où l'intro s'efface. */
@media (prefers-reduced-motion: no-preference) {
  html.has-intro:not(.site-live) .hero2,
  html.has-intro:not(.site-live) .hero2 * { animation-play-state: paused !important; }
}

@media (prefers-reduced-motion: reduce) {
  .ci-grain, .ci-hint i, .ci-logo { animation: none; }
  .ci-cap, .intro, .ci-loader, .ci-bar { transition: none; }
}
