body {
    font-family: sans-serif;
    margin: 0;
    background-color: #f4f4f4;
    color: #333;
}

header {
    background-color: #333; /* Fallback color */
    color: #fff;
    padding: 3rem 1rem; /* Aumentamos padding para el fondo */
    text-align: center;
    position: relative; /* Necesario para overlay y botón */
    background-image: url('header-background.jpg');
    background-size: cover; /* Cubrir todo el área */
    background-position: center center; /* Centrar la imagen */
    background-repeat: no-repeat;
    z-index: 1; /* Para que esté sobre el overlay si lo añadimos */
    transition: padding 0.3s ease; /* Transición suave para el cambio de padding */
}

/* Overlay semitransparente para mejorar legibilidad del texto */
header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5); /* Negro semitransparente */
    z-index: -1; /* Detrás del contenido del header */
}

header h1 {
    display: block;
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 2.8em; /* Tamaño más grande */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7); /* Sombra para destacar */
}

header p {
    font-size: 1.2em;
    margin-bottom: 1.5rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
}

main {
    max-width: 1200px;
    margin: 0rem auto;
    padding: 1rem;
}

.gallery-container {
    display: grid; /* Restaurado */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Restaurado - Ajustar minmax si es necesario */
    gap: 1.5rem; /* Mantenemos el gap aumentado, ajustar si se prefiere el anterior */
    align-items: start; /* Restaurado - Importante para grid */

    /* column-count: 4; */ /* Eliminado */
    /* column-gap: 1rem; */ /* Eliminado */
    margin-bottom: 4rem;
}

.gallery-item {
    position: relative;
    overflow: hidden; /* Restaurado */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    background-color: #eee;
    line-height: 0; /* Ayuda a eliminar espacio extra debajo de la imagen */
    margin-bottom: 1rem; /* Restaurar espacio vertical */
    break-inside: avoid; /* Restaurar para layout de columnas si se revierte */
    opacity: 1; /* Asegurar opacidad inicial */
    transition: opacity 0.5s ease-in-out; /* Transición para fade-in */
}

.gallery-item input[type="checkbox"] {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 25px;
    height: 25px;
    cursor: pointer;
    z-index: 10;
    opacity: 0.8;
}

.gallery-item label {
    display: block;
    cursor: pointer;
    transition: filter 0.2s ease-in-out; /* Añadir transición para el filtro */
}

.gallery-item img.gallery-thumbnail {
    display: block;
    width: 100%;
    height: auto; /* Altura automática para mantener proporción */
    transition: transform 0.3s ease; /* Mantener transición por si se reintroduce escala */
    border-radius: 8px;
}

/* El efecto de selección sigue funcionando */
.gallery-item input[type="checkbox"]:checked + label {
     filter: brightness(0.85);
}
/* Quitar efecto de escala al seleccionar */
/* .gallery-item input[type="checkbox"]:checked + label img.gallery-thumbnail {
    transform: scale(1.05);
} */

.selection-summary {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.email-section {
    margin-top: 1rem;
}

.email-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.email-section input[type="email"] {
    padding: 0.8rem;
    width: 80%;
    max-width: 400px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-right: 0.5rem;
}

.email-section button {
    padding: 0.8rem 1.5rem;
    background-color: #5cb85c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.email-section button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.email-section button:hover:not(:disabled) {
    background-color: #4cae4c;
}

footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    color: #777;
}

/* Ajustes al indicador de selección sobre la imagen */
.selection-indicator {
    background-color: #f8f9fa; /* Fondo claro sólido */
    color: #212529; /* Texto oscuro */
    padding: 12px 22px; /* Aumentado */
    border: 1px solid #ced4da;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: inline-block;
    vertical-align: middle;
    margin-right: 15px;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.2s ease;
    font-size: 1em; /* Aumentado */
    border-radius: 5px;
    font-weight: 500;
}

.selection-indicator:hover {
    background-color: #e9ecef; /* Un gris muy claro al pasar el ratón */
    border-color: #adb5bd;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.selection-icon svg {
    fill: #212529; /* Icono oscuro */
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 8px;
}

#header-selected-count {
    color: #212529; /* Texto oscuro */
    font-weight: bold;
}

/* Estilos para el botón Inicio/Volver (ahora genérico) */
.header-button {
    display: inline-flex; /* Para alinear icono y texto */
    align-items: center;
    justify-content: center;
    gap: 6px; /* Espacio entre icono y texto si ambos fueran visibles */
    line-height: 1; /* Ajustar si es necesario */
    padding: 10px 20px;
    background-color: #6c757d; /* Color base gris (cambiaremos por clase) */
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    border: none;
    cursor: pointer; /* Asegurar cursor */
    font-size: 0.9em; /* Tamaño base */
    z-index: 1101; /* Por encima del header sticky y overlay */
}

/* Inicialmente ocultamos el icono y mostramos el texto */
.header-button .button-icon {
    display: none;
}
.header-button .button-text {
    display: inline;
}

.header-button:hover {
    background-color: #c2185b; /* Color más oscuro al pasar el ratón */
    transform: translateY(-1px); /* Efecto ligero de elevación */
    color: white;
}

/* Botón Volver a la web */
.header-button.header-button-top-left {
    position: absolute;
    top: 1rem; /* Posición por defecto */
    left: 1rem;
    background-color: #e91e63;
    transition: top 0.3s ease; /* Añadir transición para el cambio de top */
}
.header-button.header-button-top-left:hover {
     background-color: #c2185b;
}

/* Ajuste para el botón izquierdo cuando el header es sticky */
header.sticky-header .header-button.header-button-top-left {
    top: 2.5rem; /* Reducir el espacio cuando es sticky, ajustar según sea necesario */
    /* Podría ser necesario ajustar también left si el padding del header cambia */
    /* left: 0.5rem; */ 
}

/* Botón Limpiar selección */
.header-button.header-button-top-right {
    position: absolute;
    top: 1rem; /* Posición por defecto */
    right: 1rem;
    background-color: #d32f2f; /* Rojo para limpiar/eliminar */
    transition: top 0.3s ease; /* Añadir transición */
}
.header-button.header-button-top-right:hover {
     background-color: #b71c1c; /* Rojo más oscuro */
}

/* Ajuste para el botón derecho cuando el header es sticky */
header.sticky-header .header-button.header-button-top-right {
    top: 2.5rem; /* Cambiado de 0.5rem a 2.5rem */
    right: 2.5rem;
}

/* Ajustar controles centrales */
.header-controls {
     display: block;
     text-align: center;
     margin-top: 0;
}

/* --- Estilos del Modal Estilo Apple --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.45); /* Overlay un poco más sutil */
    padding-top: 50px; /* Espacio superior */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    animation: fadeInBackground 0.3s ease-out;
}

@keyframes fadeInBackground {
    from { background-color: rgba(0, 0, 0, 0); }
    to { background-color: rgba(0, 0, 0, 0.45); }
}

.modal-content {
    background-color: #ffffff; /* Blanco puro */
    margin: 5% auto 10% auto; /* Más espacio inferior */
    padding: 35px 45px; /* Padding generoso */
    border: none;
    border-radius: 18px; /* Esquinas bien redondeadas */
    width: 90%; /* Ligeramente más ancho */
    max-width: 640px; /* Ancho máximo ajustado */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15); /* Sombra suave y difusa */
    position: relative;
    animation: scaleUpModal 0.4s cubic-bezier(0.165, 0.84, 0.44, 1); /* Animación de escala */
}

@keyframes scaleUpModal {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 30px;
    color: #1d1d1f; /* Negro Apple */
    font-weight: 600; /* Semibold */
    font-size: 1.6em;
}

.close-button {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 28px;
    height: 28px;
    background-color: #e8e8e8; /* Círculo gris claro */
    color: #555;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    line-height: 28px; /* Centrar '×' */
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.close-button:hover,
.close-button:focus {
    background-color: #dcdcdc;
    color: #333;
    text-decoration: none;
    outline: none;
}

.modal-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-bottom: 35px;
    max-height: 35vh; /* Altura ajustada */
    overflow-y: auto;
    border: none; /* Sin bordes */
}

.modal-image-grid > div { /* Contenedor imagen+botón */
    position: relative;
    border-radius: 8px; /* Redondeo para la sombra */
    overflow: hidden; /* Asegurar redondeo */
    box-shadow: 0 2px 5px rgba(0,0,0,0.08); /* Sombra muy sutil en cada imagen */
}

.modal-image-grid img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0; /* Sin borde en la imagen misma */
    border: none;
}

.modal-image-grid .remove-photo-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: rgba(255, 59, 48, 0.85); /* Rojo Apple */
    color: white;
    border: none;
    border-radius: 50%; /* Círculo */
    width: 22px;
    height: 22px;
    font-size: 15px;
    line-height: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.modal-image-grid .remove-photo-btn:hover {
    background-color: rgba(255, 59, 48, 1);
}

.modal-image-grid p {
    grid-column: 1 / -1;
    text-align: center;
    color: #777;
}

/* Ajustes a la sección de email dentro del modal */
.modal .email-section {
    margin-top: 25px;
    text-align: center;
}

.modal .email-section p {
    margin-bottom: 15px;
    font-weight: bold;
}

.modal .email-section label {
    margin-bottom: 10px;
    font-weight: 500;
    color: #3c3c3e; /* Gris oscuro */
    font-size: 1.05em;
}

.modal .email-section input[type="email"] {
    width: 90%;
    max-width: 420px;
    padding: 14px 18px; /* Padding cómodo */
    margin-bottom: 20px;
    border: 1px solid #d2d2d7; /* Borde gris claro Apple */
    border-radius: 12px; /* Redondeo Apple */
    box-sizing: border-box;
    font-size: 1.05em;
    background-color: #f5f5f7; /* Fondo ligeramente gris */
    color: #1d1d1f;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.modal .email-section input[type="email"]:focus {
    border-color: #007aff; /* Azul Apple */
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.25);
    background-color: #fff;
    outline: none;
}

.modal .email-section button {
    width: auto;
    margin-top: 5px;
}

/* --- Estilos Página Confirmación (movidos desde process_selection.php) --- */
body.confirmation-page {
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header.confirmation-header {
    background-color: #333;
    color: #fff;
    padding: 2.5rem 1rem; /* Ajustado */
    text-align: center;
    position: relative;
    background-image: url('header-background.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: 1;
}

header.confirmation-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: -1;
}

header.confirmation-header h1 {
    margin: 0;
    font-size: 2.2em; /* Ajustado */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}

main {
    flex-grow: 1; /* Empuja el footer hacia abajo */
}

.confirmation-box {
    max-width: 650px;
    margin: 2rem auto;
    padding: 2rem; /* Ajustado */
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    text-align: center;
    /* El borde superior se definirá en clases específicas */
}

.confirmation-box.success {
    border-top: 5px solid #5cb85c; /* Verde éxito */
}

.confirmation-box.error {
     border-top: 5px solid #d9534f; /* Rojo error */
}

.confirmation-box h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.6em; /* Ajustado */
}

.confirmation-box.success h2 {
     color: #5cb85c;
}

.confirmation-box.error h2 {
     color: #d9534f;
}

.confirmation-box p {
    font-size: 1.05rem; /* Ajustado */
    line-height: 1.6;
    color: #555;
    margin-bottom: 1rem;
}

.confirmation-box p strong {
    color: #333;
}

.confirmation-button {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 10px 20px; /* Ajustado */
    background-color: #337ab7;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border: none;
    cursor: pointer;
}

.confirmation-button:hover {
    background-color: #286090;
    transform: translateY(-1px);
    color: white;
}

/* --- Media Queries para Responsividad --- */

/* Tablets y móviles grandes (hasta 992px) */
@media (max-width: 992px) {
    header h1 {
        font-size: 2.5em;
    }
    .gallery-container {
        /* column-count: 3; */ /* Eliminado */
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Restaurado (o ajustar) */
    }
    .modal-content {
        width: 85%;
        margin: 15% auto;
    }
}

/* Móviles medianos y pequeños (hasta 768px) */
@media (max-width: 768px) {
    header {
        padding: 2rem 1rem;
    }
    header h1 {
        font-size: 2em;
    }
    header p {
        font-size: 1em;
    }
    .header-controls {
         margin-top: 1rem; /* Añadir espacio en móvil */
    }
    .selection-indicator,
    .header-button {
        padding: 8px 15px;
        font-size: 0.9em;
    }
    .gallery-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Restaurado */
        gap: 1rem; /* Restaurado (o ajustar) */
        /* column-count: 2; */ /* Eliminado */
        /* column-gap: 0.8rem; */ /* Eliminado */
    }
    .gallery-item {
        /* margin-bottom: 0.8rem; */ /* Eliminado */
    }
    .gallery-item input[type="checkbox"] {
        width: 20px;
        height: 20px;
        top: 5px;
        right: 5px;
    }
    .modal-content {
        width: 90%;
        margin: 20% auto; /* Más margen superior */
        padding: 20px;
    }
    .modal-image-grid {
         grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); /* Miniaturas más pequeñas */
         max-height: 250px;
    }
    .modal .email-section input[type="email"] {
        width: 90%; /* Casi ancho completo */
        margin-bottom: 15px;
    }
     .modal .email-section button {
        width: 90%; /* Botón ancho completo */
        padding: 12px;
    }

    header.confirmation-header h1 {
        font-size: 1.8em;
    }
     .confirmation-box {
        padding: 1.5rem;
        margin: 1.5rem auto;
    }
    .confirmation-box h2 {
        font-size: 1.4em;
    }
    .confirmation-box p {
        font-size: 1rem;
    }
    .confirmation-button {
        padding: 10px 20px;
        width: 80%; /* Botón más ancho */
    }

    footer {
        font-size: 0.9em;
    }

    .header-button .button-text {
        display: none !important; /* Ocultar texto (Forzado) */
    }
    .header-button .button-icon {
        display: inline-block; /* Mostrar icono */
        /* Ajustar tamaño del icono si es necesario */
    }

    .header-button {
        padding: 0.3rem;
        /* width: 36px; */  /* Quitar ancho fijo */
        width: 10%;   /* Establecer ancho al 10% del contenedor (viewport en este caso) */
        height: 36px; /* Mantener alto fijo por ahora */
        /* Podríamos ajustar el alto también si se desea, por ejemplo: */
        /* height: auto; aspect-ratio: 1 / 1; padding: 0; */ /* Para hacerlo cuadrado basado en el ancho */
    }

     /* Si es necesario ajustar la posición top/left/right en móvil */
     .header-button-top-left,
     .header-button-top-right {
          top: 8px; /* Acercar un poco más al borde superior */
     }
     .header-button-top-left { left: 8px; }
     .header-button-top-right { right: 8px; }

     /* Ajustar padding del header en móvil si los botones son más pequeños */
     header {
         padding-top: 55px; /* Ajustar según tamaño final de botones */
     }
     header.sticky-header {
          min-height: 45px; /* Altura mínima ajustada */
          padding-top: 5px; /* Ajustar padding superior en sticky */
     }

    body.header-is-sticky .gallery-nav {
        top: 90px; /* Altura mínima del header sticky móvil */
        padding: 0.5rem 1rem; /* Padding móvil */
    }

    /* Ajustar contenido principal móvil */
    body.header-is-sticky main {
         /* Altura header móvil (45px) + Altura nav (~40px) + margen */
         margin-top: 90px; /* Ajustar este valor si es necesario */
    }
}

/* Móviles muy pequeños (hasta 480px) */
@media (max-width: 480px) {
     header h1 {
        font-size: 1.8em;
    }
    /* Aplicar solo al indicador, no a los botones de icono */
     .selection-indicator /* , .header-button */ {
         display: block; /* Uno encima del otro */
         margin-left: auto;
         margin-right: auto;
         width: 30%;
         text-align: center;
     }
     .selection-indicator {
          margin-bottom: 10px; /* Espacio entre ellos */
     }
    .gallery-container {
         grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); /* Restaurado */
         gap: 0.8rem; /* Restaurado (o ajustar) */
         /* column-count: 2; */ /* Eliminado */
         /* column-gap: 0.6rem; */ /* Eliminado */
    }
     .gallery-item {
         /* margin-bottom: 0.6rem; */ /* Eliminado */
    }
    .modal-image-grid {
         grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }
}

/* Estilos del Header cuando está sticky */
header.sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(40, 40, 40, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    padding-top: 5px;
    padding-bottom: 5px;
    min-height: 55px; /* Altura mínima escritorio */
    z-index: 1099; /* Base del header sticky */
    text-align: center;
}

header.sticky-header h1 {
   font-size: 1.2em;
   display: inline-block;
   margin: 0;
}

header.sticky-header .header-controls {
    display: inline-flex;
    margin: 0 auto;
    position: static;
}

/* Botón/Icono Vista Rápida */
.gallery-item .view-photo-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    line-height: 0; /* Para alinear SVG */
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 11; /* Encima del label pero debajo del checkbox */
}

.gallery-item:hover .view-photo-btn {
    opacity: 1;
}

.gallery-item .view-photo-btn svg {
    vertical-align: middle;
}

/* --- Estilos del Lightbox --- */
.lightbox {
    display: none; /* Oculto por defecto */
    position: fixed;
    z-index: 1200; /* Encima de todo */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.85); /* Fondo más oscuro */
    padding-top: 60px; /* Espacio para botón de cierre */
}

.lightbox-content {
    margin: auto;
    display: block;
    width: 85%;
    max-width: 800px;
    max-height: 85vh; /* Limitar altura */
}

.lightbox-content img {
    display: block;
    margin: auto;
    max-width: 100%;
    max-height: 80vh; /* Asegurar que la imagen no exceda alto */
    width: auto;
    height: auto;
}

/* Animación (Opcional) */
.lightbox-content {
    animation-name: zoomIn;
    animation-duration: 0.4s;
}
@keyframes zoomIn {
    from {transform: scale(0.8); opacity: 0;}
    to {transform: scale(1); opacity: 1;}
}

/* Botón de cierre del Lightbox */
.lightbox-close-button {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

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

/* Responsividad para lightbox en móvil */
@media (max-width: 700px) {
    .lightbox-content {
        width: 95%;
    }
}

/* Adaptar modal en pantallas pequeñas */
@media (max-width: 600px) {
    .modal-content {
        width: 95%;
        padding: 25px 20px;
        margin-top: 8%;
        border-radius: 16px;
    }
     .modal-image-grid {
         max-height: 30vh;
    }
    .email-section input[type="email"] {
        width: 95%;
        padding: 12px 15px;
        font-size: 1em;
    }
     .email-section #submit-button {
        padding: 12px 25px;
        font-size: 1em;
        min-width: 150px;
    }
    .email-disclaimer,
    .terms-acceptance {
         font-size: 0.75em;
    }
    body.header-is-sticky .gallery-nav {
        position: fixed;
        top: 110px; /* Altura mínima del header sticky escritorio */
        left: 0;
        width: 100%;
        z-index: 1097; /* Debajo del header (1099), pero encima del contenido */
        background-color: #e9ecef; /* Asegurar fondo para tapar contenido */
        box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Sombra sutil */
        padding: 0.75rem 1rem; /* Mantener padding */
        margin-bottom: 0; /* Quitar margen inferior cuando es sticky */
        border-radius: 0; /* Quitar bordes redondeados cuando es sticky */
        transition: top 0.3s ease; /* Transición suave */
    }
}

/* --- Estilos para Animación de Carga Diferida --- */
.gallery-item {
    /* ... (estilos existentes: position, overflow, border-radius, etc.) ... */
    margin-bottom: 1rem; /* Restaurar espacio vertical */
    break-inside: avoid; /* Restaurar para layout de columnas si se revierte */
    opacity: 1; /* Asegurar opacidad inicial */
    transition: opacity 0.5s ease-in-out; /* Transición para fade-in */
}

/* Estado inicial para ítems recién añadidos (se quitará con JS) */
.gallery-item.loading {
    opacity: 0;
}

/* ... (Resto de estilos) ... */

/* --- Barra de Navegación Sticky --- */
body.header-is-sticky .gallery-nav {
    position: fixed;
    top: 90px; /* Altura mínima del header sticky escritorio */
    left: 0;
    width: 100%;
    z-index: 1097; /* Debajo del header (1099), pero encima del contenido */
    background-color: #e9ecef; /* Asegurar fondo para tapar contenido */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Sombra sutil */
    padding: 0.75rem 1rem; /* Mantener padding */
    margin-bottom: 0; /* Quitar margen inferior cuando es sticky */
    border-radius: 0; /* Quitar bordes redondeados cuando es sticky */
    transition: top 0.3s ease; /* Transición suave */
}

/* Ajustar contenido principal para dejar espacio a AMBAS barras */
body.header-is-sticky main {
    /* Altura header (55px) + Altura nav (estimar ~45px) + margen */
    margin-top: 105px; /* Ajustar este valor si es necesario */
}
