/* ============================================
   LANDING — Rubik's cube CSS 3D
   ============================================ */

body.landing {
    min-height: 100vh;
    overflow-x: hidden;
}

/* Quadrillage verre noir en fond (commence sous le header, top ajusté en JS) */
.landing-ripple {
    position: fixed;
    top: 0;          /* remplacé en JS par le bas du header */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
}

/* Halo noir radial derrière le cube (entre la grille et le cube) pour le détacher */
.landing-cube-halo {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(43% 52% at 50% 54%,
        rgba(0,0,0,0.9) 0%,
        rgba(0,0,0,0.6) 44%,
        rgba(0,0,0,0) 74%);
}

.landing-main {
    position: relative;
    z-index: 2;
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 40px;
    padding: 48px 24px 64px;
}
.landing-cube-scene {
    margin-top: auto;
    /* Remonte légèrement le cube (espace ajouté sous lui) */
    margin-bottom: 40px;
}

/* ── Scène 3D ── */
:root {
    --cube-size: clamp(150px, 26vmin, 240px);
    --cubie-size: calc(var(--cube-size) / 3);
    --gap: 4px;
}

.landing-cube-scene {
    position: relative;
    width: var(--cube-size);
    height: var(--cube-size);
    perspective: 1400px;
    perspective-origin: 50% 50%;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    cursor: grab;
}
.landing-cube-scene.is-dragging { cursor: grabbing; }

.landing-cube {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateX(-22deg) rotateY(28deg);
    animation: cubeIntro 1.4s 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
    will-change: transform;
}

/* Chaque cubie est positionné en 3D */
.cubie {
    position: absolute;
    top: calc(50% - var(--cubie-size) / 2);
    left: calc(50% - var(--cubie-size) / 2);
    width: var(--cubie-size);
    height: var(--cubie-size);
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.cubie-face {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.75);
    border: 1px solid rgba(255,255,255,0.85);
    backface-visibility: hidden;
}

/* Lettres sur les faces du cube (mêmes couleur et typo partout) */
.cubie-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Monda', sans-serif;
    font-weight: 700;
    font-size: calc(var(--cubie-size) * 0.5);
    line-height: 1;
    color: rgba(255, 255, 255, 0.78);
}

/* Position des 6 faces de chaque cubie (taille = var(--cubie-size)) */
.cubie-face-front  { transform: translateZ(calc(var(--cubie-size) / 2 - var(--gap) / 2)); }
.cubie-face-back   { transform: rotateY(180deg) translateZ(calc(var(--cubie-size) / 2 - var(--gap) / 2)); }
.cubie-face-right  { transform: rotateY(90deg)  translateZ(calc(var(--cubie-size) / 2 - var(--gap) / 2)); }
.cubie-face-left   { transform: rotateY(-90deg) translateZ(calc(var(--cubie-size) / 2 - var(--gap) / 2)); }
.cubie-face-top    { transform: rotateX(90deg)  translateZ(calc(var(--cubie-size) / 2 - var(--gap) / 2)); }
.cubie-face-bottom { transform: rotateX(-90deg) translateZ(calc(var(--cubie-size) / 2 - var(--gap) / 2)); }

@keyframes cubeIntro {
    0%   { opacity: 0; transform: rotateX(-22deg) rotateY(28deg) scale(0.5); }
    60%  { opacity: 1; }
    100% { opacity: 1; transform: rotateX(-22deg) rotateY(28deg) scale(1); }
}

/* ── CTA (design system .cv-button — uniquement override apparition) ── */
.landing-cta {
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    /* Reste centré même en responsive (override du align-self:flex-end
       appliqué à .cv-button dans style.css ≤900px) */
    align-self: center;
}
.landing-cta.is-visible {
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.landing-cta.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ── Transition de sortie ── */
.landing-fadeout {
    position: fixed;
    inset: 0;
    background: #050608;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
body.landing.is-leaving .landing-fadeout { opacity: 1; }
body.landing.is-leaving .landing-cube {
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.5s ease 0.15s;
    transform: rotateX(-22deg) rotateY(28deg) scale(1.4) !important;
    opacity: 0;
}
body.landing.is-leaving .landing-cta,
body.landing.is-leaving .header { opacity: 0; transition: opacity 0.4s ease; }

/* ── Responsive ── */
@media (max-width: 600px) {
    .landing-main { gap: 28px; padding: 32px 16px 48px; }
}

@media (prefers-reduced-motion: reduce) {
    .landing-cube,
    .cubie,
    .landing-cta { animation: none !important; transition: none !important; }
    .landing-cta { opacity: 1; transform: none; pointer-events: auto; }
}
