@import url("common.css");
@import url("animation.css");

html {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.with-scrollbar {
    scrollbar-width: auto !important;
    -ms-overflow-style: auto !important;
}

.font-esthetic {
    font-family: 'Sacramento', cursive !important;
}

.font-arabic {
    font-family: 'Noto Naskh Arabic', serif !important;
}

.img-center-crop {
    width: 13rem;
    height: 13rem;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

/* Welcome Page - Responsive sin scroll */
.welcome-content {
    max-width: 600px;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    padding: clamp(0.25rem, 1vh, 0.75rem) clamp(0.5rem, 2vw, 1rem);
    justify-content: center;
    overflow: hidden;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
}

.welcome-top {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.welcome-image {
    width: clamp(5rem, 20vh, 10rem);
    height: clamp(5rem, 20vh, 10rem);
    border-radius: 50%;
    border: clamp(2px, 0.3vh, 3px) solid;
    border-color: var(--bs-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    object-fit: cover;
    margin-bottom: clamp(0.25rem, 1vh, 1rem);
    flex-shrink: 0;
}

.welcome-title {
    font-size: clamp(1.25rem, 5vh, 2.25rem);
    margin-bottom: clamp(0.125rem, 0.5vh, 0.5rem);
    line-height: 1.2;
}

.welcome-guest-name {
    font-size: clamp(0.75rem, 2vh, 1rem);
    margin-bottom: clamp(0.125rem, 0.5vh, 0.5rem);
    line-height: 1.2;
}

.welcome-button {
    font-size: clamp(0.75rem, 2vh, 1rem);
    padding: clamp(0.375rem, 1vh, 0.5rem) clamp(1rem, 3vw, 1.5rem);
    white-space: nowrap;
    margin-top: clamp(0.25rem, 1vh, 0.75rem);
    flex-shrink: 0;
}

.welcome-quote {
    flex: 0 0 auto;
    min-height: 0;
    max-height: clamp(20vh, 30vh, 35vh);
    overflow-y: auto;
    overflow-x: hidden;
    padding: clamp(0.5rem, 1.5vh, 0.75rem) !important;

    /* --- CAMBIOS PARA CENTRAR --- */
    margin-top: auto;
    /* Mantiene la cita en la parte inferior verticalmente */
    margin-bottom: clamp(0.5rem, 2vh, 1rem);

    align-self: center;
    /* Centra la CAJA horizontalmente (antes era 'stretch') */
    text-align: center;
    /* Centra el TEXTO dentro de la caja */
    width: 90%;
    /* Ocupa el 90% del ancho disponible en móviles */
    max-width: 600px;
    /* Evita que sea gigante en PC */

    box-sizing: border-box;
    /* align-self: stretch;  <-- ELIMINA O COMENTA ESTA LÍNEA ANTIGUA */
}

.welcome-quote-text {
    font-size: clamp(0.875rem, 3vh, 1.75rem);
    line-height: 1.3;
    margin-bottom: clamp(0.25rem, 1vh, 0.5rem);

    /* Aseguramos que el texto fluya centrado */
    margin-left: auto;
    margin-right: auto;
}

.welcome-quote-author {
    font-size: clamp(0.625rem, 1.5vh, 0.9rem);
    line-height: 1.2;
}

/* Ajustes para pantallas muy pequeñas */
@media screen and (max-width: 768px) {
    .welcome-content {
        padding: clamp(0.25rem, 1vh, 0.75rem);
    }

    .welcome-image {
        margin-bottom: clamp(0.125rem, 0.5vh, 0.5rem);
    }

    .welcome-quote {
        max-height: clamp(20vh, 30vh, 35vh);
    }
}

/* Ajustes para pantallas con poca altura */
@media screen and (max-height: 600px) {
    .welcome-image {
        width: clamp(4rem, 15vh, 6rem);
        height: clamp(4rem, 15vh, 6rem);
        margin-bottom: clamp(0.125rem, 0.5vh, 0.25rem);
    }

    .welcome-title {
        font-size: clamp(1rem, 4vh, 1.5rem);
        margin-bottom: 0.125rem;
    }

    .welcome-guest-name {
        font-size: clamp(0.625rem, 1.5vh, 0.875rem);
        margin-bottom: 0.125rem;
    }

    .welcome-button {
        margin-top: 0.25rem !important;
        padding: 0.25rem 0.75rem;
        font-size: clamp(0.625rem, 1.5vh, 0.875rem);
    }

    .welcome-quote {
        margin-top: 0.25rem !important;
        padding: 0.5rem !important;
        max-height: clamp(18vh, 25vh, 28vh);
    }

    .welcome-quote-text {
        font-size: clamp(0.75rem, 2.5vh, 1.25rem);
        margin-bottom: 0.125rem;
    }

    .welcome-quote-author {
        font-size: clamp(0.5rem, 1.2vh, 0.75rem);
    }
}

/* Ajustes para pantallas muy pequeñas en altura */
@media screen and (max-height: 500px) {
    .welcome-image {
        width: clamp(3rem, 12vh, 5rem);
        height: clamp(3rem, 12vh, 5rem);
    }

    .welcome-title {
        font-size: clamp(0.875rem, 3vh, 1.25rem);
    }

    .welcome-quote {
        max-height: clamp(15vh, 22vh, 25vh);
        padding: 0.375rem !important;
    }

    .welcome-quote-text {
        font-size: clamp(0.625rem, 2vh, 1rem);
    }
}

html[data-bs-theme="dark"] .btn-transparent {
    background-color: rgba(var(--bs-dark-rgb), 0.5) !important;
    backdrop-filter: blur(0.5rem);
}

html[data-bs-theme="light"] .btn-transparent {
    background-color: rgba(var(--bs-light-rgb), 0.5) !important;
    backdrop-filter: blur(0.5rem);
}

.loading-page {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1056;
}

html[data-bs-theme="light"] .color-theme-svg {
    color: rgb(255, 255, 255);
    background-color: var(--bs-light);
}

html[data-bs-theme="dark"] .color-theme-svg {
    color: rgb(0, 0, 0);
    background-color: var(--bs-dark);
}

html[data-bs-theme="light"] .bg-light-dark {
    background-color: rgb(var(--bs-light-rgb));
}

html[data-bs-theme="dark"] .bg-light-dark {
    background-color: rgb(var(--bs-dark-rgb));
}

html[data-bs-theme="light"] .bg-white-black {
    background-color: rgb(var(--bs-white-rgb));
}

html[data-bs-theme="dark"] .bg-white-black {
    background-color: rgb(var(--bs-black-rgb));
}

.bg-cover-home {
    width: 100%;
    height: 100%;
    object-fit: cover;
    mask-image: linear-gradient(0.5turn, transparent, black 40%, black 60%, transparent);
}

.width-loading {
    width: 25%;
}

.cursor-pointer {
    cursor: pointer;
}

@media screen and (max-width: 992px) {
    .width-loading {
        width: 50%;
    }
}

@media screen and (max-width: 576px) {
    .width-loading {
        width: 75%;
    }
}

svg {
    display: block;
    line-height: 0;
    shape-rendering: geometricPrecision;
    backface-visibility: hidden;
}

.svg-wrapper {
    overflow: hidden !important;
    transform: translateZ(0) !important;
}

.no-gap-bottom {
    margin-bottom: -0.75rem !important;
}

/* Collage Style */
.collage-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 120px);
    gap: 0.75rem;
    width: 100%;
    margin: 0 auto;
}

.collage-item {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.5s ease;
    background-color: rgba(0, 0, 0, 0.05);
}

.collage-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    z-index: 10;
}

.collage-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(0);
    opacity: 1;
    transition: filter 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    /* Prevenir descarga */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: auto;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Animación inicial solo al cargar la página - empiezan con blur y aparecen sin blur */
.collage-image:not(.initial-loaded) {
    opacity: 0;
    filter: blur(8px);
    animation: fadeInRotate 0.8s ease-out forwards;
}

/* Efecto escalonado para la carga inicial */
.collage-item:nth-child(1) .collage-image {
    animation-delay: 0.1s;
}

.collage-item:nth-child(2) .collage-image {
    animation-delay: 0.2s;
}

.collage-item:nth-child(3) .collage-image {
    animation-delay: 0.3s;
}

.collage-item:nth-child(4) .collage-image {
    animation-delay: 0.4s;
}

.collage-item:nth-child(5) .collage-image {
    animation-delay: 0.5s;
}

.collage-item:nth-child(6) .collage-image {
    animation-delay: 0.6s;
}

.collage-item:nth-child(7) .collage-image {
    animation-delay: 0.7s;
}

.collage-item:nth-child(8) .collage-image {
    animation-delay: 0.8s;
}

/* Animación para el cambio de imágenes */
.collage-item.rotating .collage-image {
    animation: rotateOut 0.6s ease-in-out forwards;
    will-change: transform, opacity, filter;
    pointer-events: none;
}

/* Cuando la imagen está cambiando, mantenerla completamente oculta */
.collage-item .collage-image.changing {
    opacity: 0 !important;
    visibility: hidden !important;
    animation: none !important;
    transform: rotate(180deg) scale(0.5) !important;
    filter: blur(12px) !important;
}

/* Nueva imagen entrando - debe estar oculta inicialmente */
.collage-item:not(.rotating) .collage-image.loaded {
    opacity: 0;
    filter: blur(12px);
    transform: rotate(-180deg) scale(0.5);
    animation: fadeInRotate 0.8s ease-out forwards;
    will-change: transform, opacity, filter;
    visibility: visible;
}

/* Asegurar que después de rotateOut, la imagen permanezca oculta */
.collage-item:not(.rotating) .collage-image:not(.loaded):not(.initial-loaded) {
    opacity: 0;
    visibility: hidden;
}

/* Estado normal: sin blur */
.collage-image.initial-loaded {
    filter: blur(0) !important;
    opacity: 1 !important;
}

.collage-item:hover .collage-image {
    filter: blur(0) !important;
    opacity: 1 !important;
    transform: scale(1.05);
    transition: filter 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

/* Prevenir selección y acciones de descarga en móviles */
.collage-container,
.collage-item,
.collage-image {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Prevenir drag en imágenes */
.collage-image {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

/* Tamaños específicos para cada item del collage */
.collage-item-large {
    grid-column: span 2;
    grid-row: span 2;
}

.collage-item-medium {
    grid-column: span 1;
    grid-row: span 2;
}

.collage-item-small {
    grid-column: span 1;
    grid-row: span 1;
}

/* Posicionamiento específico para crear el efecto collage */
.collage-container .collage-item:nth-child(1) {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
}

.collage-container .collage-item:nth-child(2) {
    grid-column: 3 / 4;
    grid-row: 1 / 3;
}

.collage-container .collage-item:nth-child(3) {
    grid-column: 4 / 5;
    grid-row: 1 / 2;
}

.collage-container .collage-item:nth-child(4) {
    grid-column: 4 / 5;
    grid-row: 2 / 4;
}

.collage-container .collage-item:nth-child(5) {
    grid-column: 1 / 2;
    grid-row: 3 / 4;
}

.collage-container .collage-item:nth-child(6) {
    grid-column: 2 / 4;
    grid-row: 3 / 5;
}

.collage-container .collage-item:nth-child(7) {
    grid-column: 4 / 5;
    grid-row: 4 / 5;
}

.collage-container .collage-item:nth-child(8) {
    grid-column: 1 / 2;
    grid-row: 4 / 5;
}

@media screen and (max-width: 768px) {
    .collage-container {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(6, 100px);
        gap: 0.5rem;
    }

    .collage-container .collage-item:nth-child(1) {
        grid-column: 1 / 2;
        grid-row: 1 / 3;
    }

    .collage-container .collage-item:nth-child(2) {
        grid-column: 2 / 3;
        grid-row: 1 / 2;
    }

    .collage-container .collage-item:nth-child(3) {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
    }

    .collage-container .collage-item:nth-child(4) {
        grid-column: 1 / 2;
        grid-row: 3 / 5;
    }

    .collage-container .collage-item:nth-child(5) {
        grid-column: 2 / 3;
        grid-row: 3 / 4;
    }

    .collage-container .collage-item:nth-child(6) {
        grid-column: 1 / 3;
        grid-row: 5 / 7;
    }

    .collage-container .collage-item:nth-child(7) {
        grid-column: 2 / 3;
        grid-row: 4 / 5;
    }

    .collage-container .collage-item:nth-child(8) {
        grid-column: 2 / 3;
        grid-row: 7 / 8;
    }

    .collage-image {
        filter: none;
        opacity: 1;
    }
}

/* Gallery Horizontal Scroll */
.gallery-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    height: 300px;
    mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
}

.gallery-track {
    display: flex;
    gap: 1.5rem;
    height: 100%;
    width: fit-content;
    will-change: transform;
    position: relative;
    left: 0;
}

.gallery-track.animate {
    animation: gallery-scroll 30s linear infinite !important;
    animation-play-state: running !important;
}

.gallery-image {
    flex-shrink: 0;
    width: 250px;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
    filter: blur(8px);
    opacity: 0.7;
    transition: filter 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
    position: relative;
}

.gallery-image.throw-animation {
    animation: gallery-throw 2s ease-out forwards;
}

.gallery-image.cloned {
    animation: none !important;
    transform: none !important;
}

/* Cuando el track está animado, resetear transform de las imágenes individuales */
.gallery-track.animate .gallery-image {
    transform: none !important;
    animation-fill-mode: forwards;
}

.gallery-image:hover {
    filter: blur(0);
    opacity: 1;
    transform: scale(1.1);
    z-index: 10;
}

/* Animación inicial: efecto de "arrojar" todas las imágenes */
@keyframes gallery-throw {
    0% {
        transform: translateX(200vw) translateY(-100vh) rotate(60deg) scale(0.2);
        opacity: 0;
    }

    40% {
        opacity: 0.5;
    }

    80% {
        transform: translateX(-5vw) translateY(5vh) rotate(-5deg) scale(1.05);
        opacity: 0.7;
    }

    100% {
        transform: translateX(0) translateY(0) rotate(0deg) scale(1);
        opacity: 0.7;
    }
}

/* Animación continua: movimiento de derecha a izquierda */
@keyframes gallery-scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(-50% - 0.75rem));
    }
}

@media screen and (max-width: 768px) {
    .gallery-container {
        height: 200px;
    }

    .gallery-image {
        width: 180px;
        filter: blur(6px);
        opacity: 0.6;
    }

    .gallery-track.animate {
        gap: 1rem;
        animation-duration: 25s;
    }
}