/* ============================================================
   aiDo site navigation — SINGLE SOURCE OF TRUTH for the header.
   Linked on every page (static landing pages + generated
   blog/news pages via base.html). Edit the nav HERE and nowhere else.
   Full horizontal nav >=1100px; hamburger below (fits all iPad widths).
   Relies on CSS variables (--space-*, --color-*, --nav-*) from each
   page's :root. Component styles (.theme-toggle, .btn) live with the page.
   ============================================================ */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: var(--space-md) 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 1099px) {
    .nav {
        padding: 0.75rem 0;
    }
}

.nav.scrolled {
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--nav-border);
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    gap: var(--space-sm);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--color-text-strong);
    min-width: 0;
    flex: 0 1 auto;
}

.nav-logo-icon {
    width: 36px;
    height: 36px;
    color: var(--color-accent);
}

.nav-logo-text {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

@media (max-width: 420px) {
    .nav-logo {
        gap: 0.6rem;
    }

    .nav-logo-icon {
        width: 32px;
        height: 32px;
        flex: 0 0 32px;
    }

    .nav-logo-text {
        font-size: 1.45rem;
    }
}

@media (max-width: 360px) {
    .nav-logo-text {
        font-size: 1.25rem;
    }
}

.nav-links {
    display: none;
    gap: var(--space-lg);
    list-style: none;
    white-space: nowrap;
}

@media (min-width: 1100px) {
    .nav-links {
        display: flex;
    }
}

.nav-links a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s;
    position: relative;
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--color-text-strong);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-accent);
    transition: width 0.3s;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 0 0 auto;
    min-width: 0;
}

@media (min-width: 1100px) {
    .nav-actions {
        gap: var(--space-md);
    }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid var(--color-card-border);
    border-radius: 12px;
    cursor: pointer;
    gap: 5px;
    padding: 12px;
    transition: all 0.3s;
}

.mobile-menu-toggle:hover {
    border-color: var(--color-accent);
}

@media (min-width: 1100px) {
    .mobile-menu-toggle {
        display: none;
    }
}

.mobile-menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: all 0.3s;
}

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

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

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

/* Mobile Menu Dropdown */
.mobile-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--nav-border);
    padding: var(--space-md) var(--space-lg) var(--space-lg);
    display: none;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.mobile-menu.active {
    display: flex;
    max-height: 600px;
    opacity: 1;
}

@media (min-width: 1100px) {
    .mobile-menu {
        display: none !important;
    }
}

.mobile-menu a {
    color: var(--color-text);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-card-border);
    transition: color 0.3s;
}

.mobile-menu-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-card-border);
}

.mobile-menu a:last-child {
    border-bottom: none;
}

.mobile-menu a:hover {
    color: var(--color-accent);
}

/* Hide login button on small screens */
@media (max-width: 1099px) {
    .nav-actions .btn-ghost {
        display: none;
    }

    /* Hide desktop theme toggle on mobile */
    .nav-actions .theme-toggle {
        display: none;
    }
}

/* Smaller nav button on mobile */
@media (max-width: 1099px) {
    .nav-actions .btn-primary {
        min-height: 40px;
        padding: 0.5rem 0.9rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }
}

@media (max-width: 374px) {
    .nav-actions {
        gap: 0.5rem;
    }

    .nav-actions .btn-primary {
        padding: 0.45rem 0.75rem;
        font-size: 0.7rem;
    }

    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
}

@media (max-width: 340px) {
    .nav-actions .btn-primary {
        display: none;
    }
}

/* Optional short/long CTA label — used on the landing page's primary button.
   Harmless on pages whose button has no .nav-cta-full/.nav-cta-short spans. */
.nav-cta-short { display: none; }
@media (max-width: 520px) {
    .nav-cta-full { display: none; }
    .nav-cta-short { display: inline; }
}

/* ---- iPad / medium screens (768–1099px) ----
   Plenty of room for the core links + the theme toggle inline.
   Show Blog · News · About + the day/night toggle; keep the hamburger for the
   overflow (Features, For Guests, Log in). Below 768px everything collapses to
   the hamburger; at >=1100px the full nav shows and the hamburger hides. */
@media (min-width: 768px) and (max-width: 1099px) {
    .nav-links { display: flex; }
    .nav-links li:nth-child(1),   /* Features  -> stays in the hamburger */
    .nav-links li:nth-child(2) {  /* For Guests -> stays in the hamburger */
        display: none;
    }
    .nav-actions .theme-toggle { display: flex; }
}
