/* =============================================================
   ALCO-TIER · SHELL v9 — шапка, навигация, секции, подвал, модалки
   Подключается после tokens.css, до page-css.
   Разметочный контракт:

   <header class="endfield-sidebar site-header" id="siteHeader">
     <div class="container site-header-inner">
       <a class="brand" href="/">…</a>
       <nav class="site-nav"> <a class="sidebar-nav-item" href="#sec-…">…</a> </nav>
       <div class="site-actions"> … <button id="sidebarToggleBtn" class="nav-burger">☰</button></div>
     </div>
   </header>

   <nav class="mobile-bottom-bar"> <a class="mobile-tab-item" href="#sec-…">…</a> </nav>

   <section class="ef-section sec" id="sec-…">
     <div class="container">
       <header class="sec-head"><div>…</div><div class="sec-tools">…</div></header>
       …
     </div>
   </section>

   <footer class="site-foot"> … </footer>
   ============================================================= */

/* ============================ шапка ============================ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 80;
    background: rgba(11, 9, 6, .78);
    -webkit-backdrop-filter: blur(14px) saturate(120%);
    backdrop-filter: blur(14px) saturate(120%);
    border-bottom: 1px solid var(--line);
}

.site-header-inner {
    display: flex;
    align-items: center;
    gap: clamp(16px, 3vw, 40px);
    min-height: var(--header-h);
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 0 0 auto;
    line-height: 1;
}
.brand-mark {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: .01em;
    text-transform: uppercase;
    color: var(--cream-2);
    transition: color var(--dur);
}
.brand:hover .brand-mark { color: var(--accent); }
.brand-sub {
    font-size: .6875rem;
    font-weight: 500;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-inline: auto;
}

.sidebar-nav-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 0 13px;
    border-radius: var(--r-sm);
    color: var(--muted);
    font-size: var(--fs-sm);
    font-weight: 500;
    white-space: nowrap;
    transition: color var(--dur), background var(--dur);
}
.sidebar-nav-item:hover { color: var(--cream-2); background: rgba(242, 232, 213, .055); }
.sidebar-nav-item.active { color: var(--cream-2); }
.sidebar-nav-item.active::after {
    content: "";
    position: absolute;
    left: 13px; right: 13px; bottom: 4px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
}
.sidebar-nav-item .nav-index {
    font-family: var(--font-display);
    font-size: .6875rem;
    font-weight: 500;
    color: var(--muted-2);
    letter-spacing: .06em;
}
.sidebar-nav-item.active .nav-index { color: var(--accent); }

.site-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

/* пилюля комнаты */
.room-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-pill);
    background: rgba(242, 232, 213, .035);
    color: var(--cream);
    font-size: var(--fs-xs);
    font-weight: 500;
    transition: border-color var(--dur), background var(--dur);
}
.room-pill:hover { border-color: var(--line-3); background: rgba(242, 232, 213, .075); }
.room-pill .room-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #7ED17E;
    box-shadow: 0 0 0 3px rgba(126, 209, 126, .16);
}
.room-pill strong {
    font-weight: 700;
    color: var(--cream-2);
    letter-spacing: .02em;
}
.room-pill .room-label { color: var(--muted); }

/* звук */
.sound-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 13px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-pill);
    color: var(--muted);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: .04em;
    transition: color var(--dur), border-color var(--dur);
}
.sound-toggle:hover { color: var(--cream-2); border-color: var(--line-3); }
.sound-toggle[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

.nav-burger {
    display: none;
    width: 42px; height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    color: var(--cream);
    font-size: 1.1rem;
}
.nav-burger:hover { border-color: var(--line-3); }

/* ============================ каркас секций ============================ */

.sec {
    position: relative;
    padding-block: clamp(64px, 8vw, 112px);
}
.sec--tight { padding-block: clamp(40px, 5vw, 64px); }
.sec--flush { padding-block: 0; }

.sec-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--s-5);
    margin-bottom: clamp(28px, 4vw, 48px);
    flex-wrap: wrap;
}
.sec-head > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 720px;
}
.sec-title {
    font-size: var(--fs-h2);
    font-weight: 600;
    letter-spacing: -.01em;
}
.sec-lead { max-width: 58ch; }
.sec-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* полноширинная фотополоса */
.photo-band {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.photo-band img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-band::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--photo-warm);
    pointer-events: none;
}

/* ============================ мобильный низ ============================ */

.mobile-bottom-bar {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 70;
    height: calc(var(--bottom-bar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(11, 9, 6, .92);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
}
.mobile-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    color: var(--muted-2);
    font-size: .75rem;
    font-weight: 500;
    letter-spacing: .02em;
    transition: color var(--dur);
}
.mobile-tab-item .tab-icon {
    font-family: var(--font-display);
    font-size: .75rem;
    letter-spacing: .04em;
}
.mobile-tab-item.active { color: var(--accent); }

/* ============================ подвал ============================ */

.site-foot {
    margin-top: clamp(48px, 7vw, 96px);
    border-top: 1px solid var(--line);
    background: var(--night-2);
}
.site-foot-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s-6);
    flex-wrap: wrap;
    padding-block: clamp(32px, 5vw, 56px);
}
.site-foot p {
    font-size: var(--fs-xs);
    color: var(--muted-2);
    max-width: 46ch;
}
.site-foot .foot-mark {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1;
    color: var(--cream);
}
.site-foot .foot-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: var(--fs-sm);
}
.site-foot .foot-links a { color: var(--muted); }
.site-foot .foot-links a:hover { color: var(--cream-2); }

/* ============================ модалки ============================ */

.lightbox-modal,
.trailer-modal,
.modal-overlay,
.qr-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(5, 3, 2, .84);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.lightbox-modal.open,
.trailer-modal.open,
.modal-overlay.open,
.qr-modal.open { display: flex; }

.lightbox-modal-card,
.trailer-modal-card,
.modal-content,
.qr-modal-card {
    position: relative;
    width: min(720px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border-radius: var(--r-lg);
    background: var(--paper);
    color: var(--paper-ink);
    box-shadow: var(--shadow-lg);
}
.modal-content { width: min(560px, 100%); }
.qr-modal-card { width: min(420px, 100%); padding: 28px; }
.trailer-modal-card { width: min(880px, 100%); background: var(--night-2); color: var(--cream); }

.lightbox-close,
.trailer-close,
.modal-close,
.qr-close {
    position: absolute;
    top: 10px; right: 10px;
    z-index: 2;
    width: 38px; height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-pill);
    background: rgba(0, 0, 0, .35);
    color: var(--cream);
    font-size: 1.25rem;
    line-height: 1;
    transition: background var(--dur), transform var(--dur);
}
.lightbox-close:hover,
.trailer-close:hover,
.modal-close:hover,
.qr-close:hover { background: var(--accent); color: var(--accent-ink); transform: rotate(90deg); }

.lightbox-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--paper-line);
}
.lightbox-head span:first-child {
    font-family: var(--font-display);
    font-size: 1.1rem;
    text-transform: uppercase;
}
.lightbox-cap { font-size: var(--fs-xs); color: var(--paper-muted); letter-spacing: .1em; text-transform: uppercase; }
.lightbox-img-wrap { background: #0b0906; }
.lightbox-img-wrap img { width: 100%; max-height: 62vh; object-fit: contain; }
.lightbox-modal-card > p { padding: 18px 24px 24px; color: var(--paper-muted); font-size: var(--fs-sm); }

.trailer-frame { position: relative; aspect-ratio: 16 / 9; }
.trailer-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ============================ тост ============================ */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(28px + var(--bottom-bar-h));
    z-index: 300;
    transform: translate(-50%, 16px);
    max-width: min(90vw, 520px);
    padding: 13px 20px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-pill);
    background: rgba(23, 19, 13, .96);
    color: var(--cream-2);
    font-size: var(--fs-sm);
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur), transform var(--dur) var(--ease-out);
}
.toast.show,
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ============================ пропустить навигацию ============================ */

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 400;
    padding: 10px 16px;
    border-radius: var(--r-sm);
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
    transition: top .2s;
}
.skip-link:focus { top: 12px; }

/* ============================ адаптив ============================ */

@media (max-width: 1080px) {
    .site-nav { gap: 0; }
    .sidebar-nav-item { padding: 0 10px; font-size: var(--fs-xs); }
    .sidebar-nav-item .nav-index { display: none; }
}

@media (max-width: 900px) {
    :root { --header-h: 64px; }

    body { padding-bottom: var(--bottom-bar-h); }

    /* тач-таргеты ≥44px в шапке (мобила) */
    .room-pill,
    .sound-toggle,
    .nav-burger { height: 44px; min-height: 44px; }
    .link-action { min-height: 44px; display: inline-flex; align-items: center; }

    .nav-burger { display: inline-flex; }

    .site-nav {
        position: absolute;
        left: 0; right: 0;
        top: 100%;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        margin: 0;
        padding: 10px var(--gutter) 16px;
        background: rgba(11, 9, 6, .98);
        border-bottom: 1px solid var(--line);
    }
    .site-header.is-expanded .site-nav { display: flex; }
    .sidebar-nav-item {
        min-height: 48px;
        padding: 0 8px;
        font-size: var(--fs-body);
        border-radius: var(--r-xs);
    }
    .sidebar-nav-item.active { background: rgba(242, 232, 213, .05); }
    .sidebar-nav-item.active::after { display: none; }

    .site-actions { margin-left: auto; }
    .room-pill { padding: 0 11px; }
    .room-pill .room-label { display: none; }
    .sound-toggle { width: 40px; padding: 0; justify-content: center; }
    .sound-toggle span { display: none; }

    .mobile-bottom-bar { display: flex; }

    .sec { padding-block: 56px; }
    .sec-head { margin-bottom: 24px; }

    .site-foot-inner { flex-direction: column; }
    .toast { bottom: calc(18px + var(--bottom-bar-h)); }
}

@media (max-width: 560px) {
    .brand-sub { display: none; }
    .site-actions .btn { display: none; }
    .sec-title { font-size: clamp(1.9rem, 9vw, 2.6rem); }
}
