/* ouverture.css : animation d'ouverture (ouverture.js), 8 s en quatre actes. Bleu nuit profond, or et orange d'accent
   du logotype, verre dépoli pour les cartes. Durée gardée égale à DUREE_MS de ouverture.js (contrôlé par les tests).
   Repères : 01 Géologie 0 à 1,7 s ; 02 Mine 1,7 à 3,6 s ; 03 Usine 3,6 à 5,9 s ; 04 Pilotage 5,9 à 8 s. */
:root {
  /* Marque G-CORE (logotype) : couleurs fixes, jamais remplacées par une compagnie. Définies une seule fois ici, pour
     l'animation d'ouverture et la page d'accès (acces.css) ; cette feuille est liée par le logiciel et par GMO Collecte. */
  --marque-nuit: #050E18; --marque-or: #D4AF37; --marque-or-clair: #F3D77C; --marque-orange: #F28A2E; --marque-encre: #F5F2EC;
}
.ouverture {
  --ouv-duree: 8s;
  /* Valeurs par défaut des variables posées par ouverture.js (rang de l'élément, taille, opacité des particules). */
  --i: 0; --s: 2px; --o: .6;
  --ouv-nuit-2: #0E2236; --ouv-encre-2: #9FB0C2;
  position: fixed; inset: 0; z-index: 9999; overflow: hidden; cursor: pointer;
  color: var(--marque-encre); font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--marque-nuit);
  animation: ouv-entree .35s ease-out both;
}

/* ---------- Fond : halos, sol en perspective, particules ---------- */
.ouv-fond { position: absolute; inset: 0; background: radial-gradient(ellipse 80% 70% at 50% 42%, var(--ouv-nuit-2), var(--marque-nuit) 72%); }
.ouv-halo { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.ouv-h1 { width: 46vmax; height: 46vmax; left: -12vmax; top: -14vmax; background: rgb(212 175 55 / .28); animation: ouv-derive 9s ease-in-out infinite alternate; }
.ouv-h2 { width: 38vmax; height: 38vmax; right: -10vmax; bottom: -12vmax; background: rgb(242 138 46 / .22); animation: ouv-derive 11s ease-in-out -3s infinite alternate-reverse; }
.ouv-h3 { width: 30vmax; height: 30vmax; left: 35%; top: 30%; background: rgb(64 132 196 / .18); animation: ouv-derive 13s ease-in-out -6s infinite alternate; }
.ouv-grille {
  position: absolute; left: -50%; bottom: -2%; width: 200%; height: 46%;
  background-image: linear-gradient(rgb(212 175 55 / .16) 1px, transparent 1px), linear-gradient(90deg, rgb(212 175 55 / .16) 1px, transparent 1px);
  background-size: 56px 56px; transform: perspective(520px) rotateX(64deg); transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 85%); mask-image: linear-gradient(to top, #000 10%, transparent 85%);
  animation: ouv-defile 1.8s linear infinite;
}
.ouv-particules { position: absolute; inset: 0; pointer-events: none; }
.ouv-p {
  position: absolute; bottom: -10px; left: var(--x); width: var(--s); height: var(--s); border-radius: 50%;
  background: var(--marque-or-clair); box-shadow: 0 0 8px 2px rgb(243 215 124 / .55); opacity: 0;
  animation: ouv-particule var(--t) linear var(--d) infinite;
}

/* ---------- Actes annoncés ---------- */
.ouv-etapes { position: absolute; top: calc(22px + env(safe-area-inset-top, 0px)); left: 24px; height: 22px; min-width: 200px; }
.ouv-etape { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 13px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--ouv-encre-2); opacity: 0; animation: ouv-etape var(--t) ease-out var(--d) both; }
.ouv-etape b { color: var(--marque-or); margin-right: 10px; font-weight: 800; letter-spacing: .08em; }
.ouv-e1 { --d: .2s; --t: 1.5s; } .ouv-e2 { --d: 1.7s; --t: 1.9s; } .ouv-e3 { --d: 3.6s; --t: 2.3s; }
.ouv-e4 { animation: ouv-monte .5s ease-out 5.9s both; }

/* ---------- Théâtre : scène et cartes, qui reculent à l'acte 4 ---------- */
.ouv-theatre {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 0 12px;
  animation: ouv-recul .75s cubic-bezier(.6, 0, .4, 1) 5.9s forwards;
}
.ouv-scene { width: min(900px, 96vw); height: auto; overflow: visible; }

/* Acte 1 : relevé et forages */
.ouv-contour { fill: none; stroke: var(--marque-or); stroke-width: 1; stroke-dasharray: 100; stroke-dashoffset: 100; opacity: .55;
  animation: ouv-trace .9s ease-out calc(.15s + var(--i) * .12s) forwards, ouv-attenue .6s ease-out 1.8s forwards; }
.ouv-scan { animation: ouv-balayage 1.3s cubic-bezier(.4, 0, .2, 1) .3s both; opacity: 0; }
.ouv-forages { animation: ouv-efface .5s ease-in 1.75s forwards; }
.ouv-forage { stroke: var(--marque-encre); stroke-width: 1.6; stroke-linecap: round; opacity: .85; transform-box: fill-box; transform-origin: 50% 0; transform: scaleY(0);
  animation: ouv-creuse .55s cubic-bezier(.2, .8, .2, 1) calc(.6s + var(--i) * .1s) forwards; }
.ouv-carotte { fill: var(--marque-or-clair); opacity: 0; transform-box: fill-box; transform-origin: center;
  animation: ouv-pop .35s ease-out calc(1.05s + var(--i) * .1s) forwards; }

/* Acte 2 : fosse, piste, trace et camion */
.ouv-halo-fosse { opacity: 0; animation: ouv-apparait .8s ease-out 1.8s forwards; }
.ouv-gradin { fill: none; stroke-width: 2; stroke-dasharray: 100; stroke-dashoffset: 100; animation: ouv-trace .7s ease-out calc(1.55s + var(--i) * .09s) forwards; }
.ouv-g5 { fill: rgb(212 175 55 / .22); }
.ouv-piste { fill: none; stroke: rgb(245 242 236 / .28); stroke-width: 6; stroke-linecap: round; opacity: 0; animation: ouv-apparait .35s ease-out 1.75s forwards; }
.ouv-traine { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; animation: ouv-trace 1.8s cubic-bezier(.5, 0, .3, 1) 1.9s forwards; }
.ouv-camion { opacity: 0; animation: ouv-apparait .2s linear 1.9s forwards; }
.ouv-benne { fill: var(--marque-orange); }
.ouv-cabine { fill: var(--marque-encre); }
.ouv-vitre { fill: #3B5B7A; }
.ouv-roue { fill: #11161C; stroke: var(--ouv-encre-2); stroke-width: 1; }
.ouv-minerai { fill: var(--marque-or-clair); }

/* Acte 3 : usine, coulée, lingot */
.ouv-usine { opacity: 0; transform: translateY(12px); animation: ouv-monte-svg .6s cubic-bezier(.2, .8, .2, 1) 3.35s forwards; }
.ouv-bati { fill: #17324B; stroke: rgb(245 242 236 / .3); stroke-width: 1; }
.ouv-convoyeur { fill: none; stroke: var(--marque-or); stroke-width: 2; stroke-dasharray: 5 5; animation: ouv-tapis .6s linear 3.6s infinite; }
.ouv-broyeur { fill: none; stroke: var(--marque-or); stroke-width: 2.4; stroke-dasharray: 7 5; transform-box: fill-box; transform-origin: center; animation: ouv-tourne 1.1s linear 3.6s infinite; }
.ouv-axe { fill: var(--marque-or-clair); }
.ouv-fumee { fill: rgb(245 242 236 / .2); opacity: 0; transform-box: fill-box; transform-origin: center; animation: ouv-fumee 1.6s ease-out 3.7s infinite; }
.ouv-f2 { animation-delay: 4.1s; }
.ouv-coulee { fill: none; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; animation: ouv-trace .5s ease-in 3.9s forwards; }
.ouv-lingot { opacity: 0; transform-box: fill-box; transform-origin: 50% 100%; animation: ouv-lingot .6s cubic-bezier(.2, 1.4, .4, 1) 4.25s forwards; }
.ouv-reflet { fill: rgb(255 255 255 / .75); transform: skewX(-20deg) translateX(0); animation: ouv-reflet 1s ease-in-out 4.7s 2 both; }
.ouv-sol { fill: none; stroke: rgb(245 242 236 / .16); stroke-width: 1; stroke-dasharray: 100; stroke-dashoffset: 100; animation: ouv-trace .8s ease-out .05s forwards; }

/* Cartes des départements (verre dépoli) */
.ouv-cartes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: min(780px, 94vw); }
.ouv-carte {
  display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 14px; min-width: 0;
  background: linear-gradient(145deg, rgb(255 255 255 / .09), rgb(255 255 255 / .03));
  border: 1px solid rgb(255 255 255 / .14); box-shadow: 0 12px 40px rgb(0 0 0 / .35), inset 0 1px 0 rgb(255 255 255 / .12);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  opacity: 0; transform: translateY(22px) scale(.96);
  animation: ouv-carte .65s cubic-bezier(.2, .8, .2, 1) calc(4.45s + var(--i) * .16s) forwards;
}
.ouv-carte-tete { display: flex; align-items: center; gap: 8px; }
.ouv-puce { width: 8px; height: 8px; border-radius: 50%; background: var(--marque-or); box-shadow: 0 0 10px 2px rgb(212 175 55 / .6); animation: ouv-pouls 1.4s ease-in-out 4.6s infinite; }
.ouv-c2 .ouv-puce { background: var(--marque-orange); box-shadow: 0 0 10px 2px rgb(242 138 46 / .6); }
.ouv-c3 .ouv-puce { background: var(--marque-or-clair); }
.ouv-carte-titre { font-size: 15px; font-weight: 700; }
.ouv-carte-sous { font-size: 12px; color: var(--ouv-encre-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ouv-courbe { width: 100%; height: 28px; margin-top: 2px; overflow: visible; }
.ouv-courbe-trait { fill: none; stroke: var(--marque-or-clair); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100;
  animation: ouv-trace .8s ease-out calc(4.8s + var(--i) * .16s) forwards; }
.ouv-c2 .ouv-courbe-trait { stroke: var(--marque-orange); }

/* ---------- Acte 4 : marque ---------- */
.ouv-final { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 0 20px; pointer-events: none; perspective: 600px; }
.ouv-nom { display: flex; flex-wrap: wrap; justify-content: center; column-gap: .28em; row-gap: .08em; max-width: 92vw; text-align: center;
  font-size: clamp(30px, min(11vw, calc(150vw / var(--n, 7))), 104px); font-weight: 800; letter-spacing: -.02em; line-height: 1.04; }
.ouv-mot { display: inline-flex; white-space: nowrap; }
.ouv-cie { letter-spacing: -.01em; }
.ouv-lettre {
  display: inline-block; opacity: 0; transform: translateY(45%) rotateX(70deg); filter: blur(10px);
  color: transparent; background: linear-gradient(105deg, var(--marque-encre) 0 42%, #FFF6CF 50%, var(--marque-encre) 58% 100%);
  background-size: 320% 100%; background-position: 100% 0; -webkit-background-clip: text; background-clip: text;
  animation: ouv-lettre .75s cubic-bezier(.2, .8, .2, 1) calc(6.05s + var(--i) * .07s) forwards, ouv-eclat 1.1s ease-in-out calc(6.9s + var(--i) * .05s) forwards;
}
.ouv-point { background: none; color: var(--marque-orange); text-shadow: 0 0 22px rgb(242 138 46 / .7); }
.ouv-trait { width: min(340px, 60vw); height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--marque-or), transparent); transform: scaleX(0); animation: ouv-etire .7s ease-out 6.75s forwards; }
.ouv-produit { font-size: clamp(12px, 2.2vw, 16px); font-weight: 600; letter-spacing: .34em; padding-left: .34em; color: var(--marque-or-clair); opacity: 0; animation: ouv-produit .8s ease-out 6.95s forwards; }
.ouv-sous { margin: 6px 0 0; max-width: 560px; text-align: center; font-size: clamp(14px, 2.4vw, 17px); color: var(--ouv-encre-2); opacity: 0; animation: ouv-monte .6s ease-out 7.3s forwards; }

/* ---------- Commandes ---------- */
.ouv-progression { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgb(255 255 255 / .06); }
.ouv-progression i { display: block; height: 100%; background: linear-gradient(90deg, var(--marque-or), var(--marque-orange)); transform-origin: 0 50%; transform: scaleX(0); animation: ouv-etire var(--ouv-duree) linear forwards; }
.ouv-passer {
  position: absolute; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); min-height: 40px; padding: 0 18px; border-radius: 999px;
  border: 1px solid rgb(245 242 236 / .3); background: rgb(255 255 255 / .06); color: var(--marque-encre); font: inherit; font-size: 14px; cursor: pointer;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: background .2s;
}
.ouv-passer:hover { background: rgb(255 255 255 / .14); }
.ouv-passer:focus-visible { outline: 2px solid var(--marque-or); outline-offset: 2px; }

/* ---------- Téléphones ---------- */
@media (max-width: 600px) {
  .ouv-cartes { gap: 8px; }
  .ouv-carte { padding: 10px; border-radius: 12px; }
  .ouv-carte-titre { font-size: 13px; }
  .ouv-carte-sous { display: none; }
  .ouv-etapes { left: 16px; top: calc(16px + env(safe-area-inset-top, 0px)); }
}

/* ---------- Sortie et mouvement réduit ---------- */
.ouverture.ouv-sortie { animation: ouv-sortie .52s ease-in forwards; }
.ouverture.ouv-reduit { --ouv-duree: 1.4s; }
.ouverture.ouv-reduit .ouv-theatre, .ouverture.ouv-reduit .ouv-particules, .ouverture.ouv-reduit .ouv-etapes { display: none; }
.ouverture.ouv-reduit .ouv-halo, .ouverture.ouv-reduit .ouv-grille { animation: none; }
.ouverture.ouv-reduit .ouv-lettre, .ouverture.ouv-reduit .ouv-produit, .ouverture.ouv-reduit .ouv-sous { animation: ouv-apparait .3s ease-out both; transform: none; filter: none; }
.ouverture.ouv-reduit .ouv-trait { animation: ouv-etire .3s ease-out both; }
@media (prefers-reduced-motion: reduce) { .ouverture *, .ouverture { animation-iteration-count: 1 !important; } }
@media print { .ouverture { display: none; } }

@keyframes ouv-entree { from { opacity: 0; } to { opacity: 1; } }
@keyframes ouv-sortie { to { opacity: 0; transform: scale(1.05); filter: blur(8px); } }
@keyframes ouv-derive { to { transform: translate(6vmax, 4vmax) scale(1.12); } }
@keyframes ouv-defile { to { background-position: 0 56px, 0 0; } }
@keyframes ouv-particule { 0% { opacity: 0; transform: translateY(0); } 12% { opacity: var(--o); } 85% { opacity: var(--o); } 100% { opacity: 0; transform: translateY(-105vh); } }
@keyframes ouv-etape { 0% { opacity: 0; transform: translateY(8px); } 15%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-8px); } }
@keyframes ouv-recul { to { opacity: 0; transform: scale(.88) translateY(-24px); filter: blur(8px); } }
@keyframes ouv-trace { to { stroke-dashoffset: 0; } }
@keyframes ouv-attenue { to { opacity: .16; } }
@keyframes ouv-efface { to { opacity: 0; } }
@keyframes ouv-balayage { 0% { opacity: 0; transform: translateX(0); } 15%, 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(1060px); } }
@keyframes ouv-creuse { to { transform: scaleY(1); } }
@keyframes ouv-pop { 0% { opacity: 0; transform: scale(0); } 70% { opacity: 1; transform: scale(1.6); } 100% { opacity: 1; transform: scale(1); } }
@keyframes ouv-apparait { to { opacity: 1; } }
@keyframes ouv-monte { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes ouv-monte-svg { to { opacity: 1; transform: none; } }
@keyframes ouv-tapis { to { stroke-dashoffset: -10; } }
@keyframes ouv-tourne { to { transform: rotate(360deg); } }
@keyframes ouv-fumee { 0% { opacity: 0; transform: translateY(0) scale(.6); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(-18px) scale(1.5); } }
@keyframes ouv-lingot { 0% { opacity: 0; transform: translateY(-10px) scale(.6); } 100% { opacity: 1; transform: none; } }
@keyframes ouv-reflet { from { transform: skewX(-20deg) translateX(0); } to { transform: skewX(-20deg) translateX(110px); } }
@keyframes ouv-carte { to { opacity: 1; transform: none; } }
@keyframes ouv-pouls { 50% { transform: scale(1.35); opacity: .7; } }
@keyframes ouv-lettre { to { opacity: 1; transform: none; filter: none; } }
@keyframes ouv-eclat { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes ouv-etire { to { transform: scaleX(1); } }
@keyframes ouv-produit { from { opacity: 0; letter-spacing: .9em; } to { opacity: 1; letter-spacing: .34em; } }
