/* Film Animation Overlay Styles */
.film-animation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #0a0a0a;
    z-index: 10000;
    overflow: hidden;
}

.film-section-overlay {
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.film-strip {
    position: relative;
    width: 600px;
    height: 100%;
    background: linear-gradient(90deg, #1a1a1a 0%, #2a2a2a 50%, #1a1a1a 100%);
    overflow: hidden;
    box-shadow: 0 0 100px rgba(0,0,0,0.9);
}

/* Перфорация киноленты */
.film-strip::before,
.film-strip::after {
    content: '';
    position: absolute;
    width: 50px;
    height: 100%;
    background:
        repeating-linear-gradient(
            0deg,
            #0a0a0a 0px,
            #0a0a0a 12px,
            #1a1a1a 12px,
            #1a1a1a 18px,
            transparent 18px,
            transparent 24px,
            #1a1a1a 24px,
            #1a1a1a 30px,
            #0a0a0a 30px,
            #0a0a0a 42px
        );
    z-index: 5;
}

.film-strip::before {
    left: 0;
    box-shadow: inset -5px 0 10px rgba(0,0,0,0.5);
}

.film-strip::after {
    right: 0;
    box-shadow: inset 5px 0 10px rgba(0,0,0,0.5);
}

.film-frames-wrapper {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.film-frames {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 480px;
    gap: 40px;
    padding: 40px 0;
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.film-frame {
    flex-shrink: 0;
    width: 100%;
    height: 360px;
    background: #000;
    border: 5px solid #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
    box-shadow:
        0 0 20px rgba(0,0,0,0.8),
        inset 0 0 30px rgba(0,0,0,0.3);
    position: relative;
}

.film-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.15) contrast(1.1) brightness(0.95);
}

/* Цифры и текст по краям пленки */
.film-edge-markings {
    position: absolute;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    color: #ffffff;
    z-index: 25;
    text-shadow:
        2px 2px 4px rgba(0,0,0,0.9),
        -1px -1px 2px rgba(0,0,0,0.9),
        1px -1px 2px rgba(0,0,0,0.9),
        -1px 1px 2px rgba(0,0,0,0.9);
    display: flex;
    flex-direction: column;
    gap: 80px;
    align-items: center;
    top: 0;
    height: auto;
    padding: 40px 0;
    pointer-events: none;
}

.film-edge-markings.left {
    left: 15px;
}

.film-edge-markings.right {
    right: 15px;
}

.film-edge-markings .marking-item {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 4px;
    border-radius: 2px;
}

.film-edge-markings .arrow {
    font-size: 14px;
    background: transparent;
}

.film-edge-markings .brand {
    font-family: 'Arial Black', sans-serif;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 1px;
    text-orientation: upright;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 6px;
}

/* Эффект царапин и пыли */
.film-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 2px,
            rgba(255,255,255,0.02) 2px,
            rgba(255,255,255,0.02) 3px
        ),
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 100px,
            rgba(255,255,255,0.03) 100px,
            rgba(255,255,255,0.03) 101px
        );
    pointer-events: none;
    z-index: 2;
}

/* Эффект зернистости */
.film-frame::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.05) 1px, transparent 1px),
        radial-gradient(circle at 60% 70%, rgba(0,0,0,0.1) 1px, transparent 1px),
        radial-gradient(circle at 80% 10%, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 4px 4px, 6px 6px, 5px 5px;
    opacity: 0.6;
    pointer-events: none;
    z-index: 3;
    animation: grain 0.3s steps(3) infinite;
}

@keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-1%, -1%); }
    20% { transform: translate(1%, 1%); }
    30% { transform: translate(-1%, 1%); }
    40% { transform: translate(1%, -1%); }
    50% { transform: translate(-1%, 0); }
    60% { transform: translate(1%, 0); }
    70% { transform: translate(0, -1%); }
    80% { transform: translate(0, 1%); }
    90% { transform: translate(-1%, -1%); }
}

/* Эффект виньетки */
.film-section-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, transparent 20%, rgba(0,0,0,0.95) 100%);
    pointer-events: none;
    z-index: 5;
}

/* Надпись сверху */
.film-title {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Arial Black', sans-serif;
    font-size: 72px;
    font-weight: 900;
    color: #ffffff;
    text-align: center;
    z-index: 30;
    opacity: 0;
    text-shadow:
        3px 3px 6px rgba(0,0,0,0.9),
        -2px -2px 4px rgba(0,0,0,0.9);
    letter-spacing: 0;
    pointer-events: none;
    white-space: nowrap;
}

.film-title.show {
    animation: titleFadeIn 1.5s ease-out forwards;
}

.film-title.hide {
    animation: titleFadeOut 0.8s ease-out forwards;
}

@keyframes titleFadeIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes titleFadeOut {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Мерцание света проектора */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.97; }
}

.film-strip {
    animation: flicker 0.15s infinite;
}

/* Эффект включения проектора */
.projector-light {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.3) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    z-index: 3;
    pointer-events: none;
}

.projector-light.active {
    animation: projectorTurnOn 2s ease-out forwards;
}

@keyframes projectorTurnOn {
    0% {
        width: 0;
        height: 0;
        opacity: 0;
    }
    30% {
        width: 200px;
        height: 200px;
        opacity: 0.5;
    }
    60% {
        width: 700px;
        height: 900px;
        opacity: 0.8;
    }
    100% {
        width: 700px;
        height: 900px;
        opacity: 0;
    }
}

/* Дрожание при включении */
@keyframes projectorShake {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    10% { transform: translate(-50%, -50%) rotate(0.5deg); }
    20% { transform: translate(-50%, -50%) rotate(-0.5deg); }
    30% { transform: translate(-50%, -50%) rotate(0.3deg); }
    40% { transform: translate(-50%, -50%) rotate(-0.3deg); }
    50% { transform: translate(-50%, -50%) rotate(0.2deg); }
    60% { transform: translate(-50%, -50%) rotate(-0.2deg); }
    70% { transform: translate(-50%, -50%) rotate(0.1deg); }
    80% { transform: translate(-50%, -50%) rotate(-0.1deg); }
}

.film-strip.projector-starting {
    animation: projectorShake 0.8s ease-in-out;
}

/* Анимация падения киноленты */
@keyframes filmFalling {
    0% {
        transform: translateY(-100px) scale(0.8);
        opacity: 0;
    }
    60% {
        transform: translateY(0) scale(1.05);
        opacity: 1;
    }
    80% {
        transform: translateY(-10px) scale(0.98);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Анимация раскачивания */
@keyframes filmSwing {
    0% {
        transform: rotate(0deg);
    }
    20% {
        transform: rotate(3deg);
    }
    40% {
        transform: rotate(-2deg);
    }
    60% {
        transform: rotate(1deg);
    }
    80% {
        transform: rotate(-0.5deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

/* Mobile version - reduce title size 10x */
@media (max-width: 768px) {
    .film-title {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .film-title {
        font-size: 36px;
    }
}

/* Скрываем кнопку мобильного меню (гамбургер) во время анимации киноленты */
.film-animation-active .mobile-menu-toggle,
body:has(.film-animation-overlay) .mobile-menu-toggle {
    display: none !important;
}

