html {
    scroll-behavior: smooth;
}

/* Estilos generales del contenedor del tour fotográfico */
.photo-tour-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: 'Arial', sans-serif;
}

.photo-tour-header {
    text-align: center;
    margin-bottom: 2rem;
}

.photo-tour-header h1 {
    font-size: 2.0rem;
    margin-bottom: 0.5rem;
}

/* Navegación por categorías */
.photo-tour-nav {
    border-bottom: 1px solid #ddd;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
}

.photo-tour-nav ul {
    display: flex;
    justify-content: center;
    gap: 1rem;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.photo-tour-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.3s;
}

.photo-tour-nav a:hover {
    background-color: #f0f0f0;
}

.photo-tour-nav a img {
    height: 80px;
    width: 130px;
    object-fit: cover;
    border-radius: 4px;
}

/* Secciones de fotos */
.photo-section {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    margin-bottom: 5rem;
    scroll-margin-top: 120px;
}

/* --- MODIFICACIÓN --- */
/* El comportamiento sticky se aplica ahora al contenedor del título y los detalles */
.section-title-wrapper {
    flex: 0 0 220px; /* Ancho fijo */
    padding-right: 1rem;
    position: sticky; /* El contenedor se queda fijo */
    top: 120px; /* Espacio desde arriba */
    align-self: flex-start; /* Importante para que no se estire con la columna de fotos */
    text-align: left;
}

/* El h2 ya no necesita ser sticky por sí mismo */
.photo-section h2 {
    font-size: 1.5rem;
    font-weight: bold;
    border: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

/* Estilos para los detalles */
.section-details {
    margin-top: 1rem; /* Espacio entre el título y los detalles */
}

.section-details ul {
    list-style: none;
    padding: 0;
    margin: 0;
    color: #555;
}

.section-details li {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    padding-left: 1.2rem;
    position: relative;
    line-height: 1.4;
}

.section-details li::before {
    content: '✔';
    position: absolute;
    left: 0;
    top: 1px;
    color: #28a745;
    font-weight: bold;
}


.photo-grid-wrapper {
    flex: 1; /* Ocupa el resto del espacio */
}

.photo-grid {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Este es el espacio vertical entre la fila grande y la fila de pequeñas */
}

/* Contenedor de una fila de la galería */
.photo-row {
    display: flex;
    width: 100%;
}

/* Estilos para el contenedor del par de imágenes pequeñas */
.vertical-pair-container {
    display: flex;
    flex-direction: row;
    gap: 10px; /* Espacio entre las dos imágenes pequeñas */
}

/* Estilo para cada 'caja' de imagen */
.grid-item {
    overflow: hidden;
    position: relative;
    border-radius: 0; /* Bordes rectos */
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.grid-item:hover img {
    transform: scale(1.05);
}

/* Estilo para la imagen grande */
.large-item {
    width: 100%;
    aspect-ratio: 16 / 9; /* Proporción panorámica */
}

/* Estilo para las imágenes pequeñas */
.small-item {
    flex: 1; /* Cada una ocupa la mitad del espacio en el contenedor */
    aspect-ratio: 3 / 4; /* Proporción vertical */
}

/* En caso de que solo haya una imagen pequeña en la última fila, que ocupe todo el ancho */
.small-item:only-child {
    flex: 0 0 100%;
    aspect-ratio: 16 / 9; /* Se comporta como una grande si está sola */
}




/* Swiper Nav for Mobile */
.photo-tour-nav-swiper {
    margin-bottom: 2rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

.photo-tour-nav-swiper .swiper-slide {
    width: auto;
}

.photo-tour-nav-swiper .swiper-slide a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    padding: 0.5rem;
    border-radius: 8px;
}

.photo-tour-nav-swiper .swiper-slide a img {
    height: 80px;
    width: 130px;
    object-fit: cover;
    border-radius: 4px;
}


/* Responsive para pantallas pequeñas */
@media (max-width: 768px) {
    .photo-section {
        flex-direction: column;
        gap: 0;
    }

    /* En móvil, el contenedor del título ya no es pegajoso */
    .section-title-wrapper {
        position: static;
        top: auto;
        flex: 0 0 auto; /* Permite que la altura se ajuste al contenido en columnas */
    }

    .photo-section h2 {
        font-size: 1.5rem;
        font-weight: bold;
        border: none;
        padding: 0;
        margin: 0;
    }

    .section-details {
      margin-top: 0.3rem;
      padding-bottom: 0;
    }
    .section-details ul {
        margin: 0;
        padding: 0;
    }
    .section-details li {
        margin-bottom: 0;
    }
    .photo-grid-wrapper {
        margin-top: 1rem;
    }
    .photo-tour-container {
        padding-left: 0;
        padding-right: 0;
    }
    .photo-tour-header,
    .section-title-wrapper {
        padding-left: 1rem;
        padding-right: 1rem;
        text-align: left;
    }
}


/* --- Estilos para el Modal de la Galería --- */
.gallery-modal {
    display: none; /* Oculto por defecto */
    position: fixed; /* Permanece fijo en la pantalla */
    z-index: 1000; /* Se superpone a todo lo demás */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Permite scroll si la imagen es muy grande */
    background-color: rgba(0, 0, 0, 0.9); /* Fondo oscuro semitransparente */
    justify-content: center; /* Centra el contenido horizontalmente */
    align-items: center; /* Centra el contenido verticalmente */
    flex-direction: column; /* Apila los elementos en columna si es necesario */
}

.gallery-modal.active {
    display: flex; /* Mostrar cuando esté activo */
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#modalImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Asegura que la imagen se vea completa sin distorsión */
    display: block; /* Elimina espacio extra debajo de la imagen */
}

.close-button {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1001; /* Asegura que el botón de cierre esté por encima de todo */
}

.close-button:hover,
.close-button:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Botones de navegación */
.prev-button, .next-button {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px; /* Ajuste vertical */
    color: white;
    font-weight: bold;
    font-size: 20px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    -webkit-user-select: none;
    background-color: rgba(0, 0, 0, 0.5); /* Fondo semitransparente para los botones */
}

.next-button {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.prev-button {
    left: 0;
    border-radius: 0 3px 3px 0;
}

.prev-button:hover, .next-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Estilo para el contador de imágenes */
.image-counter {
    position: absolute;
    top: 15px;
    left: 15px;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    z-index: 1001;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 5px;
}

/* Responsividad para pantallas pequeñas */
@media only screen and (max-width: 768px) {
    .prev-button, .next-button, .close-button {
        font-size: 24px;
        padding: 10px;
    }
    .close-button {
        top: 10px;
        right: 15px;
        font-size: 30px;
    }
    .image-counter {
        font-size: 16px;
        top: 10px;
        left: 10px;
        padding: 3px 7px;
    }
}
/* --- Sticky Header for Photo Tour --- */
.sticky-nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    z-index: 1060;
    transform: translateZ(0);
}

.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    color: #222222;
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 8px;
    border-radius: 50px;
    transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.nav-btn:hover {
    background-color: #f7f7f7;
}

.nav-btn:active {
    transform: scale(0.96);
    box-shadow: inset 0 0 5px rgba(0,0,0,0.1);
}

.nav-btn i {
  font-size: 16px;
}

.share-button span {
    font-size: 14px;
    font-weight: 600;
    margin-left: 8px;
}

@media (max-width: 576px) {
    .share-button span {
        display: none;
    }
    .sticky-nav-bar {
        padding: 10px 16px;
    }
}

/* Adjust main content to not be obscured by the sticky header */
/* This also requires removing the original header from the PHP */
body {
    padding-top: 65px;
}

.photo-tour-container {
    margin-top: 0;
    padding-top: 2rem;
}

/* Adjust sticky category title position */
.section-title-wrapper {
   top: 80px; /* Space for the new sticky nav bar */
}

@media (max-width: 992px) {
    .section-title-wrapper {
        top: 0;
        position: static;
    }
}