/* ===================================
   VARIABLES & RESET
   =================================== */

:root {
    --color-dark: #0a0a0f;
    --color-night: #1a1a2e;
    --color-purple: #4a2566;
    --color-pink: #e94b7e;
    --color-peach: #ff9a76;
    --color-light: #f7f7ff;
    --color-gold: #ffd89b;

    --font-main: 'Georgia', 'Times New Roman', serif;
    --font-accent: 'Helvetica Neue', Arial, sans-serif;

    --transition-smooth: cubic-bezier(0.4, 0.0, 0.2, 1);
    --transition-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
    color: var(--color-light);
    background: var(--color-dark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===================================
   CANVAS PARTICULES
   =================================== */

#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* ===================================
   LAYOUT PRINCIPAL
   =================================== */

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

.scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.2s var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scene.active {
    opacity: 1;
    pointer-events: all;
    z-index: 1;
}

/* ===================================
   BACKGROUNDS
   =================================== */

.scene-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
}

.scene-background.starry {
    background: radial-gradient(ellipse at bottom, #1a1a2e 0%, #0a0a0f 100%);
}

.scene-background.gradient-purple {
    background: linear-gradient(135deg, #1a1a2e 0%, #4a2566 50%, #2e1a3d 100%);
}

.polaroid-photo {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.polaroid-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Vidéos */
.scene-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
}

.fullscreen-video {
    z-index: -1;
    opacity: 1 !important;
}

/* Hide starry background when video is present */
#scene-0 .scene-background.starry {
    display: none;
}

/* ===================================
   STYLE POLAROID POUR VIDÉOS
   =================================== */

.polaroid-container {
    position: relative;
    width: 400px;
    height: 480px;
    background: white;
    padding: 15px;
    padding-bottom: 60px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s var(--transition-smooth);
}

.polaroid-container::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 20px;
    background: rgba(200, 200, 200, 0.6);
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    /* Épingle/scotch */
}

.polaroid-container:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.polaroid-video {
    position: relative;
    width: 100%;
    height: 370px;
    background: #000;
    overflow: hidden;
}

.polaroid-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.polaroid-caption {
    position: absolute;
    bottom: 15px;
    left: 15px;
    right: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

.video-replay-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
    transition: all 0.3s var(--transition-bounce);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.video-replay-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: white;
}

.video-replay-btn.show {
    display: block;
}

/* Variations de rotation pour effet "épinglé" */
.polaroid-left {
    transform: rotate(-2deg);
}

.polaroid-right {
    transform: rotate(2deg);
}

.polaroid-left:hover {
    transform: rotate(-1deg) scale(1.02);
}

.polaroid-right:hover {
    transform: rotate(1deg) scale(1.02);
}

.scene-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.6);
    z-index: -1;
}

.scene-overlay.soft {
    background: rgba(10, 10, 15, 0.4);
}

.scene-overlay.dark {
    background: rgba(10, 10, 15, 0.5);
}

/* ===================================
   CONTENU & TEXTE
   =================================== */

.scene-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 2rem;
    text-align: left;
}

/* Layout split pour polaroid + texte */
.scene-content.split-layout {
    max-width: 1200px;
    display: flex;
    gap: 3rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.scene-content.split-layout .text-container {
    flex: 1;
    min-width: 350px;
    max-width: 500px;
}

.scene-content.split-layout .polaroid-container {
    flex-shrink: 0;
}

/* ===================================
   SCÈNE INTRO: COEUR
   =================================== */

.intro-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    text-align: center;
}

.heart-container {
    cursor: pointer;
    animation: float 3s ease-in-out infinite;
}

.heart {
    font-size: 8rem;
    transition: all 0.3s var(--transition-bounce);
    filter: drop-shadow(0 0 30px rgba(233, 75, 126, 0.6));
}

.heart:hover {
    transform: scale(1.2);
    filter: drop-shadow(0 0 50px rgba(233, 75, 126, 0.9));
}

.heart:active {
    transform: scale(0.9);
}

.heart-inner {
    animation: heartbeat 1.5s ease-in-out infinite;
}

.start-text {
    margin-top: 2rem;
    font-size: 1.5rem;
    color: var(--color-light);
    opacity: 0.8;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(1.1);
    }
    20%, 40% {
        transform: scale(0.95);
    }
}

.text-container {
    animation: fadeInUp 1s var(--transition-smooth) forwards;
}

.text-container.centered {
    text-align: center;
}

.text-container p {
    font-size: 1.3rem;
    line-height: 1.8;
    margin: 0.8rem 0;
    opacity: 0;
    animation: fadeInText 0.8s var(--transition-smooth) forwards;
}

.text-container p:nth-child(1) { animation-delay: 0.2s; }
.text-container p:nth-child(2) { animation-delay: 0.4s; }
.text-container p:nth-child(3) { animation-delay: 0.6s; }
.text-container p:nth-child(4) { animation-delay: 0.8s; }
.text-container p:nth-child(5) { animation-delay: 1s; }
.text-container p:nth-child(6) { animation-delay: 1.2s; }
.text-container p:nth-child(7) { animation-delay: 1.4s; }
.text-container p:nth-child(8) { animation-delay: 1.6s; }
.text-container p:nth-child(9) { animation-delay: 1.8s; }
.text-container p:nth-child(10) { animation-delay: 2s; }

/* Styles de texte spéciaux */
.date-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--color-gold);
    margin-bottom: 1.5rem;
    text-shadow: 0 0 20px rgba(255, 216, 155, 0.5);
}

.emphasis {
    font-style: italic;
    color: var(--color-peach);
    font-weight: 500;
}

.big-text {
    font-size: 1.6rem;
    font-weight: bold;
}

.aside {
    font-size: 1rem;
    opacity: 0.7;
    font-style: italic;
}

.quote {
    font-style: italic;
    color: var(--color-pink);
    padding-left: 1.5rem;
    border-left: 3px solid var(--color-pink);
}

.spacer {
    height: 1.5rem;
}

.signature {
    font-size: 1.2rem;
    margin-top: 2rem;
    opacity: 0.9;
}

.patate-easter-egg {
    cursor: pointer;
    transition: all 0.3s var(--transition-bounce);
    display: inline-block;
}

.patate-easter-egg:hover {
    color: var(--color-gold);
    transform: scale(1.2) rotate(5deg);
}

/* ===================================
   SCÈNE 0: TYPEWRITER EFFECT
   =================================== */

.typewriter .line {
    font-size: 1.5rem;
    overflow: hidden;
    white-space: nowrap;
    margin: 1.5rem auto;
    letter-spacing: 0.05em;
    animation: none;
    opacity: 1;
}

/* ===================================
   SCÈNE 1: MESSAGES
   =================================== */

.messages-container {
    margin-top: 3rem;
    max-width: 500px;
    display: flex;
    flex-direction: column;
}

.intro-text {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-align: center;
    opacity: 0;
    /* Garder l'espace dans le layout */
    visibility: hidden;
}

.message {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    margin: 0.8rem 0;
    max-width: 70%;
    opacity: 0;
    /* Garder l'espace dans le layout */
    visibility: hidden;
    transform: scale(0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.message:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.message.left {
    background: rgba(74, 37, 102, 0.7);
    align-self: flex-start;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.message.right {
    background: rgba(233, 75, 126, 0.7);
    align-self: flex-end;
    margin-left: auto;
    text-align: right;
    border-bottom-right-radius: 4px;
}

@keyframes messageIn {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.8) rotateX(20deg);
    }
    70% {
        transform: translateY(-5px) scale(1.05) rotateX(0);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotateX(0);
    }
}

.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 0.8rem 1.2rem;
    background: rgba(233, 75, 126, 0.6);
    border-radius: 18px;
    width: fit-content;
    margin-left: auto;
    opacity: 0;
    animation: popIn 0.4s var(--transition-bounce) forwards;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ===================================
   MESSAGE BUBBLES (Scènes 3+)
   =================================== */

.message-bubble {
    display: inline-block;
    padding: 1rem 1.5rem;
    border-radius: 20px;
    margin: 1rem 0;
    font-size: 1.2rem;
    max-width: 80%;
    animation: popIn 0.5s var(--transition-bounce) forwards;
}

.message-bubble.big {
    font-size: 1.4rem;
}

.message-bubble.left {
    background: rgba(74, 37, 102, 0.8);
    margin-right: auto;
}

.message-bubble.right {
    background: rgba(233, 75, 126, 0.8);
    margin-left: auto;
}

.message-bubble.delayed {
    opacity: 0;
    animation-delay: 1.5s;
}

/* ===================================
   NAVIGATION
   =================================== */

.scene-navigation {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    gap: 1rem;
    z-index: 10;
}

.nav-btn {
    background: linear-gradient(135deg, rgba(233, 75, 126, 0.8), rgba(74, 37, 102, 0.8));
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    font-size: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.4s var(--transition-bounce);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(233, 75, 126, 0.4),
                0 0 40px rgba(233, 75, 126, 0.2);
    position: relative;
    overflow: hidden;
    line-height: 1;
    padding: 0;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.nav-btn:hover::before {
    width: 100%;
    height: 100%;
}

.nav-btn:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 6px 30px rgba(233, 75, 126, 0.6),
                0 0 60px rgba(233, 75, 126, 0.4);
}

.nav-btn:active {
    transform: scale(0.9);
}

.prev-btn:hover {
    transform: scale(1.15) rotate(-5deg);
}

.prev-btn,
.next-btn {
    padding-bottom: 2px;
}

.replay-btn {
    width: auto;
    padding: 0 2rem;
    border-radius: 30px;
    font-size: 1rem;
    height: 60px;
    background: linear-gradient(135deg, rgba(255, 215, 155, 0.9), rgba(233, 75, 126, 0.8));
    font-weight: 600;
    letter-spacing: 0.5px;
}

.replay-btn::before {
    border-radius: 30px;
}

.replay-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(255, 215, 155, 0.6),
                0 0 60px rgba(255, 215, 155, 0.4);
}

/* ===================================
   AUDIO CONTROLS
   =================================== */

#audio-controls {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 100;
}

.audio-btn {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
}

.audio-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 2px 12px rgba(255, 255, 255, 0.2);
}

/* ===================================
   ANIMATIONS
   =================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInText {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    60% {
        transform: translateY(-5px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 20px rgba(255, 216, 155, 0.5);
    }
    50% {
        text-shadow: 0 0 40px rgba(255, 216, 155, 0.8), 0 0 60px rgba(255, 216, 155, 0.4);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px) rotate(-2deg); }
    75% { transform: translateX(5px) rotate(2deg); }
}

/* Classes d'animation déclenchées par JS */
.sparkle-trigger {
    animation: glow 2s ease-in-out infinite;
}

.dog-trigger {
    cursor: pointer;
}

.dog-trigger:hover {
    animation: shake 0.5s ease-in-out;
}

.dramatic {
    animation: pulse 2s ease-in-out infinite;
}

/* ===================================
   EFFETS SPÉCIAUX PAR SCÈNE
   =================================== */

.heartbeat-scene .text-container {
    animation: pulse 3s ease-in-out infinite;
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 768px) {
    .scene-content {
        padding: 1.5rem;
    }

    .text-container p {
        font-size: 1.1rem;
    }

    .date-title {
        font-size: 1.4rem;
    }

    .big-text {
        font-size: 1.3rem;
    }

    .nav-btn {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .scene-navigation {
        bottom: 1rem;
        right: 1rem;
        gap: 0.75rem;
    }

    .replay-btn {
        padding: 0 1.5rem;
        height: 45px;
        font-size: 0.9rem;
    }

    .message-bubble {
        font-size: 1rem;
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .text-container p {
        font-size: 1rem;
    }

    .typewriter .line {
        font-size: 1.2rem;
    }
}

/* ===================================
   LOADING STATE
   =================================== */

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-text {
    font-size: 1.5rem;
    color: var(--color-light);
    animation: pulse 2s ease-in-out infinite;
}
