@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;800;900&display=swap&font-display=swap');

:root {
    --primary: #323B60;
    --secondary: #98B3C8;
    --accent: #F4CECE;
    --dark: #1e243d;
    --overlay: rgba(30, 36, 61, 0.9);
}

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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, var(--primary), var(--dark));
    min-height: 100vh;
    padding: 40px;
    color: #fff;
    position: relative;
    overflow-x: hidden;
}

/* Patrón de fondo simplificado para mejor rendimiento */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.9) 1.5px, transparent 1.5px),
        radial-gradient(circle, rgba(255, 240, 180, 0.85) 2.5px, transparent 2.5px);

    background-size:
        100px 100px,
        160px 150px;

    background-position:
        0 0,
        50px 50px;

    background-attachment: fixed;
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
    will-change: transform;
}

body>* {
    position: relative;
    z-index: 1;
}

h1 {
    text-align: center;
    margin-bottom: 40px;
    font-weight: 900;
    letter-spacing: 3px;
    font-family: 'Playfair Display', serif;
    font-size: 50px;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 4px;
    text-underline-offset: 15px;
    text-shadow:
        0 2px 10px rgba(244, 206, 206, 0.3),
        0 4px 20px rgba(244, 206, 206, 0.2);
    position: relative;
}

/* Información de la galería */
.gallery-info {
    text-align: center;
    font-size: 14px;
    color: var(--secondary);
    letter-spacing: 1px;
    font-weight: 900;
    border: 2px solid var(--secondary);
    padding: 5px 0px;
    border-radius: 5px;
    margin: 0 auto 35px auto;
    max-width: 200px;
}

@keyframes titlePulse {

    0%,
    100% {
        text-shadow:
            0 2px 10px rgba(244, 206, 206, 0.3),
            0 4px 20px rgba(244, 206, 206, 0.2);
    }

    50% {
        text-shadow:
            0 2px 15px rgba(244, 206, 206, 0.5),
            0 4px 30px rgba(244, 206, 206, 0.4);
    }
}

/* GALERÍA */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    max-width: 1400px;
    margin: auto;
}

.gallery-item {
    cursor: pointer;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
}

.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.gallery img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
}

.gallery-title {
    background: rgba(0, 0, 0, 0.7);
    padding: 12px;
    text-align: center;
    font-size: 16px;
    font-weight: 800;
    font-family: 'Playfair Display', serif;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 6px;
    letter-spacing: 0.5px;
}

/* MODAL */
.lightbox {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    animation: zoomIn 0.25s ease;
    object-fit: contain;
}

@keyframes zoomIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* TÍTULO EN LIGHTBOX */
.lightbox-title {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    max-width: 80%;
    z-index: 1001;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
    letter-spacing: 1px;
    animation: zoomIn 0.25s ease;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    padding: 0px 4px;
}

/* CONTADOR EN LIGHTBOX */
.lightbox-counter {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--secondary);
    text-align: center;
    z-index: 1001;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
    letter-spacing: 0.5px;
    animation: zoomIn 0.25s ease;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 5px;
    padding: 0px 4px 2px 4px;
}

/* FLECHAS */
.nav {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    color: var(--accent);
    cursor: pointer;
    user-select: none;
    padding: 0;
    margin: 0;
    transition: color 0.2s ease;
    z-index: 1001;
    line-height: 1;
}

.nav:hover {
    color: #fff;
}

.prev {
    left: 30px;
    transform: translateY(-50%);
}

.next {
    right: 30px;
    transform: translateY(-50%);
    left: auto;
}

/* CERRAR */
.close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 40px;
    font-weight: 900;
    cursor: pointer;
    color: var(--secondary);
    transition: color 0.2s ease;
    z-index: 1002;
    padding: 0;
    margin: 0;
    line-height: 1;
}

.close:hover {
    color: var(--accent);
}

@media (max-width: 768px) {

    /* FLECHAS MÓVIL - Abajo de la imagen */
    .nav {
        position: fixed;
        top: auto;
        left: auto;
        bottom: 50px;
        transform: none;
        font-size: 40px;
        width: 50px;
        height: 50px;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.3s ease;
    }

    .nav:active {
        background: rgba(0, 0, 0, 0.7);
    }

    .prev {
        left: 20px;
    }

    .next {
        right: 20px;
    }

    /* EQUIS más notable en móvil */
    .close {
        top: 15px;
        right: 15px;
        font-size: 44px;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        width: 55px;
        height: 55px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.3s ease;
    }

    .close:active {
        background: rgba(0, 0, 0, 0.7);
    }

    /* Contadores más pequeños en móvil */
    .lightbox-counter {
        bottom: 120px;
        font-size: 12px;
    }

    .lightbox-title {
        bottom: 70px;
        font-size: 16px;
        max-width: 90%;
    }
}