/*==========================================
  Desiwood — site header (resources/views/frontend/components/header.blade.php,
  navbar.blade.php; behaviour in public/frontend/js/dw-header.js).
  Loaded after custom.css; every rule is scoped to .dw-header.

  The bar is fixed and takes no space in the flow (like the old absolute header),
  so nothing here moves the page. Every state change animates transform or opacity
  only: the "smaller" scrolled header is the glass layer scaled on Y and the content
  translated up, not a height change.
==========================================*/

.dw-header {
    /* Bar heights as unitless px so they can be divided for the scaleY. */
    --dh-h: 88;
    --dh-hc: 68;
    --dh-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --dh-fast: .2s;
    --dh-base: .45s;
    --dh-slow: .6s;
    --dh-accent: var(--accent-color, #ff8a00);
    --dh-accent-2: var(--accent-secondary-color, #ff006a);
    --dh-gradient: linear-gradient(90deg, var(--dh-accent) 0%, var(--dh-accent-2) 100%);
    --dh-text-strong: #fff;
    --dh-line: rgba(255, 255, 255, .08);
    --dh-panel: rgba(20, 8, 36, .92);
    --dh-focus: 0 0 0 2px var(--black-color, #110422), 0 0 0 4px rgba(255, 138, 0, .9);
    font-family: var(--accent-font, "Jost", sans-serif);
    line-height: 1.3;
}

.dw-header ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.dw-header a {
    text-decoration: none;
}

/* ---------- Bar ---------- */

.dw-header__bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: calc(var(--dh-h) * 1px);
    pointer-events: none; /* the empty strip below the compact bar must not block clicks */
    transform: translateY(0);
    transition: transform var(--dh-base) var(--dh-ease);
}

.dw-header.is-hidden .dw-header__bar {
    transform: translateY(-100%);
}

.dw-header__glass {
    position: absolute;
    inset: 0;
    background: rgba(17, 4, 34, .62);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    backdrop-filter: blur(18px) saturate(160%);
    opacity: 0;
    transform-origin: top;
    transition: opacity var(--dh-base) var(--dh-ease), transform var(--dh-base) var(--dh-ease);
}

/* Bottom hairline; also the track of the scroll-progress bar. */
.dw-header__line {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(var(--dh-h) * 1px - 1px);
    height: 1px;
    background: var(--dh-line);
    opacity: 0;
    transition: opacity var(--dh-base) var(--dh-ease), transform var(--dh-base) var(--dh-ease);
}

.dw-header__progress {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: var(--dh-gradient);
    box-shadow: 0 0 10px rgba(255, 0, 106, .45);
    transform: scaleX(0);
    transform-origin: left;
}

.dw-header__inner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 24px;
    height: 100%;
    pointer-events: auto;
    transition: transform var(--dh-base) var(--dh-ease);
}

/* Scrolled: frosted glass, slightly shorter bar, smaller logo. */
.dw-header.is-compact .dw-header__glass {
    opacity: 1;
    transform: scaleY(calc(var(--dh-hc) / var(--dh-h)));
}

.dw-header.is-compact .dw-header__line {
    opacity: 1;
    transform: translateY(calc((var(--dh-hc) - var(--dh-h)) * 1px));
}

.dw-header.is-compact .dw-header__inner {
    transform: translateY(calc((var(--dh-hc) - var(--dh-h)) * .5px));
}

/* Browsers without backdrop-filter get a near-solid bar instead of clear glass. */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .dw-header__glass {
        background: rgba(17, 4, 34, .96);
    }
}

/* ---------- Logo ---------- */

.dw-header__logo {
    flex: 0 0 auto;
    display: block;
    border-radius: 10px;
    transform-origin: left center;
    transition: transform var(--dh-base) var(--dh-ease);
}

.dw-header__logo img {
    display: block;
    width: 64px;
    height: auto;
}

.dw-header.is-compact .dw-header__logo {
    transform: scale(.84);
}

/* ---------- Desktop nav ---------- */

.dw-nav {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.dw-nav__list {
    position: relative;
    display: flex;
    align-items: center;
}

.dw-nav__item--drop {
    position: relative;
}

.dw-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    border: 0;
    border-radius: 8px;
    background: none;
    font-family: inherit;
    font-size: 15.5px;
    font-weight: 500;
    letter-spacing: .012em;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--dh-text-strong);
    opacity: .74;
    cursor: pointer;
    transition: opacity var(--dh-fast) var(--dh-ease);
}

.dw-nav__link:hover,
.dw-nav__link:focus-visible,
.dw-nav__link.is-active,
.dw-nav__link[aria-expanded="true"] {
    color: var(--dh-text-strong);
    opacity: 1;
}

.dw-nav__caret {
    font-size: 16px;
    opacity: .7;
    transition: transform var(--dh-base) var(--dh-ease), opacity var(--dh-fast) var(--dh-ease);
}

.dw-nav__link[aria-expanded="true"] .dw-nav__caret {
    opacity: 1;
    transform: rotate(180deg);
}

/* Shared underline: a 100px bar scaled to the hovered label by dw-header.js. */
.dw-nav__indicator {
    position: absolute;
    left: 0;
    bottom: 2px;
    width: 100px;
    height: 2px;
    border-radius: 2px;
    background: var(--dh-gradient);
    box-shadow: 0 0 12px rgba(255, 0, 106, .55);
    pointer-events: none;
    opacity: 0;
    transform-origin: left;
    transition: transform var(--dh-base) var(--dh-ease), opacity var(--dh-fast) var(--dh-ease);
}

.dw-nav__indicator.is-shown {
    opacity: 1;
}

.dw-nav__indicator.is-instant {
    transition: none;
}

/* ---------- Dropdown panels (mega menu and Resources) ---------- */

.dw-mega,
.dw-drop {
    position: absolute;
    top: calc(100% + 14px);
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 18px;
    background: var(--dh-panel);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    backdrop-filter: blur(24px) saturate(160%);
    box-shadow: 0 24px 60px rgba(4, 0, 12, .55), 0 0 0 1px rgba(255, 0, 106, .06);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity var(--dh-fast) var(--dh-ease),
        transform var(--dh-base) var(--dh-ease),
        visibility 0s linear var(--dh-base);
}

/* Hover bridge over the gap between the trigger and the panel. */
.dw-mega::before,
.dw-drop::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 18px;
}

.dw-mega {
    left: 50%;
    width: min(880px, calc(100vw - 48px));
    transform: translate(-50%, 8px) scale(.98);
    transform-origin: top center;
}

.dw-drop {
    left: 50%;
    width: 320px;
    padding: 8px;
    transform: translate(-50%, 8px) scale(.98);
    transform-origin: top center;
}

[data-dw-menu].is-open > .dw-mega,
[data-dw-menu].is-open > .dw-drop {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0) scale(1);
    transition:
        opacity var(--dh-fast) var(--dh-ease),
        transform var(--dh-base) var(--dh-ease),
        visibility 0s;
}

.dw-mega__body {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 12px;
    padding: 12px;
}

.dw-mega__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
}

.dw-menu-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px;
    border-radius: 12px;
    position: relative;
    isolation: isolate;
    color: var(--dh-text-strong);
}

.dw-menu-item::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: rgba(255, 255, 255, .05);
    opacity: 0;
    transition: opacity var(--dh-fast) var(--dh-ease);
}

.dw-menu-item:hover,
.dw-menu-item:focus-visible {
    color: var(--dh-text-strong);
}

.dw-menu-item:hover::before,
.dw-menu-item:focus-visible::before {
    opacity: 1;
}

.dw-menu-item__icon {
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 11px;
    background: linear-gradient(135deg, rgba(255, 138, 0, .16), rgba(255, 0, 106, .16));
    font-size: 19px;
    color: #ffb15c;
    transition: transform var(--dh-base) var(--dh-ease);
}

.dw-menu-item:hover .dw-menu-item__icon {
    transform: translateY(-2px);
}

.dw-menu-item__text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.dw-menu-item__title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .005em;
    color: var(--dh-text-strong);
}

.dw-menu-item__desc {
    font-family: var(--default-font, "Poppins", sans-serif);
    font-size: 12.5px;
    line-height: 1.5;
    color: rgba(255, 255, 255, .55);
}

.dw-mega__feature {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 22px;
    overflow: hidden;
    border: 1px solid rgba(255, 138, 0, .22);
    border-radius: 14px;
    background:
        radial-gradient(120% 90% at 100% 0%, rgba(255, 0, 106, .32) 0%, transparent 60%),
        radial-gradient(90% 80% at 0% 100%, rgba(255, 138, 0, .26) 0%, transparent 60%),
        #1c0a30;
    color: var(--dh-text-strong);
}

/* Release artwork behind the card: a tilted 2x2 wall of covers, blurred and
   faded so the text on top stays crisp. The images are only requested once
   the menu has been opened (dw-header.js adds .is-loaded to the panel). */
.dw-mega__feature::before {
    content: "";
    position: absolute;
    inset: -24px;
    z-index: 0;
    background-repeat: no-repeat;
    background-size: 50% 50%;
    background-position: 0 0, 100% 0, 0 100%, 100% 100%;
    filter: blur(2px) saturate(1.2);
    opacity: .9;
    transform: rotate(-8deg) scale(1.12);
    transition: transform .6s var(--dh-ease);
}

.dw-mega.is-loaded .dw-mega__feature::before {
    background-image:
        url("../images/sde4.jpeg"),
        url("../images/sde14.jpg"),
        url("../images/sde3.jpeg"),
        url("../images/sde9.jpg");
}

/* Brand-tinted shade: darkest where the text sits. */
.dw-mega__feature::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        linear-gradient(180deg, rgba(22, 8, 38, .45) 0%, rgba(22, 8, 38, .72) 40%, rgba(22, 8, 38, .9) 100%),
        radial-gradient(120% 90% at 100% 0%, rgba(255, 0, 106, .35) 0%, transparent 60%),
        radial-gradient(90% 80% at 0% 100%, rgba(255, 138, 0, .25) 0%, transparent 60%);
}

.dw-mega__feature > * {
    position: relative;
    z-index: 1;
}

.dw-mega__feature:hover::before {
    transform: rotate(-8deg) scale(1.18);
}

.dw-mega__badge {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .1);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.dw-mega__feature-title {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -.005em;
}

.dw-mega__feature-desc {
    font-family: var(--default-font, "Poppins", sans-serif);
    font-size: 13px;
    line-height: 1.55;
    color: rgba(255, 255, 255, .7);
}

.dw-mega__feature-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    font-size: 15px;
    font-weight: 600;
}

.dw-mega__feature-link i {
    transition: transform var(--dh-base) var(--dh-ease);
}

.dw-mega__feature:hover .dw-mega__feature-link i {
    transform: translateX(4px);
}

.dw-mega__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 26px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    font-family: var(--default-font, "Poppins", sans-serif);
    font-size: 13px;
    color: rgba(255, 255, 255, .55);
}

.dw-mega__all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 6px;
    font-family: var(--accent-font, "Jost", sans-serif);
    font-size: 14.5px;
    font-weight: 600;
    color: #ffb15c;
}

.dw-mega__all:hover {
    color: #fff;
}

/* ---------- Actions ---------- */

.dw-header__actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dw-header__login {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 15.5px;
    font-weight: 500;
    letter-spacing: .012em;
    color: var(--dh-text-strong);
    opacity: .74;
    transition: opacity var(--dh-fast) var(--dh-ease);
}

.dw-header__login:hover,
.dw-header__login:focus-visible,
.dw-header__login.is-active {
    color: var(--dh-text-strong);
    opacity: 1;
}

/* Primary CTA: gradient ring around a dark fill, glow on hover, magnetic via JS. */
.dw-header__cta {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 12px;
    font-size: 15.5px;
    font-weight: 600;
    letter-spacing: .015em;
    color: #fff;
    background: var(--dh-gradient);
    transition: transform var(--dh-base) var(--dh-ease);
}

.dw-header__cta::before {
    content: "";
    position: absolute;
    inset: 1.5px;
    z-index: -1;
    border-radius: 10.5px;
    background: linear-gradient(180deg, #2a0f3d 0%, #1a0629 100%);
    opacity: .82;
    transition: opacity var(--dh-base) var(--dh-ease);
}

.dw-header__cta::after {
    content: "";
    position: absolute;
    inset: -2px;
    z-index: -2;
    border-radius: 14px;
    background: var(--dh-gradient);
    filter: blur(14px);
    opacity: .28;
    transition: opacity var(--dh-base) var(--dh-ease);
}

.dw-header__cta:hover {
    color: #fff;
}

.dw-header__cta:hover::before {
    opacity: 0;
}

.dw-header__cta:hover::after {
    opacity: .6;
}

.dw-header__cta i {
    font-size: 16px;
    transition: transform var(--dh-base) var(--dh-ease);
}

.dw-header__cta:hover i {
    transform: translateX(3px);
}

/* ---------- Focus ---------- */

.dw-header a:focus-visible,
.dw-header button:focus-visible {
    outline: none;
    box-shadow: var(--dh-focus);
}

.dw-header a:focus:not(:focus-visible),
.dw-header button:focus:not(:focus-visible) {
    outline: none;
}

/* ---------- Burger ---------- */

.dw-burger {
    display: none;
    position: relative;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    cursor: pointer;
}

.dw-burger__bar {
    position: absolute;
    left: 12px;
    top: 50%;
    width: 18px;
    height: 2px;
    margin-top: -1px;
    border-radius: 2px;
    background: #fff;
    transition: transform var(--dh-base) var(--dh-ease), opacity var(--dh-fast) var(--dh-ease);
}

.dw-burger__bar:nth-child(1) {
    transform: translateY(-6px);
}

.dw-burger__bar:nth-child(3) {
    transform: translateY(6px);
}

.dw-header.is-menu-open .dw-burger__bar:nth-child(1) {
    transform: rotate(45deg);
}

.dw-header.is-menu-open .dw-burger__bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(.2);
}

.dw-header.is-menu-open .dw-burger__bar:nth-child(3) {
    transform: rotate(-45deg);
}

/* ---------- Mobile overlay ---------- */

.dw-mobile {
    display: none;
}

@media (max-width: 1199.98px) {
    .dw-header {
        --dh-h: 76;
        --dh-hc: 64;
    }

    .dw-nav,
    .dw-header__actions {
        display: none;
    }

    .dw-burger {
        display: block;
    }

    .dw-header__logo img {
        width: 54px;
    }

    .dw-mobile {
        position: fixed;
        inset: 0;
        z-index: 999; /* under the bar, so the logo and close button stay on top */
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 32px;
        padding: calc(var(--dh-h) * 1px + 24px) 24px max(28px, env(safe-area-inset-bottom));
        overflow-y: auto;
        overscroll-behavior: contain;
        background: rgba(17, 4, 34, .78);
        -webkit-backdrop-filter: blur(24px) saturate(150%);
        backdrop-filter: blur(24px) saturate(150%);
        visibility: hidden;
        opacity: 0;
        transition: opacity var(--dh-base) var(--dh-ease), visibility 0s linear var(--dh-base);
    }

    .dw-header.is-menu-open .dw-mobile {
        visibility: visible;
        opacity: 1;
        transition: opacity var(--dh-base) var(--dh-ease), visibility 0s;
    }

    /* The overlay already blurs everything; a second glass layer would double the tint. */
    .dw-header.is-menu-open .dw-header__glass,
    .dw-header.is-menu-open .dw-header__line {
        opacity: 0;
    }

    .dw-mobile__item,
    .dw-mobile__footer {
        opacity: 0;
        transform: translateY(18px);
        transition: opacity var(--dh-base) var(--dh-ease), transform var(--dh-slow) var(--dh-ease);
    }

    .dw-header.is-menu-open .dw-mobile__item,
    .dw-header.is-menu-open .dw-mobile__footer {
        opacity: 1;
        transform: none;
        transition-delay: calc(80ms + var(--i) * 40ms);
    }

    .dw-mobile__link {
        display: inline-block;
        padding: 8px 0;
        border-radius: 8px;
        font-size: clamp(28px, 7.4vw, 40px);
        font-weight: 500;
        letter-spacing: -.015em;
        line-height: 1.15;
        color: #fff;
        opacity: .78;
        transition: opacity var(--dh-fast) var(--dh-ease);
    }

    .dw-mobile__link:hover,
    .dw-mobile__link:focus-visible,
    .dw-mobile__link.is-active {
        color: #fff;
        opacity: 1;
    }

    .dw-mobile__link.is-active {
        background: var(--dh-gradient);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .dw-mobile__footer {
        display: flex;
        flex-direction: column;
        gap: 22px;
    }

    .dw-mobile__actions {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .dw-header__cta--block {
        flex: 1 1 auto;
        padding: 15px 20px;
        font-size: 17px;
    }

    .dw-mobile__login {
        padding: 15px 22px;
        border: 1px solid rgba(255, 255, 255, .14);
        border-radius: 12px;
        font-size: 17px;
        font-weight: 500;
        color: rgba(255, 255, 255, .85);
    }

    .dw-mobile__social {
        display: flex;
        gap: 10px;
    }

    .dw-mobile__social a {
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        border: 1px solid rgba(255, 255, 255, .12);
        border-radius: 50%;
        font-size: 19px;
        color: #fff;
        opacity: .75;
        transition: opacity var(--dh-fast) var(--dh-ease);
    }

    .dw-mobile__social a:hover,
    .dw-mobile__social a:focus-visible {
        color: #fff;
        opacity: 1;
    }

    @supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
        .dw-mobile {
            background: rgba(17, 4, 34, .98);
        }
    }
}

@media (max-width: 575.98px) {
    .dw-header__logo img {
        width: 48px;
    }
}

/* Body scroll lock while the mobile menu is open (set by dw-header.js). */
html.dw-scroll-locked,
html.dw-scroll-locked body {
    overflow: hidden;
}

/* ---------- Reduced motion: every state change is instant ---------- */

@media (prefers-reduced-motion: reduce) {
    .dw-header *,
    .dw-header *::before,
    .dw-header *::after {
        transition-duration: 0s !important;
        transition-delay: 0s !important;
    }
}
