/* ============================================================
   Alejandro & Andrea · Invitación de Boda
   Estilos personalizados
   ============================================================ */

:root {
    --primary: #5a5f49;
    --primary-container: #7d8468;
    --on-primary: #ffffff; /*nuevo color c8a592*/
    --secondary-container: #e8edea;
    --on-surface: #1a1c1b;
    --on-surface-variant: #424944;
}

/* Tipografía base */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #fcfdfc;
    color: var(--on-surface);
    overflow-x: hidden;
    opacity: 0;
    animation: page-fade-in 0.7s ease-out forwards;
}

@keyframes page-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Transiciones suaves en toda la página */
a,
button,
img,
input,
select,
textarea {
    transition-property: color, background-color, border-color, box-shadow,
                         transform, opacity, filter;
    transition-duration: 0.3s;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Evitar que el header fijo tape los títulos al navegar por anclas */
section[id] {
    scroll-margin-top: 5rem;
}

.font-script {
    font-family: 'Pinyon Script', cursive;
}

.font-headline {
    font-family: 'Cormorant Garamond', serif;
}

.font-label {
    font-family: 'Plus Jakarta Sans', sans-serif;
}

/* Material Symbols */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}

.fill-1 {
    font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}

/* Degradado verde corporativo */
.green-gradient {
    background: linear-gradient(135deg, #5a5f49 0%, #7d8468 100%);
}

/* Sombra elegante para texto sobre imágenes */
.text-shadow-elegant {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Animaciones de aparición al hacer scroll */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Barra de navegación con sombra al hacer scroll */
#navbar.scrolled {
    box-shadow: 0 8px 30px rgba(45, 74, 62, 0.08);
}

/* Enlaces activos en la navegación */
.nav-link.active {
    color: var(--primary);
}

/* Selector: personalización de la flecha */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%235a5f49' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
}

/* Tooltip de copiado */
.tooltip {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10;
}

.tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

/* Estado del botón de copiar */
#copy-clabe.copied {
    color: #a8d5ba;
}

/* Carrusel de fotos */
.carousel-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.8s ease;
    pointer-events: none;
    background: var(--primary);
}

.carousel-slide.active {
    opacity: 1;
    pointer-events: auto;
}

.carousel-slide-blur {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.15);
    filter: blur(28px) saturate(1.15) brightness(0.75);
    opacity: 0.9;
}

.carousel-slide-img {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.75rem;
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.35));
}

.carousel-thumb {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid transparent;
    background: #e1e4e1;
    padding: 0;
}

.carousel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel-thumb:hover {
    opacity: 0.8;
}

.carousel-thumb.active {
    opacity: 1;
    transform: scale(1);
    border-color: var(--primary);
    box-shadow: 0 6px 16px rgba(90, 95, 73, 0.25);
}

/* Fallback de altura para carrusel y video (evita colapso en móviles sin aspect-ratio) */
#carousel-track {
    min-height: 380px;
}

#video-stage {
    min-height: 300px;
}

/* Fallback para la imagen de Nuestra Historia (portrait 4:5) */
.story-img-wrap {
    aspect-ratio: 4/5;
    width: 100%;
}

@supports not (aspect-ratio: 1/1) {
    .story-img-wrap {
        min-height: 480px;
    }
}

@media (max-width: 640px) {
    .carousel-thumb {
        width: 3.5rem;
        height: 3.5rem;
    }
    .carousel-slide-blur {
        filter: blur(16px) saturate(1.15) brightness(0.75);
    }
}

/* Botón de música de fondo */
#music-toggle {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary);
    color: #ffffff;
    border-radius: 9999px;
    padding: 0.75rem 1.4rem 0.75rem 1.1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    font-family: 'Cormorant Garamond', serif;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.7rem;
    border: none;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

#music-toggle:hover {
    background: var(--primary-container);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}

#music-toggle:active {
    transform: translateY(0);
}

.music-eq {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 16px;
}

.music-eq span {
    width: 4px;
    border-radius: 2px;
    background: currentColor;
    height: 30%;
    animation: eq-wave 1.1s ease-in-out infinite;
}

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

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

@keyframes eq-wave {
    0%, 100% { height: 30%; }
    50% { height: 100%; }
}

/* Cuando está pausada, las barras quedan quietas */
#music-toggle:not(.is-playing) .music-eq span {
    animation: none;
    height: 30%;
}

/* Aviso para activar el sonido */
#music-message {
    position: fixed;
    bottom: 5.5rem;
    left: 50%;
    transform: translate(-50%, 16px);
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(26, 28, 27, 0.92);
    backdrop-filter: blur(8px);
    color: #ffffff;
    border-radius: 9999px;
    padding: 0.6rem 0.9rem 0.6rem 1rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
    max-width: calc(100vw - 2rem);
}

#music-message.show {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}

#music-message .material-symbols-outlined {
    font-size: 1.25rem;
    color: #cfe0cd;
}

#music-message p {
    margin: 0;
    white-space: nowrap;
}

#music-enable {
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    padding: 0.45rem 1rem;
    font-family: 'Cormorant Garamond', serif;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#music-enable:hover {
    background: var(--primary-container);
}

#music-message-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0.2rem;
    display: flex;
    align-items: center;
}

#music-message-close:hover {
    color: #ffffff;
}

#music-message-close .material-symbols-outlined {
    font-size: 1.1rem;
    color: inherit;
}

@media (max-width: 480px) {
    #music-message {
        bottom: 5rem;
        font-size: 0.72rem;
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
        border-radius: 1rem;
        padding: 0.7rem 1rem;
        width: calc(100vw - 2rem);
    }
    #music-message p {
        white-space: normal;
    }
}

/* Preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    body {
        animation: none;
        opacity: 1;
    }
    a,
    button,
    img,
    input,
    select,
    textarea {
        transition: none;
    }
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
