/* Горизонтальный скролл */
.horizontal-scroll {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.horizontal-scroll::-webkit-scrollbar {
    display: none;
}

.horizontal-track {
    display: flex;
    flex-direction: row;
    width: max-content;
    height: 100%;
}

/* Карточка */
.film-card {
    min-width: 100%;
    width: 100%;
    flex-shrink: 0;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 2rem;
    position: relative;
    transition: box-shadow 0.4s ease, transform 0.4s ease;
    transform-style: preserve-3d;
    overflow: hidden; /* чтобы ничего не вылезало за края */
}

.film-card::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, #c49b3f, #e8b86b, #f5cd7a, #c49b3f);
    border-radius: 34px;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

@media (hover: hover) and (pointer: fine) {
    .film-card:hover::before {
        opacity: 0.6;
    }
}

/* Контент карточки — всегда горизонтальная компоновка */
.card-sticky {
    display: grid;
    justify-content: center;
    grid-template-columns: minmax(180px, 350px) 1fr;
    gap: 2rem;
    width: 95vw;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    border-radius: 32px;
    background: rgba(20,20,20,0.2);
    border: 1px solid rgba(255,255,255,0.05);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

/* Чтобы правая колонка сжималась, а не вылезала */
.card-sticky > :last-child {
    min-width: 0;
}

@supports (backdrop-filter: blur(3px)) {
    .card-sticky {
        backdrop-filter: blur(3px);
    }
}

/* Постер */
.film-poster {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    aspect-ratio: 4 / 5;
    width: 100%;
    max-width: 100%;
    margin: 0;
    cursor: pointer;
    margin-bottom: 10px
}

.film-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.view-counter,
.film-rating {
    position: absolute;
    background: rgba(0,0,0,0.7);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: bold;
    z-index: 3;
}

.view-counter {
    bottom: 1rem;
    right: 1rem;
    font-size: 0.7rem;
}

.film-rating {
    top: 1rem;
    right: 1rem;
    font-size: 0.8rem;
}

/* Текстовая часть */
.film-meta {
    display: flex;
    gap: 1rem;
    margin-top: 10px;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: #aaa;
    flex-wrap: wrap;
    overflow-wrap: break-word;
    word-break: break-word;
}

.film-year {
    font-family: monospace;
    color: #c49b3f;
    font-weight: bold;
}

.film-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    margin-bottom: 1rem;
    overflow-wrap: break-word;
    word-break: break-word;
}

.film-details {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed #333;
    flex-wrap: wrap;
    overflow-wrap: break-word;
    word-break: break-word;
}

.film-synopsis {
    line-height: 1.7;
    margin-bottom: 2rem;
    color: #ccc;
    overflow-wrap: break-word;
    word-break: break-word;
}

.film-quote {
    font-style: italic;
    border-left: 3px solid #c49b3f;
    padding-left: 1rem;
    margin-bottom: 1.8rem;
    color: #c4b594;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Кнопка действия */
.watch-trailer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #c49b3f;
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: gap 0.3s ease, color 0.3s ease;
}

.watch-trailer:hover {
    gap: 16px;
    color: #fff;
}

/* Футер */
.cinema-footer {
    flex-shrink: 0;
    background: linear-gradient(0deg, #050505, #0a0a0a);
    border-top: 1px solid #2a2a2a;
    padding: 1.5rem 2rem 3rem;
    text-align: center;
}

.footer-call {
    font-family: monospace;
    letter-spacing: 8px;
    color: #c49b3f;
    margin-bottom: 1rem;
    font-size: 0.8rem;
}

.footer-names {
    max-width: 700px;
    margin: 0 auto;
    font-size: 0.9rem;
    line-height: 1.6;
}

.footer-names strong {
    color: #c49b3f;
}

.friends-list {
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.friend-link {
    color: #c49b3f;
    text-decoration: none;
    font-weight: bold;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    background: rgba(196,155,63,0.1);
    transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease;
}

.friend-link:hover {
    color: #fff;
    background: rgba(196,155,63,0.3);
    transform: translateY(-2px);
}

.footer-quote {
    max-width: 500px;
    margin: 0.8rem auto;
    font-size: 0.8rem;
    font-style: italic;
    color: #888;
}

.footer-copyright {
    margin-top: 1rem;
    font-size: 0.65rem;
    opacity: 0.5;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.96);
}

@supports (backdrop-filter: blur(20px)) {
    .modal {
        backdrop-filter: blur(20px);
    }
}

.modal.active {
    display: flex;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    padding: 2rem;
    background: #1a1a1a;
    border-radius: 20px;
    border: 1px solid rgba(196,155,63,0.3);
    text-align: center;
}

.modal-content img {
    max-height: 60vh;
    margin-bottom: 1rem;
    border-radius: 10px;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: none;
    color: #c49b3f;
    font-size: 2rem;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
}

.modal-close:hover {
    background: rgba(196,155,63,0.2);
    transform: rotate(90deg);
}

/* Частицы */
.particles-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Лайк */
.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.like-btn.liked {
    animation: likePop 0.3s ease;
}

@keyframes likePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* =========================================================
   ТИПОГРАФИКА И ВЫРАВНИВАНИЕ
========================================================= */

.card-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    overflow-x: hidden;
    min-width: 0;
    width: 100%;
}

/* Заголовок */
.film-title {
    text-align: left;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin-bottom: 0.75rem;
}

/* Мета-информация */
.film-meta {
    text-align: left;
    margin-bottom: 0.5rem;
}

/* Детали */
.film-details {
    text-align: left;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    gap: 0.75rem 1.5rem;
}

.detail-item {
    white-space: nowrap;
}

/* Описание */
.film-synopsis {
    text-align: left;
    line-height: 1.6;
    margin-bottom: 1.25rem;
    hyphens: auto;
}

/* Цитата */
.film-quote {
    text-align: left;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    max-width: 60ch;
    hyphens: auto;
}

/* Кнопки */
.watch-trailer,
.memory-link,
.like-btn {
    align-self: flex-start;
}

/* Исправление выхода текста за рамки — глобально */
.card-content,
.film-synopsis,
.film-quote,
.film-details,
.film-meta {
    overflow-x: hidden;
    word-break: break-word;
    white-space: normal;
}

/* =========================================================
   АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ (ГОРИЗОНТАЛЬНАЯ КОМПОНОВКА)
========================================================= */

/* Планшеты (до 768px) */
@media (max-width: 768px) {
    .film-card {
        padding: 1rem;
    }

    .card-sticky {
        grid-template-columns: minmax(140px, 45%) 1fr;
        gap: 1rem;
        padding: 1rem;
    }

    .film-poster {
        max-width: 100%;
    }

    .film-title {
        font-size: clamp(1.3rem, 4vw, 1.8rem);
    }

    /* Убираем ограничение в 65ch/60ch, чтобы текст не вылезал */
    .film-synopsis,
    .film-quote {
        font-size: 0.85rem;
    }

    .film-synopsis {
        line-height: 1.5;
    }

    .film-quote {
        font-size: 0.8rem;
    }

    .film-details {
        gap: 0.3rem 0.8rem;
    }

    .detail-item {
        white-space: normal;
    }

    .cinema-footer {
        padding: 1rem 1rem 2rem;
    }

    .modal-content {
        padding: 1rem;
        max-width: 95%;
    }
    .modal-content img {
        max-height: 50vh;
    }
    .modal-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 32px;
        height: 32px;
        font-size: 1.5rem;
    }
}

/* Очень маленькие экраны (до 480px) */
@media (max-width: 480px) {
    .film-card {
        padding: 0.5rem;
    }

    .card-sticky {
        grid-template-columns: minmax(120px, 40%) 1fr;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .film-meta {
        gap: 0.3rem;
        font-size: 0.7rem;
    }

    .film-details {
        flex-direction: column;
        gap: 0.3rem;
    }

    .film-synopsis {
        font-size: 0.75rem;
    }

    .film-quote {
        font-size: 0.7rem;
        padding-left: 0.75rem;
    }

    .watch-trailer {
        font-size: 0.8rem;
    }

    .footer-call {
        letter-spacing: 4px;
        font-size: 0.7rem;
    }
    .footer-names {
        font-size: 0.8rem;
    }
    .friends-list {
        gap: 0.5rem;
    }
    .friend-link {
        padding: 0.1rem 0.5rem;
        font-size: 0.75rem;
    }
    .footer-quote {
        font-size: 0.7rem;
    }

    .modal-content {
        max-width: 98%;
        padding: 0.75rem;
    }
    .modal-content img {
        max-height: 45vh;
    }
}

/* подсказка */
.swipe-hint-mobile {
    display: none;
    text-align: center;
    font-size: 0.7rem;
    color: #aaa;
    margin: 1rem auto 0.5rem;
}

@media (max-width: 768px) {
    .swipe-hint-mobile {
        display: block;
    }
}
/* =========================================================
   PRELOADER
========================================================= */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#preloader.hide {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    text-align: center;
    color: #c49b3f;
    font-family: 'Inter', sans-serif;
}

.preloader-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 3px solid rgba(196,155,63,0.2);
    border-top: 3px solid #c49b3f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.preloader-progress-container {
    width: 250px;
    height: 4px;
    background: rgba(196,155,63,0.2);
    border-radius: 4px;
    margin: 20px auto;
    overflow: hidden;
}

.preloader-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #c49b3f, #e8b86b);
    border-radius: 4px;
    transition: width 0.2s ease;
}

.preloader-text {
    font-size: 0.9rem;
    letter-spacing: 2px;
    margin-bottom: 8px;
    color: #aaa;
}

.preloader-percent {
    font-size: 0.8rem;
    color: #c49b3f;
    font-family: monospace;
}

@media (max-width: 600px) {
    .preloader-progress-container {
        width: 200px;
    }
    .preloader-spinner {
        width: 45px;
        height: 45px;
    }
}

/* =========================================================
   ФИКСЫ ДЛЯ IOS (iPhone, iPad)
========================================================= */
.film-card,
.card-sticky,
.film-poster {
    position: relative;
    z-index: 100;
    will-change: transform;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.film-poster img {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.card-sticky {
    position: relative;
}