/* ============================================================================
   Labocine — TOPBAR, revamped 2026-07. Loads AFTER styles.css and re-skins
   the shared `.topbar` (views/layout.hbs) in the cinematic design language:
   translucent glass in a light and a dark variant, a red "lamp" that glides
   under links on hover and parks under the current page, scroll condensing,
   brand-color accents, and a glass profile dropdown + mobile drawer.

   MARKUP/IDS/HREFS ARE UNCHANGED — #menu, #sideMenu, #profile,
   #profile-dropdown and their toggle classes (.visible) are the contracts
   app.js binds to. This sheet + the small enhancement script in layout.hbs
   (html.tb-scrolled / .is-current / .tb-lamp) are purely additive.
   ============================================================================ */

.topbar {
    --tb-h: 56px;
    --tb-h-scrolled: 50px;
    --tb-bg: rgba(255, 255, 255, 0.72);
    --tb-bg-scrolled: rgba(255, 255, 255, 0.92);
    --tb-line: rgba(10, 10, 15, 0.08);
    --tb-text: #5a5a64;
    --tb-text-strong: #0b0b0f;
    --tb-muted: #8b8b96;
    --tb-red: #f40000;
    --tb-red-hover: #ff2b2b;
    --tb-green: #1fae53;
    --tb-cyan: #008AAB;
    --tb-menu-bg: rgba(15, 15, 19, 0.94);

    height: var(--tb-h);
    top: 0;
    padding: 0 clamp(16px, 2.6vw, 40px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 0;
    border-bottom: 1px solid var(--tb-line);
    background: transparent;
    transition: height 0.35s cubic-bezier(0.2, 0.7, 0.2, 1),
                border-color 0.35s ease, box-shadow 0.35s ease, top 0.35s ease;
}
/* THE GLASS LIVES ON AN OVERLAY, NOT THE HEADER ITSELF: a backdrop-filter
   (or transform) on .topbar makes it the containing block for its
   position:fixed descendants — and the mobile drawer (#sideMenu) is a fixed
   child of the header, so it would be crushed into the 52px bar instead of
   covering the viewport. Keep .topbar free of filters and transforms. */
.topbar::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--tb-bg);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    backdrop-filter: blur(18px) saturate(1.5);
    transition: background 0.35s ease;
}
.topbar--dark {
    --tb-bg: rgba(7, 7, 10, 0.55);
    --tb-bg-scrolled: rgba(7, 7, 10, 0.86);
    --tb-line: rgba(255, 255, 255, 0.08);
    --tb-text: #b9b9c4;
    --tb-text-strong: #ffffff;
    --tb-muted: #8b8b96;
    --tb-green: #34e08a;
}
/* condensed once the page scrolls (html.tb-scrolled set by JS) */
html.tb-scrolled .topbar {
    height: var(--tb-h-scrolled);
    box-shadow: 0 12px 34px -22px rgba(0, 0, 0, 0.55);
}
html.tb-scrolled .topbar::before { background: var(--tb-bg-scrolled); }
/* mobile: the bar tucks away scrolling down, returns scrolling up
   (a `top` offset, NOT transform — see the containing-block note above) */
.topbar.tb-hidden { top: calc(-1 * var(--tb-h) - 4px); }

/* ── logo ─────────────────────────────────────────────────────────────────── */
.topbar__logo__wrapper {
    padding: 0;
    height: auto;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.topbar__logo__wrapper a { display: block; }
.topbar__logo__wrapper img {
    display: block;
    height: 24px;
    width: auto;
    transition: height 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.2s ease;
}
html.tb-scrolled .topbar__logo__wrapper img { height: 21px; }
.topbar__logo__wrapper a:hover img { opacity: 0.85; }

/* ── the nav rail ─────────────────────────────────────────────────────────── */
.topbar__nav { height: 100%; }
.topbar__nav__list {
    height: 100%;
    position: relative;          /* the lamp lives here */
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 1em;
}
.topbar__nav__list > li { margin: 0; height: 100%; display: flex; align-items: center; }
.topbar__nav__list > li:hover { box-shadow: none; }
.topbar--dark .topbar__nav__list > li:hover { box-shadow: none !important; }

.topbar__nav__list > li > a {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 11px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.11em;
    line-height: 1;
    color: var(--tb-text);
    transition: color 0.22s ease, opacity 0.22s ease;
}
.topbar__nav__list > li > a:hover { color: var(--tb-text-strong); }
.topbar--dark .topbar__nav__list > li > a { color: var(--tb-text) !important; }
.topbar--dark .topbar__nav__list > li > a:hover { color: var(--tb-text-strong) !important; }
.topbar__nav__list > li > a.is-current { color: var(--tb-text-strong); }
.topbar--dark .topbar__nav__list > li > a.is-current { color: var(--tb-text-strong) !important; }

/* the lamp — a red glow that glides under the hovered link and parks
   under the current page (created + moved by the layout script) */
.tb-lamp {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 40px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--tb-red) 22%, var(--tb-red) 78%, transparent);
    box-shadow: 0 0 12px rgba(244, 0, 0, 0.65);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.32s cubic-bezier(0.3, 0.9, 0.3, 1), width 0.32s cubic-bezier(0.3, 0.9, 0.3, 1), opacity 0.25s ease;
}
.tb-lamp.is-on { opacity: 1; }

/* ── brand accents (colors moved out of inline styles into classes) ───────── */
.topbar .tb-snw img { height: 24px; display: block; }
.topbar--dark .tb-snw img { filter: drop-shadow(0 0 8px rgba(244, 120, 0, 0.45)); }
.topbar .tb-habitat, .topbar--dark .topbar__nav__list > li > a.tb-habitat { color: var(--tb-green) !important; }
.topbar .tb-habitat:hover, .topbar--dark .topbar__nav__list > li > a.tb-habitat:hover { color: #4dff9f !important; }
.topbar .tb-scenes, .topbar--dark .topbar__nav__list > li > a.tb-scenes { color: var(--tb-red) !important; }
.topbar .tb-scenes:hover, .topbar--dark .topbar__nav__list > li > a.tb-scenes:hover { color: var(--tb-red-hover) !important; }

/* LIVE — a calm cyan pulse instead of the legacy strobing glow */
.topbar .glow__blue, .topbar--dark .topbar__nav__list > li > a.glow__blue {
    color: #19c7e6 !important;
    animation: tb-live 2.6s ease-in-out infinite;
}
@keyframes tb-live {
    0%, 100% { text-shadow: 0 0 10px rgba(25, 199, 230, 0.35); }
    50% { text-shadow: 0 0 18px rgba(25, 199, 230, 0.75); }
}

/* PRO — a clean bordered pill */
.topbar__nav__list > li > a.tb-pro,
.topbar--dark .topbar__nav__list > li > a.tb-pro {
    color: var(--tb-cyan) !important;
    border: 1px solid rgba(0, 138, 171, 0.55);
    border-radius: 999px;
    height: 26px;
    padding: 0 13px;
    margin: 0 4px;
    align-self: center;
    transition: color 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}
.topbar__nav__list > li > a.tb-pro:hover,
.topbar--dark .topbar__nav__list > li > a.tb-pro:hover {
    color: #fff !important;
    background: var(--tb-cyan);
    border-color: var(--tb-cyan);
}

/* SIGNUP — the one true CTA */
.topbar__nav__list > li > a.tb-signup,
.topbar--dark .topbar__nav__list > li > a.tb-signup {
    color: #fff !important;
    background: var(--tb-red);
    border-radius: 999px;
    height: 30px;
    padding: 0 16px;
    margin-left: 6px;
    align-self: center;
    box-shadow: 0 8px 22px -10px rgba(244, 0, 0, 0.7);
    transition: background 0.2s ease, transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.25s ease;
}
.topbar__nav__list > li > a.tb-signup:hover,
.topbar--dark .topbar__nav__list > li > a.tb-signup:hover {
    color: #fff !important;
    background: var(--tb-red-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 26px -10px rgba(244, 0, 0, 0.85);
}

/* ── search icon button ───────────────────────────────────────────────────── */
/* NOTE the legacy asset names are swapped: search.svg is the WHITE glyph,
   search-white.svg is the dark (#444) one */
.topbar .tb-search-ico {
    display: block;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--tb-line);
    background: url(/assets/img/search-white.svg) no-repeat center / 16px 16px;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.topbar--dark .tb-search-ico {
    background-image: url(/assets/img/search.svg);
    border-color: rgba(255, 255, 255, 0.2);
}
.topbar #topbar-search-btn:hover .tb-search-ico {
    border-color: rgba(244, 0, 0, 0.6);
    transform: translateY(-1px);
}

/* ── profile avatar + dropdown ────────────────────────────────────────────── */
.topbar #profile > a > .avatar__img {
    margin-top: 0;
    width: 34px;
    height: 34px;
    border: 2px solid transparent;
    box-shadow: 0 0 0 1px var(--tb-line);
    transition: box-shadow 0.25s ease, transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.topbar #profile:hover > a > .avatar__img {
    box-shadow: 0 0 0 2px rgba(244, 0, 0, 0.65), 0 0 18px -2px rgba(244, 0, 0, 0.4);
    transform: translateY(-1px);
}

/* dark glass dropdown, both variants (beats the legacy __white !importants) */
.topbar .topbar__profile__menu {
    top: calc(100% + 10px);
    right: 0;
    min-width: 250px;
    padding: 8px;
    border-radius: 14px;
    background: var(--tb-menu-bg) !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: 0 30px 60px -25px rgba(0, 0, 0, 0.75);
    transform: translateY(-6px) scale(0.97);
    transform-origin: top right;
    transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
.topbar .topbar__profile__menu.visible { transform: none; }
.topbar .topbar__profile__menu a {
    display: block;
    padding: 10px 14px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.09em;
    color: #e8e8ee !important;
    transition: background 0.18s ease, color 0.18s ease;
}
.topbar .topbar__profile__menu a:hover { background: rgba(255, 255, 255, 0.08); color: #fff !important; }
.topbar .topbar__profile__menu a[href="/auth/logout"] { color: #ff6b6b !important; }
.topbar .topbar__profile__menu a[href="/auth/logout"]:hover { background: rgba(244, 0, 0, 0.14); color: #ff8d8d !important; }
/* the "you are using…" note */
.topbar .topbar__profile__menu li[style] {
    color: #8b8b96 !important;
    font-size: 0.78em !important;
    padding: 4px 14px 8px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 4px;
}

/* ── mobile drawer (same #sideMenu/.visible mechanics) ────────────────────── */
.sidemenu__overlay {
    background: rgba(4, 5, 7, 0.6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.sidemenu__nav__list {
    box-sizing: border-box;
    width: min(320px, 84%);
    background: rgba(11, 11, 15, 0.96);
    -webkit-backdrop-filter: blur(22px);
    backdrop-filter: blur(22px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px 10px 30px;
}
.sidemenu__nav__list > li a {
    height: 46px;
    line-height: 46px;
    padding: 0 14px;
    margin: 2px 0;
    border-bottom: 0;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 700;
    letter-spacing: 0.1em;
    transition: background 0.18s ease;
}
.sidemenu__nav__list > li a:hover { background: rgba(255, 255, 255, 0.07); }
.sidemenu__nav__list .tb-habitat { color: #34e08a !important; }
.sidemenu__nav__list .tb-scenes { color: #ff4d4d !important; }
.sidemenu__nav__list .tb-pro { color: #35cbe8 !important; }
.sidemenu__nav__list .tb-snw img { height: 26px; }
.sidemenu__nav__list #sidemenu-search-btn .tb-search-ico {
    margin: 14px 0 6px 14px;
    background-image: url(/assets/img/search.svg);
    border-color: rgba(255, 255, 255, 0.25);
}
/* staggered entrance when the drawer opens */
.sidemenu__nav__list > li { opacity: 0; transform: translateX(-14px); transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1); }
.sidemenu__nav.visible .sidemenu__nav__list > li { opacity: 1; transform: none; }
.sidemenu__nav.visible .sidemenu__nav__list > li:nth-child(1) { transition-delay: 0.05s; }
.sidemenu__nav.visible .sidemenu__nav__list > li:nth-child(2) { transition-delay: 0.08s; }
.sidemenu__nav.visible .sidemenu__nav__list > li:nth-child(3) { transition-delay: 0.11s; }
.sidemenu__nav.visible .sidemenu__nav__list > li:nth-child(4) { transition-delay: 0.14s; }
.sidemenu__nav.visible .sidemenu__nav__list > li:nth-child(5) { transition-delay: 0.17s; }
.sidemenu__nav.visible .sidemenu__nav__list > li:nth-child(6) { transition-delay: 0.2s; }
.sidemenu__nav.visible .sidemenu__nav__list > li:nth-child(7) { transition-delay: 0.23s; }
.sidemenu__nav.visible .sidemenu__nav__list > li:nth-child(8) { transition-delay: 0.26s; }
.sidemenu__nav.visible .sidemenu__nav__list > li:nth-child(9) { transition-delay: 0.29s; }
.sidemenu__nav.visible .sidemenu__nav__list > li:nth-child(10) { transition-delay: 0.32s; }
.sidemenu__nav.visible .sidemenu__nav__list > li:nth-child(n+11) { transition-delay: 0.35s; }

/* hamburger */
.topbar__responsive__menu { margin-top: 0; display: none; align-items: center; cursor: pointer; }
.topbar__responsive__menu img { display: block; width: 26px; }

/* ── responsive ───────────────────────────────────────────────────────────── */
@media screen and (max-width: 960px) {
    .topbar { --tb-h: 52px; --tb-h-scrolled: 48px; padding: 0 14px; }
    .topbar__responsive__menu { display: flex; }
    .topbar__logo__wrapper { margin: 0 auto; height: auto; }
    .topbar__logo__wrapper img { height: 22px; }
}

/* ── reduced motion ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .topbar, .topbar__logo__wrapper img, .tb-lamp,
    .topbar .topbar__profile__menu, .sidemenu__nav__list > li { transition: none; }
    .topbar .glow__blue, .topbar--dark .topbar__nav__list > li > a.glow__blue { animation: none; }
    .topbar.tb-hidden { top: 0; }
}
