/* --- reset.css --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    -o-tab-size: 4;
    tab-size: 4;
    scroll-behavior: smooth;
    line-height: 1.5;
}

body {
    font-family: var(--font-family-base), system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

input, button, textarea, select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
    line-height: 1.2;
}

a {
    color: var(--accent);
    text-decoration: none;
}

ul, ol {
    list-style: none;
}


/* 1. CSS-токены (Custom Properties) */
:root {
    --bg: #0e1116;
    --bg-2: #12161d;
    --text: #e9edf3;
    --muted: #a6b0bf;
    --accent: #b042d4;
    --accent-hover: #c662e8;
    --border: rgba(255, 255, 255, .14);
    --glass: rgba(255, 255, 255, .06);

    --radius: 18px;
    --shadow-lg: 0 30px 70px rgba(0, 0, 0, .5);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, .35);

    --container-max: 1200px;
    --container-padding: 20px;
    --g: 20px; /* gutter */

    --h1: clamp(28px, 3.2vw, 44px);
    --h2: clamp(22px, 2.4vw, 32px);
    --body: clamp(15px, 1.4vw, 17px);
    --small: 13px;

    --font-family-base: 'Inter', sans-serif;

    /* Переменные для ambient-анимации */
    --ambient-opacity: 0;
    --ambient-scale: 1;
    --movie-card-width: 214px;
}

/* 2. Базовые стили */
body {
    background-color: var(--bg);
    color: var(--text);
    font-size: var(--body);
}

main {
    display: block; /* IE fix */
}

/* 3. Утилиты */
.container {
    max-width: var(--container-max);
    padding: 0 var(--container-padding);
    margin: 0 auto;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Доступность: кольца фокуса */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex="0"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* 4. Header */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--g) 0;
    transition: background-color 200ms ease-out, box-shadow 200ms ease-out, padding 200ms ease-out;
}

.site-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo img {
    height: 40px;
    width: auto;
    transition: transform 150ms ease-out;
}

.site-logo:hover img {
    transform: scale(1.05);
}

.search-button {
    color: var(--muted);
    padding: 8px;
    border-radius: 50%;
}

.search-button:hover {
    color: var(--text);
    background-color: var(--glass);
}

/* Липкий хедер */
.sticky-nav {
    display: none;
    align-items: center;
    gap: 16px;
}

.sticky-nav-title {
    font-size: var(--body);
    font-weight: 600;
    color: var(--text);
}

.sticky-nav-button {
    background-color: var(--accent);
    color: var(--bg);
    font-size: var(--small);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 100px;
    transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}

.sticky-nav-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sticky-nav-button:active,
.submit-comment-button:active {
    animation: rainbow-button-press 1s linear infinite; /* Радужное нажатие */
}

.site-header.is-sticky {
    padding: 12px 0;
    background-color: var(--bg-2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.site-header.is-sticky .sticky-nav {
    display: flex;
}

.site-header.is-sticky .search-button {
    display: none; /* Скрываем поиск в липком режиме для простоты */
}

.site-header.is-sticky .site-logo {
    display: none; /* Скрываем лого в липком режиме */
}

/* 5. Hero */
.hero-section {
    position: relative;
    height: 650px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden; /* Важно для параллакса и fade */
}

.hero-poster-bg {
    position: absolute;
    top: -5%; /* Для параллакса */
    left: 0;
    right: 0;
    bottom: -5%; /* Для параллакса */
    background-size: cover;
    background-position: center;
    /* transition для плавного старта параллакса, если JS не успел */
    transition: transform 0.1s linear;
}

/* Оверлей: затемнение сверху */
.hero-poster-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 70%;
    /*background: linear-gradient(to bottom, rgba(14, 17, 22, 0.55), transparent 100%);*/
}

/* Оверлей: дот-сетка */
.hero-poster-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(var(--text) 0.5px, transparent 0.5px);
    background-size: 4px 4px;
    opacity: 0.15;
}

/* Fade в фон сайта (снизу) */
.hero-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(to top, var(--bg) 20%, transparent 100%);
    z-index: 2; /* Выше постера, но ниже плеера */
}

/* 6. Интегрированный плеер */
.player-card-wrapper {
    position: relative;
    z-index: 10;
    margin: 120px auto 30px !important; /* !! Ключевой сдвиг для "встройки" !! */
    max-width: 1100px; /* Ограничение ширины плеера */
}

.player-card {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: var(--bg-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    /* overflow: hidden;  <-- Убрано, чтобы ::before был виден */
}

.player-card.is-visible.is-ready {
    --ambient-opacity: 0.6;
}

.player-card.is-visible {
    --ambient-opacity: 0.5;
    --ambient-scale: 1;
}

/* Ambient Light (Псевдоэлемент под карточкой) */
.player-card::before {
    content: '';
    position: absolute;
    inset: -12px; /* Аккуратный ободок */
    z-index: -1;
    background: conic-gradient(
            from 0deg, /* ИСПРАВЛЕНО: убрана переменная --ambient-angle */ var(--accent),
            #a87dff,
            #ff7da5,
            #a87dff,
            var(--accent)
    );
    filter: blur(30px); /* Меньшее размытие */
    transform: translateZ(0); /* GPU */
    animation: rainbow-hue-rotate 8s linear infinite; /* ИСПРАВЛЕНО */

    /* Управляется через JS (IntersectionObserver) */
    opacity: var(--ambient-opacity);
    transform: scale(var(--ambient-scale));
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.player-card.is-visible {
    --ambient-opacity: 0.5;
    --ambient-scale: 1;
}

/* Усиление ambient, когда плеер готов */
.player-card.is-visible.is-ready {
    --ambient-opacity: 0.6;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--glass);
    box-shadow: inset 0 0 0 1px var(--border);
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #7b1f2b 0%, #179a4a 100%);
    color: #fff;
    text-align: center;
}

/* Когда плеер готов, скрываем текст "Загружается..." */
.player-card.is-ready .dreams-player {
    color: transparent;
}

/* 7. Название и Рейтинг */
.movie-details-section {
    margin: 20px auto !important;
}

.movie-title-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--g);
    margin-bottom: var(--g);
}

.movie-title-row h1 {
    font-size: var(--h1);
    font-weight: 700;
}

.movie-rating {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--h2);
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
}

.movie-rating .star-icon {
    color: #ffc107; /* Желтая звезда */
    width: 1em;
    height: 1em;
}

.meta-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--muted);
    font-size: var(--small);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meta-chips span {
    display: flex;
    align-items: center;
    gap: 12px;
}

.meta-chips span:not(:last-child)::after {
    content: '•';
    opacity: 0.5;
}

/* 8. Контентная зона (2 колонки) */
.content-grid-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: calc(var(--g) * 2);
    padding-bottom: calc(var(--g) * 2);
}

.content-card {
    background-color: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: calc(var(--g) * 1.5);
    transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}

.content-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.content-card h2 {
    font-size: var(--h2);
    font-weight: 600;
    margin-bottom: var(--g);
}

/* Стили для постера в описании */
.description-layout {
    display: flex;
    flex-direction: row;
    gap: calc(var(--g) * 1.5);
    align-items: flex-start;
    justify-content: space-between;
}

.description-text-content {
    flex: 1;
    min-width: 0; /* Prevents flex overflow */
    max-width: 72ch; /* Keep text readable */
}

.description-poster {
    flex-shrink: 0;
    width: 260px; /* A good fixed width */
    position: sticky; /* Sticky poster */
    top: 100px; /* Space from sticky header */
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.description-poster img {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
}

/* Конец стилей для постера */

.description-block .description-content {
    line-height: 1.7;
    color: var(--muted);
    /*max-height: 150px; !* Ограничение высоты *!*/
    overflow: hidden;
    position: relative;
    /*transition: max-height 300ms ease-out;*/
}

.description-block .description-content p {
    margin-bottom: 1em;
}

/* Градиент "скрытия" */
.description-block .description-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(to top, var(--bg-2), transparent);
    transition: opacity 150ms linear;
}

.description-block .description-content.is-expanded {
    max-height: 1000px; /* Большая высота */
}

.description-block .description-content.is-expanded::after {
    opacity: 0;
}

.show-more-button {
    font-size: var(--small);
    font-weight: 600;
    color: var(--accent);
    margin-top: var(--g);
}

/* Правая колонка: Аккордеон/Табы (используем аккордеон) */
.facts-accordion .accordion-item {
    border-bottom: 1px solid var(--border);
}

.facts-accordion .accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: var(--g) 0;
    font-size: var(--body);
    font-weight: 600;
}

.accordion-icon {
    transition: transform 250ms ease-out;
    flex-shrink: 0;
    margin-left: 12px;
}

.accordion-item.is-open .accordion-icon {
    transform: rotate(45deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 250ms ease-out, padding 250ms ease-out;
}

.accordion-content p {
    padding-bottom: var(--g);
    color: var(--muted);
    max-width: 72ch;
}

/* 9. Актёры */
.actors-section {
    margin: 20px auto !important;
}

.actors-section h2 {
    font-size: var(--h2);
    font-weight: 600;
    margin-bottom: var(--g);
}

.actors-list {
    color: var(--muted);
    line-height: 1.4;
}

/* 10. Больше про фильм (отдельная секция) */
.more-info-section {
    background-color: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: calc(var(--g) * 2);
    margin-bottom: calc(var(--g) * 2);
    box-shadow: var(--shadow-md);

    /* Слабый ambient */
    position: relative;
    overflow: hidden; /* ВАЖНО: Возвращаем overflow, чтобы обрезать свечение */
    transition: box-shadow 500ms ease-out; /* Анимируем тень */
}

.more-info-section.is-visible {
    /* Анимируем box-shadow. */
    box-shadow: var(--shadow-md), 0 0 15px 2px hsla(0, 100%, 50%, 0.1);
    animation: rainbow-box-shadow 10s linear infinite;
}

/* Новый @keyframes для радужного box-shadow */
@keyframes rainbow-box-shadow {
    0% {
        box-shadow: var(--shadow-md), 0 0 15px 2px hsla(0, 80%, 60%, 0.15);
    }
    20% {
        box-shadow: var(--shadow-md), 0 0 15px 2px hsla(72, 80%, 60%, 0.15);
    }
    40% {
        box-shadow: var(--shadow-md), 0 0 15px 2px hsla(144, 80%, 60%, 0.15);
    }
    60% {
        box-shadow: var(--shadow-md), 0 0 15px 2px hsla(216, 80%, 60%, 0.15);
    }
    80% {
        box-shadow: var(--shadow-md), 0 0 15px 2px hsla(288, 80%, 60%, 0.15);
    }
    100% {
        box-shadow: var(--shadow-md), 0 0 15px 2px hsla(360, 80%, 60%, 0.15);
    }
}

/* Анимация вращения (для плеера) */
@keyframes rainbow-hue-rotate {
    0% {
        filter: blur(30px) hue-rotate(0deg);
    }
    100% {
        filter: blur(30px) hue-rotate(360deg);
    }
}

/* Анимация нажатия кнопок */
@keyframes rainbow-button-press {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

.more-info-content {
    position: relative;
    z-index: 1;
}

.more-info-section h2 {
    font-size: var(--h2);
    font-weight: 600;
    margin-bottom: calc(var(--g) * 1.5);
}

.more-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--g);
}

.more-info-item h3 {
    font-size: var(--body);
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.more-info-item p {
    color: var(--muted);
    font-size: var(--small);
    max-width: 72ch;
    line-height: 1.6;
}

/* 11. Факто-сетка 2xN */
.fact-grid-section {
    padding-bottom: calc(var(--g) * 3);
}

.fact-grid-section h2 {
    font-size: var(--h2);
    font-weight: 600;
    margin-bottom: var(--g);
}

/* Десктопная сетка */
.fact-grid-desktop {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--g);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.fact-grid-row {
    display: contents; /* Ряды как часть грида */
}

.fact-grid-row > div {
    padding: var(--g);
}

.fact-grid-row:not(:last-child) > div {
    border-bottom: 1px solid var(--border);
}

.fact-grid-label {
    font-weight: 600;
    color: var(--text);
    background: var(--glass);
}

.fact-grid-value {
    color: var(--muted);
}

.fact-grid-row:hover > div {
    background: var(--glass);
    /* Радужное свечение (слабое) */
    box-shadow: inset 0 0 10px hsla(0, 0%, 0%, 0);
    animation: rainbow-box-shadow 4s linear infinite;
}

/* Мобильный аккордеон */
.fact-grid-mobile {
    display: none; /* Скрыт по умолчанию */
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.fact-grid-mobile .accordion-item {
    border-bottom: 1px solid var(--border);
}

.fact-grid-mobile .accordion-item:last-child {
    border-bottom: none;
}

.fact-grid-mobile .accordion-header {
    padding: var(--g);
}

.fact-grid-mobile .accordion-content p {
    padding: 0 var(--g) var(--g) var(--g);
}

/* 12. Комментарии */
.comments-section {
    padding-bottom: calc(var(--g) * 3);
}

.comments-section h2 {
    font-size: var(--h2);
    font-weight: 600;
    margin-bottom: var(--g);
}

.comments-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--g);
    padding-bottom: var(--g);
    border-bottom: 1px solid var(--border);
    margin-bottom: calc(var(--g) * 1.5);
}

.comments-sort {
    display: flex;
    gap: 8px;
    background-color: var(--bg-2);
    border-radius: 100px;
    padding: 4px;
}

.comments-sort button {
    font-size: var(--small);
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 100px;
    transition: background-color 150ms ease-out, color 150ms ease-out;
}

.comments-sort button:hover {
    background-color: var(--glass);
}

.comments-sort button.is-active {
    background-color: var(--accent);
    color: var(--bg);
}

.comments-count {
    font-size: var(--small);
    color: var(--muted);
}

.comments-list {
    display: grid;
    gap: calc(var(--g) * 1.5);
}

.comment-card {
    display: grid;
    grid-template-areas: "avatar header"
                             "avatar body"
                             "avatar footer";
    grid-template-columns: auto 1fr;
    gap: 0 16px;
}

.comment-avatar {
    grid-area: avatar;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-2);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    color: var(--accent);
    border: 1px solid var(--border);
}

.comment-header {
    grid-area: header;
    display: flex;
    align-items: center;
    gap: 12px;
}

.comment-author {
    font-weight: 600;
    color: var(--text);
}

.comment-date {
    font-size: var(--small);
    color: var(--muted);
}

.comment-body {
    grid-area: body;
    padding: 8px 0;
    color: var(--muted);
    line-height: 1.7;
    /*max-width: 72ch;*/
}

.comment-footer {
    grid-area: footer;
}

.like-button {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--small);
    color: var(--muted);
    padding: 4px;
    border-radius: 6px;
}

.like-button:hover {
    background-color: var(--glass);
    color: var(--text);
}

.like-button.is-liked {
    color: var(--accent);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: calc(var(--g) * 2);
}

.pagination button {
    font-size: var(--small);
    font-weight: 500;
    color: var(--muted);
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 8px;
    transition: background-color 150ms ease-out, color 150ms ease-out;
}

.pagination button:hover {
    background-color: var(--glass);
    color: var(--text);
}

.pagination button.is-active {
    background-color: var(--accent);
    color: var(--bg);
    font-weight: 600;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.comment-form {
    margin-top: calc(var(--g) * 2);
    padding-top: calc(var(--g) * 1.5);
    border-top: 1px solid var(--border);
}

.comment-form h3 {
    font-size: var(--h2);
    font-weight: 600;
    margin-bottom: var(--g);
}

.comment-form textarea {
    width: 100%;
    min-height: 120px;
    background-color: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: var(--body);
    resize: vertical;
    margin-bottom: var(--g);
}

.comment-form textarea:focus {
    border-color: var(--accent);
    background-color: var(--bg);
}

.submit-comment-button {
    background-color: var(--accent);
    color: var(--bg);
    font-size: var(--body);
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 100px;
    transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}

.submit-comment-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 13. Footer */
.site-footer {
    background-color: var(--bg-2);
    border-top: 1px solid var(--border);
    padding: calc(var(--g) * 3) 0;
    font-size: var(--small);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: calc(var(--g) * 2);
    margin-bottom: calc(var(--g) * 2);
}

.footer-column h3 {
    font-size: var(--body);
    font-weight: 600;
    margin-bottom: var(--g);
    color: var(--text);
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--muted);
}

.footer-links a:hover {
    color: var(--text);
    text-decoration: underline;
}

.copyright {
    text-align: center;
    color: var(--muted);
    opacity: 0.7;
}

/* 14. Адаптивность */

/* Планшет (768–1279px) */
@media (max-width: 1279px) {
    .content-grid-wrapper {
        grid-template-columns: 1fr; /* Колонки стекаются */
        gap: var(--g);
    }

    .player-card-wrapper {
        /* Плеер уже 100% от контейнера, что хорошо */
        margin-top: -200px; /* Уменьшаем сдвиг на планшете */
    }

    .hero-section {
        height: 550px; /* Уменьшаем высоту хиро */
    }
}

/* Мобильные (≤767px) */
@media (max-width: 767px) {
    :root {
        --g: 16px;
        --container-padding: 16px;
        --radius: 12px;
    }

    body {
        line-height: 1.7; /* Увеличиваем межстрочный */
    }

    .site-header {
        padding: var(--g) 0;
    }

    .site-header.is-sticky {
        padding: 10px 0;
    }

    .site-logo img {
        height: 32px;
    }

    .hero-section {
        height: 450px;
    }

    .player-card-wrapper {
        margin-top: -150px; /* Еще уменьшаем сдвиг */
    }

    .player-card::before {
        filter: blur(20px); /* Уменьшаем "жар" ambient */
        inset: -10px;
        animation: rainbow-hue-rotate 8s linear infinite; /* ИСПРАВЛЕНО: возвращаем анимацию */
    }

    .player-card.is-visible {
        --ambient-opacity: 0.2;
    }

    .player-card.is-visible.is-ready {
        --ambient-opacity: 0.3;
    }

    @keyframes rainbow-hue-rotate {
        /* ИСПРАВЛЕНО: убрана переменная --ambient-angle */
        0% {
            filter: blur(20px) hue-rotate(0deg);
        }
        100% {
            filter: blur(20px) hue-rotate(360deg);
        }
    }

    .more-info-section.is-visible {
        /* Уменьшаем тень на мобильных */
        animation-name: none;
        box-shadow: var(--shadow-md);
    }

    .movie-title-row h1 {
        font-size: 26px; /* Чуть меньше clamp() */
    }

    .movie-rating {
        font-size: 22px;
    }

    .description-layout {
        flex-direction: column; /* Stack on mobile */
    }

    .description-text-content {
        max-width: 100%; /* Full width on mobile */
    }

    .description-poster {
        display: none; /* Hide poster on mobile for neatness */
    }

    .content-grid-wrapper {
        gap: var(--g);
    }

    .content-card {
        padding: var(--g);
    }

    /* Факто-сетка: скрываем десктоп, показываем мобильный аккордеон */
    .fact-grid-desktop {
        display: none;
    }

    .fact-grid-mobile {
        display: block;
    }

    .comments-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .pagination button {
        min-width: 32px;
        height: 32px;
        padding: 0 4px;
    }

    .pagination button.page-arrow {
        display: none; /* Скрываем "Дальше" для экономии места */
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr; /* 2 колонки */
        gap: var(--g);
    }
}

/* ------------------------------------------------------------
   Дополнения (header/footer + модальные окна) из igksd.html
   Цель: меню/поиск/мобильное меню/модалки без влияния на остальную верстку
------------------------------------------------------------ */

:root {
    --header-height: 70px;
}

/* Header (меню + поиск) */
.site-header {
    background-color: rgba(14, 17, 22, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
    padding: 0;
    display: flex;
    align-items: center;
}

/* Убираем резкие изменения в режиме is-sticky (скрипт в bundle.js остается) */
.site-header.is-sticky {
    padding: 0;
    background-color: rgba(14, 17, 22, 0.92);
    box-shadow: none;
}

.site-header.is-sticky .sticky-nav {
    display: none !important;
}

.site-header.is-sticky .site-logo {
    display: block !important;
}

.site-header.is-sticky .main-nav {
    display: flex !important;
}

.site-header.is-sticky .header-right {
    display: flex !important;
    align-items: center;
}

/* Login */
.login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-weight: 500;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 999px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.login-btn:hover {
    color: var(--text);
    background-color: var(--glass);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(176, 66, 212, 0.15);
}

.login-btn svg {
    width: 20px;
    height: 20px;
}

.header-inner {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 22px;
}

.site-logo img {
    height: 32px;
    width: auto;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 28px;
    margin-left: 18px;
    margin-right: auto;
}

.main-nav a {
    font-size: 15px;
    font-weight: 500;
    color: var(--muted);
    position: relative;
}

.main-nav a:hover {
    color: var(--text);
}

.main-nav a.active {
    color: var(--text);
}

.main-nav a.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -23px;
    height: 2px;
    background-color: var(--accent);
    box-shadow: 0 -2px 10px var(--accent);
}

.header-right {
    display: flex;
    align-items: center;
    margin-left: auto;
    gap: 12px;
}

/* Поиск (кнопка + выезжающее поле) */
.search-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--glass);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    transition: width 250ms ease;
    width: 44px;
    height: 44px;
}

.search-wrapper.is-open {
    width: 320px;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 0 14px;
    color: var(--text);
    font-size: 14px;
    opacity: 0;
    transition: opacity 200ms ease;
    pointer-events: none;
}

.search-wrapper.is-open .search-input {
    opacity: 1;
    pointer-events: all;
}

.search-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

.search-btn:hover {
    color: var(--text);
    background-color: rgba(255, 255, 255, .04);
}

/* Mobile menu */
.mobile-menu-btn {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background-color: var(--glass);
    border: 1px solid var(--border);
    color: var(--text);
    align-items: center;
    justify-content: center;
    margin-left: 12px;
}

.mobile-nav-overlay {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg);
    z-index: 999;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-top: 1px solid var(--border);
}

.mobile-nav-overlay.is-active {
    transform: translateX(0);
}

.mobile-nav-link {
    font-size: 18px;
    font-weight: 600;
    padding: 15px 0;
    border-bottom: 1px solid var(--glass);
    color: var(--text);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
    z-index: 1200;
    padding: 20px;
}

.modal-overlay.is-visible {
    opacity: 1;
    pointer-events: all;
}

.modal-window {
    background-color: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    max-width: 720px;
    width: 100%;
    padding: 26px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background-color: var(--glass);
    border: 1px solid var(--border);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
}

.modal-text {
    color: var(--muted);
    white-space: pre-line;
    line-height: 1.7;
}

/* Extracted from index.html */
/* --- RESET.CSS --- */
html {
    scroll-behavior: smooth;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    background-color: #0e1116;
    color: #e9edf3;
}

img, svg {
    display: block;
    max-width: 100%;
}

input, button {
    font: inherit;
    color: inherit;
    border: none;
    background: none;
}

button {
    cursor: pointer;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

ul {
    list-style: none;
}

/* --- STYLES.CSS --- */
:root {
    --bg: #0e1116;
    --bg-2: #12161d;
    --text: #e9edf3;
    --muted: #a6b0bf;
    --accent: #b042d4;
    --accent-hover: #c662e8;
    --border: rgba(255, 255, 255, .14);
    --glass: rgba(255, 255, 255, .06);
    --radius: 18px;
    --shadow-lg: 0 30px 70px rgba(0, 0, 0, .5);
    --container-max: 1320px;
    --container-padding: 20px;
    --header-height: 70px;
    --ambient-opacity: 0;
    --ambient-scale: 1;
    --movie-card-width: 214px;
}

.container {
    max-width: var(--container-max);
    padding: 0 var(--container-padding);
    margin: 0 auto;
}

/* --- HEADER --- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: rgba(14, 17, 22, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
    display: flex;
    align-items: center;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.site-logo img {
    height: 32px;
    width: auto;
    transition: transform 150ms ease-out;
    display: block;
}

.site-logo:hover img {
    transform: scale(1.05);
}

/* NAV */
.main-nav {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-left: 40px;
    margin-right: auto;
}

.main-nav a {
    font-weight: 500;
    font-size: 15px;
    color: var(--muted);
    position: relative;
}

.main-nav a:hover, .main-nav a.active {
    color: var(--text);
}

.main-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -23px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--accent);
    box-shadow: 0 -2px 10px var(--accent);
}

/* RIGHT AREA (Login + Search + Burger) */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px; /* Отступ между элементами */
}

/* Кнопка Входа */
.login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-weight: 500;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 100px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.login-btn:hover {
    color: var(--text);
    background-color: var(--glass);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(176, 66, 212, 0.15);
}

.login-btn svg {
    width: 20px;
    height: 20px;
}

/* Поиск */
.search-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 4px;
    transition: all 0.3s ease;
    width: 42px;
    overflow: hidden;
    justify-content: flex-end;
}

.search-wrapper.is-open {
    width: 280px;
    background-color: var(--bg);
    border-color: var(--accent);
}

.search-input {
    width: 100%;
    opacity: 0;
    padding: 0 15px;
    font-size: 14px;
    color: var(--text);
    transition: opacity 0.2s 0.1s;
    pointer-events: none;
    background: transparent;
}

.search-input:focus {
    outline: none;
}

.search-wrapper.is-open .search-input {
    opacity: 1;
    pointer-events: all;
}

.search-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

.search-wrapper.is-open .search-btn {
    color: var(--accent);
}

.mobile-menu-btn {
    display: none;
    color: var(--text);
    padding: 5px;
}

/* --- HERO SLIDER --- */
.hero-section {
    margin-top: 90px;
    position: relative;
    height: 550px; /* Чуть выше для эффектности */
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 40px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    /*background-color: #000;*/
}

.hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    z-index: 1;
}

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

.slide-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transform: scale(1.05); /* Легкий зум для эффекта */
    transition: transform 6s ease; /* Эффект приближения при показе можно добавить JS-ом, но пока статика */
}

.slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(14, 17, 22, 0.95) 0%, rgba(14, 17, 22, 0.6) 50%, transparent 100%);
    display: flex;
    align-items: center;
    padding: 0 60px;
}

.slide-content {
    max-width: 550px;
    position: relative;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.6s ease 0.3s; /* Задержка появления текста */
}

.hero-slide.active .slide-content {
    transform: translateY(0);
    opacity: 1;
}

.slide-label {
    display: inline-block;
    background-color: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(176, 66, 212, 0.4);
}

.slide-title {
    font-size: clamp(32px, 4vw, 64px);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 15px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.slide-desc {
    color: var(--muted);
    margin-bottom: 30px;
    font-size: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.slider-dots {
    position: absolute;
    bottom: 30px;
    left: 60px;
    z-index: 10;
    display: flex;
    gap: 10px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s;
}

.dot.active {
    background: var(--accent);
    width: 24px;
    border-radius: 100px;
}

.dot:hover {
    background: rgba(255, 255, 255, 0.8);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: var(--accent);
    color: white;
    padding: 14px 36px;
    border-radius: 100px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(176, 66, 212, 0.3);
    background-color: var(--accent-hover);
}

/* --- CATEGORIES & GRID --- */
.categories-section {
    margin-bottom: 50px;
}

.categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.category-chip {
    background-color: var(--bg-2);
    border: 1px solid var(--border);
    padding: 10px 24px;
    border-radius: 100px;
    font-size: 14px;
    color: var(--muted);
    font-weight: 500;
    transition: all 0.2s;
}

.category-chip:hover, .category-chip.active {
    background-color: var(--glass);
    color: var(--text);
    border-color: var(--accent);
}

.category-chip.active {
    background-color: var(--accent);
    color: white;
}

.section-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.section-title::before {
    content: '';
    display: block;
    width: 4px;
    height: 24px;
    background-color: var(--accent);
    border-radius: 4px;
    box-shadow: 0 0 10px var(--accent);
}

.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--movie-card-width), 1fr));
    justify-content: center;
    gap: 24px;
    margin-bottom: 60px;
}

.movie-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(100%, var(--movie-card-width));
    height: 100%;
    justify-self: center;
}

.movie-card > a {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.poster-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    background-color: var(--bg-2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.poster-img {
    width: 100%; /* одинаковая ширина независимо от исходного постера */
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}

.play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.play-btn-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.movie-card:hover .poster-wrapper {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}

.movie-card:hover .play-overlay {
    opacity: 1;
}

.movie-card:hover .play-btn-icon {
    transform: scale(1);
}

.movie-card:hover .poster-img {
    transform: scale(1.05);
}

.rating-star-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(14, 17, 22, 0.85);
    backdrop-filter: blur(4px);
    padding: 4px 8px;
    border-radius: 8px;
    z-index: 6;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rating-star-badge svg {
    color: #ffc107;
    width: 14px;
    height: 14px;
}

.rating-star-badge span {
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.movie-info h3 {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 4px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.movie-info p {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: end;
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.movie-card:hover h3 {
    color: var(--accent);
}

/* --- PAGINATION STYLES --- */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: -20px;
    margin-bottom: 80px;
}

.pagination {
    display: flex;
    gap: 8px;
    background-color: var(--bg-2);
    padding: 8px;
    border-radius: 100px;
    border: 1px solid var(--border);
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 50%; /* Круглые кнопки для цифр */
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    transition: all 0.2s;
}

.page-link:hover {
    color: var(--text);
    background-color: var(--glass);
}

.page-link.active {
    background-color: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(176, 66, 212, 0.3);
}

.page-control {
    border-radius: 100px; /* Овальные кнопки для Вперед/Назад */
    padding: 0 20px;
}

.page-control.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}


/* Footer */
.site-footer {
    background-color: var(--bg-2);
    border-top: 1px solid var(--border);
    padding: 60px 0 30px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h4 {
    color: var(--text);
    font-size: 16px;
    margin-bottom: 20px;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--muted);
    font-size: 14px;
}

.footer-links a:hover {
    color: var(--accent);
}

.copyright {
    text-align: center;
    border-top: 1px solid var(--border);
    padding-top: 30px;
    color: var(--muted);
    font-size: 13px;
    opacity: 0.6;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.is-visible {
    opacity: 1;
    pointer-events: all;
}

.modal-window {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s;
    box-shadow: var(--shadow-lg);
}

.modal-overlay.is-visible .modal-window {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: var(--muted);
    padding: 8px;
}

.modal-close:hover {
    color: var(--text);
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
}

.modal-text {
    color: var(--muted);
    line-height: 1.6;
    font-size: 15px;
    white-space: pre-line;
}

/* Media Queries */
@media (max-width: 1200px) {
    .movies-grid {
        --movie-card-width: 200px;
    }
}

@media (max-width: 1024px) {
    .movies-grid {
        --movie-card-width: 184px;
    }

    .main-nav {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
        z-index: 1001;
    }
}

@media (max-width: 768px) {
    .movies-grid {
        --movie-card-width: 160px;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-slide {
        justify-content: center;
    }

    .slide-overlay {
        padding: 0 20px;
        justify-content: center;
        text-align: center;
    }

    .slide-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hero-section {
        height: 480px;
    }

    .slider-dots {
        left: 50%;
        transform: translateX(-50%);
        bottom: 20px;
    }

    .header-right {
        gap: 10px;
    }

    .search-wrapper {
        width: 36px;
    }

    .pagination {
        gap: 4px;
        padding: 4px;
        width: 100%;
        justify-content: space-between;
    }

    .page-link {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
        padding: 0 8px;
    }

    /* Скрываем лишние страницы на мобилках */
    .page-link.desktop-only {
        display: none;
    }

    .page-control {
        padding: 0 12px;
    }
}

@media (max-width: 480px) {
    .movies-grid {
        --movie-card-width: 140px;
    }

    .categories-section {
        margin-top: 100px;
    }

    .category-chip {
        padding: 8px 16px;
        font-size: 13px;
    }

    .site-header {
        padding: 0 10px;
    }

    .login-btn span {
        display: none;
    }

    .login-btn {
        padding: 8px;
    }

    .section-title {
        font-size: 24px;
    }
}

/* Dynamic text logo (replaces logo image) */
.site-logo-text {
    font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    font-weight: 800;
    font-size: 28px;
    line-height: 1;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    display: inline-block;
    transition: transform 150ms ease-out;
    will-change: transform;
}

.site-logo:hover .site-logo-text {
    transform: scale(1.05);
}

/* Match footer logo size to previous 24px image height */
.site-footer .site-logo-text {
    font-size: 24px;
}
