/**
 * Compact gallery layout – list + detail
 */

/* Gallery-specific (shared header/footer: site-theme.css) */
/* List page canvas: site-theme.css (--site-page-bg) */

body.page-gallery-detail {
    line-height: 1.35;
    background: #eceff1;
}

body.page-gallery-detail header {
    padding: 6px 12px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

body.page-gallery-detail .logo-image {
    height: 44px;
}

/* Category nav – plain text row */
.gallery-page--joomla {
    width: 100%;
    background: #fff;
}

.gallery-cat-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    padding: 10px 16px 12px;
    border-bottom: 1px solid #ebebeb;
    background: #fff;
}

body.page-gallery-list .gallery-cat-nav,
body.page-gallery-list .gallery-list-meta {
    padding-left: var(--gallery-album-inset, 18px);
    padding-right: var(--gallery-album-inset, 18px);
}

.gallery-cat-nav__link {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 400;
    color: #777;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s;
    border: none;
    background: none;
    border-radius: 0;
}

.gallery-cat-nav__link:hover {
    color: #333;
    background: none;
    transform: none;
}

.gallery-cat-nav__link.is-active {
    color: #222;
    font-weight: 600;
    background: none;
}

.gallery-list-meta {
    padding: 6px 16px;
    font-size: 12px;
    color: #888;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.gallery-list-meta__count {
    margin-left: auto;
}

.gallery-container--joomla {
    max-width: none !important;
    margin: 0 !important;
}

body.page-gallery-list .gallery-container--joomla {
    padding: var(--gallery-album-inset, var(--gallery-mosaic-gap, 18px)) !important;
    box-sizing: border-box;
}

/*
 * Mosaic: CSS columns as no-JS fallback; JS reflows into flex columns for left-to-right publish order.
 */
body.page-gallery-list .gallery.gallery--joomla.gallery--mosaic {
    display: block !important;
    column-count: 5 !important;
    column-gap: var(--gallery-mosaic-gap, 18px) !important;
    column-fill: balance;
    column-width: auto;
    grid-template-columns: none !important;
    grid-auto-rows: unset !important;
    gap: unset !important;
    margin-bottom: calc(-1 * var(--gallery-mosaic-gap, 18px));
    width: 100%;
    box-sizing: border-box;
}

body.page-gallery-list .gallery.gallery--joomla.gallery--mosaic.gallery--mosaic-row-flow {
    display: flex !important;
    flex-direction: row;
    align-items: flex-start;
    gap: var(--gallery-mosaic-gap, 18px) !important;
    column-count: unset !important;
    column-fill: unset;
    margin-bottom: 0;
}

body.page-gallery-list .gallery--mosaic-row-flow > .gallery-mosaic-col {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--gallery-mosaic-gap, 18px) !important;
}

body.page-gallery-list .gallery--mosaic-row-flow > .gallery-mosaic-col > .gallery-card {
    margin: 0 !important;
    break-inside: auto;
    page-break-inside: auto;
    -webkit-column-break-inside: auto;
}

body.page-gallery-list .gallery.gallery--joomla.gallery--mosaic:not(.gallery--mosaic-row-flow) .gallery-card {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 0 var(--gallery-mosaic-gap, 18px);
    box-sizing: border-box;
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
}

.gallery-card {
    margin: 0;
    background: #fff;
    border: 1px solid #e8e8e8;
    overflow: hidden;
}

/* Polaroid-style tile + Apple-like hover / press */
.gallery--mosaic .gallery-card--polaroid {
    position: relative;
    z-index: 0;
    background: #fff;
    border: none;
    border-radius: 2px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.06),
        0 4px 14px rgba(0, 0, 0, 0.08);
    overflow: visible;
    transform: translate3d(0, 0, 0);
    transition:
        transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        box-shadow 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, box-shadow;
}

.gallery--mosaic .gallery-card--polaroid:hover {
    z-index: 3;
    transform: translate3d(0, -6px, 0) scale(1.018);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.04),
        0 16px 36px rgba(0, 0, 0, 0.14),
        0 0 0 1px rgba(0, 0, 0, 0.03);
}

.gallery--mosaic .gallery-card--polaroid:active {
    z-index: 3;
    transition-duration: 0.14s;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transform: translate3d(0, -2px, 0) scale(0.988);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.08),
        0 6px 18px rgba(0, 0, 0, 0.1);
}

.gallery--mosaic .gallery-card--polaroid .gallery-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    border-radius: 2px;
}

.gallery--mosaic .gallery-card--polaroid .gallery-card__link:focus-visible {
    outline: 2px solid #7eb8d8;
    outline-offset: 4px;
}

.gallery--mosaic .gallery-card--polaroid .gallery-card__photo {
    border: 1px solid #c5c5c5;
    border-bottom: none;
    padding: 10px 10px 0;
    background: #fff;
    box-sizing: border-box;
}

.gallery--mosaic .gallery-card--polaroid .gallery-card__image {
    aspect-ratio: auto;
    overflow: hidden;
    background: #f0f0f0;
    line-height: 0;
    border-radius: 1px;
}

.gallery--mosaic .gallery-card--polaroid .gallery-card__caption {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px 12px;
    background: #fff;
    border: 1px solid #c5c5c5;
    border-top: none;
    box-sizing: border-box;
}

.gallery--mosaic .gallery-card--polaroid .gallery-card__title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
    color: #333;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery--mosaic .gallery-card--polaroid .gallery-card__stats {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    font-size: 11px;
    color: #777;
    line-height: 1;
}

.gallery--mosaic .gallery-card--polaroid .gallery-card__stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.gallery--mosaic .gallery-card--polaroid .gallery-card__stat i {
    font-size: 11px;
    color: #999;
}

.gallery--mosaic .gallery-card--polaroid .gallery-card__stat--likes i {
    color: #d45c5c;
}

.gallery-card__stat--likes,
.publication-stats__likes,
.stat.likes {
    cursor: pointer;
}

.gallery-card__stat--likes.is-liked i,
.publication-stats__likes.is-liked i,
.stat.likes.is-liked i,
.gallery-neighbor-card__stat--likes.is-liked i {
    color: #e74c3c;
}

.gallery-card__stat--likes.is-liked,
.publication-stats__likes.is-liked,
.stat.likes.is-liked {
    font-weight: 600;
}

.gallery--mosaic .gallery-card--polaroid .gallery-card__image img {
    transform: scale(1);
    transition:
        transform 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        opacity 0.4s ease;
    backface-visibility: hidden;
}

.gallery--mosaic .gallery-card--polaroid:hover .gallery-card__image img {
    transform: scale(1.045);
}

.gallery--mosaic .gallery-card--polaroid:active .gallery-card__image img {
    transform: scale(1.02);
    transition-duration: 0.12s;
}

.gallery--mosaic .gallery-card--polaroid:hover .gallery-card__title {
    color: #111;
}

.gallery--mosaic .gallery-card--polaroid .gallery-card__title {
    transition: color 0.35s ease;
}

@media (prefers-reduced-motion: reduce) {
    .gallery--mosaic .gallery-card--polaroid,
    .gallery--mosaic .gallery-card--polaroid .gallery-card__image img,
    .gallery--mosaic .gallery-card--polaroid .gallery-card__title {
        transition: none;
    }

    .gallery--mosaic .gallery-card--polaroid:hover,
    .gallery--mosaic .gallery-card--polaroid:active {
        transform: none;
    }

    .gallery--mosaic .gallery-card--polaroid:hover .gallery-card__image img,
    .gallery--mosaic .gallery-card--polaroid:active .gallery-card__image img {
        transform: none;
    }
}

.gallery-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.gallery-card__link:hover .gallery-card__image img {
    opacity: 0.92;
}

.gallery--mosaic .gallery-card__image {
    aspect-ratio: auto;
    overflow: hidden;
    background: #f5f5f5;
    line-height: 0;
}

.gallery-card__image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f5f5f5;
    line-height: 0;
}

.gallery--mosaic .gallery-card__image img {
    width: 100%;
    height: auto;
    max-width: 100%;
    display: block;
    transition: opacity 0.2s;
}

.gallery-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s;
}

/* Legacy bar (non-polaroid) */
.gallery-card__bar,
.gallery-card__caption {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px 10px;
    min-height: 44px;
    border-top: 1px solid #f0f0f0;
}

.gallery-card__title {
    flex: 1;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-card__stats {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 11px;
    color: #888;
    line-height: 1.2;
}

.gallery-card__stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.gallery-card__stat i {
    font-size: 10px;
    color: #aaa;
}

.gallery-card__stat--likes i {
    color: #e74c3c;
}

.no-results--joomla {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.gallery-pagination--joomla {
    margin-top: 16px;
    gap: 6px;
}

@media (max-width: 1100px) {
    body.page-gallery-list .gallery.gallery--joomla.gallery--mosaic {
        column-count: 4 !important;
    }
}

@media (max-width: 850px) {
    body.page-gallery-list .gallery.gallery--joomla.gallery--mosaic {
        column-count: 3 !important;
    }
}

@media (max-width: 768px) {
    .gallery-cat-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    body.page-gallery-list header nav {
        display: none;
    }
}

@media (max-width: 520px) {
    body.page-gallery-list .gallery.gallery--joomla.gallery--mosaic {
        column-count: 2 !important;
    }
}

@media (max-width: 480px) {
    .gallery-card__title {
        font-size: 10px;
    }
}

/* Gallery detail layout shell: site-theme.css (same as competitions .articles-layout) */
body.page-gallery-detail .gallery-detail {
    max-width: none;
    margin: 0;
    padding: 0 !important;
}

/* Sidebar категории/тагове: site-theme.css */

/* Static cover (competition detail — no slider) */
.publication-hero-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: min(52vh, 520px);
    min-height: 200px;
    margin-bottom: 8px;
    border-radius: 6px;
    overflow: hidden;
    background: #1c2329;
    border: 1px solid #2c3e50;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
}

.publication-hero-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Hero slider (replaces static cover) */
.gallery-hero-slider {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: min(52vh, 520px);
    min-height: 200px;
    margin-bottom: 8px;
    border-radius: 6px;
    overflow: hidden;
    background: #1c2329;
    border: 1px solid #2c3e50;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
}

.gallery-hero-slider__viewport {
    position: relative;
    width: 100%;
    height: 100%;
}

.gallery-hero-slider__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.7s ease;
    pointer-events: none;
}

.gallery-hero-slider__slide.is-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
}

.gallery-hero-slider__slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transform: scale(1);
    transition: transform 7s ease-out;
}

.gallery-hero-slider__slide.is-active img {
    transform: scale(1.08);
}

.gallery-hero-slider__shade {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.55) 0%,
        rgba(0, 0, 0, 0.1) 35%,
        transparent 60%
    );
}

.gallery-hero-slider__btn {
    position: absolute;
    top: 50%;
    z-index: 4;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #2c3e50;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    transition: background 0.2s, transform 0.2s;
}

.gallery-hero-slider__btn:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.06);
}

.gallery-hero-slider__btn--prev {
    left: 10px;
}

.gallery-hero-slider__btn--next {
    right: 10px;
}

.gallery-hero-slider__footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    gap: 12px;
}

.gallery-hero-slider__dots {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gallery-hero-slider__dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.gallery-hero-slider__dot.is-active {
    background: #fff;
    transform: scale(1.25);
}

.gallery-hero-slider__counter {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

.gallery-hero-slider__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 5;
    background: rgba(255, 255, 255, 0.2);
}

.gallery-hero-slider__progress span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #3498db, #9b59b6);
    transition: width 0.1s linear;
}

.gallery-hero-slider.is-paused .gallery-hero-slider__progress span {
    transition: none;
}

.gallery-hero-slider__open-all {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 4;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}

.gallery-hero-slider__open-all:hover {
    background: rgba(52, 152, 219, 0.85);
}

.gallery-hero-slider__viewport {
    cursor: pointer;
}

@media (max-width: 768px) {
    .gallery-hero-slider {
        aspect-ratio: 4 / 3;
        max-height: 42vh;
        min-height: 180px;
    }

    .gallery-hero-slider__btn {
        width: 34px;
        height: 34px;
        font-size: 12px;
    }
}

/* —— Unified publication detail header (gallery / competition / article / event) —— */
.publication-detail-header,
.gallery-detail-header {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 12px 14px !important;
    margin-bottom: 8px !important;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.publication-detail-header__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    width: 100%;
}

.publication-detail-title,
.publication-detail-header h1,
.gallery-detail-header h1 {
    flex: 1 1 auto;
    min-width: min(100%, 220px);
    margin: 0 !important;
    font-family: Georgia, "Times New Roman", "Segoe UI", serif;
    font-size: clamp(1.35rem, 2.6vw, 1.9rem) !important;
    font-weight: 700;
    line-height: 1.22;
    letter-spacing: -0.02em;
    color: #1a2a3a;
}

.publication-detail-meta,
.gallery-meta {
    flex: 0 1 auto;
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px 10px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-bottom: none !important;
}

.publication-detail-meta .category,
.gallery-meta .category {
    padding: 4px 10px !important;
    font-size: 0.72rem !important;
    font-weight: 600;
    border-radius: 4px !important;
    line-height: 1.2;
    background: #3498db;
    color: #fff;
}

.publication-detail-meta .tags,
.gallery-meta .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px !important;
}

.publication-detail-meta .tag,
.gallery-meta .tag {
    padding: 2px 7px !important;
    font-size: 0.7rem !important;
    border-radius: 4px !important;
    line-height: 1.2;
    border: 1px solid;
}

.publication-detail-meta .stats,
.gallery-meta .stats {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.publication-detail-meta .stat.likes,
.gallery-meta .stat.likes {
    cursor: pointer;
}

.publication-detail-meta .stat.likes:hover,
.gallery-meta .stat.likes:hover {
    color: #e74c3c;
}

.publication-detail-meta .stat,
.publication-detail-meta .author,
.publication-detail-meta .date,
.publication-detail-meta .location,
.gallery-meta .stat,
.gallery-meta .author,
.gallery-meta .date,
.gallery-meta .location {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem !important;
    color: #555;
    white-space: nowrap;
}

.publication-detail-meta .stat__value,
.gallery-meta .stat__value {
    font-weight: 600;
    color: #2c3e50;
}

.publication-detail-meta .stat i,
.publication-detail-meta .author i,
.publication-detail-meta .date i,
.publication-detail-meta .location i,
.gallery-meta .stat i,
.gallery-meta .author i,
.gallery-meta .date i,
.gallery-meta .location i {
    font-size: 0.72rem;
    color: #aaa;
}

.publication-detail-meta .stat.likes i,
.gallery-meta .stat.likes i {
    color: #e74c3c;
}

.publication-detail-header .gallery-description,
.publication-detail-header .publication-detail-body {
    width: 100%;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.publication-detail-body,
.gallery-description {
    font-size: 14px;
    line-height: 1.45;
}

.publication-detail > .publication-detail-body {
    margin-top: 0;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.publication-detail-body h2,
.publication-detail-body h3,
.publication-detail-body h4 {
    color: #2c3e50;
    margin: 1.2em 0 0.6em;
    line-height: 1.3;
}

.publication-detail-body h2 { font-size: 1.35rem; }
.publication-detail-body h3 { font-size: 1.15rem; }
.publication-detail-body h4 { font-size: 1rem; }

.publication-detail-body p {
    margin: 0 0 1em;
}

.publication-detail-body ul,
.publication-detail-body ol {
    margin: 0 0 1em 1.4em;
    padding: 0;
}

.publication-detail-body li {
    margin-bottom: 0.35em;
}

.publication-detail-body blockquote {
    margin: 1em 0;
    padding: 10px 14px;
    border-left: 3px solid #3498db;
    background: #f8f9fa;
    color: #555;
}

.publication-detail-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

@media (max-width: 720px) {
    .publication-detail-header__top {
        align-items: flex-start;
    }

    .publication-detail-title,
    .publication-detail-header h1,
    .gallery-detail-header h1 {
        flex: 1 1 100%;
    }

    .publication-detail-meta,
    .gallery-meta {
        flex: 1 1 100%;
        justify-content: flex-start !important;
    }
}

/* Embedded gallery in description – compact toolbar + grid */
body.page-gallery-detail .gallery-description .embedded-media-gallery,
body.page-competitions .gallery-description .embedded-media-gallery {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    align-items: center;
    margin: 6px 0 !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

body.page-gallery-detail .gallery-description .embedded-media-gallery .media-gallery-header,
body.page-competitions .gallery-description .embedded-media-gallery .media-gallery-header {
    grid-column: 1;
    grid-row: 1;
    padding: 6px 10px !important;
    background: #f8f9fa;
    border-bottom: none !important;
}

body.page-gallery-detail .gallery-description .embedded-media-gallery .media-gallery-header h3,
body.page-competitions .gallery-description .embedded-media-gallery .media-gallery-header h3 {
    margin: 0 !important;
    font-size: 0.9rem !important;
    font-weight: 600;
    line-height: 1.3;
}

body.page-gallery-detail .gallery-description .embedded-media-gallery .media-description {
    font-size: 12px;
    line-height: 1.35;
    margin-top: 2px !important;
}

body.page-gallery-detail .gallery-description .embedded-media-gallery .gallery-actions,
body.page-competitions .gallery-description .embedded-media-gallery .gallery-actions {
    grid-column: 2;
    grid-row: 1;
    display: flex !important;
    padding: 4px 8px !important;
    margin: 0 !important;
    gap: 6px !important;
    border-bottom: none !important;
    background: #f8f9fa;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
}

body.page-gallery-detail .gallery-description .embedded-media-gallery .gallery-actions .action-btn,
body.page-competitions .gallery-description .embedded-media-gallery .gallery-actions .action-btn {
    padding: 4px 10px !important;
    font-size: 0.72rem !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    white-space: nowrap;
}

body.page-gallery-detail .gallery-description .embedded-media-gallery .gallery-actions .action-btn:hover,
body.page-competitions .gallery-description .embedded-media-gallery .gallery-actions .action-btn:hover {
    transform: none !important;
    box-shadow: none !important;
}

body.page-gallery-detail .gallery-description .embedded-media-gallery .gallery-actions .action-btn i,
body.page-competitions .gallery-description .embedded-media-gallery .gallery-actions .action-btn i {
    font-size: 0.75rem !important;
}

body.page-gallery-detail .gallery-description .embedded-media-gallery .media-gallery-grid,
body.page-competitions .gallery-description .embedded-media-gallery .media-gallery-grid {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid !important;
    padding: 8px !important;
    max-height: none !important;
    border-top: 1px solid #e9ecef;
}

body.page-gallery-detail .gallery-description .embedded-media-gallery .gallery-item,
body.page-competitions .gallery-description .embedded-media-gallery .gallery-item {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    min-height: 0;
    border-radius: 3px !important;
    box-shadow: none !important;
}

body.page-gallery-detail .gallery-description .embedded-media-gallery .gallery-item img,
body.page-competitions .gallery-description .embedded-media-gallery .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

body.page-gallery-detail .gallery-description .embedded-media-gallery .gallery-item:hover,
body.page-competitions .gallery-description .embedded-media-gallery .gallery-item:hover {
    transform: none !important;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.35) !important;
}

body.page-gallery-detail .gallery-description--embedded-media {
    margin-top: 10px;
    padding-top: 0;
}

body.page-gallery-detail .gallery-description .embedded-media-gallery .media-gallery-info,
body.page-competitions .gallery-description .embedded-media-gallery .media-gallery-info {
    grid-column: 1 / -1;
    grid-row: 3;
    padding: 5px 10px !important;
    font-size: 11px;
    background: #f8f9fa;
}

@media (max-width: 720px) {
    body.page-gallery-detail .gallery-description .embedded-media-gallery,
    body.page-competitions .gallery-description .embedded-media-gallery {
        grid-template-columns: 1fr !important;
    }

    body.page-gallery-detail .gallery-description .embedded-media-gallery .gallery-actions,
    body.page-competitions .gallery-description .embedded-media-gallery .gallery-actions {
        grid-column: 1;
        grid-row: 2;
        justify-content: flex-start !important;
        padding: 0 10px 6px !important;
        border-bottom: 1px solid #e9ecef !important;
    }

    body.page-gallery-detail .gallery-description .embedded-media-gallery .media-gallery-grid,
    body.page-competitions .gallery-description .embedded-media-gallery .media-gallery-grid {
        grid-row: 3;
    }

    body.page-gallery-detail .gallery-description .embedded-media-gallery .media-gallery-info,
    body.page-competitions .gallery-description .embedded-media-gallery .media-gallery-info {
        grid-row: 4;
    }
}

body.page-gallery-detail .gallery-media,
body.page-competitions .gallery-media {
    padding: 8px !important;
    border-radius: 4px;
    margin-top: 12px;
    background: transparent !important;
    box-shadow: none !important;
}

body.page-gallery-detail .gallery-media__title,
body.page-competitions .gallery-media__title {
    margin: 0 0 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
}

body.page-gallery-detail .gallery-media .media-info,
body.page-competitions .gallery-media .media-info {
    background: #f8f9fa;
    padding: 10px 12px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.45;
}

body.page-gallery-detail .gallery-media .media-info p,
body.page-competitions .gallery-media .media-info p {
    margin: 0 0 4px;
}

body.page-gallery-detail .gallery-media .media-info__tags,
body.page-competitions .gallery-media .media-info__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

body.page-gallery-detail .gallery-media .media-info .tag,
body.page-competitions .gallery-media .media-info .tag {
    font-size: 12px;
    padding: 4px 10px;
    margin: 0;
    border-radius: 15px;
    border: 1px solid;
}

body.page-gallery-detail .media-grid,
body.page-gallery-detail .media-gallery-grid,
body.page-competitions .media-grid,
body.page-competitions .media-gallery-grid {
    gap: 8px !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

body.page-gallery-detail .media-grid__empty,
body.page-competitions .media-grid__empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    margin: 0;
    font-size: 13px;
}

body.page-gallery-detail .media-grid__empty--error,
body.page-competitions .media-grid__empty--error {
    color: #e74c3c;
}

@media (max-width: 900px) {
    body.page-gallery-detail .media-grid,
    body.page-gallery-detail .media-gallery-grid,
    body.page-competitions .media-grid,
    body.page-competitions .media-gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 600px) {
    body.page-gallery-detail .media-grid,
    body.page-gallery-detail .media-gallery-grid,
    body.page-competitions .media-grid,
    body.page-competitions .media-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

body.page-gallery-detail .media-item,
body.page-competitions .media-item {
    height: 120px;
    border-radius: 3px;
}

body.page-gallery-detail .media-item--openable,
body.page-competitions .media-item--openable {
    cursor: pointer;
}

body.page-gallery-detail .media-item--openable:hover,
body.page-competitions .media-item--openable:hover {
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.45);
}

body.page-gallery-detail .media-item--openable:focus-visible,
body.page-competitions .media-item--openable:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

body.page-gallery-detail .media-item img,
body.page-gallery-detail .media-item video,
body.page-competitions .media-item img,
body.page-competitions .media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.page-gallery-list footer,
body.page-gallery-detail footer,
body.page-publication-detail footer,
body.page-competition-detail footer,
body.page-article-detail footer,
body.page-event-detail footer {
    margin-top: 0;
    padding: 20px 12px 12px;
}

/* Neighbors strip – full width, long & narrow band (like header edge-to-edge) */
body.page-gallery-detail .gallery-neighbors-strip,
body.page-publication-detail .gallery-neighbors-strip,
body.page-competition-detail .gallery-neighbors-strip,
body.page-article-detail .gallery-neighbors-strip,
body.page-event-detail .gallery-neighbors-strip {
    width: 100%;
    max-width: none;
    margin: 14px 0 0;
    padding: 10px clamp(12px, 2vw, 28px) 12px;
    background: linear-gradient(180deg, #e8ecef 0%, #dfe4e8 100%);
    border-top: 1px solid #cfd4da;
    border-bottom: 1px solid #cfd4da;
    border-radius: 0;
    box-sizing: border-box;
}

.gallery-neighbors-strip__inner {
    width: 100%;
    max-width: none;
    margin: 0;
}

.gallery-neighbors-strip__title {
    margin: 0 0 8px;
    padding: 0 2px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.gallery-neighbors-strip__title i {
    color: #3498db;
    font-size: 0.85rem;
}

.publication-neighbors-strip--gallery .publication-neighbors-strip__icon {
    color: #3498db;
}

.publication-neighbors-strip--competition .publication-neighbors-strip__icon {
    color: #e74c3c;
}

.publication-neighbors-strip--article .publication-neighbors-strip__icon {
    color: #3498db;
}

.publication-neighbors-strip--event .publication-neighbors-strip__icon {
    color: #27ae60;
}

.gallery-neighbors-strip__hint {
    font-size: 0.7rem;
    font-weight: 500;
    color: #6c757d;
}

.gallery-neighbors-strip__track {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-end;
    justify-content: center;
    gap: clamp(12px, 1.8vw, 36px);
    width: 100%;
    min-height: 0;
}

.gallery-neighbors-group {
    display: flex;
    flex-direction: row;
    flex: 1 1 0;
    min-width: 0;
    gap: clamp(8px, 1vw, 14px);
}

.gallery-neighbors-strip__track:has(.gallery-neighbors-group:only-child) {
    justify-content: center;
}

.gallery-neighbors-strip__track:has(.gallery-neighbors-group:only-child) .gallery-neighbors-group {
    flex: 1 1 100%;
    max-width: 100%;
}

/* Narrow band between before / after groups – not a huge empty flex gap on wide screens */
.gallery-neighbors-gap {
    flex: 0 0 clamp(18px, 2vw, 40px);
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 100px;
    margin: 0;
}

.gallery-neighbors-gap__line {
    display: block;
    width: 2px;
    height: 70%;
    max-height: 72px;
    border-radius: 1px;
    background: linear-gradient(
        180deg,
        transparent 0%,
        #b8c0c8 12%,
        #b8c0c8 88%,
        transparent 100%
    );
}

/* Compact polaroid – width grows on large screens; image band keeps fixed height */
.gallery-neighbor-card--compact {
    flex: 1 1 0;
    min-width: clamp(148px, 11vw, 220px);
    max-width: clamp(220px, 16vw, 400px);
    width: auto;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border-radius: 2px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.06),
        0 3px 10px rgba(0, 0, 0, 0.08);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.gallery-neighbor-card--compact:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.gallery-neighbor-card__photo {
    border: 1px solid #c5c5c5;
    border-bottom: none;
    padding: 6px 6px 0;
    background: #fff;
    box-sizing: border-box;
}

.gallery-neighbor-card__image {
    display: block;
    height: 126px;
    overflow: hidden;
    background: #f0f0f0;
    line-height: 0;
}

.gallery-neighbor-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.gallery-neighbor-card--compact:hover .gallery-neighbor-card__image img {
    transform: scale(1.04);
}

.gallery-neighbor-card__caption {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 46px;
    padding: 7px 10px 9px;
    background: #fff;
    border: 1px solid #c5c5c5;
    border-top: none;
    box-sizing: border-box;
}

.gallery-neighbor-card__title {
    font-size: 0.68rem;
    font-weight: 700;
    color: #333;
    line-height: 1.25;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-neighbor-card__footer {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 18px;
}

.gallery-neighbor-card__meta {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: 0.62rem;
    color: #777;
    line-height: 1.2;
}

.gallery-neighbor-card__category {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 2px;
    font-size: 0.6rem;
    font-weight: 600;
    color: #fff;
    background: var(--site-accent, #5eb4b8);
    white-space: nowrap;
}

.gallery-neighbor-card__stats {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    font-size: 0.62rem;
    color: #888;
    white-space: nowrap;
}

.gallery-neighbor-card__stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.gallery-neighbor-card__stat i {
    font-size: 0.6rem;
    color: #aaa;
}

.gallery-neighbor-card__stat--likes i {
    color: #d45c5c;
}

@media (max-width: 1100px) {
    .gallery-neighbor-card--compact {
        min-width: clamp(128px, 28vw, 260px);
        max-width: none;
    }
}

@media (max-width: 900px) {
    .gallery-neighbors-strip__track {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }

    .gallery-neighbors-group {
        flex: 1 1 100%;
        flex-wrap: wrap;
        justify-content: center;
    }

    .gallery-neighbors-gap {
        flex: 1 1 100%;
        order: 1;
        height: 2px;
        min-width: 0;
        margin: 4px 0;
    }

    .gallery-neighbors-group--before {
        order: 0;
    }

    .gallery-neighbors-group--after {
        order: 2;
    }

    .gallery-neighbors-gap__line {
        width: 45%;
        height: 2px;
        max-height: none;
        background: linear-gradient(
            90deg,
            transparent 0%,
            #b8c0c8 20%,
            #b8c0c8 80%,
            transparent 100%
        );
    }

    .gallery-neighbor-card--compact {
        flex: 1 1 calc(33.333% - 12px);
        min-width: 148px;
        max-width: 280px;
    }
}

@media (max-width: 760px) {
    .gallery-neighbor-card--compact {
        flex: 1 1 calc(50% - 10px);
        min-width: 140px;
        max-width: 280px;
    }
}

@media (max-width: 400px) {
    .gallery-neighbor-card--compact {
        flex: 1 1 100%;
        min-width: 0;
        max-width: 320px;
    }
}

@media (max-width: 768px) {
    body.page-gallery-list .gallery-toolbar__count {
        margin-left: 0;
        width: 100%;
    }

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: 4px !important;
    }

    body.page-gallery-list header,
    body.page-gallery-detail header {
        padding: 8px 10px;
    }
}

/* Inline embedded gallery lightbox (inside publication body) */
.embedded-modal {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10050;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.embedded-modal.active {
    opacity: 1;
    visibility: visible;
}

.embedded-modal .modal-content {
    position: relative;
    width: 90%;
    height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.embedded-modal .modal-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.embedded-modal .nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    z-index: 10052;
}

.embedded-modal .nav-btn.prev {
    left: 1rem;
}

.embedded-modal .nav-btn.next {
    right: 1rem;
}

.embedded-modal .image-info {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    z-index: 10052;
}

.embedded-modal .toolbar {
    position: fixed;
    top: 1rem;
    left: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10052;
}

.embedded-modal .tool-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.embedded-modal .tool-btn.active {
    background: #e74c3c;
}

.embedded-modal .close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10053;
    opacity: 0;
    transition: opacity 0.3s;
}

.embedded-modal.active .close {
    opacity: 1;
}

.participant-only-context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.75rem;
    background: rgba(52, 152, 219, 0.06);
}

.participant-only-context__back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #2c3e50;
    font-weight: 600;
    text-decoration: none;
}

.participant-only-context__back:hover {
    color: #2980b9;
}

.participant-only-context__label,
.participant-only-context__participant {
    color: #555;
    font-size: 0.9375rem;
}

.participant-only-context__participant {
    font-weight: 600;
    color: #2c3e50;
}

body.is-participant-only-view .gallery-hero-slider,
body.is-participant-only-view .gallery-description,
body.is-participant-only-view .gallery-detail-header,
body.is-participant-only-view .gallery-sidebar,
body.is-participant-only-view .articles-sidebar,
body.is-participant-only-view .publication-neighbors-strip,
body.is-participant-only-view .publication-content--multi,
body.is-participant-only-view .multi-media-section,
body.is-participant-only-view .multi-media-table-wrap,
body.is-participant-only-view .publication-detail-header {
    display: none !important;
}

body.is-participant-only-view .gallery-detail-layout,
body.is-participant-only-view .site-content-panel--columns {
    display: block;
}

body.is-participant-only-view .gallery-detail-main {
    max-width: none;
}

