/* Gallery Styles */
.cd-gallery-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.cd-gallery-card {
    background: var(--cd-white);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--cd-gray-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none !important;
    color: inherit !important;
    height: 100%;
}

.cd-gallery-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.cd-gallery-card-img {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    background-color: var(--cd-gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cd-gallery-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
    margin: 0 !important;
}

.cd-gallery-card:hover .cd-gallery-card-img img {
    transform: scale(1.1);
}

.cd-gallery-placeholder {
    color: var(--cd-text-muted);
}

.cd-gallery-placeholder .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
}

.cd-gallery-count {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    backdrop-filter: blur(4px);
}

.cd-gallery-card-content {
    padding: 20px;
    flex: 1;
}

.cd-gallery-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--cd-secondary);
    margin: 8px 0 0 0;
    line-height: 1.4;
}

/* Individual Gallery Details */
.cd-gallery-details-wrap {
    background: var(--cd-white);
    border-radius: 16px;
    border: 1px solid var(--cd-gray-border);
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.03);
    margin-bottom: 30px;
}

.cd-gallery-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.cd-gallery-photo-item {
    position: relative;
    aspect-ratio: 1/1;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.cd-gallery-link {
    display: block;
    width: 100%;
    height: 100%;
}

.cd-gallery-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    margin: 0 !important;
}

.cd-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 51, 102, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.cd-gallery-overlay .dashicons {
    color: #fff;
    font-size: 32px;
    width: 32px;
    height: 32px;
    transform: scale(0.5);
    transition: transform 0.3s;
}

.cd-gallery-photo-item:hover img {
    transform: scale(1.15);
}

.cd-gallery-photo-item:hover .cd-gallery-overlay {
    opacity: 1;
}

.cd-gallery-photo-item:hover .cd-gallery-overlay .dashicons {
    transform: scale(1);
}

@media (max-width: 768px) {
    .cd-gallery-details-wrap {
        padding: 20px;
    }

    .cd-gallery-photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
}

/* ==========================================
   High Contrast (Acessibilidade) Overrides
   ========================================== */
body.cd-high-contrast .cd-gallery-card,
body.cd-high-contrast .cd-gallery-details-wrap {
    background: #000000 !important;
    border: 2px solid #ffffff !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

body.cd-high-contrast .cd-gallery-card:hover {
    border-color: #ffff00 !important;
    transform: none !important;
    box-shadow: none !important;
}

body.cd-high-contrast .cd-gallery-card-title {
    color: #ffffff !important;
}

body.cd-high-contrast .cd-gallery-card:hover .cd-gallery-card-title {
    color: #ffff00 !important;
}

body.cd-high-contrast .cd-gallery-count {
    background: #000000 !important;
    border: 1px solid #ffffff !important;
    color: #ffffff !important;
}

body.cd-high-contrast .cd-gallery-card-img img,
body.cd-high-contrast .cd-gallery-photo-item img {
    filter: grayscale(1) contrast(1.5) !important;
}

body.cd-high-contrast .cd-gallery-photo-item {
    border: 2px solid #ffffff !important;
    box-shadow: none !important;
}

body.cd-high-contrast .cd-gallery-photo-item:hover {
    border-color: #ffff00 !important;
}

body.cd-high-contrast .cd-gallery-overlay {
    background: rgba(0, 0, 0, 0.8) !important;
}

body.cd-high-contrast .cd-gallery-overlay .dashicons {
    color: #ffff00 !important;
}

body.cd-high-contrast .cd-gallery-placeholder .dashicons {
    color: #ffff00 !important;
}

/* Swiper Gallery Carousel Navigation Overrides */
body.cd-high-contrast .cd-gal-swiper .swiper-button-next,
body.cd-high-contrast .cd-gal-swiper .swiper-button-prev {
    color: #ffff00 !important;
}

body.cd-high-contrast .cd-gal-swiper .swiper-pagination-bullet-active {
    background: #ffff00 !important;
}
