/* ==========================================================================
   MC Coach Sportif — intro.css
   Animation d'ouverture de la page d'accueil : « Signature de lumière ».
   Des particules d'or forment le logo dans la nuit, puis la nuit s'ouvre sur le site.
   Chargé uniquement par index.html. Le déroulé est piloté par assets/js/intro.js.
   ========================================================================== */

:root {
  --nuit: #0b0906;
  --nuit-2: #1a150d;
  --champagne: #f3e3b5;
}

/* Écran de nuit affiché dès le premier affichage, en attendant que le script démarre */
html.intro-active body {
  overflow: hidden;
}
html.intro-active::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 4999;
  background: var(--nuit);
}

.intro {
  position: fixed;
  inset: 0;
  z-index: 5000;
  overflow: hidden;
  color: var(--champagne);
  background: radial-gradient(ellipse at 50% 45%, var(--nuit-2) 0%, var(--nuit) 62%, #050403 100%);
}
.intro-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Trait de lumière horizontal (balayage d'ouverture) */
.intro-scan {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 1px;
  transform: translate(-50%, -50%);
  background: linear-gradient(90deg, transparent, var(--gold2) 50%, transparent);
  box-shadow: 0 0 18px rgba(239, 207, 115, 0.7);
  opacity: 0;
}
.intro.is-scanning .intro-scan {
  animation: introScan 1.3s cubic-bezier(0.6, 0, 0.2, 1) forwards;
}
@keyframes introScan {
  0% {
    width: 0;
    opacity: 0;
  }
  25% {
    opacity: 1;
  }
  70% {
    width: 100vw;
    opacity: 0.9;
  }
  100% {
    width: 100vw;
    opacity: 0;
  }
}

/* Cadre fin aux quatre coins et indications discrètes */
.intro-frame {
  position: absolute;
  inset: max(18px, 3vmin);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}
.intro.is-scanning .intro-frame {
  opacity: 1;
}
.intro-corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border-color: rgba(226, 181, 60, 0.7);
  border-style: solid;
  border-width: 0;
}
.intro-corner.tl {
  top: 0;
  left: 0;
  border-top-width: 1px;
  border-left-width: 1px;
}
.intro-corner.tr {
  top: 0;
  right: 0;
  border-top-width: 1px;
  border-right-width: 1px;
}
.intro-corner.bl {
  bottom: 0;
  left: 0;
  border-bottom-width: 1px;
  border-left-width: 1px;
}
.intro-corner.br {
  bottom: 0;
  right: 0;
  border-bottom-width: 1px;
  border-right-width: 1px;
}
.intro-label {
  position: absolute;
  font:
    700 10px "DM Sans",
    system-ui,
    sans-serif;
  letter-spacing: 0.32em;
  color: rgba(243, 227, 181, 0.6);
  white-space: nowrap;
}
.intro-label.tl {
  top: 8px;
  left: 42px;
}
.intro-label.bl {
  bottom: 8px;
  left: 42px;
}
.intro-label.tr {
  top: 8px;
  right: 42px;
  font-variant-numeric: tabular-nums;
  color: var(--gold2);
}

/* Logo net (vectoriel), qui prend le relais des particules */
.intro-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.intro-signature {
  display: grid;
  justify-items: center;
  gap: clamp(18px, 3vh, 30px);
  transform: translateY(-2vh);
}
.intro-logo {
  position: relative;
  width: min(78vw, 760px);
  aspect-ratio: 2 / 1;
  opacity: 0;
  filter: drop-shadow(0 0 22px rgba(226, 181, 60, 0.35));
  transition: opacity 0.9s ease;
}
.intro-logo img {
  width: 100%;
  height: 100%;
  display: block;
}
/* Reflet lumineux qui balaie le logo : la lumière est découpée à la forme exacte du logo */
.intro-logo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 249, 228, 0.95) 50%, transparent 58%)
    no-repeat;
  background-size: 300% 100%;
  background-position: 100% 0;
  -webkit-mask: url("../images/logo/logo-mc-coach-sportif-or.svg") center / 100% 100% no-repeat;
  mask: url("../images/logo/logo-mc-coach-sportif-or.svg") center / 100% 100% no-repeat;
  mix-blend-mode: screen;
}
.intro.is-signed .intro-logo {
  opacity: 1;
}
.intro.is-signed .intro-logo::after {
  animation: introShine 1.2s 0.15s cubic-bezier(0.5, 0, 0.3, 1) forwards;
}
@keyframes introShine {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0% 0;
  }
}
.intro-devise {
  font:
    italic 500 clamp(17px, 2.4vw, 26px) / 1.3 "Playfair Display",
    Georgia,
    serif;
  letter-spacing: -0.01em;
  color: var(--champagne);
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  filter: blur(6px);
  transition:
    opacity 1s 0.5s ease,
    transform 1s 0.5s var(--ease),
    filter 1s 0.5s ease;
}
.intro-devise em {
  color: var(--gold2);
}
.intro.is-signed .intro-devise {
  opacity: 1;
  transform: none;
  filter: none;
}

/* Bouton pour passer l'intro */
.intro-skip {
  position: absolute;
  left: 50%;
  bottom: calc(max(18px, 3vmin) + 22px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  padding: 10px 18px;
  border: 1px solid rgba(243, 227, 181, 0.35);
  background: rgba(11, 9, 6, 0.4);
  color: var(--champagne);
  font:
    700 10px "DM Sans",
    system-ui,
    sans-serif;
  letter-spacing: 0.24em;
  cursor: pointer;
  transition:
    border-color 0.3s,
    background 0.3s;
}
.intro-skip:hover,
.intro-skip:focus-visible {
  border-color: var(--gold2);
  background: rgba(226, 181, 60, 0.12);
}

/* Sortie : tout s'efface pendant que le cercle s'ouvre sur le site */
.intro.is-opening .intro-frame,
.intro.is-opening .intro-skip {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.intro.is-opening .intro-signature {
  transform: translateY(-2vh) scale(1.12);
  opacity: 0;
  transition:
    transform 1.1s cubic-bezier(0.6, 0, 0.2, 1),
    opacity 0.7s ease;
}

@media (max-width: 620px) {
  .intro-label.tl,
  .intro-label.bl {
    left: 34px;
    font-size: 8px;
  }
  .intro-label.tr {
    right: 34px;
    font-size: 8px;
  }
  .intro-corner {
    width: 18px;
    height: 18px;
  }
  .intro-logo {
    width: 88vw;
  }
  .intro-devise {
    padding: 0 24px;
    text-wrap: balance;
  }
}
@media (prefers-reduced-motion: reduce) {
  .intro {
    display: none !important;
  }
}
