/* === Страница галереи /galleries/<slug>/ === */

.gallery-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.gallery-page h1 {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin: 0 0 1rem;
    line-height: 1.2;
}

.gallery-description {
    font-size: 1.05rem;
    color: #444;
    line-height: 1.6;
    text-align: center;
    max-width: 760px;
    margin: 0 auto 1.5rem;
}

.gallery-text-block {
    font-size: 1rem;
    color: #333;
    line-height: 1.65;
    margin: 0 auto 2rem;
    max-width: 860px;
}

.gallery-text-block p { margin: 0 0 1em; }
.gallery-text-block p:last-child { margin-bottom: 0; }

/* === Большой слайдер === */

.big-slider {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    overflow: hidden;
    border-radius: 14px;
    background: #0e0e0e;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

.big-slider-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    max-height: 70vh;
    min-height: 380px;
    background: #0e0e0e;
}

.big-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.45s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow: hidden;
}

.big-slide.active {
    opacity: 1;
    z-index: 1;
}

/* Размытый фон-заливка из самого фото — убирает «чёрные поля» по бокам
   у портретных кадров. URL картинки JS прокидывает через --slide-bg.
   ::before стоит на абсолют-позиции под основным <img>; для портретов
   blurred-фон визуально продолжает кадр на всю ширину. */
.big-slide::before {
    content: '';
    position: absolute;
    inset: -20px;
    background-image: var(--slide-bg, none);
    background-size: cover;
    background-position: center;
    filter: blur(36px) saturate(115%);
    opacity: 0.55;
    z-index: 0;
    transform: translateZ(0);
}

.big-slide img {
    position: relative;
    z-index: 1;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}

.big-slide-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 2.5rem 2rem 1.4rem;
    /* Плотный градиент снизу плюс text-shadow ниже гарантируют читаемость
       даже когда нижняя часть фото такая же тёмная, как сам текст. */
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.35) 35%,
        rgba(0, 0, 0, 0.78) 70%,
        rgba(0, 0, 0, 0.92) 100%
    );
    color: #fff;
    pointer-events: none;
}

.big-slide-caption h3 {
    margin: 0 0 0.35rem;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 0, 0, 0.5);
}

.big-slide-caption p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    opacity: 0.96;
    max-width: 800px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Счётчик кадров «1 / 7» */
.big-slider-counter {
    position: absolute;
    top: 14px;
    right: 18px;
    z-index: 11;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* Стрелки */
.big-slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
    color: #111;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.big-slider-btn:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.05);
}

.big-slider-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.big-slider-btn.prev { left: 14px; }
.big-slider-btn.next { right: 14px; }

/* Точки */
.big-slider-dots {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 999px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.big-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    padding: 0;
    transition: background 0.15s, transform 0.15s;
}

.big-dot:hover { background: rgba(255, 255, 255, 0.75); }
.big-dot.active { background: #fff; transform: scale(1.2); }

/* === Сетка миниатюр под слайдером === */

.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin: 2rem 0;
}

@media (min-width: 640px) { .gallery-thumbs { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .gallery-thumbs { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .gallery-thumbs { grid-template-columns: repeat(5, 1fr); } }

.gallery-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 8px;
    background: #eee;
    cursor: pointer;
    border: none;
    padding: 0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.18);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.gallery-thumb:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.gallery-thumb:hover::after { opacity: 1; }

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

.gallery-thumb:hover img { transform: scale(1.06); }

/* === Блок «Связанные материалы» === */

.gallery-related {
    margin: 3rem 0 2rem;
}

.gallery-related > h2 {
    font-size: 1.6rem;
    margin: 0 0 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.gallery-related-group { margin-bottom: 2rem; }
.gallery-related-group:last-child { margin-bottom: 0; }

.gallery-related-group-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #777;
    margin: 0 0 0.75rem;
    font-weight: 600;
}

/* Сетка карточек */
.linked-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 640px) { .linked-cards-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .linked-cards-grid { grid-template-columns: repeat(4, 1fr); } }

.linked-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.linked-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.1);
    border-color: #d0d0d0;
    text-decoration: none;
    color: inherit;
}

.linked-card-thumb {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #f1f1f1;
    overflow: hidden;
}

.linked-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.linked-card:hover .linked-card-thumb img { transform: scale(1.04); }

.linked-card-body {
    padding: 0.75rem 0.9rem 0.9rem;
}

.linked-card-kicker {
    margin: 0 0 0.2rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    font-weight: 600;
}

.linked-card-title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.35;
    color: #1a1a1a;
}

/* === Другие галереи === */

.other-galleries {
    margin: 3rem 0 1rem;
}

.other-galleries h2 {
    font-size: 1.4rem;
    margin: 0 0 1rem;
    font-weight: 600;
}

.other-galleries-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 640px) { .other-galleries-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .other-galleries-grid { grid-template-columns: repeat(6, 1fr); } }

.other-gallery-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #eee;
    transition: transform 0.15s, box-shadow 0.15s;
}

.other-gallery-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.other-gallery-card .thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #eee;
}

.other-gallery-card .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.other-gallery-card .title {
    padding: 0.5rem 0.6rem;
    font-size: 0.9rem;
    text-align: center;
    line-height: 1.3;
}

/* === Мобильные === */

@media (max-width: 768px) {
    .gallery-page h1 { font-size: 1.5rem; }
    .big-slider-wrapper { aspect-ratio: 4 / 3; max-height: 60vh; min-height: 300px; }
    .big-slider-btn { width: 40px; height: 40px; }
    .big-slider-btn svg { width: 18px; height: 18px; }
    .big-slide-caption { padding: 1rem 1.25rem 0.85rem; }
    .big-slide-caption h3 { font-size: 1.02rem; }
    .big-slide-caption p { font-size: 0.85rem; }
    .big-slider-counter { font-size: 0.78rem; padding: 4px 10px; top: 10px; right: 12px; }
}
