/* noto-sans-jp-cyrillic-wght-normal */
@font-face {
    font-family: 'Noto Sans JP Variable';
    font-style: normal;
    font-display: auto;
    font-weight: 100 900;
    src: url(https://cdn.jsdelivr.net/fontsource/fonts/noto-sans-jp:vf@latest/cyrillic-wght-normal.woff2) format('woff2-variations');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

.cormorant-garamond {
    font-family: "Cormorant Garamond", serif;
}

/* Wrapper englobant tout le contenu (hors loader) */
.front3d-wrapper{
    position: relative;
    width: 100%;
    height: 100vh; /* plein écran */
    z-index: 99999999999999999999 !important;
}
#wrapper{
    background-color: #ffffff00 !important;
}
/* Loader */
#loader {
    position: fixed;
    inset: 0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999999999999999999999999 !important;
}

#loader .loader-inner {
    position: relative;
    width: 100vw;
    height: 100vh;
}

.loader-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(0);
    width: clamp(70px, 7vw, 160px);
    height: auto;
    opacity: 0;
    /* 1) Fondu d'apparition, 2) décalage gauche synchronisé avec le slide du texte */
    animation: logoFadeIn 1.2s ease-out forwards 0.1s, logoNudgeLeft 0.7s ease forwards 1.1s;
    will-change: transform, opacity;
    z-index: 2;
}

.loader-logo-texte {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-160%, -50%) translateZ(0);
    width: clamp(70px, 8vw, 160px);
    height: auto;
    opacity: 0;
    animation: logoTextSlideIn 0.9s cubic-bezier(.2,.8,.2,1) forwards 1.1s;
    will-change: transform, opacity;
    z-index: 1;
}

@keyframes logoFadeIn {
    0% { opacity: 0; transform: translate(-50%, -50%) translateZ(0) scale(.96); }
    100% { opacity: 1; transform: translate(-50%, -50%) translateZ(0) scale(1); }
}

/* Léger déplacement du logo principal vers la gauche quand le texte arrive */
@keyframes logoNudgeLeft {
    0% { transform: translate(-50%, -50%) translateZ(0) scale(1); }
    100% { transform: translate(-62%, -50%) translateZ(0) scale(1); }
}

@keyframes logoTextSlideIn {
    0% { opacity: 0; transform: translate(-160%, -50%) translateZ(0); }
    100% { opacity: 1; transform: translate(60%, -50%) translateZ(0); }
}

/* Sortie: le texte retourne vers le logo et s'efface */
@keyframes logoTextSlideOut {
    0% { opacity: 1; transform: translate(60%, -50%); }
    100% { opacity: 0; transform: translate(-50%, -50%); }
}

/* Etat masqué du loader (après séquence) */
#loader.is-hidden {
    pointer-events: none;
    animation: loaderFadeOut 0.8s ease-out forwards;
}

@keyframes loaderFadeOut {
    to { opacity: 0; }
}

/* Zoom vers l'avant du contenu pendant le fondu de fin */
#loader.is-hidden .loader-inner {
    animation: loaderZoomOut 0.8s ease-out forwards;
}

@keyframes loaderZoomOut {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
}

/* Zoom léger du logo pendant la sortie du texte */
@keyframes logoSlightZoom {
    0% { transform: translate(-62%, -50%) scale(1); }
    100% { transform: translate(-62%, -50%) scale(1.06); }
}

/* Etat de sortie avant le fondu final */
#loader.is-exit .loader-logo-texte {
    animation: logoTextSlideOut 0.8s cubic-bezier(.4,0,.2,1) forwards;
}

#loader.is-exit-logo .loader-logo {
    animation: logoSlightZoom 0.8s ease-out forwards;
}

h1 {
    font-family: "Cormorant Garamond", serif;
    font-optical-sizing: auto;
    font-weight: 300;
    font-style: normal;
}

span {
    color: #FF9FB6;
}

.soustitre {
    letter-spacing: 0.4em;
    font-weight: 300;
}

.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
}

.background-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


.temple-container {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    z-index: 2;
    /* Valeur plus élevée que celle de tree-container */
    will-change: transform;
    opacity: 0;
}

.temple-image {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Slices du temple pour découpe */
.temple-image-left,
.temple-image-right{
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    opacity: 0; /* invisibles par défaut */
}

/* Masques clip-path: moitiés verticale */
.temple-image-left{ clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%); }
.temple-image-right{ clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%); }

/* Etat de séparation: montrer les moitiés et écarter */
.temple-container.split-cut .temple-image{ opacity: 0; }
.temple-container.split-cut .temple-image-left,
.temple-container.split-cut .temple-image-right{
    opacity: 1;
    transition: transform 0.9s cubic-bezier(.2,.8,.2,1), opacity 0.2s ease;
}
.temple-container.split-cut .temple-image-left{ transform: translateX(calc(-50% - 40vw)); }
.temple-container.split-cut .temple-image-right{ transform: translateX(calc(-50% + 40vw)); }

.content-section {
    position: fixed;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    z-index: 5;
}

canvas {
    position: fixed !important;
    top: 0;
    left: 0;
    z-index: 8;
    pointer-events: none;
}

/* Styles pour le canvas des particules */
.particles-canvas {
    position: fixed !important;
    top: 0;
    left: 0;
    z-index: 3;
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 1;
    filter: brightness(1.2) contrast(1.1);
}

/* Styles pour les arbres latéraux */
.tree-left-container,
.tree-right-container {
    position: fixed;
    top: 0;
    height: 50vh;
    /* Hauteur augmentée pour éviter la coupure */
    z-index: 1;
    /* Au-dessus du background mais sous le temple et le contenu */
    will-change: transform, opacity;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

.tree-left-container {
    left: 0;
    width: 25vw;
    /* Largeur augmentée pour l'arbre de gauche */
    padding: 0;
    margin: 0;
    overflow: hidden;
    /* Masquer tout débordement */
}

.tree-right-container {
    right: 0;
    width: 40vw;
    /* Largeur augmentée pour l'arbre de droite */
    padding: 0;
    margin: 0;
    overflow: hidden;
    /* Masquer tout débordement */
}

/* Éjection latérale lors de la coupe */
.tree-left-container.split-out {
    transform: translateX(-60vw);
    transition: transform 0.9s cubic-bezier(.2,.8,.2,1);
}

.tree-right-container.split-out {
    transform: translateX(60vw);
    transition: transform 0.9s cubic-bezier(.2,.8,.2,1);
}

/* Optionnel: atténuer le contenu pendant la coupe */
.content-section.split-dim, .btn-primary.split-dim {
    transition: opacity 0.4s ease;
    opacity: 0.3;
}

.tree-left,
.tree-right {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Utiliser cover pour remplir complètement l'espace */
    object-position: top left;
    /* Positionner l'image vers le haut et à gauche pour l'arbre gauche */
    display: block;
    padding: 0;
    margin: 0;
    border: none;
    outline: none;
}

.btn-primary{
    position: fixed;
    top: 75%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(112deg, #E5A5CB 0%, #B46994 100%);
    padding: 10px 20px;
    border-radius: 30px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    z-index: 5;
    box-shadow: 0 4px 8px #F2CBD7;
}

/* Overlay de découpe */
.split-overlay{
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9; /* au-dessus du katana (8) */
    display: none; /* visible uniquement pendant l'effet */
}

.split-overlay.is-active{ display: block; }

.split-left,
.split-right{
    position: absolute;
    top: 0;
    width: 50vw;
    height: 100vh;
    background: rgba(255,255,255,0.0); /* transparent, on laisse voir le fond réel */
    will-change: transform;
}

.split-left{ left: 0; transform: translateX(0); }
.split-right{ right: 0; transform: translateX(0); }

/* Trait lumineux de la coupe */
.split-glow{
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 50%, rgba(255,255,255,0) 100%);
    filter: drop-shadow(0 0 12px rgba(255,255,255,0.9)) drop-shadow(0 0 24px rgba(229,165,203,0.8));
    opacity: 0;
}

/* Flash et étincelles */
.split-flash{
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.85), rgba(255,255,255,0) 60%);
    opacity: 0;
}

.split-sparks{
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    background: repeating-linear-gradient(180deg, rgba(229,165,203,0.0) 0 6px, rgba(229,165,203,0.8) 6px 8px, rgba(229,165,203,0.0) 8px 14px);
    filter: blur(0.6px) drop-shadow(0 0 10px rgba(229,165,203,0.9));
    opacity: 0;
}

/* Animations de séparation */
@keyframes splitLeftMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(-52vw); }
}

@keyframes splitRightMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(52vw); }
}

@keyframes splitGlowFlash {
    0% { opacity: 0; }
    15% { opacity: 1; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

.split-overlay.play .split-left{ animation: splitLeftMove 0.9s cubic-bezier(.2,.8,.2,1) forwards; }
.split-overlay.play .split-right{ animation: splitRightMove 0.9s cubic-bezier(.2,.8,.2,1) forwards; }
.split-overlay.play .split-glow{ animation: splitGlowFlash 0.9s ease-out forwards; }
.split-overlay.play .split-flash{ animation: splitGlowFlash 0.6s ease-out forwards; }
.split-overlay.play .split-sparks{ animation: splitGlowFlash 0.9s ease-out forwards; }

/* Overlay global au-dessus de tout */
.custom-top-overlay{
    position: fixed;
    inset: 0;
    pointer-events: none; /* laisser passer les clics si juste décoratif */
    z-index: 10000; /* plus haut que #loader (9999) et que .split-overlay (9) */
    /* Exemple: transparent par défaut. Ajoutez un fond si nécessaire */
    background: transparent;
}

/* Shake d’écran pendant l’impact */
@keyframes screenShake {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(2px, -1px); }
    60% { transform: translate(-1px, 1px); }
    80% { transform: translate(1px, -2px); }
    100% { transform: translate(0, 0); }
}

body.split-shake { animation: screenShake 0.18s ease-in-out; }

/* Léger zoom avant redirection (sur html pour éviter les conflits de transform du body) */
@keyframes preRedirectZoom {
    0% { transform: scale(1); }
    100% { transform: scale(1.7); }
}

html.pre-redirect-zoom {
    animation: preRedirectZoom 0.16s ease-out forwards;
}

/* Animation d'ouverture des arbres - gérée par JavaScript */
.tree-left {
    transform: translateX(-100%);
    opacity: 0;
    /* Pas de transition CSS - animation JavaScript pure */
}

.tree-right {
    transform: translateX(100%);
    opacity: 0;
    /* Pas de transition CSS - animation JavaScript pure */
    object-position: top right;
    /* Positionner l'image vers le haut et à droite pour l'arbre droit */
}

/* Animations de feuillage pour les arbres - plus douces et constantes */
@keyframes treeSwayLeft {
    0%, 100% {
        transform: translateX(0%) rotate(-0.15deg);
    }
    25% {
        transform: translateX(0%) rotate(0.2deg);
    }
    50% {
        transform: translateX(0%) rotate(-0.1deg);
    }
    75% {
        transform: translateX(0%) rotate(0.18deg);
    }
}

@keyframes treeSwayRight {
    0%, 100% {
        transform: translateX(0%) rotate(0.12deg);
    }
    30% {
        transform: translateX(0%) rotate(-0.18deg);
    }
    60% {
        transform: translateX(0%) rotate(0.15deg);
    }
    90% {
        transform: translateX(0%) rotate(-0.08deg);
    }
}

@keyframes gentleFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0.05deg);
    }
    50% {
        transform: translateY(-1px) rotate(-0.08deg);
    }
}

/* États d'animation - gérés par JavaScript avec animations de feuillage */
.tree-left.animate-in {
    transform: translateX(0%);
    opacity: 1;
    animation: treeSwayLeft 8s ease-in-out infinite;
    transform-origin: bottom center;
    animation-fill-mode: both;
}

.tree-right.animate-in {
    transform: translateX(0%);
    opacity: 1;
    animation: treeSwayRight 8s ease-in-out infinite;
    transform-origin: bottom center;
    animation-fill-mode: both;
}

/* Animation du temple - apparition par le bas */
@keyframes templeRiseUp {
    0% {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(-50%) translateY(0%);
        opacity: 1;
    }
}

.temple-container.animate-in {
    animation: templeRiseUp 1.2s ease-out forwards;
}

/* Responsive design pour les arbres */
@media (max-width: 768px) {
    .tree-left-container,
    .tree-right-container {
        width: 22vw;
        height: 45vh;
    }
}

@media (max-width: 480px) {
    .tree-left-container,
    .tree-right-container {
        width: 20vw;
        height: 40vh;
    }
}
