/*
 * Site header, mobile menu and footer.
 *
 * The footer was copied into both stylesheets too, and five of its eight
 * rules had already drifted apart. It lives here now for the same reason.
 *
 * Loaded by every public page — the landing page (landingStyle.css) and the
 * blog and policy pages (layoutStyle.css). It lives on its own because it used
 * to be copied into both, and the copies drifted: the blog kept rendering a
 * language switcher that the markup had stopped producing.
 *
 * Colours come from whichever stylesheet loaded first, so the header picks up
 * each page's own tokens.
 */

        /* ─── Navbar ─────────────────────────────────────────────────────── */
        .nav {
            position: sticky;
            top: 0;
            z-index: 50;
            background: rgba(3,7,18,0.7);
            backdrop-filter: blur(20px) saturate(180%);
            border-bottom: 1px solid var(--border);
            transition: background 0.3s;
        }

        .nav-inner {
            display: flex;
            align-items: center;
            justify-content: space-between;
            min-height: 68px;
            gap: 20px;
        }

        .brand {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            flex: 0 0 auto;
            min-width: 0;
        }

        /* Wordmark is ~2.06:1, so width is the binding constraint on narrow
           viewports — size by width and let height follow the aspect ratio. */
        .brand img {
            width: clamp(110px, 11vw, 190px);
            height: auto;
            display: block;
        }

        .brand-wordmark {
            font-size: 18px;
            font-weight: 800;
            letter-spacing: -0.5px;
            background: linear-gradient(135deg, #fff, var(--cyan));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .nav-links {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .nav-links a {
            font-size: 14px;
            font-weight: 500;
            color: var(--muted);
            padding: 6px 12px;
            border-radius: 8px;
            transition: all 0.15s;
        }

        .nav-links a:hover {
            color: var(--ink);
            background: var(--glass-hover);
        }

        .nav-actions {
            display: flex;
            align-items: center;
            gap: 10px;
            flex: 0 0 auto;

            /* One height for every control in the row — language, login, signup
               and the hamburger all read off this, so the row cannot drift out
               of alignment when any one of them is restyled. */
            --nav-control-h: 38px;
        }

        /* min-height as well as height: layoutStyle.css gives .btn a
           min-height of 42px for the blog pages, and a min-height beats a
           height however specific the height's selector is. Without this the
           language control sits 38px tall beside 42px buttons there. */
        .nav-actions .btn {
            height: var(--nav-control-h);
            min-height: var(--nav-control-h);
            padding-block: 0;
        }

        .nav-lang-wrap { position: relative; flex: 0 0 auto; }

        .nav-lang {
            display: inline-flex;
            align-items: center;
            gap: 7px;
            height: var(--nav-control-h);
            padding-inline: 11px 9px;
            border-radius: 11px;
            background: var(--glass);
            border: 1px solid var(--border);
            color: var(--muted);
            font-size: 12px;
            font-weight: 800;
            letter-spacing: 0.4px;
            line-height: 1;
            transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
        }

        .nav-lang:hover {
            color: var(--cyan);
            background: rgba(6,182,212,0.10);
            border-color: rgba(6,182,212,0.40);
        }

        /* Open is a held state, not a hover: touch has no hover, so the trigger
           has to keep showing which menu is up after the finger lifts. */
        .nav-lang-wrap.is-open .nav-lang {
            color: #67e8f9;
            background: rgba(6,182,212,0.12);
            border-color: rgba(6,182,212,0.45);
        }

        .nav-lang:focus-visible,
        .nav-lang-opt:focus-visible {
            outline: 2px solid rgba(6,182,212,0.75);
            outline-offset: 2px;
        }

        .nav-lang svg {
            flex: 0 0 auto;
            stroke-width: 1.7;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        .nav-lang-chev {
            opacity: 0.65;
            transition: transform 0.22s cubic-bezier(0.4,0,0.2,1), opacity 0.22s;
        }

        .nav-lang-wrap.is-open .nav-lang-chev { transform: rotate(180deg); opacity: 1; }

        /* Arabic glyphs sit smaller than Latin at the same size. */
        .nav-lang-code[lang="ar"] { font-size: 16px; letter-spacing: 0; }

        .nav-lang-menu {
            position: absolute;
            top: calc(100% + 9px);
            inset-inline-end: 0;
            z-index: 60;
            min-width: 194px;
            display: flex;
            flex-direction: column;
            gap: 2px;
            padding: 6px;
            border-radius: 12px;
            background: rgba(15,23,42,0.94);
            border: 1px solid var(--border);
            backdrop-filter: blur(20px) saturate(180%);
            box-shadow: 0 20px 46px rgba(0,0,0,0.55);
            opacity: 0;
            visibility: hidden;
            transform: translateY(-6px) scale(0.98);
            transition: opacity 0.18s cubic-bezier(0.4,0,0.2,1),
                        transform 0.18s cubic-bezier(0.4,0,0.2,1),
                        visibility 0s linear 0.18s;
        }

        /* visibility, not display: it animates, and it still drops the closed
           options out of the tab order. */
        .nav-lang-wrap.is-open .nav-lang-menu {
            opacity: 1;
            visibility: visible;
            transform: none;
            transition-delay: 0s;
        }

        .nav-lang-opt {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            min-height: 44px;
            padding: 10px 11px;
            border-radius: 8px;
            color: var(--muted);
            font-size: 14px;
            font-weight: 500;
            line-height: 1.2;
            transition: all 0.15s;
        }

        /* Each language reads in its own face — the global [lang="ar"] rule
           gives Tajawal, but English would otherwise inherit it on an Arabic
           page. */
        .nav-lang-opt[lang="en"] { font-family: "Inter", "Segoe UI", system-ui, sans-serif; }

        .nav-lang-opt:hover { color: var(--ink); background: var(--glass-hover); }
        .nav-lang-opt.is-current { color: var(--ink); font-weight: 600; }

        .nav-lang-check {
            flex: 0 0 auto;
            opacity: 0;
            color: var(--cyan);
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        .nav-lang-opt.is-current .nav-lang-check { opacity: 1; }

        @media (prefers-reduced-motion: reduce) {
            .nav-lang-menu { transform: none; transition-duration: 0.01ms; }
            .nav-lang-chev { transition-duration: 0.01ms; }
        }

        .nav-login-short,
        .nav-signup-short {
            display: none;
        }

        /* ─── Hamburger menu ─────────────────────────────────────────────── */
        .nav-hamburger {
            display: none;
            flex-direction: column;
            justify-content: center;
            gap: 5px;
            width: var(--nav-control-h); height: var(--nav-control-h);
            border-radius: 10px;
            border: 1px solid var(--border-bright);
            background: var(--glass);
            cursor: pointer;
            padding: 9px;
            flex-shrink: 0;
        }

        .nav-hamburger span {
            display: block;
            height: 2px;
            border-radius: 2px;
            background: var(--ink);
            transition: all 0.25s ease;
        }

        .nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
        .nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
        .nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

        .mobile-menu {
            display: none;
            flex-direction: column;
            gap: 4px;
            padding: 12px 0 16px;
            border-top: 1px solid var(--border);
        }

        .mobile-menu.open { display: flex; }

        .mobile-menu a {
            font-size: 15px;
            font-weight: 500;
            color: var(--muted);
            padding: 11px 16px;
            border-radius: 10px;
            transition: all 0.15s;
        }

        .mobile-menu a:hover, .mobile-menu a:active {
            color: var(--ink);
            background: var(--glass-hover);
        }

        .mobile-menu .mob-divider {
            height: 1px;
            background: var(--border);
            margin: 6px 0;
        }

        .mobile-menu .mob-cta {
            margin-top: 4px;
        }

        /* ─── Responsive — tablet (≤1024px) ─────────────────────────────── */
        @media (max-width: 1024px) {
            .nav-links            { display: none; }
            .nav-hamburger        { display: flex; }
        }

        /* ─── Responsive — mobile (≤768px) ──────────────────────────────── */
        @media (max-width: 768px) {
            .nav-inner            { min-height: 64px; gap: 10px; }
            .brand img            { width: min(150px, 30vw); }
            /* Touch: the row grows to 40px and every control follows. */
            .nav-actions          { gap: 8px; --nav-control-h: 40px; }
            .nav-actions .btn     { border-radius: 11px; }
            .nav-lang             { padding-inline: 10px 8px; }
            .nav-login            { padding-inline: 13px; }
            .nav-signup           { padding-inline: 13px; }
            .nav-hamburger        { border-radius: 11px; }
        }

        /* ─── Responsive — small phones (≤480px) ────────────────────────── */
        @media (max-width: 480px) {
            .nav-inner            { gap: 8px; }
            .brand img            { width: min(140px, 36vw); }
            .nav-actions          { gap: 6px; }
            /* The globe alone below 480px — the code and chevron are what the
               row cannot afford, and the menu still names the current language.
               Square, so it matches the hamburger exactly. */
            .nav-lang             { width: var(--nav-control-h); padding: 0; justify-content: center; gap: 0; border-radius: 10px; }
            .nav-lang-code        { display: none; }
            .nav-lang-chev        { display: none; }
            /* Three buttons plus the logo overflow a 360px viewport. Signup keeps
               the slot; signing in stays one tap away in the mobile menu. */
            .nav-login            { display: none; }
            .nav-signup           { padding-inline: 11px; font-size: 13px; }
            .nav-signup-full      { display: none; }
            .nav-signup-short     { display: inline; }
            .nav-hamburger        { border-radius: 10px; }
        }

        /* ─── Footer ─────────────────────────────────────────────────── */
        .footer {
            border-top: 1px solid var(--border);
            padding: 18px 0 14px;
            background:
                radial-gradient(circle at 12% 0%, rgba(6,182,212,0.08), transparent 32%),
                rgba(255,255,255,0.015);
        }

        .footer-inner {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 16px;
        }

        /* Copyright sits on its own row, centred across the full footer width. */
        .footer-bottom {
            margin-top: 10px;
            text-align: center;
        }

        .footer-logo {
            width: clamp(104px, 8.5vw, 132px);
            height: auto;
            flex-shrink: 0;
            filter: drop-shadow(0 10px 24px rgba(6,182,212,0.16));
        }

        .footer-links {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            flex-wrap: wrap;
            gap: 10px;
            font-size: 13px;
            color: var(--muted);
        }

        .footer-links a {
            padding: 7px 10px;
            border-radius: 999px;
            transition: color 0.16s, background 0.16s;
        }

        .footer-links a:hover {
            color: var(--ink);
            background: var(--glass-hover);
        }

        .footer-copy {
            text-align: center;
            font-size: 13px;
            color: var(--faint);
            line-height: 1.6;
        }

        @media (max-width: 768px) {
            .footer-inner         {
                flex-direction: column;
                align-items: center;
                text-align: center;
                gap: 14px;
            }
            .footer-logo          { width: min(132px, 40vw); }
            .footer-links         { justify-content: center; gap: 8px; }
        }

        @media (max-width: 480px) {
            .footer               { padding: 16px 0 12px; }
            .footer-logo          { width: min(124px, 44vw); }
            .footer-copy          { font-size: 12px; }
        }
