/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    background:
        radial-gradient(ellipse at var(--light-x, 30%) var(--light-y, 30%), rgba(212, 175, 55, 0.14) 0%, transparent 50%),
        radial-gradient(ellipse at calc(100% - var(--light-x, 30%)) calc(100% - var(--light-y, 30%)), rgba(139, 90, 43, 0.12) 0%, transparent 55%),
        radial-gradient(circle at 50% 50%, rgba(47, 68, 40, 0.45) 0%, transparent 80%),
        linear-gradient(160deg, #070d0a 0%, #0c120a 45%, #050905 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
    overflow: hidden;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Центральный блок */
.loading-center {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

/* Заголовок */
.loading-title {
    font-family: 'Open', cursive;
    font-size: 4rem;
    font-weight: normal;
    color: var(--secondary-color);
    display: flex;
    z-index: 100;
    position: relative;
    letter-spacing: 0.04em;
    animation: goldPulse 4s ease-in-out infinite alternate 1.5s;
}

@keyframes goldPulse {
    0% {
        text-shadow: 
            0 2px 25px rgba(212, 175, 55, 0.15),
            0 0 10px rgba(255, 255, 255, 0.03);
    }
    100% {
        text-shadow: 
            0 2px 45px rgba(212, 175, 55, 0.45),
            0 0 20px rgba(212, 175, 55, 0.25),
            0 0 5px rgba(255, 255, 255, 0.08);
    }
}

.loading-title span {
    opacity: 0;
    transform: translateY(24px);
    animation: letterFadeIn 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.loading-title .space {
    width: 1.1rem;
}

.loading-title span:nth-child(1)  { animation-delay: 0.05s; }
.loading-title span:nth-child(2)  { animation-delay: 0.10s; }
.loading-title span:nth-child(3)  { animation-delay: 0.14s; }
.loading-title span:nth-child(4)  { animation-delay: 0.18s; }
.loading-title span:nth-child(5)  { animation-delay: 0.22s; }
.loading-title span:nth-child(6)  { animation-delay: 0.26s; }
.loading-title span:nth-child(7)  { animation-delay: 0.30s; }
.loading-title span:nth-child(8)  { animation-delay: 0.34s; }
.loading-title span:nth-child(10) { animation-delay: 0.40s; }
.loading-title span:nth-child(11) { animation-delay: 0.44s; }
.loading-title span:nth-child(12) { animation-delay: 0.48s; }
.loading-title span:nth-child(13) { animation-delay: 0.52s; }
.loading-title span:nth-child(14) { animation-delay: 0.56s; }
.loading-title span:nth-child(15) { animation-delay: 0.60s; }
.loading-title span:nth-child(16) { animation-delay: 0.64s; }

.loading-title span:nth-child(1),
.loading-title span:nth-child(10) {
    color: var(--accent-gold);
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
}

@keyframes letterFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Подзаголовок */
.loading-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    opacity: 0;
    animation: subtitleFade 0.8s ease-out 0.8s forwards;
}

@keyframes subtitleFade {
    to { opacity: 1; }
}

/* Прогресс */
.loading-progress-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 2rem;
}

.progress-bar {
    width: 320px;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.loading-progress-indicator .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b5a2b, #d4af37, #ffffff);
    background-size: 200% 100%;
    width: 0%;
    transition: width 0.25s ease-out;
    border-radius: 2px;
    position: relative;
    box-shadow: 
        0 0 15px rgba(212, 175, 55, 0.8),
        0 0 5px rgba(255, 255, 255, 0.5);
    animation: progressShimmer 2s linear infinite;
}

.loading-progress-indicator .progress-fill::after {
    content: '';
    position: absolute;
    right: -4px;
    top: -3px;
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 
        0 0 10px #ffffff,
        0 0 20px #d4af37,
        0 0 30px #d4af37;
}

@keyframes progressShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Текст статуса загрузки */
.loading-status-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
}

.floating-art-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    transform: translate(var(--mouse-tilt-x, 0px), var(--mouse-tilt-y, 0px));
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.art-frame {
    position: absolute;
    border-radius: 12px; /* В стиле проекта — скругленные углы */
    overflow: hidden;
    /* Роскошная классическая багетная рама: сочетание дерева и золота */
    border: 3px solid rgba(22, 17, 9, 0.95); /* Глубокий благородный темный багет */
    outline: 1px solid rgba(212, 175, 55, 0.35); /* Внешняя тонкая золотая кайма */
    outline-offset: -1px;
    box-shadow:
        /* Профилирование рамы и внутреннее золочение (паспарту) */
        inset 0 0 0 1px rgba(212, 175, 55, 0.5),    /* Внутренний золотой ободок багета */
        inset 0 0 0 3px rgba(35, 27, 15, 0.9),       /* Рельефная тень профиля дерева */
        inset 0 0 0 5px rgba(212, 175, 55, 0.3),     /* Золотой штапик (паспарту) */
        inset 0 0 15px rgba(0, 0, 0, 0.8),           /* Глубокая тень рамы на живописный холст */
        /* Эффект парения в пространстве с теплым отсветом золота */
        0 15px 40px rgba(0, 0, 0, 0.65),
        0 5px 15px rgba(212, 175, 55, 0.12);
    opacity: 0;
    will-change: transform, opacity;
}

.art-frame.loaded {
    animation: floatMedium 12s ease-in-out infinite;
}

/* Само «полотно» (чистое искусство без текста с легким текстурным наложением) */
.art-content {
    width: 100%;
    height: 100%;
    position: relative;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.45); /* Дополнительная глубина живописи */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}

/* Эффект блика на лаке */
.art-content::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 45%,
        rgba(255, 255, 255, 0.08) 48%,
        rgba(255, 255, 255, 0.16) 50%,
        rgba(255, 255, 255, 0.08) 52%,
        transparent 55%
    );
    transform: rotate(-15deg);
    pointer-events: none;
    mix-blend-mode: overlay;
    animation: glossSheen 8s ease-in-out infinite alternate;
}

@keyframes glossSheen {
    0% { transform: translate(-8%, -8%) rotate(-15deg); }
    100% { transform: translate(8%, 8%) rotate(-15deg); }
}

/* ======== УНИКАЛЬНЫЕ НАСТОЯЩИЕ ЖИВОПИСНЫЕ КАРТИНЫ (ИЗ ПРОЕКТА) ДЛЯ КАЖДОЙ КАРТОЧКИ ======== */

.af-1 .art-content {
    background-image: url('/images/open/IMG_0505.PNG');
}

.af-2 .art-content {
    background-image: url('/images/open/IMG_0507.PNG');
}

.af-3 .art-content {
    background-image: url('/images/open/IMG_0508.PNG');
}

.af-4 .art-content {
    background-image: url('/images/open/IMG_0509.PNG');
}

.af-5 .art-content {
    background-image: url('/images/open/IMG_0510.PNG');
}

.af-6 .art-content {
    background-image: url('/images/open/IMG_0511.PNG');
}

.af-7 .art-content {
    background-image: url('/images/open/IMG_0512.PNG');
}

.af-8 .art-content {
    background-image: url('/images/open/IMG_0513.PNG');
}

.af-9 .art-content {
    background-image: url('/images/open/IMG_0514.PNG');
}

/* ======== РАЗМЕРЫ И ПОЗИЦИИ КАРТОЧЕК ======== */
.af-1  { width: 130px; height: 130px; left:  4%; top: 8%;  animation: floatMedium 11s ease-in-out infinite; animation-delay: 0.0s; filter: brightness(0.85); }
.af-2  { width: 110px; height: 110px; left: 18%; top: 65%; animation: floatSlow 14s ease-in-out infinite; animation-delay: 0.7s; filter: blur(1.5px) brightness(0.6); }
.af-3  { width: 140px; height: 140px; left: 30%; top: 5%;  animation: floatFast 9s ease-in-out infinite; animation-delay: 1.4s; filter: blur(0.4px) brightness(0.95); }
.af-4  { width: 120px; height: 120px; left: 72%; top: 12%; animation: floatMedium 12s ease-in-out infinite; animation-delay: 2.1s; filter: brightness(0.85); }
.af-5  { width: 115px; height: 115px; left: 85%; top: 58%; animation: floatMedium 11.5s ease-in-out infinite; animation-delay: 2.8s; filter: brightness(0.85); }
.af-6  { width: 100px; height: 100px; left: 5%;  top: 55%; animation: floatSlow 15s ease-in-out infinite; animation-delay: 3.5s; filter: blur(2px) brightness(0.55); }
.af-7  { width: 130px; height: 130px; left: 60%; top: 72%; animation: floatFast 9.5s ease-in-out infinite; animation-delay: 4.2s; filter: blur(0.4px) brightness(0.95); }
.af-8  { width: 110px; height: 110px; left: 88%; top: 10%; animation: floatSlow 13.5s ease-in-out infinite; animation-delay: 4.9s; filter: blur(1.5px) brightness(0.6); }
.af-9  { width: 115px; height: 115px; left: 42%; top: 78%; animation: floatMedium 12.5s ease-in-out infinite; animation-delay: 5.6s; filter: brightness(0.85); }

/* Анимации плавания разной глубины */
@keyframes floatSlow {
    0% {
        opacity: 0;
        transform: translateY(15px) rotate(-0.8deg) scale(0.97);
    }
    10% {
        opacity: 0.55;
    }
    50% {
        transform: translateY(-15px) rotate(0.8deg) scale(1.02);
        opacity: 0.65;
    }
    90% {
        opacity: 0.55;
    }
    100% {
        opacity: 0;
        transform: translateY(15px) rotate(-0.8deg) scale(0.97);
    }
}

@keyframes floatMedium {
    0% {
        opacity: 0;
        transform: translateY(25px) rotate(1.2deg) scale(0.96);
    }
    8% {
        opacity: 0.75;
    }
    50% {
        transform: translateY(-25px) rotate(-1.2deg) scale(1.03);
        opacity: 0.85;
    }
    92% {
        opacity: 0.75;
    }
    100% {
        opacity: 0;
        transform: translateY(25px) rotate(1.2deg) scale(0.96);
    }
}

@keyframes floatFast {
    0% {
        opacity: 0;
        transform: translateY(35px) rotate(-2deg) scale(0.95);
    }
    6% {
        opacity: 0.85;
    }
    50% {
        transform: translateY(-35px) rotate(2deg) scale(1.05);
        opacity: 0.95;
    }
    94% {
        opacity: 0.85;
    }
    100% {
        opacity: 0;
        transform: translateY(35px) rotate(-2deg) scale(0.95);
    }
}

/* ======== МЕДИА-ЗАПРОСЫ ======== */
@media (max-width: 768px) {
    .loading-title { font-size: 2.5rem; }
    .progress-bar  { width: 260px; }
    .af-1  { width: 90px; height: 90px; }
    .af-2  { width: 80px; height: 80px; filter: blur(1px) brightness(0.65); }
    .af-3  { width: 100px; height: 100px; filter: brightness(0.95); }
    .af-4  { width: 85px; height: 85px; }
    .af-5  { width: 85px; height: 85px; }
    .af-6  { width: 75px; height: 75px; filter: blur(1.2px) brightness(0.6); }
    .af-7  { width: 95px; height: 95px; filter: brightness(0.95); }
    .af-8  { width: 85px; height: 85px; filter: blur(1px) brightness(0.65); }
    .af-9  { width: 80px; height: 80px; }
}

@media (max-width: 480px) {
    .loading-title { font-size: 1.8rem; flex-wrap: wrap; justify-content: center; gap: 0.15rem; }
    .loading-title .space { width: 0.4rem; }
    .progress-bar  { width: 200px; }
    .af-1  { width: 70px; height: 70px; filter: none; }
    .af-2  { width: 65px; height: 65px; filter: none; }
    .af-3  { width: 80px; height: 80px; filter: none; }
    .af-4  { width: 70px; height: 70px; filter: none; }
    .af-5  { width: 65px; height: 65px; filter: none; }
    .af-6  { display: none; }
    .af-7  { width: 75px; height: 75px; filter: none; }
    .af-8  { display: none; }
    .af-9  { width: 65px; height: 65px; filter: none; }
}
