/*
 * cultina_nav widget — desktop bar + mobile burger overlay.
 * Colors/fonts come from the Cultina tokens (themes/cultina/assets/css/_tokens.css),
 * which alias the Elementor Kit globals: palette changes in Site Settings
 * propagate here automatically. No hex values in this file.
 *
 * Breakpoint: burger below 1025px (matches the design's 1024 tablet artboards).
 */

.cn {
    display: flex;
    align-items: center;
}

/* ----- desktop bar ------------------------------------------------------ */

.cn-desktop {
    display: flex;
    align-items: center;
    gap: var(--cultina-space-6, 2rem);
}

/* Split mode: [links-half] [logo] [links-half], logo slightly oversized
   so the calligraphy overflows the 159px bar like in the design. */
.cn--split {
    width: 100%;
    justify-content: center;
}

/* Cluster width is tuned so its left edge lands on the content margin (≈405px
   at 1920): the leftmost link is then flush with the hero intro / two-column
   sections. The logo stays centred in the viewport, so the gap each side of the
   logo controls the cluster width symmetrically. Values measured from XD. */
.cn--split .cn-desktop {
    width: 100%;
    justify-content: center;
    gap: 69px;
}

.cn-half {
    display: flex;
    align-items: center;
    gap: 52px;
}

.cn-logo {
    display: flex;
    align-items: center;
    line-height: 0;
}

.cn-logo img {
    height: auto;
}

/* Single-logo mode (no scroll icon set): full logo in flow, sized by the
   widget's "Logo-Breite" control (which sets --cn-logo-w on .cn-logo). */
.cn-logo__full {
    width: var(--cn-logo-w, 180px);
}

/* ----- scroll-linked logo → icon swap (when an "Icon beim Scrollen" is set) ---
   Both images stack in a box whose footprint INTERPOLATES with the scroll
   progress --cn-shrink (0 = full logo, 1 = icon), set by nav.js. object-fit:
   contain keeps each image proportional inside the morphing box; the two
   cross-fade via opacity. No transitions — the values track the scroll position
   directly (down and up), in sync with the header height. The --cn-logo-* /
   --cn-icon-* variables are emitted by the widget's Logo-/Icon-Breite controls. */
.cn-logo--has-icon {
    position: relative;
    display: block;
    flex: 0 0 auto;
    /* The slot keeps its WIDTH at every scroll position, so the nav cluster width
       never changes and the menu items stay put — only the image inside morphs to
       the (smaller, centred) icon. Its HEIGHT shrinks with --cn-shrink toward the
       icon height, so the slot stops propping the header row open and the bar can
       tighten to --cultina-header-h-min (header.css). Width fixed = no horizontal
       movement; height shrinks = the bar can shrink. */
    width: var(--cn-logo-w, 210px);
    height: calc(
        var(--cn-logo-h, 104px) -
        (var(--cn-logo-h, 104px) - var(--cn-icon-h, 56px)) * var(--cn-shrink, 0)
    );
}

/* Full logo fills the slot. */
.cn-logo--has-icon .cn-logo__full {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

/* Icon stays at its own (small) size, centred inside the fixed slot. */
.cn-logo--has-icon .cn-logo__icon {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--cn-icon-w, 56px);
    height: var(--cn-icon-h, 56px);
    transform: translate(-50%, -50%);
    object-fit: contain;
    object-position: center;
}

/* Cross-fade with a small overlap: full logo fades out by ~70% scroll, the icon
   fades in from ~40% — a clean hand-off rather than a 50/50 muddle mid-scroll. */
.cn-logo--has-icon .cn-logo__full {
    opacity: clamp(0, calc(1 - var(--cn-shrink, 0) / 0.7), 1);
}

.cn-logo--has-icon .cn-logo__icon {
    opacity: clamp(0, calc((var(--cn-shrink, 0) - 0.4) / 0.6), 1);
}

.cn .cn-link {
    font-family: var(--cultina-font-family);
    font-size: var(--cultina-font-size-strong, 1.25rem); /* 20px per Anima navbar */
    font-weight: var(--cultina-font-weight-medium, 500);
    color: #A0A0A0; /* inactive: light grey per reference; active overrides below */
    text-decoration: none;
    line-height: 1.2;
    padding-bottom: 6px;
    border-bottom: 3px solid transparent;
    transition: border-color var(--cultina-duration-fast, 150ms) var(--cultina-ease-out, ease-out),
                color var(--cultina-duration-fast, 150ms) var(--cultina-ease-out, ease-out);
}

.cn .cn-link:hover,
.cn .cn-link:focus-visible {
    color: var(--cultina-color-primary);
    border-bottom-color: var(--cultina-color-primary);
}

.cn.cn--underline-active .cn-link--active {
    border-bottom-color: var(--cultina-color-primary);
}

/* Active item: dark + bold (reference shows only the current page emphasized). */
.cn .cn-link--active {
    color: var(--cultina-color-text);
    font-weight: var(--cultina-font-weight-bold, 700);
}

.cn .cn-link:focus-visible {
    outline: none;
    box-shadow: var(--cultina-focus-ring);
    border-radius: var(--cultina-radius-sm, 4px);
}

/* ----- burger button ----------------------------------------------------- */

.cn .cn-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: none;
    border: 0;
    cursor: pointer;
}

.cn .cn-burger__bar {
    display: block;
    width: 100%;
    height: 3px;
    border-radius: 2px;
    background: var(--cultina-color-text);
    transition: transform var(--cultina-duration-base, 300ms) var(--cultina-ease-in-out, ease-in-out),
                opacity var(--cultina-duration-base, 300ms) var(--cultina-ease-in-out, ease-in-out);
}

.cn .cn-burger[aria-expanded="true"] .cn-burger__bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.cn .cn-burger[aria-expanded="true"] .cn-burger__bar:nth-child(2) {
    opacity: 0;
}
.cn .cn-burger[aria-expanded="true"] .cn-burger__bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ----- mobile overlay (XD design: dark panel, white logo + magenta close,
   contact pills, centred white links with active underline, social bottom) --- */

.cn-overlay {
    position: fixed;
    inset: 0;
    /* Above the fixed contact flaps (z 9000+) so the open menu covers them. */
    z-index: 9990;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 28px 20px 36px;
    background: #313131;
    overflow-y: auto;
}

.cn-overlay[hidden] {
    display: none;
}
/* QA preview (?menuopen=1 → body.cultina-menu-open): force the HEADER overlay
   open (scoped so a second nav elsewhere on the page doesn't overlap it). */
.cultina-menu-open .cultina-site-header .cn-overlay[hidden] {
    display: flex;
}

/* top bar: white logo left, magenta-circle close right */
.cn-overlay__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cn-overlay__logo {
    display: inline-flex;
    line-height: 0;
}
/* .cn-overlay ancestor (0,0,2,1) beats Elementor's `.elementor img{height:auto}`
   (0,0,1,1) which would otherwise blow the logo up to its natural file size. */
.cn-overlay .cn-overlay__logo img {
    display: block;
    height: 56px;
    width: auto;
    max-width: none;
    /* The colour logo turned solid white to match the dark panel. */
    filter: brightness(0) invert(1);
}
.cn-overlay__close {
    flex: 0 0 auto;
    box-sizing: border-box;
    /* !important throughout: Elementor's atomic button styles otherwise reset the
       background and pad/resize it (it came out 66×52 instead of a 52px circle). */
    width: 52px !important;
    height: 52px !important;
    min-width: 52px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    background: var(--cultina-color-primary, #C2006A) !important;
    color: #FFFFFF;
    border: 0;
    cursor: pointer;
}
.cn-overlay__x {
    display: block;
    font-size: 30px;
    line-height: 1;
    font-weight: 300;
}

/* contact pills */
.cn-overlay__contact {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.cn-overlay__pill {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 61px;
    padding: 0 30px;
    border-radius: 31px;
    font-family: var(--cultina-font-family);
    font-weight: var(--cultina-font-weight-bold, 700);
    font-size: 18px;
    text-decoration: none;
}
.cn-overlay__pill-icon { flex: 0 0 auto; display: inline-flex; }
.cn-overlay__pill-icon svg { display: block; width: 24px; height: 24px; }
/* .cn-overlay ancestor (0,0,2,0) keeps the pill's own colour on hover too — the
   theme's generic a:hover (0,0,1,1) would otherwise recolour these <a> pills. */
.cn-overlay .cn-overlay__pill--mail  { background: var(--cultina-color-primary, #C2006A); color: #FFFFFF; }
.cn-overlay .cn-overlay__pill--phone { background: var(--cultina-color-secondary, #A2C617); color: var(--cultina-color-text, #313131); }

/* nav links: centred white bold; active page underlined magenta */
.cn-overlay__links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
    margin: 8px 0;
}
.cn-overlay__links .cn-link {
    font-family: var(--cultina-font-family);
    font-size: 28px;
    font-weight: var(--cultina-font-weight-bold, 700);
    line-height: 1.1;
    color: #FFFFFF;
    text-decoration: none;
    padding-bottom: 6px;
    border-bottom: 3px solid transparent;
}
.cn-overlay__links .cn-link--active {
    color: #FFFFFF;
    border-bottom-color: var(--cultina-color-primary, #C2006A);
}

/* social: pale circles with dark icons, pinned to the bottom */
.cn-overlay__social {
    margin-top: auto;
    display: flex;
    justify-content: center;
    gap: 20px;
    padding-top: 12px;
}
.cn-overlay__soc {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--cultina-color-surface-blue, #E8F5F9);
    color: var(--cultina-color-text, #313131);
}
.cn-overlay__soc svg { display: block; width: 20px; height: 20px; }

/* ----- responsive switch -------------------------------------------------- */

/* Mobile logo (≤1024) — hidden on desktop, where the split cluster owns the logo. */
.cn-mobile-logo { display: none; }

@media (max-width: 1024px) {
    .cn-desktop {
        display: none;
    }
    /* The nav widget is a flex child of the centered header row; without this it
       shrinks to the (now small) logo+burger content and sits centered. Force it
       full-width so space-between can push logo left / burger right. */
    .cultina-header-row .elementor-widget-cultina_nav {
        width: 100%;
    }
    /* Mobile bar: logo left, burger right (matches the mobile design). The
       padding keeps both off the screen edges. */
    .cn--split {
        justify-content: space-between;
        padding-left: 20px;
        padding-right: 20px;
    }
    .cn-mobile-logo {
        display: inline-flex;
        align-items: center;
        line-height: 0;
        flex: 0 0 auto;
    }
    /* .cn ancestor (0,0,2,1) out-specifies Elementor's `.elementor img
       { height:auto }` (0,0,1,1) which loads after nav.css — without this the
       height falls back to the logo's natural file size (huge). */
    .cn .cn-mobile-logo img {
        display: block;
        height: 44px;
        width: auto;
        max-width: none;
    }
    /* Burger becomes a filled magenta circle with white bars. */
    .cn .cn-burger {
        display: flex;
        align-items: center;
        flex: 0 0 auto;
        width: 52px;
        height: 52px;
        padding: 15px;
        background: var(--cultina-color-primary);
        border-radius: 50%;
    }
    .cn .cn-burger__bar {
        background: #FFFFFF;
    }

    /* Stack mode (e.g. the footer): show the menu items stacked vertically and
       suppress the burger/overlay/mobile-logo. `.cn--mobile-stack .cn-desktop`
       (0,2,0) out-specifies the `.cn-desktop { display:none }` above; the
       align-items/gap come from the widget's stacked-menu Style controls. */
    .cn--mobile-stack .cn-desktop {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        width: auto;
    }
    .cn--mobile-stack .cn-burger,
    .cn--mobile-stack .cn-mobile-logo,
    .cn--mobile-stack .cn-overlay {
        display: none;
    }
}

/* Editor hint (only rendered in Elementor edit mode) */
.cn-editor-hint {
    padding: var(--cultina-space-4, 1rem);
    background: var(--cultina-color-surface-mute, #f4f4f4);
    color: var(--cultina-color-text-muted, #6e6e6e);
    border-radius: var(--cultina-radius-md, 8px);
    font-size: var(--cultina-font-size-body, 1.125rem);
}
