/* =========================================================
   Navigation: top bar, main bar, sliding indicator, mega menu
   and the phone/tablet drawer. Loaded after site.css / pro.css.
   ========================================================= */
header.site-header { display: block; padding: 0; min-height: 0; background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--line); transition: box-shadow .3s; }
header.site-header.is-scrolled { box-shadow: 0 8px 30px rgba(15, 27, 61, .1); }

.topbar { background: linear-gradient(90deg, var(--navy-deep), #0f1c6b); color: rgba(255, 255, 255, .85); font: 500 12px/1 var(--font-ui); overflow: hidden; max-height: 40px; transition: max-height .35s var(--ease-out), opacity .25s; }
.is-scrolled .topbar { max-height: 0; opacity: 0; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; width: min(1240px, 100% - 40px); margin-inline: auto; height: 38px; }
.topbar-contact { display: flex; gap: 26px; }
.topbar a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; transition: color .2s; }
.topbar-contact a:hover { color: #fff; }
.topbar svg, .menu-cta svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.lang-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, .12); }
.lang-switch a { padding: 5px 12px; border-radius: 999px; font-size: 11px; letter-spacing: .1em; font-weight: 600; transition: background .25s, color .25s; }
.lang-switch a:hover { color: #fff; }
.lang-switch a[aria-current] { background: #fff; color: var(--navy); }

.mainbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; width: min(1240px, 100% - 40px); margin-inline: auto; height: 76px; transition: height .3s var(--ease-out); }
.is-scrolled .mainbar { height: 62px; }
.brand { flex: none; }
.brand img { display: block; height: 54px; width: auto; margin: 0; transition: height .3s var(--ease-out), transform .4s var(--ease-out); }
.is-scrolled .brand img { height: 44px; }
.brand:hover img { transform: scale(1.05) rotate(-1.5deg); }

.menu { position: relative; display: flex; align-items: center; gap: 22px; margin: 0; }
.menu-list { display: flex; align-items: center; gap: 2px; }
.menu-item { position: relative; display: flex; align-items: center; }
.menu-link { position: relative; display: block; padding: 12px 15px; font: 600 13.5px/1 var(--font-ui); letter-spacing: .01em; color: var(--ink); text-decoration: none; white-space: nowrap; transition: color .2s; }
.menu-link:hover { color: var(--navy); }
.menu-link[aria-current] { color: var(--red); }
.has-mega .menu-link { padding-right: 4px; }
.menu-caret { display: grid; place-items: center; width: 26px; height: 26px; margin-right: 6px; border: 0; border-radius: 50%; background: none; color: var(--ink); cursor: pointer; transition: background .2s; }
.menu-caret:hover { background: var(--surface); }
.menu-caret svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--ease-out); }
.menu-caret[aria-expanded="true"] svg { transform: rotate(180deg); }

/* sliding indicator: follows hover/focus, rests on the current page */
.menu-indicator { position: absolute; left: 0; bottom: -2px; height: 3px; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--red), #ff6b3d); opacity: 0; transition: transform .4s var(--ease-out), width .4s var(--ease-out), opacity .25s; pointer-events: none; }
.menu-indicator.is-on { opacity: 1; }

.menu-cta { display: inline-flex; align-items: center; gap: 9px; padding: 12px 20px; border-radius: 999px; background: linear-gradient(135deg, var(--red), #ff3d2e); color: #fff; font: 700 12px/1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; text-decoration: none; box-shadow: 0 8px 22px rgba(226, 0, 26, .3); transition: transform .3s var(--ease-out), box-shadow .3s; white-space: nowrap; }
.menu-cta:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(226, 0, 26, .42); }

/* mega menu */
.mega { position: absolute; top: calc(100% + 14px); right: -40px; width: min(640px, 92vw); padding: 22px; border-radius: 16px; background: #fff; box-shadow: var(--shadow-lg); border: 1px solid var(--line); opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity .25s, transform .35s var(--ease-out), visibility .25s; z-index: 60; }
.mega::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; border-radius: 16px 16px 0 0; background: linear-gradient(90deg, var(--red), var(--blue)); }
.mega::after { content: ""; position: absolute; top: -20px; left: 0; right: 0; height: 20px; }
.has-mega.is-open > .mega { opacity: 1; visibility: visible; transform: none; }
.mega-title { margin: 4px 0 14px; font: 700 11px/1 var(--font-ui); letter-spacing: .18em; text-transform: uppercase; color: #8a94a8; }
.mega-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mega-card { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 12px; text-decoration: none; position: relative; transition: background .2s, transform .3s var(--ease-out); }
.mega-card:hover, .mega-card:focus-visible { background: var(--surface); transform: translateX(3px); }
.mega-card img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; flex: none; box-shadow: var(--shadow-sm); }
.mega-text { display: grid; gap: 2px; min-width: 0; }
.mega-text strong { font: 700 14px/1.2 var(--font-ui); color: var(--ink); }
.mega-text small { font-size: 12px; color: #7a869b; line-height: 1.3; }
.mega-tag { position: absolute; top: 8px; right: 10px; font: 600 9.5px/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--blue); background: rgba(42, 116, 184, .1); padding: 4px 7px; border-radius: 999px; font-style: normal; }
.mega-all { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding: 13px 16px; border-radius: 12px; background: var(--surface); color: var(--navy); font: 700 13px/1 var(--font-ui); text-decoration: none; transition: background .25s, color .25s; }
.mega-all:hover { background: var(--navy); color: #fff; }
.mega-all span { transition: transform .3s var(--ease-out); }
.mega-all:hover span { transform: translateX(5px); }

.menu-toggle, .menu-meta, .menu-backdrop { display: none; }

/* phone / tablet drawer */
@media (max-width: 980px) {
    html.menu-open { overflow: hidden; }
    /* backdrop-filter would turn the header into the containing block of the fixed drawer */
    header.site-header { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
    .topbar { display: none; }
    .mainbar { height: 64px; width: calc(100% - 28px); }
    .is-scrolled .mainbar { height: 58px; }
    .brand img, .is-scrolled .brand img { height: 44px; }
    .menu-toggle { display: grid; place-content: center; gap: 5px; width: 46px; height: 46px; border: 0; border-radius: 12px; background: var(--surface); cursor: pointer; position: relative; z-index: 120; }
    .menu-toggle span { display: block; width: 22px; height: 2px; border-radius: 2px; background: var(--navy); transition: transform .35s var(--ease-out), opacity .2s; }
    .menu-open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
    .menu-open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .menu { position: fixed; z-index: 110; top: 0; right: 0; bottom: 0; width: min(390px, 88vw); flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0; padding: 88px 22px 24px; background: #fff; box-shadow: -20px 0 60px rgba(5, 5, 63, .25); overflow-y: auto; overscroll-behavior: contain; transform: translateX(105%); visibility: hidden; transition: transform .45s var(--ease-out), visibility .45s; }
    .menu-open .menu { transform: none; visibility: visible; }
    .menu-list { flex-direction: column; align-items: stretch; gap: 0; }
    .menu-item { flex-wrap: wrap; border-bottom: 1px solid var(--line); }
    .menu-link { flex: 1; padding: 18px 4px; font-size: 17px; }
    .menu-link[aria-current]::before { content: ""; position: absolute; left: -22px; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--red); }
    .menu-caret { width: 40px; height: 40px; margin: 0; background: var(--surface); }
    .menu-indicator { display: none; }

    .mega { position: static; flex-basis: 100%; width: 100%; padding: 0; border: 0; border-radius: 0; box-shadow: none; opacity: 1; visibility: visible; transform: none; max-height: 0; overflow: hidden; transition: max-height .4s var(--ease-out); }
    .mega::before, .mega::after, .mega-title { display: none; }
    .has-mega.is-open > .mega { max-height: 720px; padding-bottom: 14px; }
    .mega-grid { grid-template-columns: 1fr; }
    .mega-card { padding: 8px 6px; }
    .mega-all { margin-top: 8px; }

    .menu-cta { justify-content: center; margin-top: 24px; padding: 16px 20px; font-size: 13px; }
    .menu-meta { display: grid; gap: 10px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); font: 500 14px/1.4 var(--font-ui); color: var(--muted); }
    .menu-meta > a { text-decoration: none; }
    .menu-meta .lang-switch { justify-self: start; background: var(--surface); }
    .menu-meta .lang-switch a { color: var(--ink); }
    .menu-meta .lang-switch a[aria-current] { background: var(--navy); color: #fff; }

    .menu-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(5, 5, 63, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; transition: opacity .35s; }
    .menu-backdrop[hidden] { display: none; }
    .menu-open .menu-backdrop { opacity: 1; }
    .menu-open header.site-header { z-index: 60; }
}

@media (max-width: 1180px) and (min-width: 981px) {
    .menu-link { padding-inline: 10px; font-size: 13px; }
    .menu-cta { padding: 11px 14px; }
    .menu { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .menu, .mega, .menu-indicator, .menu-toggle span, .topbar { transition: none; }
}

/* ---------- PWA: install button and toasts ---------- */
.install-btn { display: inline-flex; align-items: center; gap: 7px; margin-right: 12px; padding: 6px 13px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; background: transparent; color: #fff; font: 600 11px/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; transition: background .25s, color .25s; }
.install-btn[hidden] { display: none; }
.install-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.install-btn:hover { background: #fff; color: var(--navy); }
.topbar-right { display: flex; align-items: center; }
.menu-meta .install-btn { justify-self: start; margin: 0; border-color: var(--navy); color: var(--navy); }
.menu-meta .install-btn:hover { background: var(--navy); color: #fff; }

.pwa-toast { position: fixed; z-index: 1200; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 16px; max-width: min(92vw, 460px); padding: 14px 18px; border-radius: 14px; background: var(--ink); color: #fff; font: 500 14px/1.4 var(--font-ui); box-shadow: var(--shadow-lg); transform: translate(-50%, 24px); opacity: 0; transition: transform .4s var(--ease-out), opacity .3s; }
.pwa-toast.is-shown { transform: translate(-50%, 0); opacity: 1; }
.pwa-toast button { flex: none; padding: 8px 14px; border: 0; border-radius: 999px; background: #fff; color: var(--navy); font: 700 12px/1 var(--font-ui); cursor: pointer; }

/* standalone window: respect device safe areas */
@media (display-mode: standalone) {
    header.site-header { padding-top: env(safe-area-inset-top); }
    .site-footer { padding-bottom: env(safe-area-inset-bottom); }
}
