/* ==========================================================================
   PORTAL / SCI-FI STAR-GATE HOME STYLING - KINDRED.FR
   Design fidèle à une véritable porte circulaire de science-fiction
   7 Chevrons avec GLYPHES ANTIQUES gravés et FAISCEAUX DE TRANSMISSION
   ========================================================================== */

:root {
    --bg-space: #030712;
    --energy-cyan: #38bdf8;
    --energy-core: #0ea5e9;
    --energy-glow: rgba(56, 189, 248, 0.7);
    --energy-bright: #f0f9ff;

    --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
    background-color: var(--bg-space);
    font-family: var(--font-main);
    color: #f8fafc;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

/* ==========================================================================
   FOND SPATIAL (CANVAS ÉTOILES & NÉBULEUSES)
   ========================================================================== */
#spaceCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.8s cubic-bezier(0.16, 1, 0.3, 1);
}

body.loaded #spaceCanvas {
    opacity: 1;
}

.ambient-nebula {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: 
        radial-gradient(circle at 50% 50%, rgba(14, 165, 233, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 15% 25%, rgba(139, 92, 246, 0.09) 0%, transparent 50%),
        radial-gradient(circle at 85% 75%, rgba(56, 189, 248, 0.08) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 2.5s ease-out;
}

body.loaded .ambient-nebula {
    opacity: 1;
}

/* ==========================================================================
   SCÈNE PRINCIPALE DU PORTAIL
   ========================================================================== */
.portal-stage {
    position: relative;
    z-index: 10;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    perspective: 1200px;
    overflow: hidden;
}

/* En-tête supérieur discret */
.top-header {
    position: absolute;
    top: 1.25rem;
    left: 1.5rem;
    right: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
    z-index: 40;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 1.2s ease 1s, transform 1.2s ease 1s;
}

body.loaded .top-header {
    opacity: 0.85;
    transform: translateY(0);
}

.brand-micro {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: #e2e8f0;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.brand-micro .status-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--energy-cyan);
    box-shadow: 0 0 10px var(--energy-cyan);
    animation: statusPulse 2.5s infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 0.5; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.2); }
}

.nav-hint-top {
    font-size: 0.75rem;
    color: #94a3b8;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ==========================================================================
   STRUCTURE PRINCIPALE DE LA PORTE CIRCULAIRE
   ========================================================================== */
.portal-container {
    position: relative;
    width: min(88vw, 88vh, 670px);
    height: min(88vw, 88vh, 670px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 1.8s cubic-bezier(0.16, 1, 0.3, 1);
}

body.loaded .portal-container {
    opacity: 1;
}

/* Halo énergétique diffus autour de la porte */
.portal-glow {
    position: absolute;
    inset: -6%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.22) 0%, rgba(56, 189, 248, 0.08) 50%, transparent 72%);
    filter: blur(28px);
    z-index: 2;
    pointer-events: none;
    opacity: 0.7;
    animation: portalPulseGlow 4s ease-in-out infinite alternate;
}

@keyframes portalPulseGlow {
    0% { transform: scale(0.97); opacity: 0.55; }
    100% { transform: scale(1.03); opacity: 0.9; }
}

/* Structure SVG complète */
.portal-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    overflow: visible;
    pointer-events: none;
}

/* Seuls les chevrons SVG captent le clic et le survol */
.gate-chevrons-svg-layer,
.chevron-svg-link {
    pointer-events: auto;
}

/* Rotation de l'anneau de coordonnées */
.ring-slow-rotator {
    transform-origin: 500px 500px;
    animation: slowRingRotate 220s linear infinite;
    pointer-events: none;
}

.ring-counter-rotator {
    transform-origin: 500px 500px;
    animation: counterRingRotate 280s linear infinite;
    pointer-events: none;
}

@keyframes slowRingRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes counterRingRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(-360deg); }
}

/* ==========================================================================
   FAISCEAUX DE TRANSMISSION ÉNERGÉTIQUE (LIAISON CHEVRON ➔ CENTRE)
   ========================================================================== */
.energy-conduits-layer {
    pointer-events: none;
}

.energy-beam {
    stroke: var(--energy-cyan);
    stroke-width: 3.5;
    stroke-dasharray: 8 16;
    stroke-linecap: round;
    opacity: 0;
    filter: url(#beamGlow);
    transition: opacity 0.35s ease, stroke-dashoffset 1s linear;
}

.energy-beam.active {
    opacity: 0.95;
    animation: beamFlow 1s linear infinite;
}

@keyframes beamFlow {
    from { stroke-dashoffset: 48; }
    to { stroke-dashoffset: 0; }
}

/* ==========================================================================
   LES 7 CHEVRONS MÉCANIQUES AVEC GLYPHES GRAVÉS DANS LE MÉTAL
   ========================================================================== */
.gate-chevrons-svg-layer {
    pointer-events: auto;
}

.chevron-svg-link {
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    display: block;
}

.chevron-unit {
    /* Aucun transform, aucune transition de position — les chevrons restent FIXES sur l'anneau */
}

/* 1. Halo lumineux diffus */
.cv-halo {
    fill: #38bdf8 !important;
    opacity: 0 !important;
    filter: url(#glyphGlow);
    transition: opacity 0.35s ease;
}

/* 2. Boîtier métallique principal du chevron : acier / titane contrasté */
.cv-body {
    fill: #2b3952 !important;
    stroke: #64748b !important;
    stroke-width: 2.5 !important;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.7));
    transition: all 0.35s ease;
}

/* 3. Mâchoires mécaniques de maintien : chromées / acier brossé */
.cv-clamps {
    fill: none !important;
    stroke: #94a3b8 !important;
    stroke-width: 2.5 !important;
    stroke-linecap: round !important;
    transition: stroke 0.35s ease;
}

/* 4. Éperon d'ancrage dirigé vers le centre */
.cv-beak {
    fill: #1e293b !important;
    stroke: #475569 !important;
    stroke-width: 1.5 !important;
    transition: all 0.35s ease;
}

/* 5. Plaque de pierre/cristal gravée centrale */
.cv-stone {
    fill: #0c1e38 !important;
    stroke: #38bdf8 !important;
    stroke-width: 1.5 !important;
    transition: all 0.35s ease;
}

/* 6. GLYPHE UNIQUE GRAVÉ : teinté cyan nébuleux à l'état normal */
.cv-glyph {
    fill: none !important;
    stroke: #38bdf8 !important;
    stroke-width: 2.4 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    opacity: 0.85;
    filter: drop-shadow(0 0 3px rgba(56, 189, 248, 0.5));
    transition: all 0.35s ease;
}

/* ==========================================================================
   ANIMATION AU SURVOL (PC) OU À LA SÉLECTION (MOBILE)
   Pas de transform/scale : les chevrons restent absolument fixes sur l'anneau.
   Seuls les couleurs et filtres changent pour éviter tout tremblement.
   ========================================================================== */

/* --- HALO (hover, active, lit) --- */
.chevron-svg-link:hover .cv-halo,
.chevron-svg-link.active .cv-halo,
.chevron-svg-link.lit .cv-halo {
    opacity: 0.85 !important;
}

/* --- CORPS MÉTALLIQUE --- */
.chevron-svg-link:hover .cv-body,
.chevron-svg-link.active .cv-body {
    fill: #1e3a66 !important;
    stroke: #38bdf8 !important;
    filter: drop-shadow(0 0 22px rgba(56, 189, 248, 0.9)) !important;
    transition: fill 0.3s ease, stroke 0.3s ease, filter 0.3s ease;
}

/* Animation d'entrée : illumination plus douce */
.chevron-svg-link.lit .cv-body {
    fill: #1a3258 !important;
    stroke: #7dd3fc !important;
    filter: drop-shadow(0 0 16px rgba(56, 189, 248, 0.7)) !important;
    transition: fill 0.3s ease, stroke 0.3s ease, filter 0.3s ease;
}

/* --- MÂCHOIRES --- */
.chevron-svg-link:hover .cv-clamps,
.chevron-svg-link.active .cv-clamps {
    stroke: #ffffff !important;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.8)) !important;
    transition: stroke 0.3s ease, filter 0.3s ease;
}

.chevron-svg-link.lit .cv-clamps {
    stroke: #bae6fd !important;
    transition: stroke 0.3s ease;
}

/* --- ÉPERON --- */
.chevron-svg-link:hover .cv-beak,
.chevron-svg-link.active .cv-beak {
    fill: #0284c7 !important;
    stroke: #38bdf8 !important;
    transition: fill 0.3s ease, stroke 0.3s ease;
}

.chevron-svg-link.lit .cv-beak {
    fill: #0369a1 !important;
    stroke: #7dd3fc !important;
    transition: fill 0.3s ease, stroke 0.3s ease;
}

/* --- PIERRE GRAVÉE --- */
.chevron-svg-link:hover .cv-stone,
.chevron-svg-link.active .cv-stone {
    fill: #034575 !important;
    stroke: #ffffff !important;
    transition: fill 0.3s ease, stroke 0.3s ease;
}

.chevron-svg-link.lit .cv-stone {
    fill: #023a64 !important;
    stroke: #7dd3fc !important;
    transition: fill 0.3s ease, stroke 0.3s ease;
}

/* --- GLYPHE GRAVÉ (ILLUMINATION ÉNERGÉTIQUE INTENSE) --- */
.chevron-svg-link:hover .cv-glyph,
.chevron-svg-link.active .cv-glyph {
    stroke: #ffffff !important;
    opacity: 1 !important;
    filter: url(#glyphGlow) drop-shadow(0 0 10px #38bdf8) !important;
    transition: stroke 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
}

.chevron-svg-link.lit .cv-glyph {
    stroke: #7dd3fc !important;
    opacity: 1 !important;
    filter: url(#glyphGlow) !important;
    transition: stroke 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
}

/* ==========================================================================
   CŒUR ÉNERGÉTIQUE AU CENTRE (TOTALEMENT LIBRE)
   ========================================================================== */
.portal-core {
    position: absolute;
    width: 58%;
    height: 58%;
    border-radius: 50%;
    overflow: hidden;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #020917 0%, #030a1c 65%, #05142e 100%);
    box-shadow: 
        inset 0 0 35px rgba(14, 165, 233, 0.6),
        inset 0 0 70px rgba(56, 189, 248, 0.3);
    pointer-events: none;
}

.vortex-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.portal-core-mesh {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle, transparent 20%, rgba(6, 182, 212, 0.12) 60%, rgba(2, 6, 23, 0.8) 100%);
    mix-blend-mode: screen;
}

/* ==========================================================================
   TEXTE AU CENTRE DE LA PORTE (KINDRED / TITRE DESTINATION)
   ========================================================================== */
.portal-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 1rem;
    pointer-events: auto; /* Permet le clic sur le bouton Entrer */
    max-width: 82%;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.portal-tagline {
    font-size: clamp(0.6rem, 1.3vw, 0.78rem);
    text-transform: uppercase;
    letter-spacing: 0.32em;
    color: var(--energy-cyan);
    margin-bottom: 0.35rem;
    font-weight: 600;
    text-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
    transition: all 0.3s ease;
}

.portal-title {
    font-size: clamp(1.4rem, 3.8vw, 2.7rem);
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #ffffff;
    margin: 0;
    line-height: 1.1;
    text-shadow: 
        0 0 16px rgba(56, 189, 248, 0.85),
        0 0 35px rgba(14, 165, 233, 0.5);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.portal-action-hint {
    margin-top: 0.5rem;
    font-size: clamp(0.55rem, 1.1vw, 0.7rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #94a3b8;
    opacity: 0;
    transform: translateY(6px);
    transition: all 0.3s ease;
}

.portal-container.has-active .portal-action-hint {
    opacity: 0.95;
    color: #cbd5e1;
    transform: translateY(0);
}



/* ==========================================================================
   ANIMATION D'ENGAGEMENT / TRANSITION (AU CLIC SUR LE CHEVRON)
   ========================================================================== */
body.engaging {
    pointer-events: none;
}

body.engaging .portal-container {
    animation: portalBurst 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

body.engaging .chevron-svg-link.active .cv-body {
    animation: chevronLockPulse 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes chevronLockPulse {
    0%   { fill: #1e3a66; filter: drop-shadow(0 0 22px rgba(56,189,248,0.9)); }
    30%  { fill: #0ea5e9; filter: drop-shadow(0 0 45px rgba(56,189,248,1));   }
    100% { fill: #e0f2fe; filter: drop-shadow(0 0 60px rgba(255,255,255,1)); opacity: 0; }
}

@keyframes portalBurst {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(2.8);
        opacity: 0;
    }
}

.flash-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle, #e0f2fe 0%, #38bdf8 35%, #0284c7 70%, #030712 100%);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

body.engaging .flash-overlay {
    opacity: 0.96;
}

/* ==========================================================================
   FOOTER MINIMALISTE
   ========================================================================== */
.portal-footer {
    position: absolute;
    bottom: 1.25rem;
    left: 1.5rem;
    right: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 40;
    font-size: 0.75rem;
    color: #64748b;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 1.2s ease 1s, transform 1.2s ease 1s;
}

body.loaded .portal-footer {
    opacity: 1;
    transform: translateY(0);
}

.footer-links a {
    color: #94a3b8;
    text-decoration: none;
    margin-left: 1.25rem;
    transition: color 0.25s ease, text-shadow 0.25s ease;
}

.footer-links a:hover,
.footer-links a:focus-visible {
    color: var(--energy-cyan);
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
    outline: none;
}

/* ==========================================================================
   RESPONSIVE MOBILE ET PETITS ÉCRANS (320px - 430px)
   ========================================================================== */
@media (max-width: 600px) {
    .portal-stage {
        padding: 0.5rem;
    }

    .top-header {
        top: 0.75rem;
        left: 1rem;
        right: 1rem;
    }

    .portal-footer {
        bottom: 0.75rem;
        left: 1rem;
        right: 1rem;
        flex-direction: column;
        gap: 0.35rem;
        text-align: center;
        font-size: 0.7rem;
    }

    .footer-links a {
        margin: 0 0.5rem;
    }

    .portal-container {
        width: min(88vw, 88vh, 390px);
        height: min(88vw, 88vh, 390px);
    }

    .portal-core {
        width: 56%;
        height: 56%;
    }

    .portal-tagline {
        font-size: 0.62rem;
        letter-spacing: 0.2em;
    }

    .portal-title {
        font-size: 1.35rem;
        letter-spacing: 0.12em;
    }

    .nav-hint-top {
        display: none;
    }
}

@media (max-width: 360px) {
    .portal-container {
        width: min(86vw, 86vh, 310px);
        height: min(86vw, 86vh, 310px);
    }

    .portal-title {
        font-size: 1.15rem;
    }
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
    .ring-slow-rotator,
    .ring-counter-rotator,
    .portal-glow {
        animation: none !important;
    }

    .portal-container {
        transition: none !important;
    }
}
