/* === LIGHTBOX & GALLERY STYLES === */

/* --- LIGHTBOX (Liquid Glass / Modern Dark) --- */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(5, 6, 10, 0.94);
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-direction: column;
    padding: 0;
    margin: 0;
    touch-action: none;
}

.lightbox-modal.active {
    display: flex;
    opacity: 1;
}

.lightbox-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    z-index: 100002;
    background: rgba(10, 11, 17, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: auto;
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 769px) {
    .lightbox-top-bar {
        padding: 16px 30px;
    }
}

.lightbox-top-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.lightbox-counter {
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 5px 12px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.lightbox-caption-text {
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.9;
}

.lightbox-caption-text:empty {
    display: none;
}

.lightbox-top-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    pointer-events: auto;
    flex-shrink: 0;
}

.lightbox-action-btn,
.close-lightbox {
    color: #ffffff;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    user-select: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-action-btn .material-symbols-rounded,
.close-lightbox .material-symbols-rounded {
    font-size: 20px;
    line-height: 1;
    display: block;
}

.lightbox-action-btn:hover,
.close-lightbox:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.06);
    box-shadow: 0 0 15px rgba(230, 34, 34, 0.5);
    color: #ffffff;
}

.lightbox-main-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    min-height: 0;
    padding: 10px 20px;
    box-sizing: border-box;
}

.lightbox-image-container {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    overflow: visible;
    position: relative;
}

.lightbox-image-container.is-zoomed {
    overflow: hidden;
}

#lightbox-img {
    max-width: calc(100vw - 140px);
    max-height: calc(100vh - 180px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1), opacity 0.2s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    cursor: zoom-in;
    user-select: none;
    -webkit-user-drag: none;
    will-change: transform;
    touch-action: none;
    margin: auto;
    display: block;
}

.lightbox-image-container.is-zoomed #lightbox-img {
    cursor: zoom-out;
}

.lightbox-modal.dragging,
.lightbox-modal.dragging * {
    cursor: grabbing !important;
    user-select: none;
}

.lightbox-image-container.dragging #lightbox-img {
    transition: none !important;
}

/* Glass Navigation Arrows */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(14, 15, 22, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10000;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    user-select: none;
}

.lightbox-nav .material-symbols-rounded {
    font-size: 26px;
    line-height: 1;
    display: block;
}

.lightbox-nav:hover {
    background: var(--primary);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 8px 25px rgba(230, 34, 34, 0.5);
}

.lightbox-nav.prev {
    left: 20px;
}

.lightbox-nav.next {
    right: 20px;
}

@media (max-width: 768px) {
    .lightbox-main-area {
        padding: 4px 6px 58px 6px;
        position: relative;
    }
    #lightbox-img {
        max-width: calc(100vw - 12px);
        max-height: calc(100vh - 200px);
        border-radius: 8px;
    }
    .lightbox-nav {
        top: auto;
        bottom: 8px;
        transform: none;
        display: flex;
        width: 44px;
        height: 44px;
        background: rgba(20, 22, 32, 0.9);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.22);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
        z-index: 10001;
    }
    .lightbox-nav:hover,
    .lightbox-nav:focus {
        transform: none;
    }
    .lightbox-nav .material-symbols-rounded {
        font-size: 26px;
    }
    .lightbox-nav.prev {
        left: 16px;
    }
    .lightbox-nav.next {
        right: 16px;
    }
    .lightbox-nav:active {
        background: var(--primary);
        transform: scale(0.94);
    }

    html[data-theme="light"] .lightbox-nav {
        background: rgba(255, 255, 255, 0.96);
        border: 1px solid rgba(15, 23, 42, 0.15);
        color: #1d1d1f;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
        transform: none;
    }
    html[data-theme="light"] .lightbox-nav:hover,
    html[data-theme="light"] .lightbox-nav:focus {
        transform: none;
    }
    html[data-theme="light"] .lightbox-nav:active {
        background: var(--primary);
        color: #ffffff;
        transform: scale(0.94);
    }
}

/* Floating Thumbnails Bar */
.lightbox-thumbnails-wrapper {
    width: 100%;
    z-index: 100002;
    background: rgba(10, 11, 17, 0.7);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.lightbox-thumbnails {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 20px;
    overflow-x: auto;
    scrollbar-width: none;
    box-sizing: border-box;
}

.lightbox-thumbnails::-webkit-scrollbar {
    display: none;
}

.lightbox-thumb-item {
    height: 56px;
    min-width: 95px;
    aspect-ratio: 16 / 10;
    opacity: 0.45;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #000;
}

.lightbox-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lightbox-thumb-item:hover,
.lightbox-thumb-item.active {
    opacity: 1;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 0 12px rgba(230, 34, 34, 0.6);
}



/* === LIGHTBOX LIGHT MODE OVERRIDES === */
html[data-theme="light"] .lightbox-modal {
    background-color: rgba(240, 244, 252, 0.96);
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
}

html[data-theme="light"] .lightbox-top-bar {
    background: rgba(255, 255, 255, 0.85);
    border-bottom-color: rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

html[data-theme="light"] .lightbox-counter {
    color: #1d1d1f;
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(15, 23, 42, 0.1);
}

html[data-theme="light"] .lightbox-caption-text {
    color: #111827;
}

html[data-theme="light"] .lightbox-action-btn,
html[data-theme="light"] .close-lightbox {
    color: #1d1d1f;
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(15, 23, 42, 0.1);
}

html[data-theme="light"] .lightbox-action-btn:hover,
html[data-theme="light"] .close-lightbox:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    transform: scale(1.06);
    box-shadow: 0 0 15px rgba(230, 34, 34, 0.5);
}

html[data-theme="light"] #lightbox-img {
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}

html[data-theme="light"] .lightbox-nav {
    color: #1d1d1f;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(15, 23, 42, 0.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .lightbox-nav:hover,
html[data-theme="light"] .lightbox-nav:active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(230, 34, 34, 0.4);
}

html[data-theme="light"] .lightbox-thumbnails-wrapper {
    background: rgba(255, 255, 255, 0.92);
    border-top: 1px solid rgba(15, 23, 42, 0.1);
}

html[data-theme="light"] .lightbox-thumb-item {
    background: #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: rgba(15, 23, 42, 0.1);
    opacity: 0.65;
}

html[data-theme="light"] .lightbox-thumb-item:hover,
html[data-theme="light"] .lightbox-thumb-item.active {
    opacity: 1;
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(230, 34, 34, 0.5);
}

/* === GLOBAL GALLERY & CONTENT FRAME STYLES === */

.entry-content .wp-block-gallery,
.wp-block-gallery,
.wp-block-gallery.has-nested-images {
    display: flex;
    flex-wrap: nowrap;
    gap: 14px;
    margin: 32px 0 40px 0;
    padding: 14px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 22px;
    box-shadow: var(--shadow);
    box-sizing: border-box;
    width: 100%;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

html[data-theme="light"] .entry-content .wp-block-gallery,
html[data-theme="light"] .wp-block-gallery,
html[data-theme="light"] .wp-block-gallery.has-nested-images {
    background: var(--card-bg);
    border-color: var(--glass-border);
}

.entry-content .wp-block-gallery:hover,
.wp-block-gallery:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

html[data-theme="light"] .entry-content .wp-block-gallery:hover,
html[data-theme="light"] .wp-block-gallery:hover {
    border-color: rgba(15, 23, 42, 0.15);
}

/* Single image container */
.entry-content .wp-block-gallery:not(.has-more-photos):has(> .wp-block-image:nth-child(1):last-child),
.wp-block-gallery:not(.has-more-photos):has(> .wp-block-image:nth-child(1):last-child) {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.entry-content .wp-block-gallery .wp-block-image,
.wp-block-gallery .wp-block-image,
.wp-block-gallery.has-nested-images figure.wp-block-image {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: 100%;
    margin: 0;
    aspect-ratio: 16 / 11;
    position: relative;
    display: block;
    border-radius: 12px;
    overflow: hidden;
    background: #181a24;
    border: none;
    box-shadow: none;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: zoom-in;
    box-sizing: border-box;
}

html[data-theme="light"] .entry-content .wp-block-gallery .wp-block-image,
html[data-theme="light"] .wp-block-gallery .wp-block-image,
html[data-theme="light"] .wp-block-gallery.has-nested-images figure.wp-block-image {
    background: #e2e8f0;
    border: none;
    box-shadow: none;
}

.entry-content .wp-block-gallery .wp-block-image.gallery-hidden-tile,
.wp-block-gallery .wp-block-image.gallery-hidden-tile,
.wp-block-gallery.has-nested-images figure.wp-block-image.gallery-hidden-tile,
figure.wp-block-image.gallery-hidden-tile {
    display: none;
}

.entry-content .wp-block-gallery .wp-block-image a,
.wp-block-gallery .wp-block-image a,
.wp-block-gallery.has-nested-images figure.wp-block-image a {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    color: inherit;
    text-decoration: none;
    box-sizing: border-box;
}

.wp-block-gallery img,
.gallery-single-container .wp-block-gallery img,
.entry-content .wp-block-gallery img,
.wp-block-gallery.has-nested-images figure.wp-block-image img {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: 100%;
    min-height: 100%;
    max-height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    border-radius: 12px;
    transition: transform 0.6s cubic-bezier(0.2, 0, 0.2, 1);
}

.wp-block-gallery .wp-block-image:hover img,
.wp-block-gallery.has-nested-images figure.wp-block-image:hover img {
    transform: scale(1.05);
}

/* Normal image hover zoom icon */
.wp-block-gallery .wp-block-image:not(.gallery-more-tile)::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.65) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.wp-block-gallery .wp-block-image:not(.gallery-more-tile)::after {
    content: 'zoom_in';
    font-family: 'Material Symbols Rounded';
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(230, 34, 34, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    opacity: 0;
    transform: scale(0.6);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 2;
}

.wp-block-gallery .wp-block-image:hover {
    transform: translateY(-3px);
}

html[data-theme="light"] .wp-block-gallery .wp-block-image:hover {
    box-shadow: none;
}

.wp-block-gallery .wp-block-image:not(.gallery-more-tile):hover::before {
    opacity: 1;
}

.wp-block-gallery .wp-block-image:not(.gallery-more-tile):hover::after {
    opacity: 1;
    transform: scale(1);
}

/* === +X MORE PHOTOS OVERLAY === */
.gallery-more-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 11, 17, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #ffffff;
    cursor: pointer;
    border-radius: 12px;
    box-sizing: border-box;
}

html[data-theme="light"] .gallery-more-overlay {
    background: rgba(15, 23, 42, 0.65);
}

.gallery-more-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gallery-more-number {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.3rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.02em;
    color: #ffffff;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.gallery-more-label {
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #ffffff;
    background: linear-gradient(135deg, #ff3333 0%, #c61a1a 100%);
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(230, 34, 34, 0.4);
    white-space: nowrap;
}

.wp-block-image.gallery-more-tile:hover .gallery-more-overlay {
    background: rgba(190, 20, 20, 0.78);
}

.wp-block-image.gallery-more-tile:hover .gallery-more-content {
    transform: scale(1.08);
}

/* === RESPONSIVE GALLERY === */
@media (max-width: 768px) {
    .entry-content .wp-block-gallery,
    .wp-block-gallery,
    .wp-block-gallery.has-nested-images {
        gap: 8px;
        padding: 10px;
        border-radius: 16px;
        margin: 24px 0 32px 0;
    }

    .wp-block-gallery .wp-block-image {
        border-radius: 10px;
        aspect-ratio: 16 / 11;
    }

    .gallery-more-number {
        font-size: 1.6rem;
    }

    .gallery-more-label {
        font-size: 0.65rem;
        padding: 2px 8px;
    }

    .lightbox-thumbnails {
        height: 120px;
        padding: 5px 15px calc(35px + env(safe-area-inset-bottom, 0px)) 15px;
        justify-content: flex-start;
        background: transparent;
    }

    .lightbox-thumb-item {
        height: 65px;
        min-width: 110px;
    }
}

@media (max-width: 480px) {
    .entry-content .wp-block-gallery,
    .wp-block-gallery,
    .wp-block-gallery.has-nested-images {
        gap: 6px;
        padding: 8px;
    }

    .gallery-more-number {
        font-size: 1.3rem;
    }

    .gallery-more-label {
        font-size: 0.58rem;
        padding: 1px 6px;
        letter-spacing: 0.04em;
    }
}
