/* =========================================
   1. Variables y Configuración de Colores
   ========================================= */
:root {
    --bg-color: #131b21;

    /* Colores de sus flores favoritas */
    --rose-red: #ff0033;
    /* Rosas rojas */
    --rose-pink: #ff99aa;
    /* Rosas rosas */
    --sunflower-yellow: #ffcc00;
    /* Girasoles */
    --sunflower-center: #6b4c1e;
    /* Centro de girasol */
    --gerbera-orange: #ff8c00;
    /* Gerberas */
    --tulip-purple: #be29ec;
    /* Tulipanes */

    /* Colores estructurales */
    --stem-green: #028137;
    /* Tallos */
    --stroke-green: #65d629;
    /* Trazos */
    --paper-color: #fdfbf7;
    /* Color papel carta */
    --text-ink: #444444;
    /* Color tinta carta */
}

/* =========================================
   2. Estilos del SVG (Remapeo de colores)
   ========================================= */
/* Al cambiar estos fills, el SVG cambiará de color automáticamente */
.st0 {
    fill: #ffffff;
}

.st1 {
    fill: none;
    stroke: var(--stroke-green);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.st2 {
    fill: var(--stem-green);
}

.st3 {
    fill: none;
    stroke: var(--stem-green);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.st4 {
    fill: none;
    stroke: var(--stem-green);
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Asignamos la paleta favorita a las clases del SVG */
.st5 {
    fill: var(--rose-red);
}

/* Pétalos principales (Rosas) */
.st6 {
    fill: var(--stem-green);
}

/* Hojas pequeñas */
.st7 {
    fill: none;
    stroke: var(--stem-green);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.st8 {
    fill: var(--sunflower-yellow);
}

/* Pétalos traseros (Ahora Girasoles) */
.st9 {
    fill: var(--rose-pink);
}

/* Polen/Detalles (Ahora Rosas Rosas) */
.st10 {
    fill: var(--gerbera-orange);
}

/* Base de flor (Ahora Gerberas) */
.st11 {
    fill: var(--tulip-purple);
}

/* Líneas decorativas (Ahora Tulipanes) */
.st12 {
    fill: #fdd9c6;
}

.st13 {
    fill: none;
    stroke: #ffffff;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.st14 {
    display: none;
    fill: #ffffff;
}

/* Ocultamos elementos inicialmente para que GSAP los anime */
#Footer_group_1_,
[id^="PinkFlowerGroup"],
[id^="BaseGroup"] path,
[id^="LeafGroup"] path,
path[id^="Stroke"],
g[id^="BudGroup"] g[id^="BudGroup"] g[id^="Bud"],
#Bud8_1_,
#Bud10_1_,
#Bud23_1_,
#Bud26_1_,
[id^="Dots"],
[id^="Flourish"] {
    visibility: hidden;
}

/* =========================================
   3. Reset y Layout General
   ========================================= */
* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    font-family: "Indie Flower", cursive;
    overflow: hidden;
    /* Evita scrollbars durante la animación */
}

.container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
    z-index: 2;
    /* Por encima de la lluvia de flores */
}

/* Contenedor donde se inyectará el SVG */
#svg-container svg {
    height: 90vh;
    width: 100%;
    max-width: 800px;
}

/* Contenido de texto y botones */
.content {
    margin-top: -60vh;
    text-align: center;
    z-index: 10;
    position: relative;
}

.title {
    color: var(--rose-red);
    font-family: "Dancing Script", cursive;
    font-size: 3.5rem;
    margin-top: 60px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: 700;
}

.description {
    color: var(--rose-pink);
    font-size: 1.5rem;
    font-weight: 300;
}

/* Botón Estilizado */
.boton {
    background: var(--rose-red);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(255, 0, 51, 0.4);
    transition:
        transform 0.3s,
        background-color 0.3s;
    font-family: "Indie Flower", cursive;
    font-weight: bold;
}

.boton:hover {
    transform: scale(1.1);
    background-color: #d6002b;
}

/* Ondas de música */
.music-waves {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 30px;
    margin-top: 15px;
    gap: 4px;
}

.music-waves span {
    display: block;
    width: 5px;
    height: 10px;
    background: var(--rose-red);
    animation: audio-wave 1s infinite ease-in-out;
    border-radius: 10px;
}

.music-waves span:nth-child(1) {
    animation-delay: 0.1s;
}

.music-waves span:nth-child(2) {
    animation-delay: 0.3s;
}

.music-waves span:nth-child(3) {
    animation-delay: 0.5s;
}

.music-waves span:nth-child(4) {
    animation-delay: 0.2s;
}

.music-waves span:nth-child(5) {
    animation-delay: 0.4s;
}

@keyframes audio-wave {
    0% {
        height: 5px;
        opacity: 0.5;
    }

    50% {
        height: 25px;
        opacity: 1;
    }

    100% {
        height: 5px;
        opacity: 0.5;
    }
}

/* =========================================
   4. Modal Carta (Estilo Papel Antiguo)
   ========================================= */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,
            0,
            0,
            0.85);
    /* Fondo oscuro para resaltar la carta */
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content.paper-texture {
    background-color: var(--paper-color);
    width: 90%;
    max-width: 450px;
    /* --- NUEVO: Control de altura y scroll --- */
    max-height: 80vh;
    /* Nunca ocupará más del 80% de la altura de la pantalla */
    overflow-y: auto;
    /* Habilita el scroll vertical si el texto es largo */

    padding: 40px;
    border-radius: 2px;
    box-shadow:
        0 0 30px rgba(0, 0, 0, 0.5),
        inset 0 0 20px rgba(0, 0, 0, 0.05);
    position: relative;
    transform: translateY(50px) rotate(-1deg);
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);

    /* Efecto de renglones de papel */
    background-image: repeating-linear-gradient(var(--paper-color) 0px,
            var(--paper-color) 24px,
            #00bfff20 25px);

    /* Para navegadores que soportan estandarización de scrollbar (Firefox) */
    scrollbar-width: thin;
    scrollbar-color: var(--rose-pink) transparent;
}

/* --- NUEVO: Estilos para la barra de scroll (Chrome, Edge, Safari) --- */
.modal-content.paper-texture::-webkit-scrollbar {
    width: 6px;
    /* Barra delgada */
}

.modal-content.paper-texture::-webkit-scrollbar-track {
    background: transparent;
    margin: 10px 0;
    /* Margen para que no toque los bordes */
}

.modal-content.paper-texture::-webkit-scrollbar-thumb {
    background-color: var(--rose-pink);
    /* Color de la barra */
    border-radius: 10px;
    /* Bordes redondeados */
}

/* Aseguramos que el botón de cerrar se quede fijo al hacer scroll (Sticky) */
.close-button {
    position: sticky;
    /* Se queda pegado arriba */
    top: 0;
    float: right;
    /* Lo mantenemos a la derecha */
    z-index: 10;
    font-size: 30px;
    cursor: pointer;
    color: #888;
    transition: color 0.3s;
    line-height: 1;
    background-color: var(--paper-color);
    /* Fondo para que no se mezcle con el texto al hacer scroll */
    border-radius: 50%;
    padding: 0 5px;
}

.modal-overlay.active .modal-content {
    transform: translateY(0) rotate(0deg);
}

.letter-body {
    font-family: "Dancing Script", cursive;
    color: var(--text-ink);
    font-size: 1.5rem;
    line-height: 25px;
    /* Debe coincidir con el background-image */
}

.letter-greeting {
    font-weight: bold;
    margin-bottom: 20px;
    font-size: 1.8rem;
    color: var(--rose-red);
}

.letter-sign {
    text-align: right;
    margin-top: 30px;
    font-weight: bold;
    font-size: 1.6rem;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 30px;
    cursor: pointer;
    color: #888;
    transition: color 0.3s;
    line-height: 1;
}

.close-button:hover {
    color: var(--rose-red);
}

/* =========================================
   5. Lluvia de Flores
   ========================================= */
#rain-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    /* Permite hacer clic a través de la lluvia */
    z-index: 1;
}

.flower-rain {
    position: absolute;
    top: -50px;
    user-select: none;
    z-index: 1;
    opacity: 0.8;
    animation: fall linear infinite;
}

@keyframes fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(110vh) rotate(360deg);
        opacity: 0;
    }
}

/* =========================================
   6. Estilos Adicionales para la Carta (NUEVO)
   ========================================= */

/* Estilo para los versos cortos */
.letter-poem {
    font-family: "Indie Flower", cursive;
    /* O usa otra fuente si prefieres */
    color: var(--rose-red);
    text-align: center;
    font-size: 1.6rem;
    margin: 25px 0;
    font-style: italic;
    line-height: 1.4;
}

/* Estilo para poemas en bloque (Opción 2) */
.block-poem p {
    margin-bottom: 15px;
}

/* Contenedor de la foto estilo Polaroid */
.photo-container {
    margin: 30px auto;
    padding: 10px 10px 25px 10px;
    /* Más espacio abajo para simular polaroid */
    background-color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    width: 80%;
    /* Ajusta el tamaño de la foto aquí */
    max-width: 300px;
    text-align: center;
    transform: rotate(-2deg);
    /* Un ligero giro para que se vea natural */
    transition: transform 0.3s ease;
}

/* Efecto al pasar el mouse sobre la foto */
.photo-container:hover {
    transform: rotate(0deg) scale(1.02);
}

/* La imagen dentro del contenedor */
.letter-photo {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid #eee;
}

/* Texto debajo de la foto (Opción 1) */
.photo-caption {
    display: block;
    margin-top: 15px;
    font-family: "Indie Flower", cursive;
    color: #666;
    font-size: 1.2rem;
}

/* Clase extra para rotar más la foto (usado en Opción 2) */
.rotate-photo {
    transform: rotate(3deg);
}

/* Responsive */
@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }

    .description {
        font-size: 1.2rem;
    }

    .boton {
        width: 80%;
    }

    .modal-content.paper-texture {
        padding: 20px;
    }
}