/* Оптимизация производительности */
* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Предотвращение CLS - резервирование места для изображений */
img[width][height] {
    aspect-ratio: attr(width) / attr(height);
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
body {
    min-height: 100vh;
}
/* Анимация для меню */
#mobile-menu {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-out;
}
.reveal-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}
/* Range slider styling */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent; 
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
}
/* Масштабирование заголовка на узких экранах */
.hero-title {
    transform-origin: left center;
}
@media (max-width: 374px) {
    .hero-title {
        transform: scale(0.75);
    }
}
@media (min-width: 375px) and (max-width: 639px) {
    .hero-title {
        transform: scale(0.85);
    }
}
/* Safe area для iPhone */
.pb-safe {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}
/* Анимация загрузки видео */
@keyframes spin {
    from {
        transform: rotate(-90deg);
    }
    to {
        transform: rotate(270deg);
    }
}
@keyframes loadingProgress {
    from {
        stroke-dashoffset: 138;
    }
    to {
        stroke-dashoffset: 0;
    }
}
#loading-circle {
    animation: loadingProgress 3s linear forwards;
}
#hero-video {
    transition: opacity 0.5s ease-in-out;
}
#hero-video.playing {
    opacity: 1;
}
#play-button {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    top: 1rem !important;
    right: 1rem !important;
    width: 3.5rem !important;
    height: 3.5rem !important;
    flex-shrink: 0 !important;
}
#play-button svg {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
#play-button svg.hidden {
    display: none !important;
}
#progress-circle {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
#progress-path {
    stroke-dasharray: 163.36;
    stroke-dashoffset: 163.36;
}

/* Gallery Desktop Styles */
#gallery-desktop {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#gallery-desktop::-webkit-scrollbar {
    display: none;
}

#gallery-desktop:focus {
    outline: none;
}

/* Модальное окно - максимальный приоритет */
#application-modal {
    animation: fadeIn 0.3s ease-out;
    z-index: 2147483647 !important; /* Максимальное значение z-index */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    isolation: isolate !important;
    transform: translateZ(0) !important;
    will-change: transform !important;
    pointer-events: auto !important;
}

#application-modal.hidden {
    display: none !important;
}

#application-modal.flex {
    display: flex !important;
}

#modal-content {
    animation: slideUp 0.3s ease-out;
    position: relative;
    z-index: 2147483647 !important;
    isolation: isolate;
    pointer-events: auto !important;
}

/* Блокировка скролла при открытом модальном окне */
body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Убеждаемся, что hero-title не перекрывает модальное окно */
.hero-title {
    z-index: auto !important;
    position: relative !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Модальное окно */
#application-modal {
    animation: fadeIn 0.3s ease-out;
}

#modal-content {
    animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}
