/* --- Шрифты (self-hosted) --- */
@font-face {
    font-family: 'Lemon Tuesday';
    src: url('fonts/lemon_tuesday/Lemon Tuesday.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
/* --- Сброс --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-paper: #F0EAD6;
    --text-ink: #000000;
    --font-main: 'Inter', sans-serif;
    --font-ui: 'Golos Text', sans-serif;
    --neon-cyan: #00f3ff;
    --neon-magenta: #ff00ff;
}

body {
    background-color: #000;
    height: 100vh;
    overflow: hidden;
    font-family: var(--font-main);
}

.top-bar {
    position: fixed; top: 0; left: 0; width: 100%; height: 50px;
    background-color: #000; color: #fff;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 40px; z-index: 1000;
    font-family: var(--font-ui); font-size: 14px; letter-spacing: 0.05em;
}

.header-left {
    display: flex; align-items: center; gap: 12px;
}
.logo {
    margin-left: -40px; /* в сцене 1 текст стоит на месте будущей левой границы бургера */
    transition: transform 1s ease, text-shadow 1s ease, filter 1s ease, margin-left 0.5s ease;
}

.header-title-final {
    position: fixed;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Rubik Glitch', var(--font-ui);
    font-weight: 700;
    font-size: 2.4rem;
    letter-spacing: 0.35em;
    color: #fff;
    white-space: nowrap;
    opacity: 0;
    z-index: 1100;
    transition: opacity 3s ease;
}

.header-title-final.font-rubik-glitch {
    font-family: 'Rubik Glitch', system-ui;
}

.header-title-final.font-train-one {
    font-family: 'Train One', system-ui;
}

/* Glitch-эффект для финального заголовка в шапке (без сжатия по ширине) */
body.scene-2-final .header-title-final:hover {
    font-family: 'Unbounded', var(--font-ui);
    animation: header-glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
    text-shadow: -3px 0 var(--neon-cyan), 3px 0 var(--neon-magenta);
}
.burger-btn {
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
    width: 28px; height: 28px; padding: 0;
    background: none; border: none; color: inherit; cursor: pointer;
    opacity: 0; pointer-events: none;
    transition: opacity 1.5s ease, transform 0.5s ease, box-shadow 0.5s ease, filter 0.5s ease;
}
.burger-line {
    display: block; width: 100%; height: 2px; background: currentColor; border-radius: 1px;
}
.burger-btn .burger-line:nth-child(1) { width: 20px; margin-right: auto; }
.burger-btn .burger-line:nth-child(2) { width: 24px; margin-right: auto; }
.burger-btn .burger-line:nth-child(3) { width: 16px; margin-right: auto; }

/* Сцена 2: первые 1 с — логотип светится, увеличивается, съезжает на 4% вправо; бургер вырисовывается за 1,5 с и светится */
body.scene-2-logo-pre .top-bar .logo,
body.scene-2 .top-bar .logo {
    transform: scale(1.32) translateX(34vw);
    text-shadow: 0 0 12px rgba(255,255,255,0.9), 0 0 24px rgba(255,255,255,0.6);
}
body.scene-2-burger-pre .top-bar .burger-btn,
body.scene-2 .top-bar .burger-btn {
    opacity: 1; pointer-events: auto;
    transform: scale(1.15);
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.8));
}
/* Через 1 с: лого и бургер без свечения, на местах */
body.scene-2-header-ready .top-bar .logo {
    transform: scale(1) translateX(0);
    text-shadow: none;
    margin-left: 0;
    transition: transform 0.5s ease, text-shadow 0.5s ease, margin-left 0.5s ease;
}
body.scene-2-header-ready .top-bar .burger-btn {
    transform: scale(1);
    filter: none;
    transition: opacity 1.5s ease, transform 0.5s ease, filter 0.5s ease;
}

/* Панель бургера */
.burger-panel {
    position: fixed; top: 50px; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.95); color: #fff;
    z-index: 999; padding: 24px 40px;
    transform: translateX(-100%); visibility: hidden;
    transition: transform 0.3s ease, visibility 0.3s ease;
    overflow-y: auto;
}
.burger-panel.is-open {
    transform: translateX(0); visibility: visible;
}
.burger-panel-inner { max-width: 400px; }
.burger-section { margin-bottom: 24px; }
.burger-section-title {
    font-family: var(--font-ui); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
    margin-bottom: 12px; opacity: 0.7;
}
.burger-contacts {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
}
.burger-contact-line {
    margin: 0;
}
.burger-contact-link {
    color: #fff;
    text-decoration: none;
}
.burger-contact-link:hover {
    opacity: 0.8;
}
.burger-contact-handle {
    opacity: 0.9;
}
/* Контакты в бургере показываем только после перехода в сцену 2 и фазы header-ready */
.burger-contacts-section { opacity: 0; transition: opacity 0.4s ease; }
body.scene-2-header-ready .burger-contacts-section { opacity: 1; }

.icon-btn { background: none; border: none; color: inherit; cursor: pointer; }
#sound-toggle .sound-wave { display: block; }
#sound-toggle .sound-mute { display: none !important; }
#sound-toggle.muted .sound-wave { display: none; }
#sound-toggle.muted .sound-mute { display: block !important; }

/* --- CANVAS ФОН (космос / искры) --- */
#bg-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    display: block;
    pointer-events: none;
}

/* --- СЛОИ --- */
.scene-container { position: relative; width: 100%; height: 100%; z-index: 1; }

.layer-back {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}

.tower-wrapper {
    position: relative;
}

#tower-3d {
    position: absolute;
    inset: 0;
    height: 95vh;
    width: auto;
    transform: translateX(25%) translateY(5%) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: opacity 3s ease, transform 7s ease;
}

.tower-img {
    position: relative;
    height: 95vh;
    width: auto;
    transform: translateX(25%) translateY(5%) scale(0.92);
    opacity: 0;
    transition: opacity 3.5s ease, transform 7s ease;
}

.tower-active .tower-img {
    opacity: 1;
    transform: translateX(25%) translateY(5%) scale(1.02);
}

.tower-wrapper.tower-3d-visible #tower-3d {
    opacity: 1;
    transform: translateX(25%) translateY(5%) scale(1.02);
}

.tower-wrapper.tower-3d-visible .tower-img {
    opacity: 0;
}

.layer-front {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2; background-color: var(--bg-paper);
    mix-blend-mode: screen;
    display: flex; align-items: center; justify-content: center;
    padding: 40px;
    transition: background-color 3.5s ease;
}

/* --- КОМПОЗИЦИЯ: НЕЗАВИСИМОЕ ВЫРАВНИВАНИЕ --- */
.content-wrapper {
    display: flex; 
    /* Убираем глобальное выравнивание, чтобы управлять блоками отдельно */
    justify-content: space-between;
    
    width: 100%; 
    max-width: 1300px; 
    height: 100%;
    
    /* Убираем padding-bottom у контейнера, зададим его тексту */
    padding-bottom: 0; 
}

.text-block { 
    flex: 1; 
    max-width: 580px; 
    color: #000; 
    
    /* ТЕКСТ: ПАДАЕТ ВНИЗ */
    align-self: flex-end; 
    margin-bottom: 12vh; /* воздух снизу (было 8vh, +4vh выше) */
    transform: translateY(4vh); /* чуть ниже по вертикали */
    
    display: flex; 
    flex-direction: column; 
    justify-content: flex-end; 
}

/* --- ТИПОГРАФИКА --- */
.titles-wrapper {
    display: flex;
    flex-direction: column;
    width: max-content;
    margin-top: 20px;
    margin-bottom: 28px;
    transform: scale(1.03);
    transform-origin: left center;
}

.hero-name {
    font-family: var(--font-main);
    font-weight: 400;
    font-size: 3.33rem;
    line-height: 1;
    text-transform: uppercase;
    color: #000;
    margin: 0 0 8px 0;
    display: flex;
    justify-content: space-between;
    width: 100%;
    transform: scaleY(0.95);
    transform-origin: left center;
}

body.scene-2-final .text-block {
    /* сохраняем то же положение, что и в сцене 1,
       чтобы блок вообще не смещался по вертикали */
    transform: translateY(4vh);
}

/* В финале просто плавно прячем старый заголовок, не меняя его размеров/шрифта */
body.scene-2-final .hero-name {
    opacity: 0;
    transition: opacity 2.5s ease;
}

body.scene-2-final .header-title-final {
    opacity: 0.75;
}

/* В финале убираем разделительную полоску под именем */
body.scene-2-final .hero-role {
    border-top-color: transparent;
}

@keyframes header-glitch {
    0% {
        transform: translateX(-50%) translate(0, 0) skewX(0deg);
        text-shadow: none;
    }
    20% {
        transform: translateX(-50%) translate(-2px, 1px) skewX(-1deg);
        text-shadow: -3px 0 var(--neon-cyan), 3px 0 var(--neon-magenta);
    }
    40% {
        transform: translateX(-50%) translate(2px, -1px) skewX(1deg);
        text-shadow: -2px 0 var(--neon-cyan), 2px 0 var(--neon-magenta);
    }
    60% {
        transform: translateX(-50%) translate(-1px, 1px);
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    }
    100% {
        transform: translateX(-50%) translate(0, 0) skewX(0deg);
        text-shadow: none;
    }
}

.hero-role {
    font-family: var(--font-main);
    font-weight: 400; 
    font-size: 1.1rem; 
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #000;
    margin: 0;
    white-space: nowrap; 
    padding-top: 10px; 
    border-top: 2px solid #000; 
}

.bio-text {
    font-family: 'Comforter', cursive;
    font-size: 2.160rem;
    line-height: 1.3;
    margin-bottom: 40px;
    color: #000;
    font-weight: 400;
}

.contacts-wrap {
    margin-left: 4%;
    margin-top: -7px;
}
.contacts-wrap .contacts {
    margin-left: -4%;
    padding-right: 4%;
    box-sizing: content-box;
}
.contacts {
    font-family: var(--font-main);
    font-size: 1.1rem;
    color: #000;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 580px;
}
.contacts-row {
    display: flex;
    gap: 20px;
    align-items: center;
}
.contacts-handle {
    text-align: right;
    font-family: var(--font-main);
    font-size: 1.1rem;
    margin-right: 104px;
}
.contact-link { text-decoration: none; color: #000; border-bottom: 1px solid transparent; }
.contact-link:hover { opacity: 0.7; }
.separator { margin: 0 27px; color: #000; }

/* --- ДЕРЕВО: ВОЗВРАТ В ЦЕНТР --- */
.visual-block { 
    flex: 1; 
    display: flex; 
    justify-content: flex-end; 
    
    /* ДЕРЕВО: ВСПЛЫВАЕТ В ЦЕНТР */
    align-self: flex-end;
    margin-bottom: 8px;
    
    /* Возвращаем его визуально чуть ближе к центру (имитируем 1100px) */
    margin-right: 5vw; 
}
.visual-block a { display: none !重要; }

/* Блокировка поиска по картинке (Яндекс.Браузер и др.): не отдаём картинку в фокус мыши и отключаем контекстное меню */
.visual-block { pointer-events: none; }
.tree-image {
    max-height: 82vh; 
    filter: brightness(0) contrast(200%);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    border: none; outline: none;
}

/* --- СЦЕНА 2: через 1 с после полной непрозрачности башни, переход 0.5 с --- */
.hero-name,
.bio-text,
.bio-text p {
    transition: color 2.5s ease, text-shadow 2.5s ease;
}
.hero-role { transition: color 2.5s ease, text-shadow 2.5s ease, border-color 2.5s ease; }
.visual-block,
.contacts-wrap {
    transition: opacity 1.7s ease;
}

.scene-2 .hero-name,
.scene-2 .hero-role,
.scene-2 .bio-text,
.scene-2 .bio-text p {
    color: #fff;
    text-shadow: 0 0 12px rgba(255,255,255,0.9), 0 0 24px rgba(255,255,255,0.7), 0 0 40px rgba(255,255,255,0.5);
}
.scene-2 .hero-role { border-top-color: rgba(255,255,255,0.9); }
.scene-2 .layer-front { background-color: transparent; }
.scene-2 .visual-block,
.scene-2 .contacts-wrap {
    opacity: 0;
    pointer-events: none;
}

/* --- СЦЕНА 2: фон canvas + туманные градиенты --- */
body.scene-2 .scene-container {
    position: relative;
    overflow: hidden;
}

body.scene-2 .scene-container::before {
    content: "";
    position: absolute;
    inset: -10%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 20%, rgba(255, 200, 120, 0.066) 0, transparent 45%),
        radial-gradient(ellipse at 20% 60%, rgba(230, 180, 90, 0.088) 0, transparent 55%),
        radial-gradient(ellipse at 80% 70%, rgba(210, 150, 70, 0.077) 0, transparent 60%);
    filter: blur(12px);
    opacity: 0.9;
}

body.scene-2 .layer-front {
    background-color: transparent;
    position: relative;
}

body.scene-2 .layer-front::before {
    content: "";
    position: absolute;
    pointer-events: none;
    z-index: 0;
    inset: 0;
    background:
        radial-gradient(
            circle at 35% 55%,
            rgba(255, 255, 255, 0.25) 0,
            rgba(255, 255, 255, 0.12) 20%,
            transparent 55%
        );
    mix-blend-mode: screen;
}

@media (max-width: 768px) {
    body { overflow-y: auto; }
    .tower-img { transform: rotate(-10deg) translateX(-10%); }
    .tower-active .tower-img { transform: rotate(-10deg) translateX(-10%) scale(1.02); }
    .layer-front { padding: 18px 20px 16px; box-sizing: border-box; }
    .content-wrapper { 
        flex-direction: column-reverse; 
        text-align: center; 
        align-items: center; 
        justify-content: center;
        padding-bottom: 20px;
        max-width: 100%;
        box-sizing: border-box;
        width: 100%;
    }
    .text-block { 
        align-self: center; 
        align-items: center; 
        margin-bottom: 0; 
        margin-top: -10px;
        transform: translateY(-75px);
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        padding-left: 18px;
        padding-right: 20px;
    }
    .titles-wrapper { 
        width: 100%; 
        max-width: 100%;
        border-bottom: none; 
        align-items: center;
        margin-top: 5px;
    }
    .hero-name { font-size: 2.8rem; justify-content: center; gap: 15px; }
    .hero-role { white-space: normal; border-top: 1px solid #000; padding-top: 10px; display: block; max-width: 100%; }
    .visual-block { align-self: center; justify-content: center; margin-right: 0; margin-bottom: 0; margin-top: 38px; }
    .tree-image { max-height: 36vh; }
    .contacts-wrap { margin-left: -28px; margin-top: -7px; }
    .contacts-wrap .contacts { margin-left: 0; padding-right: 0; box-sizing: border-box; }
    .contacts { 
        justify-content: center; 
        font-size: 0.9rem; 
        width: 100%;
        max-width: 100%;
        gap: 3px;
    }
    .contacts-row { justify-content: center; }
    .separator { margin: 0 4px; }
    .contacts-handle { text-align: center; margin-right: 0; }
}
