/* Modern public theme inspired by the supplied gallery layout. */
body.public-body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Let the selected site background show through list-page content panels. */
.public-page.popular-page,
.public-page.models-page,
.public-page.category-page {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.gallery-page {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.site-header {
    background-color: var(--site-bg);
    border-bottom: 0;
}

body.site-bg--pattern .site-header,
body.site-bg--custom .site-header {
    background-color: transparent;
}

.site-nav {
    gap: 4px;
}

.site-nav > a,
.site-nav__category-toggle {
    position: relative;
    border-radius: 9px;
    color: var(--muted);
    font-weight: 550;
    transition: color .16s ease, background-color .16s ease, transform .16s ease;
}

.site-nav > a:hover,
.site-nav__category-toggle:hover {
    background: var(--soft, #eef2f7);
    color: var(--text);
}

.site-nav__category-toggle {
    justify-content: center;
    gap: 6px;
}

.site-nav__category-caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0;
}

.site-nav__category-caret svg {
    display: block;
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.category-mega-menu {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 18px 40px rgb(20 22 28 / 16%);
}

.category-mega-menu .category-mega-menu__column a,
.category-mega-menu .category-mega-menu__mobile a {
    border-radius: 8px;
    color: var(--text);
}

.category-mega-menu .category-mega-menu__column a:hover,
.category-mega-menu .category-mega-menu__mobile a:hover {
    background: var(--soft, #eef2f7);
    color: var(--text);
    text-decoration: none;
}

/* Do not reserve the ad column when no gallery sidebar ad is rendered. */
.gallery-page__media-layout--full {
    grid-template-columns: minmax(0, 1fr);
}

.gallery-grid {
    gap: 18px;
}

.gallery-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgb(20 22 28 / 6%), 0 8px 24px rgb(20 22 28 / 8%);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.gallery-card__link {
    height: 100%;
}

.gallery-card__media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    background: #e9edf2;
}

.gallery-card__media .gallery-card__cover,
.gallery-card__media .gallery-card__placeholder {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    object-fit: cover;
    transition: transform .45s ease;
}

.gallery-card__media .gallery-card__placeholder {
    display: grid;
    place-items: center;
}

.gallery-card__count {
    position: absolute;
    z-index: 1;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid rgb(255 255 255 / 20%);
    border-radius: 999px;
    background: rgb(15 17 21 / 74%);
    color: #fff;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.2;
    backdrop-filter: blur(6px);
}

.gallery-card__count svg,
.gallery-card__views svg {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gallery-card__open {
    position: absolute;
    right: 12px;
    bottom: 12px;
    left: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 650;
    text-align: center;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .2s ease, transform .2s ease;
}

.gallery-card__body {
    padding: 14px 16px 16px;
}

.gallery-card__title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
}

.gallery-card__meta {
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
}

.gallery-card__views {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
}

/* Admin setting "Выделять страницу в меню": use the primary-button treatment. */
.site-nav a.is-highlighted,
.site-nav--pill a.is-highlighted {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    font-weight: 650;
    box-shadow: 0 2px 8px rgb(37 99 235 / 22%);
    animation: none;
}

.site-nav a.is-highlighted:hover,
.site-nav a.is-highlighted:focus-visible,
.site-nav--pill a.is-highlighted:hover,
.site-nav--pill a.is-highlighted:focus-visible {
    background: var(--accent-hover);
    color: #fff;
    box-shadow: 0 4px 12px rgb(37 99 235 / 28%);
}

.gallery-card__link:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.gallery-card:hover,
.gallery-card:focus-within {
    border-color: transparent;
    box-shadow: 0 4px 8px rgb(20 22 28 / 8%), 0 18px 40px rgb(20 22 28 / 16%);
    transform: translateY(-4px);
}

.gallery-card:hover .gallery-card__media .gallery-card__cover,
.gallery-card:focus-within .gallery-card__media .gallery-card__cover {
    transform: scale(1.05);
}

.gallery-card:hover .gallery-card__open,
.gallery-card:focus-within .gallery-card__open {
    opacity: 1;
    transform: none;
}

@media (max-width: 720px) {
    .site-nav__category-toggle {
        display: inline-flex;
        justify-content: space-between;
        text-align: left;
    }

    .gallery-grid {
        gap: 12px;
    }

    .gallery-card__title {
        font-size: 16px;
    }
}

@media (hover: none) {
    .gallery-card__open {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-nav > a,
    .site-nav__category-toggle,
    .gallery-card,
    .gallery-card__media .gallery-card__cover,
    .gallery-card__open {
        transition: none;
    }
}
