/* ============================================================
   WELCOME CSS — только для главной страницы
   ============================================================ */

/* Главная — фиксированный экран без скролла */
body.page-welcome {
    overflow: hidden;
    height: 100vh;
}

/* ===== HERO ===== */
.hero {
    position: fixed;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 20px;
    text-align: center;
    transition: opacity .6s, transform .6s;
}
.hero.hidden {
    opacity: 0;
    transform: scale(.95);
    pointer-events: none;
}
.hero h1 {
    font-family: 'Rubik Wet Paint', cursive;
    font-weight: 400;
    font-size: clamp(1.8rem, 5vw, 4rem);
    line-height: 1.15;
    max-width: 900px;
    letter-spacing: .01em;
    color: var(--text);
    text-shadow:
        0 0 30px var(--glow),
        0 4px 14px rgba(0, 0, 0, .75),
        0 8px 28px rgba(0, 0, 0, .5);
}
.hero h1 .sub {
    display: block;
    font-family: 'Amatic SC', cursive;
    font-weight: 700;
    font-size: clamp(1.6rem, 4vw, 3rem);
    margin-top: 12px;
    color: var(--accent);
    letter-spacing: .05em;
    text-shadow:
        0 0 20px var(--glow),
        0 3px 10px rgba(0, 0, 0, .8),
        0 6px 22px rgba(0, 0, 0, .55);
}

/* ===== ПЛАВАЮЩАЯ КНОПКА «МЕНЮ» ===== */
.menu-trigger--floating {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 6;
    font-family: 'Caveat', cursive;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    line-height: 1;
    color: var(--text);
    background: rgba(255, 255, 255, .08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--muted);
    border-radius: 999px;
    padding: 16px 44px;
    cursor: pointer;
    text-shadow:
        0 0 24px var(--glow),
        0 0 8px var(--glow),
        0 2px 4px rgba(0, 0, 0, .85),
        0 4px 14px rgba(0, 0, 0, .55);
    transition: background .3s, border-color .3s, color .3s, box-shadow .3s, text-shadow .3s, transform .2s;
    will-change: transform;
}
.menu-trigger--floating:hover {
    background: rgba(255, 255, 255, .16);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 24px var(--glow);
    text-shadow:
        0 0 32px var(--accent),
        0 0 12px var(--accent),
        0 2px 4px rgba(0, 0, 0, .85),
        0 4px 14px rgba(0, 0, 0, .55);
}
.menu-trigger--floating:active {
    transform: scale(.97);
}

/* ===== ЗВЁЗДЫ / СОЛНЦЕ / ЛУНА / ПТИЦЫ / ОБЛАКА ===== */
.sun-moon-layer {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}
.sun-obj, .moon-obj {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    transform: translate(-50%, 50%);
    will-change: left, bottom, width, height, background, box-shadow;
}
.sun-obj.ready, .moon-obj.ready {
    transition:
        left 2s, bottom 2s,
        width 2s, height 2s,
        background 1.5s, box-shadow 1.5s,
        opacity 2s;
}
.sun-obj {
    background: radial-gradient(circle at 35% 35%, #fffbe0 0, #ffc83c 45%, #ff7000 100%);
    box-shadow: 0 0 40px rgba(255, 180, 0, .7), 0 0 80px rgba(255, 100, 0, .4);
}
.moon-obj {
    background: radial-gradient(circle at 35% 30%, #fff 0, #e8ecf8 45%, #b0b8d0 100%);
    box-shadow:
        inset -6px -4px 15px rgba(100, 110, 150, .55),
        0 0 25px rgba(200, 210, 255, .7),
        0 0 60px rgba(120, 130, 200, .4);
}

#scene {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 42vh;
    min-height: 200px;
    max-height: 340px;
    z-index: 2;
    pointer-events: none;
    transition: opacity .6s;
}
#scene path, #scene polygon { fill: #04010a; }

#birds-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 3;
    pointer-events: none;
    display: block;
    opacity: var(--day-factor, 1);
    transition: opacity 1.5s;
}

.clouds-layer {
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    overflow: hidden;
    opacity: calc(var(--day-factor, 1) * .11);
    transition: opacity 1.5s;
}
.c1, .c2 {
    width: 800px;
    height: 700px;
    position: absolute;
    background: transparent url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/131045/clouds.png") 0 0 no-repeat;
    background-size: 100%;
}
.c1.one, .c2.one { top: -260px; left: 0; }
.c1.two, .c2.two { top: -200px; left: 100px; }
.c1.three, .c2.three { top: -240px; right: 100px; }
.c1.four, .c2.four { top: -180px; right: 0; }
.c2.one { top: -209px; }

@keyframes clouds-anime { from { transform: translateX(0); } to { transform: translateX(-200%); } }
@keyframes clouds-anim { from { transform: translateX(200%); } to { transform: translateX(-200%); } }
.c1 { animation: clouds-anime 1000s linear infinite forwards; }
.c2 { transform: translateX(200%); animation: clouds-anim 1000s linear infinite forwards; }

/* ===== СХЕМА (общие стили уже в common.css, здесь только специфика для главной) ===== */
/* ===== 4 КНОПКИ + ВИНЬЕТКА (мобилка) ===== */
.mobile-vignette {
    position: fixed;
    inset: 0;
    z-index: 81;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        transparent 15%,
        rgba(0, 0, 0, .35) 45%,
        rgba(0, 0, 0, .75) 75%,
        rgba(0, 0, 0, .92) 100%
    );
    opacity: 0;
    transition: opacity .5s ease;
}
html[data-theme="light"] .mobile-vignette {
    background: radial-gradient(
        ellipse at center,
        transparent 15%,
        rgba(30, 30, 50, .2) 45%,
        rgba(30, 30, 50, .55) 75%,
        rgba(30, 30, 50, .85) 100%
    );
}
.mobile-vignette.visible { opacity: 1; }

.mobile-controls {
    position: fixed;
    inset: 0;
    z-index: 82;
    display: none;
    pointer-events: none;
    opacity: 0;
    transition: opacity .4s ease;
}
.mobile-controls.visible { display: block; opacity: 1; }

.menu-btn {
    font-family: 'Caveat', cursive;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    position: absolute;
    pointer-events: auto;
    background: transparent;
    border: 0;
    color: var(--text);
    padding: 8px 16px;
    cursor: pointer;
    text-shadow:
        0 0 24px var(--glow),
        0 0 8px var(--glow),
        0 2px 4px rgba(0, 0, 0, .85),
        0 4px 14px rgba(0, 0, 0, .55);
    transition: color .3s, text-shadow .3s, opacity .4s ease, transform .4s ease;
    white-space: nowrap;
    opacity: 0;
    transform: scale(.85);
}
.mobile-controls.visible .menu-btn { opacity: 1; transform: scale(1); }
.mobile-controls.visible .menu-btn--menu { transition-delay: .05s; }
.mobile-controls.visible .menu-btn--sections { transition-delay: .15s; }
.mobile-controls.visible .menu-btn--more { transition-delay: .25s; }
.mobile-controls.visible .menu-btn--contact { transition-delay: .35s; }

.menu-btn:hover {
    color: var(--accent);
    text-shadow:
        0 0 32px var(--accent),
        0 0 12px var(--accent),
        0 2px 4px rgba(0, 0, 0, .85),
        0 4px 14px rgba(0, 0, 0, .55);
}

.menu-btn--menu {
    top: 24px;
    left: 50%;
    transform-origin: center;
    transform: translateX(-50%) scale(.85);
}
.mobile-controls.visible .menu-btn--menu { transform: translateX(-50%) scale(1); }

.menu-btn--more {
    bottom: 24px;
    left: 50%;
    transform-origin: center;
    transform: translateX(-50%) scale(.85);
}
.mobile-controls.visible .menu-btn--more { transform: translateX(-50%) scale(1); }

.menu-btn--contact {
    left: 24px;
    top: 50%;
    transform-origin: center;
    transform: translateY(-50%) rotate(-90deg) scale(.85);
}
.mobile-controls.visible .menu-btn--contact { transform: translateY(-50%) rotate(-90deg) scale(1); }

.menu-btn--sections {
    right: 24px;
    top: 50%;
    transform-origin: center;
    transform: translateY(-50%) rotate(90deg) scale(.85);
}
.mobile-controls.visible .menu-btn--sections { transform: translateY(-50%) rotate(90deg) scale(1); }

/* ===== ЦЕНТРАЛЬНОЕ МЕНЮ (мобилка) ===== */
.center-menu {
    position: fixed;
    inset: 0;
    z-index: 83;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 26, .78);
    backdrop-filter: blur(16px);
    padding: 20px;
}
html[data-theme="light"] .center-menu { background: rgba(240, 238, 230, .85); }
.center-menu.open { display: flex; }

.menu-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 340px;
    width: 100%;
}

.menu-item {
    font-family: 'PT Sans Caption', sans-serif;
    display: block;
    padding: 16px 20px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    opacity: 0;
    backdrop-filter: blur(8px);
    transition: background .3s, border-color .3s;
}
.menu-item:hover { background: rgba(255, 255, 255, .14); border-color: var(--accent); }

.menu-item.anim-1 { animation: flyLeft .7s cubic-bezier(.34, 1.56, .64, 1) forwards; }
.menu-item.anim-2 { animation: flyRight .7s cubic-bezier(.34, 1.56, .64, 1) forwards; }
.menu-item.anim-3 { animation: flyTop .7s cubic-bezier(.34, 1.56, .64, 1) forwards; }
.menu-item.anim-4 { animation: flyBottom .7s cubic-bezier(.34, 1.56, .64, 1) forwards; }
.menu-item.anim-5 { animation: popScale .7s cubic-bezier(.34, 1.56, .64, 1) forwards; }
.menu-item.anim-6 { animation: spinIn .7s cubic-bezier(.34, 1.56, .64, 1) forwards; }

@keyframes flyLeft { 0% { opacity: 0; transform: translateX(-140px) scale(.7); } 100% { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes flyRight { 0% { opacity: 0; transform: translateX(140px) scale(.7); } 100% { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes flyTop { 0% { opacity: 0; transform: translateY(-140px) scale(.7); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes flyBottom { 0% { opacity: 0; transform: translateY(140px) scale(.7); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes popScale { 0% { opacity: 0; transform: scale(.2); } 60% { transform: scale(1.15); } 100% { opacity: 1; transform: scale(1); } }
@keyframes spinIn { 0% { opacity: 0; transform: rotate(-200deg) scale(.4); } 100% { opacity: 1; transform: rotate(0) scale(1); } }

.menu-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid var(--card-border);
    color: var(--text);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .3s;
    backdrop-filter: blur(8px);
}
.menu-close:hover { background: rgba(255, 255, 255, .16); }

/* ===== СХЕМА (D3) ===== */
.tree-wrap {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .5s;
    background: var(--bg-1);
}
.tree-wrap.visible { opacity: 1; pointer-events: auto; }

#tree-svg { width: 100vw; height: 100vh; cursor: grab; }
#tree-svg:active { cursor: grabbing; }

.node-group { cursor: grab; }
.node-circle { stroke: rgba(127, 127, 127, .3); stroke-width: 1.5; }
.node-label {
    font-family: 'PT Sans Caption', sans-serif;
    fill: #0a0a1a;
    font-weight: 700;
    pointer-events: none;
    text-anchor: middle;
    dominant-baseline: central;
}
.link-line { stroke: rgba(127, 127, 127, .2); stroke-width: 1.5; fill: none; }
.link-charge {
    stroke: #e6f0ff;
    stroke-width: 2.6;
    fill: none;
    stroke-linecap: round;
    pointer-events: none;
    filter: drop-shadow(0 0 4px var(--accent)) drop-shadow(0 0 8px var(--accent));
    opacity: 0;
}
.node-link .node-circle {
    stroke: var(--accent);
    stroke-width: 2.5;
    transition: stroke .3s, filter .3s, stroke-width .3s;
}
.node-link:hover .node-circle {
    filter: drop-shadow(0 0 8px var(--accent)) drop-shadow(0 0 16px var(--accent));
    stroke-width: 3;
}
.node-link .node-label {
    text-decoration: underline;
    text-decoration-color: rgba(10, 10, 26, .5);
    text-underline-offset: 2px;
}
.node-link { cursor: pointer !important; }

.close-scheme {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 85;
    background: var(--btn-inset-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    color: var(--text);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 2px 4px var(--inset-dark),
        inset 0 -1px 2px var(--inset-light);
    transition: color .3s, transform .3s;
}
.close-scheme.visible { display: flex; }
.close-scheme:hover { color: var(--accent); transform: rotate(90deg); }

/* Скрываем фоновые слои при открытой схеме */
body.scheme-open #birds-canvas,
body.scheme-open .clouds-layer,
body.scheme-open .stars-layer,
body.scheme-open .sun-moon-layer,
body.scheme-open #scene { opacity: 0 !important; }

/* ===== АДАПТИВ ===== */
@media (max-width: 768px) {
    #birds-canvas,
    .clouds-layer { display: none; }

    #scene { height: auto; min-height: 0; max-height: none; }

    .hero { padding: max(100px, 15vh) max(76px, 12vw); }
    .hero h1 { font-size: clamp(1.35rem, 5.6vw, 2.2rem); line-height: 1.22; }
    .hero h1 .sub { font-size: clamp(1.15rem, 4.6vw, 1.9rem); margin-top: 10px; }

    .menu-trigger--floating { font-size: 24px; letter-spacing: .14em; }

    .close-scheme { display: none !important; }
}

@media (max-width: 520px) {
    .menu-trigger--floating { font-size: 20px; letter-spacing: .12em; }
    .menu-btn { font-size: 22px; letter-spacing: .14em; }
    .menu-btn--menu { top: 18px; }
    .menu-btn--more { bottom: 18px; }
    .menu-btn--contact { left: 16px; }
    .menu-btn--sections { right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .c1, .c2 { animation: none; }
    .bg-orb { animation: none; }
    #birds-canvas, #universe { display: none; }
    .link-charge { display: none; }
}
