/* Gallery Grid Styles */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 20px 0;
    width: 100%;
}

.gallery-item {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    min-width: 0;
    /* Prevents grid items from overflowing */
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.gallery-item-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
    width: 100%;
}

.gallery-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
    /* Removes any inline spacing */
}

.gallery-item:hover .gallery-item-image img {
    transform: scale(1.05);
}

.gallery-item-image a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.gallery-item-content {
    padding: 15px;
    word-wrap: break-word;
    /* Prevents text overflow */
}

.gallery-item-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.gallery-item-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Enhanced Responsive Design */
/* Large Desktop */
@media (min-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }

    .gallery-item-title {
        font-size: 20px;
    }

    .gallery-item-description {
        font-size: 15px;
    }
}

/* Desktop */
@media (max-width: 1199px) and (min-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* Tablet Landscape */
@media (max-width: 991px) and (min-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }

    .gallery-item-content {
        padding: 12px;
    }

    .gallery-item-title {
        font-size: 17px;
    }

    .gallery-item-description {
        font-size: 13px;
    }
}

/* Tablet Portrait */
@media (max-width: 767px) and (min-width: 576px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .gallery-item-content {
        padding: 12px;
    }

    .gallery-item-title {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .gallery-item-description {
        font-size: 13px;
    }
}

/* Mobile Large */
@media (max-width: 575px) and (min-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .gallery-item-content {
        padding: 10px;
    }

    .gallery-item-title {
        font-size: 15px;
        margin-bottom: 6px;
    }

    .gallery-item-description {
        font-size: 12px;
    }
}

/* Mobile Medium */
@media (max-width: 479px) and (min-width: 375px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin: 15px 0;
    }

    .gallery-item-content {
        padding: 12px;
    }

    .gallery-item-title {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .gallery-item-description {
        font-size: 13px;
    }
}

/* Mobile Small */
@media (max-width: 374px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin: 12px 0;
    }

    .gallery-item {
        border-radius: 6px;
    }

    .gallery-item-content {
        padding: 10px;
    }

    .gallery-item-title {
        font-size: 15px;
        margin-bottom: 6px;
    }

    .gallery-item-description {
        font-size: 12px;
    }

    .gallery-item-image {
        aspect-ratio: 4/3;
        /* Slightly taller on very small screens */
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .gallery-item:hover {
        transform: none;
        /* Disable hover effects on touch devices */
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .gallery-item:hover .gallery-item-image img {
        transform: none;
    }

    .gallery-item-image::before {
        display: none;
        /* Disable shimmer effect on touch devices */
    }

    /* Add touch-friendly tap states */
    .gallery-item:active {
        transform: scale(0.98);
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .gallery-item-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print Styles */
@media print {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .gallery-item {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }

    .gallery-item-image {
        aspect-ratio: 3/2;
    }
}

/* Gallery Posts Plugin Lightbox Customization with Unique Classes */
.gpp-lightbox .gpp-lb-data .gpp-lb-caption {
    font-size: 12px !important;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    padding: 6px 12px;
    border-radius: 5px;
    display: inline-block;
    max-width: 80%;
    word-wrap: break-word;
}

@media (max-width: 991px) {
    .gpp-lightbox .gpp-lb-data .gpp-lb-caption {
        font-size: 11px !important;
    }
}

@media (max-width: 600px) {
    .gpp-lightbox .gpp-lb-data .gpp-lb-caption {
        font-size: 10px !important;
    }
}

/* Simple Lightbox Navigation Arrows */
.lb-outerContainer {
    position: relative;
}

.lb-nav {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.lb-nav a.lb-prev,
.lb-nav a.lb-next {
    opacity: 0.9;
    transition: opacity 0.2s ease;
    background: none !important;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    box-shadow: none !important;
    border: none !important;
    outline: none;
    pointer-events: auto;
}

.lb-nav a.lb-prev {
    left: -60px;
}

.lb-nav a.lb-next {
    right: -60px;
}

/* Arrow shape: thin, sharp, clean, and large */
.lb-nav a.lb-prev::before,
.lb-nav a.lb-next::before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
}

.lb-nav a.lb-prev::before {
    border-width: 30px 18px 30px 0;
    border-color: transparent #fff transparent transparent;
}

.lb-nav a.lb-next::before {
    border-width: 30px 0 30px 18px;
    border-color: transparent transparent transparent #fff;
}

.lb-nav a.lb-prev:hover,
.lb-nav a.lb-next:hover {
    opacity: 1;
    background: none !important;
    box-shadow: none !important;
}

/* Simple Arrow Indicators */
.lb-nav a.lb-prev::before,
.lb-nav a.lb-next::before {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px;
}

.lb-nav a.lb-prev::before {
    border-color: transparent #fff transparent transparent;
}

.lb-nav a.lb-next::before {
    border-color: transparent transparent transparent #fff;
}

/* Lightbox Image Container - Make images full size */
.lb-image {
    max-width: 100vw !important;
    max-height: 90vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Lightbox Data Container */
.lb-dataContainer {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    padding: 15px 20px;
    margin: 20px;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    min-width: 200px;
}

.lb-data {
    text-align: center;
}

.lb-data .lb-number {
    font-size: 14px;
    color: #ccc;
    margin-bottom: 10px;
}

.lb-data .lb-caption {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0;
}

/* Lightbox Loading */
.lb-loading {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    padding: 20px;
}

.lb-loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid #fff;
    border-top: 3px solid transparent;
    border-radius: 50%;
    animation: lightbox-spin 1s linear infinite;
    display: block;
    margin: 0 auto;
}

@keyframes lightbox-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Lightbox */
@media (max-width: 767px) {

    .lb-nav a.lb-prev,
    .lb-nav a.lb-next {
        width: 48px;
        height: 48px;
    }

    .lb-nav a.lb-prev {
        left: -40px;
    }

    .lb-nav a.lb-next {
        right: -40px;
    }

    .lb-nav a.lb-prev::before,
    .lb-nav a.lb-next::before {
        border-width: 14px;
    }

    .lb-image {
        max-width: 90vw !important;
        max-height: 85vh !important;
    }

    .lb-outerContainer {
        max-width: 90vw;
        max-height: 85vh;
    }

    .lb-data .lb-caption {
        font-size: 11px;
    }

    .lb-data .lb-number {
        font-size: 12px;
    }

    .lb-dataContainer {
        margin: 10px;
        padding: 10px 15px;
        bottom: 10px;
    }

    .lb-closeContainer .lb-close {
        width: 35px;
        height: 35px;
        top: 10px;
        right: 10px;
    }

    .lb-closeContainer .lb-close::before,
    .lb-closeContainer .lb-close::after {
        width: 16px;
        height: 2px;
    }
}

@media (max-width: 480px) {

    .lb-nav a.lb-prev,
    .lb-nav a.lb-next {
        width: 32px;
        height: 32px;
    }

    .lb-nav a.lb-prev {
        left: -28px;
    }

    .lb-nav a.lb-next {
        right: -28px;
    }

    .lb-nav a.lb-prev::before,
    .lb-nav a.lb-next::before {
        border-width: 10px;
    }

    .lb-image {
        max-width: 85vw !important;
        max-height: 80vh !important;
    }

    .lb-outerContainer {
        max-width: 85vw;
        max-height: 80vh;
    }

    .lb-data .lb-caption {
        font-size: 11px;
    }

    .lb-data .lb-number {
        font-size: 11px;
    }
}

/* Touch Device Lightbox Optimizations */
@media (hover: none) and (pointer: coarse) {

    .lb-nav a.lb-prev,
    .lb-nav a.lb-next {
        opacity: 1;
        background: none;
    }

    .lb-nav a.lb-prev:active,
    .lb-nav a.lb-next:active {
        background: none;
    }

    .lb-closeContainer .lb-close {
        opacity: 1;
        background: none;
    }

    .lb-closeContainer .lb-close:active {
        background: none;
    }
}

/* Lightbox Overlay */
.lb-overlay {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

/* Lightbox Close Button */
.lb-closeContainer .lb-close {
    opacity: 0.9;
    transition: opacity 0.2s ease;
    background: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1002;
}

.lb-closeContainer .lb-close:hover {
    opacity: 1;
    background: none;
}

.lb-closeContainer .lb-close::before,
.lb-closeContainer .lb-close::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: #fff;
    transform: rotate(45deg);
}

.lb-closeContainer .lb-close::after {
    transform: rotate(-45deg);
}

/* Keyboard Navigation Indicators */
.lb-nav a.lb-prev:focus,
.lb-nav a.lb-next:focus,
.lb-closeContainer .lb-close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Lightbox Animation Enhancements */
.lb-outerContainer,
.lb-dataContainer {
    transition: all 0.3s ease;
}

/* Lightbox Counter */
.lb-number {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
}

/* Lightbox Caption */
.lb-caption {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.4;
}

/* Lightbox Focus States */
.lb-nav a:focus,
.lb-closeContainer .lb-close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Lightbox High Contrast Mode Support */
@media (prefers-contrast: high) {

    .lb-nav a.lb-prev,
    .lb-nav a.lb-next {
        background: none;
        border: 2px solid #fff;
    }

    .lb-closeContainer .lb-close {
        background: none;
        border: 2px solid #fff;
    }

    .lb-dataContainer {
        background: rgba(0, 0, 0, 0.9);
        border: 1px solid #fff;
    }
}

/* Lightbox Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {

    .lb-outerContainer,
    .lb-dataContainer,
    .lb-image,
    .lb-nav a,
    .lb-closeContainer .lb-close {
        transition: none;
        animation: none;
    }

    .lb-loading-spinner {
        animation: none;
    }
}

/* Lightbox Print Styles */
@media print {
    .lb-overlay {
        background: white !important;
    }

    .lb-outerContainer {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }

    .lb-nav,
    .lb-closeContainer,
    .lb-dataContainer {
        display: none !important;
    }

    .lb-image {
        box-shadow: none !important;
        border-radius: 0 !important;
    }
}

/* Loading Animation */
.gallery-item-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
    pointer-events: none;
}

.gallery-item:hover .gallery-item-image::before {
    left: 100%;
}

/* Empty State */
.gallery-grid:empty::before {
    content: 'No gallery posts found.';
    display: block;
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* Focus States for Accessibility */
.gallery-item:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.gallery-item-image a:focus {
    outline: none;
}

/* Container Responsive */
.gallery-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 15px;
}

@media (min-width: 576px) {
    .gallery-container {
        padding: 0 20px;
    }
}

@media (min-width: 768px) {
    .gallery-container {
        padding: 0 30px;
    }
}

@media (min-width: 992px) {
    .gallery-container {
        padding: 0 40px;
    }
}

@media (min-width: 1200px) {
    .gallery-container {
        padding: 0 50px;
    }
}

/* Lightbox Navigation Hints */
.lb-nav-hints {
    margin-top: 10px;
    text-align: center;
}

.hint-text {
    display: block;
    font-size: 12px;
    color: #ccc;
    margin: 2px 0;
    font-style: italic;
}

/* Lightbox Loading Overlay */
.lb-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.lb-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: lightbox-spin 1s linear infinite;
}

/* Navigation Button Visual Feedback */
.lb-nav a.nav-hover {
    transform: translateY(-50%) scale(1.1);
    background: rgba(0, 0, 0, 0.8);
}

.lb-nav a.nav-clicked {
    transform: translateY(-50%) scale(0.95);
    background: rgba(0, 0, 0, 0.9);
}

/* Lightbox Zoom Controls */
.lb-image {
    transition: transform 0.3s ease;
    cursor: zoom-in;
}

.lb-image.zoomed {
    cursor: zoom-out;
}

/* Lightbox Fullscreen Support */
.lb-outerContainer:fullscreen {
    background: rgba(0, 0, 0, 0.95);
}

.lb-outerContainer:-webkit-full-screen {
    background: rgba(0, 0, 0, 0.95);
}

.lb-outerContainer:-moz-full-screen {
    background: rgba(0, 0, 0, 0.95);
}

/* Lightbox Counter Enhancement */
.lb-number {
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 15px;
    display: inline-block;
    margin-bottom: 10px;
}

/* Lightbox Caption Enhancement */
.lb-caption {
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 15px;
    border-radius: 5px;
    display: inline-block;
    max-width: 80%;
    word-wrap: break-word;
}

/* Lightbox Navigation Arrows Enhancement */
.lb-nav a.lb-prev,
.lb-nav a.lb-next {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.lb-nav a.lb-prev:hover,
.lb-nav a.lb-next:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* Lightbox Close Button Enhancement */
.lb-closeContainer .lb-close {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.lb-closeContainer .lb-close:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* Lightbox Data Container Enhancement */
.lb-dataContainer {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

/* Lightbox Image Enhancement */
.lb-image {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

/* Lightbox Outer Container Enhancement */
.lb-outerContainer {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

/* Lightbox Overlay Enhancement */
.lb-overlay {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Lightbox Responsive Enhancements */
@media (max-width: 767px) {
    .lb-nav-hints {
        margin-top: 5px;
    }

    .hint-text {
        font-size: 11px;
        margin: 1px 0;
    }

    .lb-loading-spinner {
        width: 30px;
        height: 30px;
        border-width: 3px;
    }

    .lb-number {
        padding: 3px 8px;
        font-size: 11px;
    }

    .lb-caption {
        padding: 6px 12px;
        font-size: 13px;
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .lb-nav-hints {
        display: none;
        /* Hide hints on very small screens */
    }

    .lb-loading-spinner {
        width: 25px;
        height: 25px;
        border-width: 2px;
    }

    .lb-number {
        padding: 2px 6px;
        font-size: 10px;
    }

    .lb-caption {
        padding: 4px 10px;
        font-size: 12px;
        max-width: 95%;
    }
}

/* Lightbox Animation Enhancements */
.lb-outerContainer,
.lb-dataContainer,
.lb-image {
    animation: lightbox-fade-in 0.3s ease-out;
}

@keyframes lightbox-fade-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 991px) {
    .lb-nav a.lb-prev::before {
        border-width: 18px 10px 18px 0;
    }

    .lb-nav a.lb-next::before {
        border-width: 18px 0 18px 10px;
    }
}

@media (max-width: 600px) {
    .lb-nav a.lb-prev::before {
        border-width: 12px 7px 12px 0;
    }

    .lb-nav a.lb-next::before {
        border-width: 12px 0 12px 7px;
    }

    .lb-data .lb-caption {
        font-size: 10px;
    }
}

.gpp-desc-wrapper {
    position: relative;
    display: block;
    min-height: 1.5em;
}

.gpp-desc-short {
    display: inline;
}

.gpp-desc-full {
    display: block;
    margin-top: 4px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gpp-desc-wrapper.expanded .gpp-desc-full {
    display: block;
    max-height: 500px;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gpp-desc-wrapper.expanded .gpp-desc-short {
    display: none;
}

.gpp-desc-toggle {
    color: #0073aa;
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
    margin-left: 6px;
    transition: color 0.2s;
}

.gpp-desc-toggle:hover {
    color: #005177;
}