/* Space Grotesk auto-hébergée (fonte variable, sous-ensemble latin) :
   zéro requête externe, rendu immédiat avec police de repli. */
@font-face {
    font-family: "Space Grotesk";
    src: url("../font/space-grotesk-latin.woff2") format("woff2");
    font-weight: 300 700;
    font-display: swap;
}

/* =================================================================
   Cocytus — démo WebGL "L'écosystème"
   Le canvas est fixe en fond ; les panneaux défilent par-dessus et
   pilotent la caméra. Reprend la charte de css/style.css.
   ================================================================= */

:root {
    --bg: #05070a;
    --fg: #f4f6f8;
    --muted: rgba(244, 246, 248, 0.6);
    --line: rgba(244, 246, 248, 0.12);
    --accent: #e3a857;
    --display: "Space Grotesk", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }

/* ---- Scène 3D : fixe derrière tout ---- */
.stage {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    /* repli visuel tant que WebGL n'a pas pris la main */
    background:
        radial-gradient(ellipse 80vw 60vh at 70% 30%, rgba(227,168,87,0.10), transparent 65%),
        var(--bg);
}

.stage canvas {
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0;
    transition: opacity 1.2s ease;
}
.stage.ready canvas { opacity: 1; }

/* petit témoin de chargement (three.js pèse ~190 Ko gzip) */
.stage-loader {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.5s ease;
}
.stage-loader span {
    display: block;
    width: 26px;
    height: 26px;
    border: 2px solid rgba(244,246,248,0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
.stage.ready .stage-loader { opacity: 0; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Barre du haut ---- */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 5vw;
    backdrop-filter: blur(6px);
    background: linear-gradient(to bottom, rgba(5,7,10,0.75), transparent);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--muted);
    transition: color 0.25s ease, transform 0.25s ease;
}
.back-link:hover { color: var(--fg); transform: translateX(-3px); }

.topbar-tag {
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
    padding: 0.35rem 0.8rem;
    border: 1px solid rgba(227,168,87,0.35);
    border-radius: 999px;
    background: rgba(227,168,87,0.06);
}

/* ---- Panneaux de texte ---- */
main { position: relative; z-index: 2; }

.panel {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 6rem 5vw;
    pointer-events: none;   /* le texte ne bloque pas le survol de la scène */
}

.panel-inner {
    max-width: 460px;
    pointer-events: auto;
    /* état de repos : le JS ajoute .in quand le panneau entre en scène */
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.panel.in .panel-inner { opacity: 1; transform: none; }

/* alternance gauche / droite pour laisser voir la planète */
.panel-left  { margin-right: auto; }
.panel-right { margin-left: auto; }

.panel-intro .panel-inner,
.panel-outro .panel-inner {
    max-width: 620px;
    margin: 0 auto;
    text-align: center;
}

.eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 1.6rem;
    padding: 0.4rem 0.9rem;
    border: 1px solid rgba(227,168,87,0.35);
    border-radius: 999px;
    background: rgba(227,168,87,0.06);
}

.panel h1 {
    font-family: var(--display);
    font-weight: 700;
    font-size: clamp(3.2rem, 9vw, 7rem);
    line-height: 0.95;
    letter-spacing: 0.03em;
    margin-bottom: 1.4rem;
}

.panel h2 {
    font-family: var(--display);
    font-weight: 700;
    font-size: clamp(2.4rem, 5vw, 3.8rem);
    line-height: 1.02;
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
    text-wrap: balance;
}

.panel p {
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.65;
    text-wrap: pretty;
}

.lede { font-size: 1.1rem; }

.planet-index {
    display: block;
    font-family: var(--display);
    font-size: 0.9rem;
    letter-spacing: 0.3em;
    color: var(--accent);
    margin-bottom: 0.6rem;
}

/* indice de défilement */
.scroll-hint {
    margin-top: 2.6rem;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.72rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--muted);
}
.scroll-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    animation: bob 1.8s ease-in-out infinite;
}
@keyframes bob {
    0%, 100% { transform: translateY(-3px); opacity: 1; }
    50%      { transform: translateY(3px);  opacity: 0.4; }
}

/* ---- Sortie ---- */
.outro-title { font-size: clamp(2rem, 4.4vw, 3.2rem); }

.outro-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 2.2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.6rem;
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: transform 0.25s ease, box-shadow 0.25s ease,
                border-color 0.25s ease, color 0.25s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #f2c684 0%, #e3a857 55%, #c9853e 100%);
    color: #17110a;
    box-shadow: 0 8px 24px rgba(227,168,87,0.35);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(227,168,87,0.5);
}

.btn-ghost {
    background: transparent;
    color: var(--fg);
    border-color: var(--line);
}
.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.tech-note {
    margin-top: 2.6rem;
    font-size: 0.8rem !important;
    color: rgba(244,246,248,0.42) !important;
    max-width: 480px;
    margin-inline: auto;
}

.fallback-note {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 1rem 5vw;
    color: var(--muted);
}

/* ---- Mobile : le texte prime, la scène recule ---- */
@media (max-width: 860px) {
    .panel-left, .panel-right { margin: 0 auto; }
    .panel-inner { max-width: 100%; text-align: center; }
    .panel { padding: 5rem 6vw; }
    /* la scène passe en retrait pour garantir le contraste du texte */
    .stage::after {
        content: "";
        position: absolute;
        inset: 0;
        background: rgba(5,7,10,0.45);
    }
}

/* ---- Accessibilité : mouvement réduit ---- */
@media (prefers-reduced-motion: reduce) {
    .stage canvas { transition: none; }
    .panel-inner { opacity: 1; transform: none; transition: none; }
    .scroll-dot, .stage-loader span { animation: none; }
}
