/* ==========================================================================
   ANIMATION D'OUVERTURE DU SITE (intro.css)
   Jouée à l'ouverture du site et à chaque actualisation de l'accueil, jamais si le visiteur a choisi
   « réduire les animations », jamais dans l'administration. Un clic, une touche,
   la molette ou un toucher la passent.
   ========================================================================== */

#intro {
    display: none;
}

/* Pendant l'ouverture : la page est prête derrière le rideau (pas de fondu d'entrée), sans défilement */
html.intro-active body {
    opacity: 1 !important;
    overflow: hidden;
}

/* Accueil : le grand titre est caché tant que le nom de l'ouverture n'est pas venu se poser dessus */
html.intro-active:not(.intro-landed) .hero-title {
    visibility: hidden;
}

/* Les animations d'entrée de l'accueil attendent la fin du rideau */
html.intro-active .mask-reveal span {
    animation: none !important;
}

html.intro-active #intro {
    display: block;
}

#intro {
    position: fixed;
    inset: 0;
    z-index: 9999;
    color: #E0E0E0;
    cursor: pointer;
}

/* La page, derrière le rideau, se pose doucement (léger zoom arrière) pendant la levée */
html.intro-active main {
    transform: scale(1.04);
    transform-origin: 50% 40%;
}

html.intro-revealing main {
    transform: scale(1);
    transition: transform 1.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Rideau en cinq bandes verticales qui se lèvent l'une après l'autre ---- */
.intro-panels {
    position: absolute;
    inset: 0;
    display: flex;
}

.intro-panel {
    flex: 1;
    height: 100%;
    margin-right: -1px;   /* pas de fente entre les bandes */
    background: #050505;
    transition: transform 1s cubic-bezier(0.76, 0, 0.24, 1);
    transition-delay: calc(var(--p) * 70ms);
}

#intro.is-leaving .intro-panel {
    transform: translateY(-101%);
}

/* Grain discret, comme le reste du site */
.intro-content::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 3px 3px;
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#intro.is-leaving .intro-content::before {
    opacity: 0;
}

.intro-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
}

@media (min-width: 768px) {
    .intro-content { padding: 32px 48px; }
}

/* ---- Bandeaux haut et bas ---- */
.intro-row {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #8C8C8C;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#intro.is-playing .intro-row {
    opacity: 1;
    transform: translateY(0);
}

#intro.is-leaving .intro-row {
    opacity: 0;
    transition-duration: 0.3s;
}

.intro-skip {
    display: none;
}

@media (min-width: 768px) {
    .intro-skip { display: inline; }
}

/* ---- Nom ---- */
.intro-center {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    text-align: center;
}

.intro-name {
    font-family: 'Instrument Serif', serif;
    font-weight: 300;
    font-size: clamp(48px, 12vw, 168px);
    line-height: 1.1;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    padding: 0 0.05em 0.08em;
    transform-origin: 50% 50%;
}

/* Glissement du nom vers le titre de l'accueil (valeurs calculées par intro.js) */
.intro-name.is-flying {
    overflow: visible;
    transition: transform 1.1s cubic-bezier(0.76, 0, 0.24, 1), opacity 0.35s ease;
}

.intro-letter {
    display: inline-block;
    transform: translateY(115%) rotate(8deg);
    transform-origin: 0 100%;
    transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: calc(var(--i) * 45ms);
}

.intro-space {
    display: inline-block;
    width: 0.25em;
}

#intro.is-playing .intro-letter {
    transform: translateY(0) rotate(0);
}

/* Pages autres que l'accueil : le nom s'efface vers le haut */
#intro.is-leaving:not(.is-flip) .intro-letter {
    transform: translateY(-115%);
    transition-duration: 0.6s;
    transition-timing-function: cubic-bezier(0.7, 0, 0.84, 0);
    transition-delay: calc(var(--i) * 18ms);
}

.intro-sub {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: #8C8C8C;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.8s ease 0.8s, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.8s;
}

#intro.is-playing .intro-sub {
    opacity: 1;
    transform: translateY(0);
}

#intro.is-leaving .intro-sub {
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* ---- Progression ---- */
.intro-progress {
    position: relative;
    height: 1px;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#intro.is-playing .intro-progress {
    opacity: 1;
}

#intro.is-leaving .intro-progress {
    opacity: 0;
    transition-duration: 0.3s;
}

.intro-progress-bar {
    position: absolute;
    inset: 0;
    background: #E0E0E0;
    transform: scaleX(0);
    transform-origin: left center;
}

.intro-count {
    font-variant-numeric: tabular-nums;
    color: #E0E0E0;
}

.intro-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 0.75rem;
    border-radius: 50%;
    background: #4ade80;
    vertical-align: middle;
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6);
    animation: intro-pulse 1.6s ease-out infinite;
}

@keyframes intro-pulse {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
    70% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}
