/**
 * Event Gallery Styles - Minimal
 */

.event-gallery-container {
    max-width: 1480px;
    width: 100%;
    margin: 0 auto;
    padding: 48px 24px;
}

/* Plugin Theme handoff: winner/event gallery follows the selected global template. */
body[class*="photo-award-global-template-"] .event-gallery-container {
    background: var(--pa-theme-page-bg, #fff) !important;
    color: var(--pa-theme-ink, #111);
    font-family: var(--pa-theme-body, inherit);
}

body[class*="photo-award-global-template-"] .gallery-title,
body[class*="photo-award-global-template-"] .winners-section h2,
body[class*="photo-award-global-template-"] h4.gallery-item-title,
body[class*="photo-award-global-template-"] .gallery-modal-content h2,
body[class*="photo-award-global-template-"] .gallery-modal-content h3 {
    color: var(--pa-theme-ink, #111) !important;
    font-family: var(--pa-theme-display, inherit);
    letter-spacing: -0.035em;
}

body[class*="photo-award-global-template-"] .gallery-subtitle,
body[class*="photo-award-global-template-"] .gallery-item-info p,
body[class*="photo-award-global-template-"] .gallery-modal-content p {
    color: var(--pa-theme-muted, #666) !important;
}

body[class*="photo-award-global-template-"] .gallery-item,
body[class*="photo-award-global-template-"] .gallery-modal-content,
body[class*="photo-award-global-template-"] .modal-gallery-section,
body[class*="photo-award-global-template-"] .selected-entries-section .gallery-item {
    background: var(--pa-theme-surface, #fff) !important;
    border-color: var(--pa-theme-line, #ddd) !important;
    border-radius: var(--pa-theme-radius, 0) !important;
    box-shadow: var(--pa-theme-shadow, none) !important;
    color: var(--pa-theme-ink, #111);
}

body[class*="photo-award-global-template-"] .gallery-item-award,
body[class*="photo-award-global-template-"] .modal-photographer-profile-link {
    background: var(--pa-theme-accent, #b88a2e) !important;
    border-color: var(--pa-theme-accent, #b88a2e) !important;
    border-radius: var(--pa-theme-radius, 0) !important;
    color: var(--pa-theme-on-accent, #fff) !important;
    font-family: var(--pa-theme-mono, inherit);
    letter-spacing: .08em;
}

body.photo-award-global-template-prestige-gold .gallery-item,
body.photo-award-global-template-prestige-gold .gallery-modal-content {
    border-width: 2px !important;
}

body.photo-award-global-template-prestige-gold .gallery-title,
body.photo-award-global-template-prestige-gold .winners-section h2,
body.photo-award-global-template-midnight-cinema .gallery-title,
body.photo-award-global-template-midnight-cinema .winners-section h2 {
    text-transform: uppercase;
}

body.photo-award-global-template-midnight-cinema .gallery-modal-overlay {
    background: rgba(0, 0, 0, .88) !important;
}

body.photo-award-global-template-midnight-cinema .gallery-modal-close {
    background: var(--pa-theme-accent, #d4ff00) !important;
    color: var(--pa-theme-on-accent, #000) !important;
}

body.photo-award-global-template-gallery-curator .gallery-item-image-wrapper img,
body.photo-award-global-template-gallery-curator img.gallery-item-image {
    transition: transform .35s ease;
}

body.photo-award-global-template-gallery-curator .gallery-item:hover .gallery-item-image-wrapper img,
body.photo-award-global-template-gallery-curator .gallery-item:hover img.gallery-item-image {
    transform: scale(1.025);
}

body.photo-award-global-template-signal-ops .gallery-item,
body.photo-award-global-template-signal-ops .gallery-modal-content {
    border-top-width: 3px !important;
}

body.photo-award-global-template-signal-ops .gallery-title,
body.photo-award-global-template-signal-ops .winners-section h2 {
    font-style: italic;
}

/* Final gallery badge/title color guards for template handoff overrides. */
body[class*="photo-award-global-template-"] h4.gallery-item-title,
body[class*="photo-award-global-template-"] .gallery-item-info p.user-name {
    background: #000 !important;
    color: #fff !important;
}

body[class*="photo-award-global-template-"] .gallery-item-award.award_gold,
body[class*="photo-award-global-template-"] .gallery-item-award.award_winner,
body[class*="photo-award-global-template-"] .gallery-item-award.award_first_place,
body[class*="photo-award-global-template-"] .gallery-item-award.award_1st_place,
body[class*="photo-award-global-template-"] .gallery-item-award.award_grand_prize {
    background: linear-gradient(135deg, #f9df7b 0%, #c99218 100%) !important;
    border-color: rgba(255, 235, 156, 0.78) !important;
    color: #15100a !important;
}

body[class*="photo-award-global-template-"] .gallery-item-award.award_silver,
body[class*="photo-award-global-template-"] .gallery-item-award.award_second_place,
body[class*="photo-award-global-template-"] .gallery-item-award.award_2nd_place {
    background: linear-gradient(135deg, #f2f5f8 0%, #9aa4b2 100%) !important;
    border-color: rgba(255, 255, 255, 0.72) !important;
    color: #111827 !important;
}

body[class*="photo-award-global-template-"] .gallery-item-award.award_bronze,
body[class*="photo-award-global-template-"] .gallery-item-award.award_third_place,
body[class*="photo-award-global-template-"] .gallery-item-award.award_3rd_place {
    background: linear-gradient(135deg, #d99a57 0%, #8b4a20 100%) !important;
    border-color: rgba(255, 202, 148, 0.62) !important;
    color: #ffffff !important;
}

body[class*="photo-award-global-template-"] .gallery-item-award.award_honorable_mention,
body[class*="photo-award-global-template-"] .gallery-item-award.award_honourable_mention {
    background: linear-gradient(135deg, #66b8dc 0%, #245a78 100%) !important;
    border-color: rgba(177, 230, 255, 0.62) !important;
    color: #ffffff !important;
}

.gallery-header {
    text-align: center;
    margin-bottom: 42px;
}

.gallery-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.gallery-subtitle {
    font-size: 1.5rem;
    color: #666;
    margin: 0;
    line-height: 1.45;
}

.gallery-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

/* Selected Entries */
.selected-entries-section {
    margin-bottom: 80px;
    padding-bottom: 40px;
    border-bottom: 2px solid #e0e0e0;
}

.gallery-grid-selected {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 32px;
    margin-bottom: 40px;
}

@media (min-width: 1200px) {
    .gallery-grid-selected {
        grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
        gap: 40px;
    }
}

.gallery-grid-selected .gallery-item-content {
    padding: 25px;
}

.gallery-grid-selected .gallery-item-title {
    font-size: 1.3rem;
    font-weight: 600;
}

.gallery-grid-selected .gallery-item-award {
    padding: 8px 16px;
    font-size: 1rem;
    font-weight: 600;
    background: #f5f5f5;
    border: 1px solid #d0d0d0;
}

/* Winners Section */
.winners-section {
    margin-bottom: 80px;
}

.section-title {
    font-size: 2rem;
    font-weight: 600;
    background: #000;
    color: #fff;
    margin: 0 0 38px 0;
    padding: 5px 15px 10px;
    display: inline-block;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.topic-section {
    margin-bottom: 60px;
}

.topic-title {
    font-size: 1.75rem;
    font-weight: 600;
    background: #000;
    color: #fff;
    margin: 0 0 25px 0;
    padding: 5px 15px 10px;
    display: inline-block;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.entry-type-section {
    margin-bottom: 50px;
}

.entry-type-title {
    font-size: clamp(1.2rem, 1.5vw, 1.55rem);
    line-height: 1.35;
    font-weight: 600;
    color: #111;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    margin: 0 0 20px 0;
}

/* Modal */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.gallery-modal-content {
    position: relative;
    background: #fff;
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.gallery-modal-close {
    box-shadow: none;
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: unset;
    color: #000000;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.gallery-modal-close:hover {
    background: unset;
    color: red;
}

.gallery-modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.modal-gallery-section {
    background: #f5f5f5;
    padding: 30px;
}

.modal-main-image {
    width: 100%;
    margin-bottom: 20px;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
}

.modal-main-image img {
    width: 100%;
    height: auto;
    display: block;
}

.modal-thumbnails {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    max-height: 150px;
    overflow-y: auto;
}

.modal-thumbnail {
    width: 80px;
    height: 80px;
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.modal-thumbnail:hover {
    border-color: #333;
}

.modal-thumbnail.active {
    border-color: #1a1a1a;
}

.modal-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-details-section {
    padding: 40px;
    overflow-y: auto;
}

.modal-author-info {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-author-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 5px 0;
}

.modal-author-country {
    font-size: 0.95rem;
    color: #666;
    margin: 0;
}

.modal-photographer-profile-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    margin-top: 14px;
    padding: 9px 16px;
    border: 1px solid #b88a2e;
    color: #121212;
    background: #fff;
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
}

.modal-photographer-profile-link:hover,
.modal-photographer-profile-link:focus {
    color: #fff;
    background: #121212;
    border-color: #121212;
}

.modal-entry-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 15px 0;
    line-height: 1.3;
}

.modal-entry-award {
    display: inline-block;
    padding: 8px 16px;
    background: #f0f0f0;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 25px;
}

.modal-entry-description {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 30px;
    white-space: pre-wrap;
}

.modal-social-share {
    padding-top: 25px;
    border-top: 1px solid #e0e0e0;
}

.social-share-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    margin: 0 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.social-share-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.social-share-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.social-share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.social-share-btn svg {
    width: 18px;
    height: 18px;
}

.social-share-x:hover {
    background: #000;
    color: #fff;
    border-color: #000;
}

.social-share-facebook:hover {
    background: #1877f2;
    color: #fff;
    border-color: #1877f2;
}

.social-share-linkedin:hover {
    background: #0a66c2;
    color: #fff;
    border-color: #0a66c2;
}

/* Professional Gallery Layout */
.win_gallery-category-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 240px));
    justify-content: center;
    gap: 28px;
    align-items: start;
    width: 100%;
}

.win_gallery-category-list::after {
    display: none;
    content: none;
}

.gallery-item {
    width: 100%;
    max-width: none;
    min-width: 0;
    flex: none;
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.06);
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}

.gallery-item:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 0, 0, 0.16);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.12);
}

.gallery-item-image-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    position: relative;
    overflow: hidden;
    background: #f4f4f4;
}

.gallery-item-image-wrapper img,
img.gallery-item-image {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    object-position: center;
    transition: transform 0.45s ease, filter 0.45s ease;
}

.gallery-item:hover .gallery-item-image-wrapper img,
.gallery-item:hover img.gallery-item-image {
    transform: scale(1.035);
    filter: saturate(1.02) contrast(1.02);
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    padding: 18px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.18) 42%, rgba(0, 0, 0, 0.74) 100%);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.gallery-item-image-wrapper:hover .gallery-item-overlay,
.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

h4.gallery-item-title {
    display: inline-block;
    max-width: 100%;
    margin: 0;
    padding: 7px 10px;
    color: #fff !important;
    background: #000 !important;
    font-size: 14px;
    line-height: 1.35;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.gallery-item-info p.user-name {
    display: inline-block;
    margin: 0;
    padding: 6px 10px;
    background: #000 !important;
    color: #fff !important;
    font-size: 12px;
    line-height: 1.3;
    font-weight: 500;
}

.gallery-item-award {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 5px 11px;
    color: #fff;
    font-size: 12px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, 0.34);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(6px);
    white-space: nowrap;
}

.award_gold {
    background: rgba(196, 166, 60, 0.94);
    color: #fff;
}

.award_silver {
    background: rgba(146, 146, 169, 0.94);
    color: #fff;
}

.award_bronze {
    background: rgba(159, 94, 39, 0.94);
    color: #fff;
}

.award_honorable_mention {
    background: rgba(88, 151, 190, 0.94);
    color: #fff;
}

.gallery-item-award.award_gold,
.gallery-item-award.award_winner,
.gallery-item-award.award_first_place,
.gallery-item-award.award_1st_place,
.gallery-item-award.award_grand_prize {
    background: linear-gradient(135deg, #f9df7b 0%, #c99218 100%) !important;
    border-color: rgba(255, 235, 156, 0.78) !important;
    color: #15100a !important;
    text-shadow: none;
}

.gallery-item-award.award_silver,
.gallery-item-award.award_second_place,
.gallery-item-award.award_2nd_place {
    background: linear-gradient(135deg, #f2f5f8 0%, #9aa4b2 100%) !important;
    border-color: rgba(255, 255, 255, 0.72) !important;
    color: #111827 !important;
    text-shadow: none;
}

.gallery-item-award.award_bronze,
.gallery-item-award.award_third_place,
.gallery-item-award.award_3rd_place {
    background: linear-gradient(135deg, #d99a57 0%, #8b4a20 100%) !important;
    border-color: rgba(255, 202, 148, 0.62) !important;
    color: #ffffff !important;
}

.gallery-item-award.award_honorable_mention,
.gallery-item-award.award_honourable_mention {
    background: linear-gradient(135deg, #66b8dc 0%, #245a78 100%) !important;
    border-color: rgba(177, 230, 255, 0.62) !important;
    color: #ffffff !important;
}

.gallery-item:has(.award_gold) {
    order: 1;
}

.gallery-item:has(.award_silver) {
    order: 2;
}

.gallery-item:has(.award_bronze) {
    order: 3;
}

.gallery-item:has(.award_honorable_mention) {
    order: 4;
}

.selected-entries-section .gallery-item.winner-image-out {
    max-width: none;
}

.selected-entries-section img.gallery-item-image {
    max-height: none;
}

.selected-entries-section .gallery-item-image-wrapper {
    aspect-ratio: 16 / 10;
}


.win_gallery-category-list.win_gallery-top_entries {
    grid-template-columns: repeat(auto-fill, minmax(540px, 1fr));
}

/* Responsive */
@media (max-width: 1280px) {
    .win_gallery-category-list {
        grid-template-columns: repeat(auto-fill, minmax(210px, 235px));
        justify-content: center;
    }
}

@media (max-width: 980px) {
    .event-gallery-container {
        padding: 36px 18px;
    }

    .win_gallery-category-list {
        grid-template-columns: repeat(auto-fill, minmax(210px, 235px));
        justify-content: center;
        gap: 22px;
    }

    .gallery-modal-body {
        grid-template-columns: 1fr;
    }

    .modal-gallery-section {
        padding: 15px;
    }

    .modal-details-section {
        padding: 20px 15px;
    }
}

@media (max-width: 640px) {
    .event-gallery-container {
        padding: 28px 14px;
    }

    .win_gallery-category-list {
        grid-template-columns: minmax(0, 1fr);
        gap: 22px;
    }

    .gallery-title {
        font-size: 1.85rem;
    }

    .gallery-subtitle {
        font-size: 1.05rem;
    }

    .section-title {
        font-size: 1.45rem;
    }

    .topic-title {
        font-size: 1.3rem;
    }

    .gallery-item-overlay {
        opacity: 1;
        padding: 14px;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0.13) 45%, rgba(0, 0, 0, 0.72) 100%);
    }

    .gallery-item:hover {
        transform: none;
    }

    .gallery-item:hover .gallery-item-image-wrapper img,
    .gallery-item:hover img.gallery-item-image {
        transform: none;
    }

    .gallery-item-award {
        min-height: 25px;
        padding: 5px 10px;
        font-size: 11px;
    }

    .social-share-buttons {
        flex-direction: column;
    }

    .social-share-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Responsive safety for gallery shortcodes embedded in narrow themes. */
.event-gallery-container,
.event-gallery-container * {
    box-sizing: border-box;
}

.event-gallery-container {
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.event-gallery-container img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 980px) {
    .gallery-modal-body,
    .entry-type-section,
    .gallery-grid,
    .event-gallery-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .gallery-title,
    .entry-type-title,
    .modal-entry-title {
        font-size: 22px;
        line-height: 1.2;
    }

    .gallery-modal-content {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    .event-gallery-container {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Final gallery theme cascade lock. */
body[class*="photo-award-global-template-"] .event-gallery-container {
    background: var(--pa-theme-page-bg, #fff) !important;
    color: var(--pa-theme-ink, #111) !important;
    font-family: var(--pa-theme-body, inherit) !important;
}

body[class*="photo-award-global-template-"] .gallery-title,
body[class*="photo-award-global-template-"] .winners-section h2,
body[class*="photo-award-global-template-"] h4.gallery-item-title,
body[class*="photo-award-global-template-"] .gallery-modal-content h2,
body[class*="photo-award-global-template-"] .gallery-modal-content h3 {
    color: var(--pa-theme-ink, #111) !important;
    font-family: var(--pa-theme-display, inherit) !important;
    letter-spacing: -0.035em;
}

body[class*="photo-award-global-template-"] .gallery-item,
body[class*="photo-award-global-template-"] .gallery-modal-content,
body[class*="photo-award-global-template-"] .modal-gallery-section,
body[class*="photo-award-global-template-"] .selected-entries-section .gallery-item {
    background: var(--pa-theme-surface, #fff) !important;
    border-color: var(--pa-theme-line, #ddd) !important;
    border-radius: var(--pa-theme-radius, 0) !important;
    box-shadow: var(--pa-theme-shadow, none) !important;
    color: var(--pa-theme-ink, #111) !important;
}

body[class*="photo-award-global-template-"] .gallery-item-award,
body[class*="photo-award-global-template-"] .modal-photographer-profile-link {
    background: var(--pa-theme-accent, #b88a2e) !important;
    border-color: var(--pa-theme-accent, #b88a2e) !important;
    border-radius: var(--pa-theme-radius, 0) !important;
    color: var(--pa-theme-on-accent, #fff) !important;
    font-family: var(--pa-theme-mono, inherit) !important;
    letter-spacing: .08em;
}

body.photo-award-global-template-prestige-gold .gallery-item,
body.photo-award-global-template-prestige-gold .gallery-modal-content {
    border-width: 2px !important;
}

body.photo-award-global-template-prestige-gold .gallery-title,
body.photo-award-global-template-prestige-gold .winners-section h2,
body.photo-award-global-template-midnight-cinema .gallery-title,
body.photo-award-global-template-midnight-cinema .winners-section h2 {
    text-transform: uppercase;
}

body.photo-award-global-template-midnight-cinema .gallery-modal-overlay {
    background: rgba(0, 0, 0, .88) !important;
}

body.photo-award-global-template-midnight-cinema .gallery-modal-close {
    background: var(--pa-theme-accent, #d4ff00) !important;
    color: var(--pa-theme-on-accent, #000) !important;
}

body.photo-award-global-template-gallery-curator .gallery-item:hover .gallery-item-image-wrapper img,
body.photo-award-global-template-gallery-curator .gallery-item:hover img.gallery-item-image {
    transform: scale(1.025);
}

body.photo-award-global-template-signal-ops .gallery-item,
body.photo-award-global-template-signal-ops .gallery-modal-content {
    border-top-width: 3px !important;
}

body.photo-award-global-template-signal-ops .gallery-title,
body.photo-award-global-template-signal-ops .winners-section h2 {
    font-style: italic;
}


/* Public winners gallery: match the site's dark and red interface. */
body.event-gallery-page .event-gallery-container {
  background: #101216 !important;
  color: #f5f6f8 !important;
  max-width: 1480px;
  padding: 40px 24px;
}
body.event-gallery-page .gallery-title,
body.event-gallery-page .gallery-subtitle,
body.event-gallery-page .topic-title,
body.event-gallery-page .entry-type-title,
body.event-gallery-page .gallery-item-title,
body.event-gallery-page .gallery-modal-content h2,
body.event-gallery-page .gallery-modal-content h3,
body.event-gallery-page .gallery-modal-content p {
  color: #f5f6f8 !important;
}
body.event-gallery-page .gallery-subtitle,
body.event-gallery-page .gallery-item-info p { color: #c2c7d0 !important; }
body.event-gallery-page .topic-section,
body.event-gallery-page .entry-type-section { color: #f5f6f8 !important; }
body.event-gallery-page .gallery-item,
body.event-gallery-page .gallery-modal-content,
body.event-gallery-page .modal-gallery-section {
  background: #171a20 !important;
  color: #f5f6f8 !important;
  border: 1px solid #343a45 !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.24) !important;
}
body.event-gallery-page .gallery-item-award,
body.event-gallery-page .modal-photographer-profile-link,
body.event-gallery-page .gallery-modal-close {
  background: #ed1028 !important;
  border-color: #ed1028 !important;
  color: #fff !important;
}
body.event-gallery-page .gallery-item-image,
body.event-gallery-page .gallery-item-image-wrapper img,
body.event-gallery-page #modal-main-image {
  filter: none !important;
  -webkit-filter: none !important;
  opacity: 1 !important;
}
body.event-gallery-page .user-country,
body.event-gallery-page .modal-author-country { display: none !important; }
body.event-gallery-page .selected-entries-section { border-color: #343a45 !important; }

/* Category labels use the site red with readable white text. */
body.event-gallery-page .topic-title {
  text-transform: uppercase;
  background: #ed1028 !important;
  border-color: #ed1028 !important;
  color: #ffffff !important;
}

/* Clear category boundaries and consistent single/series spacing. */
body.event-gallery-page .winners-section { margin-bottom: 0; }
body.event-gallery-page .topic-section {
    margin: 0 0 44px;
    padding: 32px 0 0;
    border-top: 1px solid #343a45;
}
body.event-gallery-page .topic-section:first-child { padding-top: 0; border-top: 0; }
body.event-gallery-page .topic-section:last-child { margin-bottom: 0; }
body.event-gallery-page .topic-title {
    max-width: 100%;
    margin: 0 0 24px;
    padding: 8px 14px;
    line-height: 1.25;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}
body.event-gallery-page .entry-type-section { margin: 0; }
body.event-gallery-page .entry-type-section + .entry-type-section { margin-top: 28px; }
body.event-gallery-page .entry-type-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0 0 18px;
    padding: 0;
    border: 0;
    color: #e3e5e9 !important;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0;
}
body.event-gallery-page .entry-type-title::after {
    content: '';
    flex: 1;
    min-width: 0;
    height: 1px;
    background: #292e37;
}
body.event-gallery-page .topic-section .win_gallery-category-list {
    justify-content: start;
    gap: 24px;
}
body.event-gallery-page .selected-entries-section { margin-bottom: 36px; padding-bottom: 32px; }
@media (max-width: 640px) {
    body.event-gallery-page .topic-section { padding-top: 26px; margin-bottom: 32px; }
    body.event-gallery-page .topic-title { margin-bottom: 20px; padding: 7px 12px; }
    body.event-gallery-page .entry-type-title { font-size: 17px; gap: 12px; margin-bottom: 14px; }
    body.event-gallery-page .topic-section .win_gallery-category-list { gap: 18px; }
    body.event-gallery-page .entry-type-section + .entry-type-section { margin-top: 24px; }
}

/* Keep gallery grids, high-density thumbnails, and previews within the viewport. */
body.event-gallery-page .win_gallery-category-list.win_gallery-top_entries {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
}
body.event-gallery-page .gallery-item-image-wrapper img.gallery-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: auto;
}
body.event-gallery-page .gallery-modal { z-index: 1000001; }
body.event-gallery-page .gallery-modal-content {
    width: min(1200px, calc(100% - 32px));
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-x: hidden;
    overscroll-behavior: contain;
}
body.event-gallery-page .gallery-modal-body { min-width: 0; }
body.event-gallery-page .modal-gallery-section,
body.event-gallery-page .modal-details-section { min-width: 0; }
body.event-gallery-page #modal-main-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 72vh;
    max-height: 72dvh;
    object-fit: contain;
}
body.event-gallery-page .modal-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
body.event-gallery-page .modal-thumbnails {
    flex-wrap: nowrap;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 2px 8px;
}
body.event-gallery-page .modal-thumbnail { flex: 0 0 80px; width: 80px; height: 80px; }
body.event-gallery-page .gallery-modal-close {
    position: fixed;
    top: 16px;
    right: max(16px, calc((100vw - 1200px) / 2 + 16px));
    z-index: 20;
}
body.event-gallery-page .modal-entry-title,
body.event-gallery-page .modal-entry-description,
body.event-gallery-page .modal-author-name { overflow-wrap: anywhere; }
@media (max-width: 640px) {
    body.event-gallery-page .event-gallery-container { padding: 28px 16px; }
    body.event-gallery-page .topic-section .win_gallery-category-list,
    body.event-gallery-page .win_gallery-category-list.win_gallery-top_entries { grid-template-columns: minmax(0, 1fr); }
    body.event-gallery-page .gallery-modal-content {
        width: calc(100% - 16px);
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
    }
    body.event-gallery-page .modal-gallery-section { padding: 44px 12px 16px; }
    body.event-gallery-page .modal-details-section { padding: 16px; }
    body.event-gallery-page .gallery-item-award {
        max-width: calc(100% - 24px);
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

/* Larger entry-type headings on desktop. */
@media (min-width: 1024px) {
  body.event-gallery-page .entry-type-title {
    font-size: 26px;
    line-height: 1.4;
  }
}

/* Compact grand-prize card with an uncropped image. */
body.event-gallery-page .selected-entries-section .win_gallery-top_entries { display: flex !important; flex-wrap: wrap; justify-content: center; gap: 24px; }
body.event-gallery-page .selected-entries-section .gallery-item.winner-image-out { flex: 0 1 640px !important; width: min(100%, 640px) !important; max-width: 640px !important; margin: 0 auto !important; }
body.event-gallery-page .selected-entries-section .gallery-item-image-wrapper { height: auto !important; aspect-ratio: auto !important; background: #101319; overflow: hidden; }
body.event-gallery-page .selected-entries-section img.gallery-item-image { display: block; width: 100% !important; height: auto !important; max-height: 420px !important; object-fit: contain !important; transform: none !important; }
body.event-gallery-page .selected-entries-section .gallery-item-overlay { position: relative !important; inset: auto !important; opacity: 1 !important; visibility: visible !important; transform: none !important; background: #151a22 !important; padding: 18px 20px !important; }
body.event-gallery-page .selected-entries-section .gallery-item-title { font-size: clamp(19px, 2vw, 25px) !important; line-height: 1.35 !important; margin: 0 0 8px !important; }
body.event-gallery-page .selected-entries-section .user-name { font-size: 17px !important; margin: 0 !important; color: #fff !important; }
@media(max-width: 640px) { body.event-gallery-page .selected-entries-section img.gallery-item-image { max-height: 320px !important; } }

/* Align the grand-prize card with the gallery content. */
body.event-gallery-page .selected-entries-section .win_gallery-top_entries { justify-content: flex-start !important; }
body.event-gallery-page .selected-entries-section .gallery-item.winner-image-out { margin-left: 0 !important; margin-right: auto !important; text-align: left; }

/* Photographer of the Year label. */
body.event-gallery-page .selected-entries-section .gallery-item-title { background: #ffd43b !important; color: #101319 !important; display: inline-block; padding: 8px 12px !important; border-radius: 4px; }

/* Winner gallery: restrained preview, blurred backdrop, no admin toolbar. */
html:has(body.event-gallery-page) { margin-top: 0 !important; }
body.event-gallery-page #wpadminbar { display: none !important; }
html body.event-gallery-page.admin-bar nav.navbar { top: 0 !important; }
html body.event-gallery-page .gallery-modal-overlay { background: rgba(0,0,0,.62) !important; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
html body.event-gallery-page .gallery-modal-content { background: #101319 !important; max-width: 1100px !important; width: calc(100% - 32px) !important; margin: 24px auto !important; padding: 52px 0 0 !important; position: relative; }
html body.event-gallery-page .modal-gallery-section { padding: 16px 24px 24px !important; }
html body.event-gallery-page .modal-main-image { height: auto !important; min-height: 0 !important; display: flex; justify-content: center; align-items: center; background: transparent !important; }
html body.event-gallery-page #modal-main-image { width: auto !important; height: auto !important; max-width: min(600px, 100%) !important; max-height: min(600px, calc(100dvh - 220px)) !important; object-fit: contain !important; }
html body.event-gallery-page .modal-details-section { padding: 20px 24px 24px !important; }
html body.event-gallery-page .modal-entry-title { padding: 20px 0 24px !important; margin: 0 !important; line-height: 1.5 !important; overflow-wrap: anywhere; }
html body.event-gallery-page .gallery-modal-close { position: absolute !important; top: 8px !important; right: 12px !important; width: 40px !important; height: 40px !important; padding: 0 !important; z-index: 5; }

html body.event-gallery-page .gallery-modal { background: transparent !important; }
html body.event-gallery-page .gallery-modal-overlay { position: fixed !important; inset: 0 !important; z-index: 0 !important; }
html body.event-gallery-page .gallery-modal-content { z-index: 1 !important; }
