/* =========================================================
   INTRO OVERLAY — Splash screen premier chargement
   Boîte carton stylisée (lignes fines + accent cyan)
   Séquence : reveal boîte → sceau → ouverture couvercle
              → double-porte qui révèle le site
   ========================================================= */

html.intro-overlay-active,
html.intro-overlay-active body {
  overflow: hidden;
}

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

.intro-overlay[hidden] {
  display: none !important;
}

.intro-overlay.is-active {
  pointer-events: auto;
  animation: intro-pointer-off 0.01s 2s forwards;
}

/* Panneaux "double porte" */
.intro-overlay__panel {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: var(--off-white);
}

.intro-overlay__panel--left {
  left: 0;
  border-right: 1px solid var(--cyan);
}

.intro-overlay__panel--right {
  right: 0;
  border-left: 1px solid var(--cyan);
}

/* Contenu central */
.intro-overlay__content {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

/* Marque */
.intro-overlay__brand {
  font-family: var(--serif);
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 500;
  letter-spacing: 0.35em;
  color: var(--charcoal);
  opacity: 0;
}

/* Boîte */
.intro-overlay__box {
  position: relative;
  width: clamp(140px, 26vw, 200px);
  perspective: 900px;
  opacity: 0;
}

.intro-overlay__box-body {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1.5px solid var(--charcoal);
  border-radius: 2px;
  background: var(--white);
  overflow: hidden;
}

.intro-overlay__box-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(0, 166, 214, 0.35), transparent 70%);
  opacity: 0;
}

.intro-overlay__box-lid {
  position: absolute;
  left: -1.5px;
  right: -1.5px;
  top: -1.5px;
  height: 32%;
  z-index: 3;
  border: 1.5px solid var(--charcoal);
  border-bottom: 1.5px solid var(--cyan);
  background: var(--white);
  transform-origin: top center;
  transform: rotateX(0deg);
  backface-visibility: hidden;
}

/* Sceau cyan estampillé sur le couvercle */
.intro-overlay__box-seal {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--cyan);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 13px;
  background: var(--white);
  transform: translate(-50%, -50%) scale(1.8);
  opacity: 0;
}

/* Rayons de lumière (burst à l'ouverture) */
.intro-overlay__box-rays {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 220%;
  height: 220%;
  z-index: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(0, 166, 214, 0.3) 0deg 4deg,
    transparent 4deg 18deg
  );
  -webkit-mask-image: radial-gradient(circle, #000 35%, transparent 70%);
  mask-image: radial-gradient(circle, #000 35%, transparent 70%);
  transform: translate(-50%, -50%) scale(0.5) rotate(0deg);
  opacity: 0;
}

/* Texte d'accompagnement */
.intro-overlay__tagline {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
  opacity: 0;
}

/* Barre de progression */
.intro-overlay__progress {
  width: 120px;
  height: 2px;
  background: var(--grey-2);
  overflow: hidden;
  border-radius: 2px;
}

.intro-overlay__progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--cyan);
}

/* ── Séquence d'animation ───────────────────────────────── */
@keyframes intro-pointer-off {
  to { pointer-events: none; }
}

@keyframes intro-brand-in {
  from { opacity: 0; letter-spacing: 0.6em; transform: translateY(4px); }
  to   { opacity: 1; letter-spacing: 0.35em; transform: translateY(0); }
}

@keyframes intro-fade-in {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes intro-tagline-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes intro-seal-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(1.8); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes intro-lid-open {
  from { transform: rotateX(0deg); }
  to   { transform: rotateX(-125deg); }
}

@keyframes intro-glow-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes intro-rays {
  0%   { opacity: 0;   transform: translate(-50%, -50%) scale(0.5) rotate(0deg); }
  55%  { opacity: 0.8; }
  100% { opacity: 0;   transform: translate(-50%, -50%) scale(1.4) rotate(18deg); }
}

@keyframes intro-progress {
  to { width: 100%; }
}

@keyframes intro-content-out {
  to { opacity: 0; transform: translateY(-12px) scale(0.98); }
}

@keyframes intro-panel-left-out {
  to { transform: translateX(-100%); }
}

@keyframes intro-panel-right-out {
  to { transform: translateX(100%); }
}

.intro-overlay.is-active .intro-overlay__brand {
  animation: intro-brand-in 0.6s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

.intro-overlay.is-active .intro-overlay__box {
  animation: intro-fade-in 0.5s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

.intro-overlay.is-active .intro-overlay__tagline {
  animation: intro-tagline-in 0.5s cubic-bezier(0.65, 0, 0.35, 1) 0.35s forwards;
}

.intro-overlay.is-active .intro-overlay__progress span {
  animation: intro-progress 1.7s linear forwards;
}

.intro-overlay.is-active .intro-overlay__box-seal {
  animation: intro-seal-in 0.4s cubic-bezier(0.34, 1.1, 0.64, 1) 0.5s forwards;
}

.intro-overlay.is-active .intro-overlay__box-lid {
  animation: intro-lid-open 0.8s cubic-bezier(0.65, 0, 0.35, 1) 0.9s forwards;
}

.intro-overlay.is-active .intro-overlay__box-glow {
  animation: intro-glow-in 0.6s ease-out 1.05s forwards;
}

.intro-overlay.is-active .intro-overlay__box-rays {
  animation: intro-rays 0.85s ease-out 0.95s forwards;
}

.intro-overlay.is-active .intro-overlay__content {
  animation: intro-content-out 0.35s cubic-bezier(0.65, 0, 0.35, 1) 1.85s forwards;
}

.intro-overlay.is-active .intro-overlay__panel--left {
  animation: intro-panel-left-out 0.7s cubic-bezier(0.65, 0, 0.35, 1) 2s forwards;
}

.intro-overlay.is-active .intro-overlay__panel--right {
  animation: intro-panel-right-out 0.7s cubic-bezier(0.65, 0, 0.35, 1) 2s forwards;
}

/* ── Accessibilité : prefers-reduced-motion ─────────────── */
@media (prefers-reduced-motion: reduce) {
  .intro-overlay.is-active .intro-overlay__brand,
  .intro-overlay.is-active .intro-overlay__box,
  .intro-overlay.is-active .intro-overlay__tagline,
  .intro-overlay.is-active .intro-overlay__box-glow,
  .intro-overlay.is-active .intro-overlay__progress span {
    animation: none;
    opacity: 1;
    transform: none;
    width: 100%;
  }

  .intro-overlay.is-active .intro-overlay__box-seal {
    animation: none;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  .intro-overlay.is-active .intro-overlay__box-rays {
    animation: none;
    opacity: 0;
  }

  .intro-overlay.is-active .intro-overlay__box-lid {
    animation: none;
    transform: rotateX(-125deg);
  }

  .intro-overlay.is-active .intro-overlay__content {
    animation: intro-content-out 0.3s ease-out 0.4s forwards;
  }

  .intro-overlay.is-active .intro-overlay__panel--left,
  .intro-overlay.is-active .intro-overlay__panel--right {
    animation-delay: 0.4s;
    animation-duration: 0.4s;
  }
}

/* ── Responsive mobile ───────────────────────────────────── */
@media (max-width: 480px) {
  .intro-overlay__content {
    gap: 18px;
  }

  .intro-overlay__brand {
    letter-spacing: 0.12em;
  }

  @keyframes intro-brand-in {
    from { opacity: 0; letter-spacing: 0.3em; transform: translateY(4px); }
    to   { opacity: 1; letter-spacing: 0.12em; transform: translateY(0); }
  }

  .intro-overlay__tagline {
    font-size: 11px;
    text-align: center;
    padding: 0 24px;
  }
}
