/* Gallery & Layout Styles */
:root {
    --bg-base: #000000;
    --page-text: #f5f5f5;
    --muted: #9ca3af;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--bg-base);
    color: var(--page-text);
    overflow-x: hidden;
    transition: background-color 0.5s ease;
}

/* Page Structure */
.site-header {
    padding: 1rem 1.5rem 0.5rem;
    text-align: center;
}

.site-header h1 {
    font-size: var(--dyn-size-title, 1.6rem);
    margin: 0 0 0.25rem;
    text-shadow: var(--dyn-txt-effect, none);
}

.site-header p {
    margin: 0;
    font-size: var(--dyn-size-subtitle, 0.9rem);
    opacity: 0.8;
    text-shadow: var(--dyn-txt-effect, none);
}

.page-shell {
    display: block;
    min-height: 100vh;
}

/* Filters */
.filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem 0.5rem;
}

.filter-btn {
    border: 1px solid rgba(148, 163, 184, 0.8);
    background: #020617;
    color: #e5e7eb;
    border-radius: 0;
    padding: 0.25rem 0.75rem;
    font-size: var(--dyn-size-button, 0.8rem);
    cursor: pointer;
    opacity: 0.85;
    text-shadow: var(--dyn-txt-effect, none);
}

.filter-btn.is-active {
    background: #e5e7eb;
    color: #020617;
    opacity: 1;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 0;
    min-height: 100vh;
    contain: layout;
}

.gallery-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

/* Photo Cards */
.photo-card {
    position: relative;
    overflow: hidden;
    border-radius: 0;
    width: 100%;
    background: transparent;
    border: none;
    cursor: zoom-in;
    display: block;
    margin: 0;
    transition: transform 0.25s ease-out;
}

/* Dynamic Placeholder States */
.gallery-grid.is-dragging .photo-card {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Skeleton Loading for Photo Cards */
.photo-card.skeleton-box {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-radius: 2px;
}


/* Hover Effect (Desktop Only) */
@media (hover: hover) {
    .photo-card:hover {
        transform: scale(0.95);
    }
}

.photo-card.is-trail {
    /* Trail Effect Disabled */
    transform: none;
    z-index: auto;
    box-shadow: none;
}

.photo-thumb {
    width: 100%;
    height: 100%;
    /* Fill pre-allocated aspect-ratio card */
    display: block;
    background-color: transparent;
    object-fit: cover;
}

/* Aspect Ratio Utilities (to avoid inline styles) */
.ratio-squared {
    aspect-ratio: 1;
}

.ratio-portrait {
    aspect-ratio: 3/4;
}

.ratio-landscape {
    aspect-ratio: 4/3;
}

.ratio-wide {
    aspect-ratio: 16/9;
}

.ratio-tall {
    aspect-ratio: 9/16;
}

.ratio-4-5 {
    aspect-ratio: 4/5;
}

.ratio-5-7 {
    aspect-ratio: 5/7;
}


/* Modal (Facebook Style) */
#photo-modal {
    position: fixed;
    inset: 0;
    display: none;
    background: #000000;
    /* Fondo totalmente opaco para simular una página nueva */
    z-index: 1000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#photo-modal.open {
    display: flex;
}

/* Modal Stacking & Interaction */
.modal-main {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 10;
    /* Main container allows clicking background to close */
    pointer-events: auto;
}

#modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
    cursor: auto;

    /* Prevent default browser image drag & context menus during zoom/pan */
    pointer-events: auto !important;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

/* Toolbar Overlay */
/* SIMPLIFIED FIX: Allow toolbar to be active. */
.modal-toolbar {
    position: absolute;
    width: 100%;
    padding: 1rem 1.5rem;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 2000;
}

/* Re-enable events: redundant if container is auto, but safe */
.modal-toolbar button,
.modal-toolbar a,
.modal-toolbar .action-group,
.modal-toolbar .icon-btn {
    pointer-events: auto !important;
}

.modal-top {
    top: 0;
    /* Background shadow removed to clean up interface during zoom */
}

.action-group {
    display: flex;
    gap: 1rem;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1.2rem;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Navigation Buttons */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    transition: background 0.2s;
    z-index: 50;
    /* Above image, below toolbar */
    pointer-events: auto !important;
    -webkit-user-select: none;
    user-select: none;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-prev {
    left: 20px;
}

.nav-next {
    right: 20px;
}

.nav-btn {
    display: none;
}

/* Force Mobile Styles override defaults/cache */
.filter-btn {
    border-radius: 0 !important;
    -webkit-appearance: none;
    appearance: none;
}

.gallery-grid,
.gallery-col {
    gap: 0 !important;
}

.photo-card {
    border-radius: 0 !important;
    border: none !important;
    background: transparent !important;
}

/* Footer / Last Updated */
#page-last-updated {
    text-align: center;
    padding: 2rem 1rem;
    opacity: 0.5;
    font-size: var(--dyn-size-body, 0.8rem);
    color: var(--muted);
    pointer-events: none;
    display: none;
    /* Hidden by default */
}

/* Global Skeleton Loading UI */
.skeleton-box {
    display: inline-block;
    position: relative;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.04) !important;
    color: transparent !important;
    border-color: transparent !important;
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
}

.skeleton-box::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.08),
            transparent);
    transform: translateX(-100%);
    animation: skeleton-shimmer 2s infinite linear;
}

@keyframes skeleton-shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}


/* CSS-Only Auto Skeleton Loaders for Dynamic Containers */
@keyframes skeleton-bg-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}



#album-filters:empty {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    width: 100%;
    min-height: 32px;
}

#album-filters:empty::before,
#album-filters:empty::after,
#album-filters:empty::first-line

/* Hack to add a 3rd fake element using pseudo if needed, though 2 is enough */
    {
    content: '';
    display: block;
    width: 80px;
    height: 28px;
    border-radius: 20px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
    background-size: 200% 100%;
    animation: skeleton-bg-shimmer 2s infinite linear;
}