/* ===============================
   МОДЕРЕН ХЕДЪР + РАДИАЛНА НАВИГАЦИЯ (АДАПТИВНИ)
   =============================== */

/* 0) Адаптивни променливи за двойката "рафт + лоти" и радиалния хъб */
:root {
    /* размер на лотито */
    --hub-size: clamp(150px, 10.5vw, 220px);

    /* контейнерът за хъба (пръстенът) е малко по-голям от самото лоти */
    --nav-size: calc(var(--hub-size) * 1.28);

    /* РАДИУС САМО ЗА ХЪБА/НОДОВЕТЕ (НЕ глобалното --radius) */
    --hub-radius: calc(var(--nav-size) * 0.42);

    --node-scale: 0.30;

    /* размер на кръглите нодове */
    /*--node-size: clamp(44px, 4.5vw, 60px);*/
    --node-size: calc(var(--hub-size) * var(--node-scale));
    /* широчина на рафта (картинката) */
    --shelf-w: clamp(260px, 22vw, 480px);

    /* базова дистанция между колоните (центриран клъстер) */
    --rail-gap: clamp(12px, 3.8vw, 100px);

    /* допълнителна дистанция САМО между рафта и Lottie (разпределена симетрично) */
    --pair-extra: clamp(0px, 1.2vw, 20px);

    /* колко да го изместим като процент от хъба (минус = наляво) */
    --lottie-shift-factor: -0.70; /* пробвай -0.15 / -0.2 по вкус */

    /* локално изместване само на Lottie (наляво отрицателно) */
    --lottie-shift-x: calc(var(--hub-size) * var(--lottie-shift-factor));

    /* изместване на нодовете, за да останат коцентрични с Lottie */
    --nodes-shift-x: var(--lottie-shift-x);

    --header-offset: 300px; /* пипни по вкус; 0px = без отместване */
}

/* Невидим флекс-спейсър преди първия елемент вътре в header-card */
.header-card::before {
    /*content: "";*/
    display: block;
    flex: 0 0 var(--header-offset); /* фиксирана ширина на „клинчето“ вдясно */
    /* за да НЕ добавя допълнителен gap между спейсъра и първото дете: */
    margin-right: calc(-1 * var(--rail-gap));
}

/* --- СТИЛОВЕ ЗА НОВИЯ МОДЕРЕН ХЕДЪР --- */
.modern-header {
    padding: 5px;
    position: sticky;
    top: 0;
    z-index: 3000;
    background: hsla(0, 0%, 100%, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-card {
    display: flex; /* всичко е във флекс ред */
    align-items: center;
    justify-content: center; /* КЛЪСТЕРНО ЦЕНТРИРАНЕ */
    gap: var(--rail-gap); /* контролирана дистанция между колоните */
    position: relative;
    z-index: 3001;
    margin: 0 auto;
    padding: 5px 10px;
    border: 1px solid hsla(var(--p-h), var(--p-s), var(--p-l), 0.4);
    border-radius: 12px;
    background: hsla(0, 0%, 100%, 0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.header-card > * {
    flex: 0 0 auto;
}

/* не разтягай децата */

/* Брандинг/лого зона (вляво) */
.header-card > .site-branding {
    order: 1;
    position: relative;
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 0; /* НЯМА margin-left, за да не измества центъра */
    padding-left: 170px; /* резерв за логото вътре в блока */
}

.site-logo {
    position: absolute;
    left: -20%;
    top: 60%;
    transform: translateY(-50%);
    display: block;
    line-height: 0;
}

/* Рафтовото изображение – стои в клъстера, без да бута вдясно */
.header-divider {
    order: 3;
    position: static !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    pointer-events: none;
    margin: 0; /* няма auto */
    margin-right: calc(var(--pair-extra) / 2); /* половината от доп. дистанцията */
}

.header-divider img.shelf-img {
    display: block;
    width: var(--shelf-w);
    height: auto;
}

/* Радиа̀лната навигация – залепена до рафта, симетрично */
.radial-nav {
    order: 4;
    margin: 0;
    margin-left: calc(var(--pair-extra) / 2); /* другата половина от доп. дистанцията */
    width: var(--hub-size);
    height: var(--hub-size);
    position: relative;
    /*display: grid;*/
    place-items: center;
    z-index: 40;
    overflow: visible; /* нодовете спокойно излизат извън контейнера */
}

/* Социални – част от десния клъстер (не са заковани вдясно) */
.header-social {
    order: 5;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    /*margin-left: 20px;   !* няма доп. марджин – ползваме rail-gap *!*/
    z-index: 10;
}

.header-social .social-link {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    text-decoration: none;
    background: transparent;
    transition: background .2s ease, transform .15s ease;
}

.header-social .social-link:hover {
    background: rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.header-social .social-icn {
    width: 38px;
    height: 38px;
    display: block;
    fill: currentColor;
    color: var(--primary);
    transition: color .2s ease;
}

.header-social .social-link:hover .social-icn {
    color: var(--primary);
    filter: brightness(0.55);
}

/* Домашна икона */
.header-home-icon {
    color: #2b2b2b;
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-block;
}

.header-home-icon:hover {
    color: var(--primary);
    transform: scale(1.05);
}

.header-home-icon svg {
    width: 48px;
    height: 48px;
    display: block;
}

/* Заглавия */
.site-titles h1 {
    font-family: "Train One", system-ui;
    font-weight: 400;
    font-size: 3.2rem;
    font-style: italic;
    text-transform: none;
    margin-bottom: 0;
    line-height: 1;
}

.gradient-text .reg {
    font-size: 0.3em;
    vertical-align: top;
    margin-left: 2px;
}

h1.gradient-text {
    background: linear-gradient(45deg, var(--primary), hsl(var(--p-h), var(--p-s), calc(var(--p-l) - 20%)));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    margin-top: 60px;
    margin-left: -80px;
}

.site-titles .motto {
    font-family: "Cormorant Garamond", serif;
    font-size: 1.1rem;
    color: #6b5e4e;
    font-style: italic;
    margin-top: 0;
    line-height: 1.2;
    margin-left: -80px;
}

/* (Старият SVG разделител, ако още стои) */
.header-divider svg {
    display: none !important;
}

/* Прогрес бар при скрол */
/*.scroll-progress-bar {*/
/*    position: absolute;*/
/*    top: 0;*/
/*    left: 0;*/
/*    height: 10px;*/
/*    background: var(--primary);*/
/*    width: 0%;*/
/*    z-index: 1001;*/
/*    transition: width 0.1s linear;*/
/*    border-top-left-radius: 12px;*/
/*}*/

/* --- РАДИАЛЕН ХЪБ (АДАПТИВЕН) --- */

/* Долен цветен фон (наследява основния цвят) */
.radial-hub .hub-bg {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    z-index: 0;
    background: hsl(var(--p-h) var(--p-s) var(--p-l));
}

/* ЛОГОТО остава под стъклото */
.radial-hub img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 50%;
    height: auto;
    object-fit: contain;
    z-index: 0;
}

/* Стъкло/блясък */
/*.radial-hub::after {*/
/*  content:"";*/
/*  position:absolute;*/
/*  inset:0;*/
/*  border-radius:50%;*/
/*  pointer-events:none;*/
/*  z-index:3;*/
/*  background:*/
/*    linear-gradient(180deg,*/
/*      rgba(255,255,255,0.35) 0%,*/
/*      rgba(255,255,255,0.20) 28%,*/
/*      rgba(255,255,255,0.00) 46%),*/
/*    radial-gradient(90% 70% at 80% 15%,*/
/*      rgba(255,255,255,0.55) 0%,*/
/*      rgba(255,255,255,0.55) 42%,*/
/*      rgba(255,255,255,0.00) 48%),*/
/*    radial-gradient(50% 40% at 25% 78%,*/
/*      rgba(255,255,255,0.35) 0%,*/
/*      rgba(255,255,255,0.35) 30%,*/
/*      rgba(255,255,255,0.00) 38%);*/
/*  box-shadow:*/
/*    inset 0 0 0 1px rgba(255,255,255,0.25),*/
/*    0 8px 22px rgba(0,0,0,0.30);*/
/*  mix-blend-mode: screen;*/
/*}*/
/*.radial-hub::before{*/
/*  content:"";*/
/*  position:absolute;*/
/*  inset:0;*/
/*  border-radius:50%;*/
/*  pointer-events:none;*/
/*  z-index:2;*/
/*  background:*/
/*    radial-gradient(90% 60% at 50% 0%,*/
/*      rgba(255,255,255,0.45) 0%,*/
/*      rgba(255,255,255,0.15) 32%,*/
/*      rgba(255,255,255,0.00) 60%);*/
/*  mix-blend-mode: screen;*/
/*}*/

/* Hub като бутон (без дефолтни стилове) */
.radial-hub {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

/* Lottie – запълва контейнера плътно */
.lottie-hub {
    position: absolute;
    inset: 0;
    margin: 0; /* не центрираме; 1:1 с контейнера */
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
}

.lottie-hub dotlottie-player {
    width: 100% !important;
    height: 100% !important;
    display: block;
    pointer-events: none;
}

/* махни „стъклото“ само за този хъб */
.lottie-hub .hub-bg {
    display: none !important;
}

.lottie-hub::before,
.lottie-hub::after {
    content: none !important;
    display: none !important;
    box-shadow: none !important;
    background: none !important;
}

/* Етикет в Lottie */
.lottie-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    height: 100%;
    transform: translateX(var(--lottie-shift-x)); /* локално изместване само на Lottie-то */
}

.lottie-wrapper .lottie-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -35%);
    font-weight: bold;
    font-size: 0.6rem;
    color: white;
    transition: all 0.3s ease;
    pointer-events: none;
}

.lottie-wrapper .lottie-label.active {
    color: hsl(var(--p-h), var(--p-s), var(--p-l));
    font-size: 1rem;
}

.lottie-label .arrow {
    font-size: 14px;
    display: block;
    margin-top: 2px;
}

/* --- НОДОВЕ (полярно позициониране от центъра) --- */
.radial-node {
    --a: 0deg; /* индивидуален ъгъл чрез .node-XXX класовете */
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--node-size);
    height: var(--node-size);
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: inset 0 4px 10px rgba(0, 0, 0, .2), 0 5px 12px rgba(0, 0, 0, .2);
    transition: filter .2s ease, box-shadow .2s ease, opacity .22s ease, visibility .22s ease;
    z-index: 9;
    font-size: clamp(18px, 1.4vw, 22px);
    text-decoration: none;
    overflow: visible;

    transform: translate(-50%, -50%) rotate(var(--a)) translate(var(--hub-radius)) rotate(calc(var(--a) * -1)) translateX(var(--nodes-shift-x)); /* коцентрично изместване на пръстена */
}

.radial-node > a, .radial-node button {
    color: #fff;
    text-decoration: none;
    font-size: inherit;
    line-height: 1;
}

.radial-node:hover {
    filter: brightness(1.15);
    box-shadow: inset 0 6px 14px rgba(0, 0, 0, .26), 0 8px 18px rgba(0, 0, 0, .26);
    border-color: white;
    z-index: 11;
}

/* Ъгли (подава се стойност към --a) */
.node-280 {
    --a: 290deg;
}

.node-180 {
    --a: 180deg;
}

.node-120 {
    --a: 145deg;
}

.node-300 {
    --a: 325deg;
}

.node-0 {
    --a: 0deg;
}

.node-60 {
    --a: 35deg;
}

/* Бейдж */
.node-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    background: #d54141;
    color: #fff;
    border: 2px solid #1d483b;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    display: grid;
    place-items: center;
}

/* Показване/скриване на нодовете чрез .open */
.radial-nav .radial-node {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.radial-nav.open .radial-node {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Подменю (профил) */
.radial-submenu {
    position: absolute;
    list-style: none;
    padding: 6px;
    margin: 0;
    border-radius: 12px;
    background: var(--primary);
    border: 1px solid rgba(255, 255, 255, .15);
    box-shadow: 0 8px 18px rgba(0, 0, 0, .18);
    display: none;
    min-width: 210px;
    z-index: 60;
    text-align: left;
}

.profile-node-wrapper::before {
    content: '';
    position: absolute;
    inset: -15px;
    background: transparent;
}

.profile-node-wrapper .radial-submenu {
    top: 50%;
    left: calc(100% + 15px);
    transform: translateY(-40%);
}

.profile-node-wrapper .profile-avatar {
    display: grid;
    place-items: center;
    width: 100%;
}

.profile-node-wrapper img {
    width: 55%;
    object-fit: cover;
    display: block;
}

.radial-submenu li {
    margin: 0;
}

.radial-submenu a, .radial-submenu button {
    display: block;
    width: 100%;
    padding: 8px 10px;
    color: #fff;
    text-align: left;
    background: transparent;
    border: 0;
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    border-radius: 6px;
    box-sizing: border-box;
    text-decoration: none;
}

.radial-submenu a:hover, .radial-submenu button:hover {
    background: rgba(255, 255, 255, .14);
}

.radial-node:hover .radial-submenu {
    display: block;
}

/* Търсене в нод */
.search-node {
    padding: 0;
}

.search-node form {
    display: flex;
    align-items: center;
    width: var(--node-size);
    height: 100%;
    transition: width .28s ease, background-color .28s ease;
    border-radius: 30px;
}

.search-node input {
    order: 2;
    width: 0;
    padding: 0;
    border: 0;
    outline: 0;
    transition: width .28s ease, padding .28s ease;
    font: inherit;
    color: #2b2b2b;
    font-size: 16px;
    background: transparent;
}

.search-node:hover form {
    width: min(230px, 52vw);
    background: #fff;
}

.search-node:hover input {
    width: 160px;
    max-width: 38vw;
    padding: 0 10px;
}

.search-node button {
    order: 1;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    min-width: var(--node-size);
    height: var(--node-size);
    display: grid;
    place-items: center;
    transition: color .28s ease;
}

.search-node:hover button {
    color: #1d483b;
}

/* Експандери/етикети – с постоянна бяла рамка и ограничение в широчината */
.expander-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: var(--node-size);
    height: 100%;
    border-radius: 30px;
    box-sizing: border-box;
    border: 2px solid #fff; /* рамката винаги е бяла */
    background: transparent;
    transition: width .28s ease, background-color .28s ease, transform .28s ease;
    will-change: width, transform;
}

.expander-wrapper .label-text {
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    color: #ffffff;
    font-size: clamp(12px, 1vw, 16px);
    font-weight: 600;
    transition: width .28s ease, padding .28s ease;
}

.expander-wrapper span:first-child {
    min-width: var(--node-size);
    display: grid;
    place-items: center;
    transition: color .28s ease;
}

.radial-node:hover .expander-wrapper {
    background: var(--primary);
    width: min(48vw, 180px);
    border-color: #fff;
    box-shadow: 0 12px 24px rgba(0, 0, 0, .5);
}

.radial-node:hover .expander-wrapper span:first-child {
    color: #1d483b;
}

.radial-node:hover .label-text {
    width: auto;
}

/* Посоки на разширяване */
.expand-right .expander-wrapper {
    flex-direction: row;
    justify-content: flex-start;
    transform-origin: left center;
}

.expand-right:hover .label-text {
    padding-right: 15px;
}

.expand-left .expander-wrapper {
    flex-direction: row-reverse;
    transform-origin: right center;
}

.expand-left:hover .expander-wrapper {
    transform: translateX(calc(var(--node-size) * -1.75));
}

.expand-left:hover .label-text {
    padding-left: 15px;
}

/* Потребителска информация в подменюто */
.user-info-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 4px 10px;
    padding: 4px 8px 8px;
}

.user-info-grid .username {
    font-weight: 600;
    font-size: 16px;
    grid-column: 1;
    grid-row: 1;
}

.user-info-grid .points {
    font-size: 14px;
    opacity: 0.8;
    grid-column: 1;
    grid-row: 2;
}

.user-info-grid .theme-label {
    font-size: 14px;
    opacity: 0.8;
    text-align: right;
    grid-column: 2;
    grid-row: 1;
}

.user-info-grid .theme-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    grid-column: 2;
    grid-row: 2;
    justify-content: flex-end;
}

.theme-controls .swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: var(--sw);
    padding: 0;
}

.theme-controls input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
}

.theme-controls input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.theme-controls input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.radial-submenu .dropdown-divider {
    height: 1px;
    background: rgb(255, 255, 255);
    margin: 6px 4px;
    border: 0;
}

.swatch {
    display: inline-block;
    width: 1em;
    height: 1em;
    border-radius: 50%;
    background: var(--sw);
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid rgba(0, 0, 0, .1);
}

/* --- Респонсив правила --- */
@media (max-width: 1200px) {
    :root {
        --hub-size: clamp(140px, 12vw, 200px);
        --nav-size: calc(var(--hub-size) * 1.26);
        --hub-radius: calc(var(--nav-size) * 0.40);
        --shelf-w: clamp(240px, 26vw, 440px);

        --rail-gap: clamp(10px, 2vw, 28px);
        --pair-extra: clamp(0px, 1vw, 16px);

        /* по-фино изместване при по-малки екрани */
        --lottie-shift-x: -20px;
        --nodes-shift-x: -20px;
    }
}

@media (max-width: 960px) {
    .header-social {
        gap: 6px;
    }

    .header-social .social-link {
        width: 30px;
        height: 30px;
    }

    .header-social .social-icn {
        width: 16px;
        height: 16px;
    }

    :root {
        --hub-size: clamp(130px, 15vw, 180px);
        --nav-size: calc(var(--hub-size) * 1.24);
        --shelf-w: clamp(220px, 35vw, 360px);

        --rail-gap: clamp(10px, 2.4vw, 24px);
        --pair-extra: clamp(0px, 1.2vw, 14px);

        --lottie-shift-x: -16px;
        --nodes-shift-x: -16px;
    }
}

@media (max-width: 480px) {
    :root {
        --hub-size: clamp(120px, 28vw, 160px);
        --nav-size: calc(var(--hub-size) * 1.22);
        --shelf-w: clamp(200px, 46vw, 300px);

        --rail-gap: clamp(8px, 3vw, 18px);
        --pair-extra: clamp(0px, 1.8vw, 12px);

        --lottie-shift-x: -10px;
        --nodes-shift-x: -10px;
    }

    /* за много тесни екрани – без текстови лейбъли в нодовете */
    .radial-node .label-text {
        display: none !important;
    }

    .radial-node:hover .expander-wrapper {
        width: var(--node-size);
        box-shadow: none;
    }
}

/* Скриване на стария навбар */
.nav, .brand-floating, .menu, .menu-button.edge-left {
    display: none !important;
}

/* ===== SAFEGUARD (винаги показвай нодовете, когато контейнерът е .open) ===== */
.radial-nav.open .radial-node {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}


/* ===== MOBILE HAMBURGER MODE (<=1200px) — ФИКС v3 ===== */
@media (max-width: 1200px) {

    /* ширина на панела и ширина на редовете вътре (можеш да ги пипаш смело) */
    :root {

        /* сложи твоята иконка тук; ако я ползваш, остави --ham-lines: 0 */
        --hamburger-icon: url('/static/images/icons/hamburger.jpg');
        --ham-lines: 1; /* 1 = ползва трите черти; 0 = скрива ги */
    }

    /* контейнерът става „бутон вдясно“ */
    .radial-nav {
        width: auto;
        height: var(--node-size);
        position: relative;
        margin-left: 0;
        order: 5;
        z-index: 1000; /* слой за панела и нодовете */
    }

    /* скриваме само Lottie, не бутона */
    .lottie-hub {
        position: absolute; /* override на absolute */
        inset: auto; /* reset на inset:0 */
        width: var(--node-size) !important;
        height: var(--node-size) !important;
        margin: 0 !important;
        display: grid !important;
        place-items: center;
        z-index: 1001; /* над панела */
        cursor: pointer;
    }

    .lottie-hub .lottie-wrapper,
    .lottie-hub dotlottie-player {
        display: none !important; /* само анимацията и етикета */
    }

    /* самият „хамбургер“ — квадрат със заоблени ръбове + иконка */
    /*.radial-hub{*/
    /*  width: 100%;*/
    /*  height: 100%;*/
    /*  border-radius: 12px;                 !* квадрат с леко заобляне *!*/
    /*  background: var(--primary);*/
    /*  box-shadow: 0 6px 16px rgba(0,0,0,.18);*/
    /*  position: relative;*/
    /*  overflow: hidden;*/
    /*}*/
    /* фон-панел зад нодовете (вече НЕ е прозрачен) */
    .radial-nav::after {
        content: none;
    }

    .radial-nav.open::after {
        content: "";
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        min-height: 20px;
        background: var(--primary); /* <- искан фон */
        border: 1px solid rgba(255, 255, 255, .28);
        border-radius: 14px;
        box-shadow: 0 18px 30px rgba(0, 0, 0, .22);
        z-index: 1000; /* зад нодовете */
        pointer-events: none; /* да не краде клик */
        opacity: 0;
        transform: translateY(-6px);
        transition: opacity .18s ease, transform .18s ease;
    }

    .radial-nav.open::after {
        opacity: 1;
        transform: translateY(0);
    }

    /* нодовете — по-компактни редове върху панела (не на пълна ширина) */
    .radial-nav .radial-node {
        position: static !important;
        transform: none !important;
        height: auto;
        border-radius: 10px;
        background: transparent;
        box-shadow: none;
        margin: 8px 8px 8px 12px;
        padding: 0;
        z-index: 1001; /* над панела */
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        display: block;
        color: #fff;
    }

    .radial-nav.open .radial-node {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    /* редова визия вътре в нода */
    .radial-node .expander-wrapper {
        /*width: 100% !important;*/
        height: auto;
        border: 0;
        /* леко потъмняване върху primary */
        background: var(--primary);
        border-radius: 10px;
        padding: 10px 12px;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .radial-node:hover .expander-wrapper {
        background: var(--primary);
    }

    .radial-node .expander-wrapper span:first-child {
        min-width: 28px;
        font-size: 20px;
        line-height: 1;
        color: #fff;
    }

    .radial-node .label-text {
        width: auto !important;
        display: inline-block;
        font-size: 15px;
        font-weight: 600;
        color: #fff;
    }

    /* значката вдясно, нормално малка */
    .node-badge {
        position: static;
        display: inline-grid;
        margin-left: auto;
        transform: none;
    }

    /* АВАТАРЪТ — по-малък на мобилно */
    .profile-node-wrapper .profile-avatar img {
        width: 40px; /* беше твърде голям */
        height: 40px;
        border-radius: 50%;
        border: 1px solid rgba(255, 255, 255, .35);
        object-fit: cover;
        display: block;
    }

    /* профилното подменю — вграден списък */
    .profile-node-wrapper .radial-submenu {
        position: static !important;
        transform: none !important;
        background: transparent;
        border: 0;
        box-shadow: none;
        display: none;
        padding: 8px 0 0 40px;
    }

    .profile-node-wrapper.submenu-open .radial-submenu {
        display: block;
    }

    .radial-submenu a, .radial-submenu button {
        color: #fff;
        background: transparent;
    }

    .radial-submenu a:hover, .radial-submenu button:hover {
        background: rgba(255, 255, 255, .14);
    }

    /* социалките — компактни */
    .header-social .social-link {
        width: 44px;
        height: 44px;
    }

    .header-social .social-icn {
        width: 26px;
        height: 26px;
    }
}

/* === Mobile menu backdrop (<=1200px) — make it solid primary === */
@media (max-width: 1200px) {
    /* осигуряваме референтен контейнер за псевдо-елемента */
    .profile-node-wrapper {
        position: relative;
    }

    /* вместо transparent → var(--primary); не пречи на кликовете и стои отзад */
    .profile-node-wrapper::before {
        background: var(--primary) !important;
        pointer-events: none;
        z-index: -1;
        /* inset и другите ти стойности остават както са дефинирани по-горе */
    }

    /* по избор: ако искаш и целият падащ панел да е в primary */
    .radial-nav.open::after {
        background: var(--primary) !important;
    }

    .profile-node-wrapper .radial-submenu {
        background: var(--primary) !important;
        border: 0;
    }
}

/* ========= MOBILE HAMBURGER (<=1200px) — ЧИСТ CSS, БЕЗ JS ========= */

/* по подразбиране (десктоп): hamburger-ът е скрит; lottie е видим */
.radial-nav .hamburger-hub,
.radial-nav .nav-toggle {
    display: none;
}

@media (max-width: 1200px) {
    :root {
        --mobile-menu-w: 280px;
    }

    /* тясна дървовидна колона */
    /* показваме hamburger-а, скриваме лотито */
    /*.radial-nav .lottie-hub { display: none !important; }*/
    /*.radial-nav .nav-toggle { display: block; position: absolute; opacity: 0; pointer-events: none; }*/
    .radial-nav {
        width: calc(var(--node-size) - 80px);
    !important; /* самият контейнер остава колкото бутона */
        height: calc(var(--node-size));
        overflow: visible;
    }

    /* самият hamburger бутон — квадрат със заоблени ръбове */
    .radial-nav .hamburger-hub {
        display: grid !important;
        place-items: center;
        width: var(--node-size);
        height: var(--node-size);
        border-radius: 12px;
        background: var(--primary);
        box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
        cursor: pointer;
        overflow: hidden;
    }

    /* трите черти */
    .hamburger-hub .hamburger-box {
        position: relative;
        width: 22px;
        height: 14px;
    }

    .hamburger-hub .hamburger-inner,
    .hamburger-hub .hamburger-inner::before,
    .hamburger-hub .hamburger-inner::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        height: 2px;
        background: #fff;
        border-radius: 2px;
    }

    .hamburger-hub .hamburger-inner {
        top: 6px;
    }

    .hamburger-hub .hamburger-inner::before {
        top: -6px;
    }

    .hamburger-hub .hamburger-inner::after {
        top: 6px;
    }

    /* фон-панел зад списъка — solid var(--primary) */
    /*.radial-nav:has(.nav-toggle:checked)::after{*/
    /*  content:"";*/
    /*  position: absolute;*/
    /*  top: calc(100% + 8px);*/
    /*  right: 0;*/
    /*  width: var(--mobile-menu-w);*/
    /*  min-height: 16px;*/
    /*  background: var(--primary);*/
    /*  border: 1px solid rgba(255,255,255,.28);*/
    /*  border-radius: 14px;*/
    /*  box-shadow: 0 18px 30px rgba(0,0,0,.22);*/
    /*  z-index: 1000;*/
    /*}*/
    /* превръщаме нодовете в вертикален тесен списък */
    .radial-nav .radial-node {
        position: static !important;
        transform: none !important;
        /*width: var(--mobile-menu-w);*/
        /*max-width: var(--mobile-menu-w);*/
        margin: 6px 0 0 0;
        padding: 0;
        display: none; /* скрити по подразбиране — показват се при чек */
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        z-index: 1001;
        color: #fff;
    }

    /* показване на нодовете при чекнат hamburger */
    .nav-toggle:checked ~ .radial-node {
        display: block;
    }

    /* редов вид за всяка „линия“ */
    .radial-node .expander-wrapper {
        width: 100% !important;
        height: auto;
        border: 0;
        background: var(--primary);
        border-radius: 10px;
        padding: 10px 12px;
        display: flex;
        align-items: center;
        gap: 10px;
        box-shadow: none;
    }

    .radial-node .expander-wrapper span:first-child {
        min-width: 26px;
        font-size: 19px;
        line-height: 1;
        color: #fff;
    }

    .radial-node .label-text {
        width: auto !important;
        display: inline-block;
        font-size: 15px;
        font-weight: 600;
        color: #fff;
    }

    .node-badge {
        position: static;
        display: inline-grid;
        margin-left: auto;
        transform: none;
    }

    /* профилното подменю — дървовидно, винаги видимо (чисто и просто) */
    .profile-node-wrapper .radial-submenu {
        position: static !important;
        transform: none !important;
        display: block;
        background: transparent;
        border: 0;
        box-shadow: none;
        padding: 6px 0 0 36px; /* лек отстъп за „клон“ */
    }

    .profile-node-wrapper .profile-avatar img {
        width: 34px;
        height: 34px;
        border-radius: 50%;
        border: 1px solid rgba(255, 255, 255, .35);
        object-fit: cover;
    }

    /* забрана на „подскачане“/скалиране на бутона при клик/фокус */
    .hamburger-hub:focus,
    .hamburger-hub:active {
        outline: none !important;
        transform: none !important;
        box-shadow: 0 6px 16px rgba(0, 0, 0, .18) !important;
    }
}


/* ── BADGES вътре в менюта (профил/side-menu) ───────────────────── */
.menu-badge {
    display: inline-grid;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    place-items: center;
    margin-left: 8px;
    border-radius: 999px;
    background: #d54141;
    color: #fff;
    font-size: 12px;
    line-height: 20px;
    font-weight: 700;
}

/* бутон в side-menu да изглежда като ред */
.side-logout {
    display: block;
    width: 100%;
    background: transparent;
    border: 0;
    padding: 10px 10px;
    text-align: left;
    cursor: pointer;
    color: var(--txt-dim);
    border-radius: var(--radius-sm);
}

.side-logout:hover {
    background: hsl(var(--p-h) var(--p-s) 95%);
    color: var(--txt);
}

/* профилният блок в aside да е отделен визуално */
.side-profile {
    margin-top: 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
}

/* ── MOBILE логика (≤1200px): скриваме Lottie и нодовете напълно ── */
@media (max-width: 1200px) {
    /* само бутонът остава */
    .radial-nav {
        width: auto;
        height: var(--node-size);
        margin-left: 0;
        order: 5;
        z-index: 10;
    }

    .radial-nav .lottie-hub {
        display: none !important;
    }

    .radial-nav .radial-node {
        display: none !important;
    }

    .radial-nav .hamburger-hub {
        display: grid !important;
        place-items: center;
        width: var(--node-size);
        height: var(--node-size);
        border-radius: 12px;
        background: var(--primary);
        box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
        cursor: pointer;
    }

    .hamburger-hub .hamburger-box {
        position: relative;
        width: 22px;
        height: 14px;
    }

    .hamburger-hub .hamburger-inner,
    .hamburger-hub .hamburger-inner::before,
    .hamburger-hub .hamburger-inner::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        height: 2px;
        background: #fff;
        border-radius: 2px;
    }

    .hamburger-hub .hamburger-inner {
        top: 6px;
    }

    .hamburger-hub .hamburger-inner::before {
        top: -6px;
    }

    .hamburger-hub .hamburger-inner::after {
        top: 6px;
    }

    /* профилното подменю в хъба да не се вижда на мобилно */
    .profile-node-wrapper .radial-submenu {
        display: none !important;
    }

    /* редовете "Абонамент" и "Поща" вътре в десктоп dropdown-а да се показват само на мобилно */
    .mobile-only {
        display: block !important;
    }
}


/* ── DESKTOP (≥1401px): показваме Lottie + нодовете; скриваме мобилните редове ── */
@media (min-width: 1401px) {
    .radial-nav .hamburger-hub {
        display: none !important;
    }

    .mobile-only {
        display: none !important;
    }
}

/* 1) Разреши пренасяне + позволи на децата да се свиват */
.header-card {
    flex-wrap: wrap; /* може на 2 реда при големи елементи */
    justify-content: center;
    gap: clamp(8px, 2.5vw, var(--rail-gap)); /* по-компактен gap на тесно */
}

.header-card > * {
    min-width: 0; /* ключово при flex — иначе overflow поради auto min-width */
}

/* 2) Нулирай „спейсъра“ в картата (спира да бута на тесно) */
@media (max-width: 1600px) {
    :root {
        --header-offset: 0px;
    }

    .header-card::before {
        content: none !important;
        display: none !important;
    }
}

/* 3) ≤1200px: скрий текстовите заглавия, намали логото, скрий социалките, дръж реда компактен */
@media (max-width: 1200px) {
    .header-divider {
        display: none !important;
    }

    .header-social {
        display: none !important;
    }

    .header-card {
        flex-wrap: nowrap;
    }

    /* Лого + заглавия: флекс с контролируем отстояние */
    .site-branding {
        display: flex;
        align-items: center;
        gap: 20px; /* разстояние между .site-logo и .site-titles */
        padding-left: 0;
    }

    .header-card > .site-branding {
        gap: 25px;
    }

    .site-logo {
        position: static;
        left: auto;
        top: auto;
        transform: none;
        flex: 0 0 auto;
        width: 100px;
        height: 90px;

        /* ВАЖНО: фонът, който „оцветява“ маската */
        background: var(--primary) !important;

        /* ВАЖНО: подай маската и в този breakpoint */
        -webkit-mask-image: url('/static/images/chitalnik_logo_text_1.png');
        mask-image: url('/static/images/chitalnik_logo_text_1.png');
        -webkit-mask-size: contain;
        mask-size: contain;
        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;
        -webkit-mask-position: center;
        mask-position: center;
        mask-mode: alpha;
    }

    /* fallback картинката – да запълва, ако няма маска */
    .site-logo img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: block;
    }

    /* леко повдигане на заглавията и компактни отстояния */
    .site-titles {
        transform: translateY(-15px); /* <- „повдигане“; важи и за всички по-малки ширини */
    }
}

/* Ако браузърът поддържа mask-image – скрий <img>, за да не покрива фона */
@supports (-webkit-mask-image: url("")) or (mask-image: url("")) {
    @media (max-width: 1200px) {
        .site-logo img {
            display: none !important;
        }
    }
}

@media (max-width: 1200px) {
    .site-branding {
        gap: 0;
    }

    .site-logo {
        margin-inline-end: 55px;
    }
}


/* 4) ≤1100px: лого в ЛЯВО, hamburger в ДЯСНО (един ред до най-малки екрани) + скрий рафта */
@media (max-width: 1100px) {
    .header-card {
        flex-wrap: nowrap !important;
        justify-content: space-between; /* разпъни краищата */
        align-items: center;
    }

    .header-divider {
        display: none !important;
    }

    /* „рафтът“ */
    /* ляво: брандинг */
    .header-card > .site-branding {
        order: 1;
        padding-left: 0 !important; /* <-- ключовото */
        margin: 0 !important;
    }

    /* дясно: hamburger */
    .radial-nav {
        order: 2;
        margin-left: auto; /* избутай в дясно */
        width: var(--node-size) !important;
        height: var(--node-size);
    }

    .lottie-hub {
        display: none !important;
    }

    /* без Lottie на тесно */
    .hamburger-hub {
        display: grid !important;
    }

    /* показваме само бутона */
}

/* 5) Hamburger режим — обща поправка на ширината и шифтовете (за ≤1200px) */
@media (max-width: 1200px) {
    .radial-nav {
        width: var(--node-size) !important;
        height: var(--node-size);
        margin-left: 0;
    }

    .lottie-wrapper {
        transform: none;
    }
}

/* 6) Още компактност за много тесни телефони */
@media (max-width: 480px) {
    .site-titles h1 {
        font-size: clamp(1.6rem, 8vw, 2.2rem);
    }

    .header-social {
        display: none;
    }

    /* безопасно, вече е скрито от 1200px надолу */
}

/* Скрий quick-action бутоните (без "Начало") на ≤720px
   + дръж всичко на ЕДИН ред, с компактен home и еластична търсачка */
@media (max-width: 720px) {
    .header-quick-actions > .qa-btn:not(.home-btn) {
        display: none !important;
    }

    .header-quick-actions {
        flex-wrap: nowrap;
        gap: 6px;
        justify-content: flex-end;
        align-items: center;
    }

    .header-quick-actions .home-btn {
        padding: 0 10px;
    }

    .header-quick-actions .home-btn span {
        display: none !important; /* скрий „Начало“ */
    }

    .header-quick-actions .qa-search {
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
    }

    .header-quick-actions .qa-search .qa-search-input {
        min-width: 0;
    }

    .header-quick-actions .notif-wrap {
        flex: 0 0 auto;
    }
}
