/**
 * Header — transparent MORVIN-style bar + fullscreen mobile menu
 *
 * @package Bargtunes
 */

:root {
    --hdr-ink: #ffffff;
    --hdr-ink-muted: rgba(255, 255, 255, 0.72);
    --hdr-border: rgba(255, 255, 255, 0.28);
    --hdr-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --hdr-glass: rgba(10, 10, 12, 0.78);
    --hdr-glass-edge: rgba(255, 255, 255, 0.1);
    --hdr-glass-inset: rgba(255, 255, 255, 0.055);
    --hdr-glass-depth: rgba(0, 0, 0, 0.55);
}

/* ---------- Main bar (transparent → glass on scroll) ---------- */

.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
    padding: clamp(18px, 2.5vw, 28px) clamp(20px, 4vw, 56px);
    background: transparent;
    background-color: transparent;
    backdrop-filter: blur(0) saturate(1);
    -webkit-backdrop-filter: blur(0) saturate(1);
    box-shadow: none;
    border: none;
    border-bottom: 1px solid transparent;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    animation: hdr-enter 0.55s var(--hdr-ease) both;
    transition:
        background 0.35s var(--hdr-ease),
        background-color 0.35s var(--hdr-ease),
        box-shadow 0.35s var(--hdr-ease),
        border-color 0.35s var(--hdr-ease),
        padding 0.35s var(--hdr-ease);
}

/* Black glass + soft neumorphism when scrolled */
.main-header.is-scrolled {
    padding-top: clamp(12px, 1.8vw, 18px);
    padding-bottom: clamp(12px, 1.8vw, 18px);
    background:
        linear-gradient(
            165deg,
            rgba(255, 255, 255, 0.07) 0%,
            rgba(255, 255, 255, 0) 42%,
            rgba(0, 0, 0, 0.22) 100%
        ),
        var(--hdr-glass) !important;
    background-color: var(--hdr-glass) !important;
    border-bottom-color: var(--hdr-glass-edge);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.42),
        0 2px 8px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 var(--hdr-glass-inset),
        inset 0 -1px 0 rgba(0, 0, 0, 0.45),
        inset 1px 0 0 rgba(255, 255, 255, 0.03),
        inset -1px 0 0 rgba(255, 255, 255, 0.03) !important;
}

@media (prefers-reduced-motion: reduce) {
    .main-header {
        transition: none;
    }
}

@keyframes hdr-enter {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .main-header {
        animation: none;
    }
}

.main-header.is-ready {
    pointer-events: auto;
}

.header-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: clamp(12px, 2vw, 28px);
    max-width: 1480px;
    margin: 0 auto;
    width: 100%;
}

/* Logo */
.site-logo {
    position: relative;
    z-index: 10001;
    flex-shrink: 0;
    justify-self: start;
}

.logo-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    max-width: min(200px, 42vw);
}

.logo-image {
    display: block;
    height: clamp(32px, 4.2vw, 46px);
    width: auto;
    max-width: 100%;
    object-fit: contain;
    transition: opacity 0.35s var(--hdr-ease), transform 0.45s var(--hdr-ease);
    will-change: transform, opacity;
}

.logo-link:hover .logo-image {
    opacity: 0.88;
    transform: translateY(-1px);
}

.logo-text {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(18px, 1.6vw, 22px);
    font-weight: 600;
    color: var(--hdr-ink);
    letter-spacing: 0.42em;
    text-transform: uppercase;
    line-height: 1;
    display: inline-block;
    transition: letter-spacing 0.35s var(--hdr-ease), opacity 0.35s var(--hdr-ease);
}

body.lang-persian .logo-text,
body.rtl .logo-text {
    letter-spacing: 0.08em;
    font-family: 'ModamWeb', 'Vazirmatn', 'Poppins', sans-serif;
}

.logo-link:hover .logo-text {
    letter-spacing: 0.48em;
    opacity: 0.88;
}

body.lang-persian .logo-link:hover .logo-text,
body.rtl .logo-link:hover .logo-text {
    letter-spacing: 0.12em;
}

/* Desktop nav — true center of header */
.hdr-nav {
    display: flex;
    justify-content: center;
    justify-self: center;
    min-width: 0;
}

.hdr-nav__list {
    display: flex;
    align-items: center;
    gap: clamp(4px, 0.8vw, 10px);
    list-style: none;
    margin: 0;
    padding: 0;
}

.hdr-nav__item {
    position: relative;
}

.hdr-nav__link {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(11px, 0.82vw, 12.5px);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.62);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    position: relative;
    transition:
        color 0.35s var(--hdr-ease),
        background 0.35s var(--hdr-ease);
}

body.lang-persian .hdr-nav__link,
body.rtl .hdr-nav__link {
    letter-spacing: 0.04em;
    font-family: 'ModamWeb', 'Vazirmatn', 'Poppins', sans-serif;
}

.hdr-nav__link::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    transform: translateX(-50%);
    transition: width 0.4s var(--hdr-ease);
}

.hdr-nav__link:hover,
.hdr-nav__link.is-active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.hdr-nav__link:hover::before,
.hdr-nav__link.is-active::before {
    width: 42%;
}

/* Actions: socials + CTA + hamburger */
.hdr-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(12px, 1.6vw, 20px);
    flex-shrink: 0;
    z-index: 10001;
    position: relative;
    justify-self: end;
}

.hdr-social {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
}

.hdr-social__link {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    transition:
        color 0.3s var(--hdr-ease),
        background 0.3s var(--hdr-ease),
        transform 0.35s var(--hdr-ease);
}

.hdr-social__link::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 50% 50%, rgba(214, 255, 75, 0.18), transparent 70%);
    opacity: 0;
    transition: opacity 0.35s var(--hdr-ease);
}

.hdr-social__link svg {
    position: relative;
    z-index: 1;
    width: 15px;
    height: 15px;
    stroke-width: 1.6;
}

.hdr-social__link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.hdr-social__link:hover::before {
    opacity: 1;
}

/* CTA — flat outlined button */
.hdr-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--hdr-ink);
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(10px, 0.8vw, 11.5px);
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    transition:
        border-color 0.35s var(--hdr-ease),
        background 0.35s var(--hdr-ease),
        transform 0.35s var(--hdr-ease);
}

.hdr-cta::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    inset-inline-start: -50%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    transform: skewX(-18deg);
    transition: inset-inline-start 0.55s var(--hdr-ease);
    pointer-events: none;
}

.hdr-cta:hover::before {
    inset-inline-start: 120%;
}

body.lang-persian .hdr-cta,
body.rtl .hdr-cta {
    letter-spacing: 0.04em;
    font-family: 'ModamWeb', 'Vazirmatn', 'Poppins', sans-serif;
}

.hdr-cta__icon {
    display: grid;
    place-items: center;
    color: inherit;
}

.hdr-cta__icon svg {
    width: 15px;
    height: 15px;
}

.hdr-cta:hover {
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-1px);
}

/* Hamburger — desktop hidden, mobile visible */
.menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid var(--hdr-border);
    border-radius: 50%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 0;
    transition: border-color 0.28s var(--hdr-ease), background 0.28s var(--hdr-ease);
}

.menu-line {
    width: 16px;
    height: 1.5px;
    background: #ffffff;
    border-radius: 2px;
    transition: transform 0.35s var(--hdr-ease), opacity 0.25s ease, width 0.25s ease;
}

.menu-toggle:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.04);
}

.menu-toggle.active .menu-line:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}

.menu-toggle.active .menu-line:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .menu-line:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

/* ---------- Fullscreen menu (mobile) ---------- */

.fullscreen-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    z-index: 10000;
    pointer-events: none;
    overflow: hidden;
}

.fullscreen-menu.active {
    pointer-events: auto;
}

.menu-bg-panels {
    position: absolute;
    inset: 0;
}

.fullscreen-menu.active .menu-panel {
    transform: scale(1);
}

.menu-panel {
    position: absolute;
    background: rgba(8, 8, 8, 0.98);
    transform: scale(0);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.menu-panel-1 { top: 0; left: 0; width: 50%; height: 50%; transform-origin: top left; }
.menu-panel-2 { top: 0; right: 0; width: 50%; height: 50%; transform-origin: top right; }
.menu-panel-3 { bottom: 0; left: 0; width: 50%; height: 50%; transform-origin: bottom left; }
.menu-panel-4 { bottom: 0; right: 0; width: 50%; height: 50%; transform-origin: bottom right; }

.menu-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 720px;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 24px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 36px;
    opacity: 0;
    z-index: 2;
    padding: max(40px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(40px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    transition: opacity 0.35s ease;
}

.fullscreen-menu.active .menu-content {
    opacity: 1;
}

.menu-items {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-item {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.fullscreen-menu.active .menu-item {
    opacity: 1;
    transform: none;
}

.fullscreen-menu.active .menu-item:nth-child(1) { transition-delay: 0.05s; }
.fullscreen-menu.active .menu-item:nth-child(2) { transition-delay: 0.09s; }
.fullscreen-menu.active .menu-item:nth-child(3) { transition-delay: 0.13s; }
.fullscreen-menu.active .menu-item:nth-child(4) { transition-delay: 0.17s; }
.fullscreen-menu.active .menu-item:nth-child(5) { transition-delay: 0.21s; }
.fullscreen-menu.active .menu-item:nth-child(6) { transition-delay: 0.25s; }

.menu-link {
    text-decoration: none;
    display: inline-block;
    padding: 10px 20px;
}

.menu-link-text {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(1.6rem, 6vw, 2.2rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.78);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    display: inline-block;
    transition: color 0.3s var(--hdr-ease), letter-spacing 0.3s var(--hdr-ease);
}

body.lang-persian .menu-link-text,
body.rtl .menu-link-text {
    letter-spacing: 0.04em;
    font-family: 'ModamWeb', 'Vazirmatn', 'Poppins', sans-serif;
}

.menu-link:hover .menu-link-text {
    color: #ffffff;
    letter-spacing: 0.2em;
}

body.lang-persian .menu-link:hover .menu-link-text,
body.rtl .menu-link:hover .menu-link-text {
    letter-spacing: 0.06em;
}

.menu-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border: 1px solid var(--hdr-border);
    border-radius: 2px;
    color: #fff;
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.35s ease, transform 0.35s ease, border-color 0.28s, background 0.28s;
}

.fullscreen-menu.active .menu-cta {
    opacity: 1;
    transform: none;
    transition-delay: 0.22s;
}

body.lang-persian .menu-cta,
body.rtl .menu-cta {
    letter-spacing: 0.04em;
    font-family: 'ModamWeb', 'Vazirmatn', 'Poppins', sans-serif;
}

.menu-cta:hover {
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.04);
}

.menu-social {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    opacity: 0;
    transform: translateY(24px);
}

.fullscreen-menu.active .menu-social {
    opacity: 1;
    transform: none;
}

.menu-social-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: border-color 0.28s var(--hdr-ease), color 0.28s var(--hdr-ease), background 0.28s var(--hdr-ease);
}

.menu-social-icon svg {
    width: 18px;
    height: 18px;
}

.menu-social-icon:hover {
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

html.menu-open,
body.menu-open {
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
}

body.menu-open {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
}

body.menu-open .fn-dock {
    visibility: hidden;
    pointer-events: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
    .header-container {
        display: flex;
        justify-content: space-between;
        gap: 16px;
    }

    .hdr-nav {
        display: none;
    }

    .hdr-social {
        display: none;
    }

    .hdr-cta {
        display: none;
    }

    .menu-toggle {
        display: flex;
    }

    .main-header {
        padding: 16px 18px;
    }

    .logo-text {
        font-size: 16px;
        letter-spacing: 0.32em;
    }

    .logo-image {
        height: 34px;
    }
}

@media (max-width: 480px) {
    .logo-text {
        letter-spacing: 0.22em;
        font-size: 15px;
    }

    .logo-image {
        height: 30px;
    }
}
