/* ============================================================================
   Shared site header (marketing pages: homepage + tax-calculator)
   SINGLE SOURCE OF TRUTH. Canonical styles lifted from the homepage.
   Markup is injected by /js/site-header.js into <div id="site-header">.
   Do not re-define these rules inline in the pages — edit them here.
   ============================================================================ */

/* Smooth anchor scrolling; scroll-padding keeps targets clear of the fixed nav. */
html { scroll-behavior: smooth; scroll-padding-top: 100px; }

/* Navigation */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 30px 50px;
    background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 100%);
    backdrop-filter: blur(10px);
    z-index: 1000;
    animation: slideDown 1s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative; /* anchor for the mobile dropdown */
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.logo-mark {
    height: 38px;
    width: auto;
    flex: 0 0 auto;
    display: block;
}
/* Transparent theme-aware marks: light shown only under data-theme="light". */
.logo-mark--light { display: none; }
.logo-text {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    animation: glow 3s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { filter: brightness(1) drop-shadow(0 0 10px rgba(102, 126, 234, 0.5)); }
    50% { filter: brightness(1.2) drop-shadow(0 0 20px rgba(102, 126, 234, 0.8)); }
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 40px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.nav-links a:hover {
    color: #fff;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
}

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

.nav-user-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-user-icon:hover {
    background: rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.6);
    transform: scale(1.05);
}

.nav-user-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: rgba(255, 255, 255, 0.7);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.3s ease;
}

.nav-user-icon:hover svg {
    stroke: #fff;
}

.nav-user-icon::after { display: none; } /* no underline on the icon link */

/* ---- Hamburger toggle (mobile only) ---- */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0 11px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: #fff;
    border-radius: 2px;
    transition: transform .25s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- Mobile layout: collapse links into a dropdown behind the hamburger ---- */
@media (max-width: 860px) {
    nav { padding: 18px 22px; }

    .nav-toggle { display: flex; }

    .nav-links {
        position: absolute;
        top: calc(100% + 16px);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 6px 0 10px;
        background: rgba(8, 8, 16, 0.97);
        backdrop-filter: blur(14px);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 14px;
        box-shadow: 0 24px 55px -22px rgba(0, 0, 0, 0.85);
        display: none;
    }
    .nav-links.open { display: flex; }
    .nav-links li { width: 100%; }
    .nav-links a {
        display: block;
        padding: 15px 24px;
        font-size: 1.05rem;
        color: rgba(255, 255, 255, 0.85);
    }
    .nav-links a::after { display: none; } /* underline animation off in stacked menu */

    .nav-user-icon {
        width: auto;
        height: auto;
        border-radius: 12px;
        justify-content: flex-start;
        gap: 12px;
        margin: 6px 14px 4px;
        padding: 12px;
    }
    /* Label the login icon inside the menu so it reads as a row, not a lone circle */
    .nav-user-icon::before {
        content: "Login";
        color: rgba(255, 255, 255, 0.85);
        font-size: 1.05rem;
    }
}

/* Keep the theme toggle aligned with the nav row (it sits between Contact and Login). */
.nav-theme-toggle { display: inline-flex; align-items: center; }
.nav-theme-toggle .theme-toggle { width: 34px; height: 34px; }
@media (max-width: 860px) {
    /* In the stacked mobile menu, give the toggle some breathing room. */
    .nav-theme-toggle { padding: 10px 18px; }
}

/* ---- Homepage mobile: theme toggle lives in the nav row, not the hamburger ----
   The standalone button is only injected on the homepage (see site-header.js),
   and only shown at mobile widths. On desktop the in-menu toggle is already in
   the row, so the standalone stays hidden. Scoped to nav.nav--home so the
   tax-calculator page keeps its in-menu toggle untouched. */
.nav-theme-toggle--standalone { display: none; }
@media (max-width: 860px) {
    .nav-theme-toggle--standalone {
        display: grid;          /* re-enable; .theme-toggle centers its icon via grid */
        margin-left: auto;      /* push to the right, beside the hamburger */
        margin-right: 10px;
    }
    /* Remove the now-duplicate toggle from the homepage dropdown only. */
    nav.nav--home .nav-theme-toggle { display: none; }
}

/* ============================================================================
   LIGHT THEME — shared nav. Additive only; dark stays the default.
   ============================================================================ */
html[data-theme="light"] nav {
    background: linear-gradient(180deg, rgba(232, 246, 251, 0.92) 0%, rgba(232, 246, 251, 0.4) 100%);
    /* Bottom hairline on the canonical border stop (was .08, off the .12/.18 scale). */
    border-bottom: 1px solid var(--lat-border);
}
/* The logo PNG is screen-blended for the dark nav; on light it needs no blend. */
html[data-theme="light"] .logo-mark--dark  { display: none; }
html[data-theme="light"] .logo-mark--light { display: block; }
/* Brand wordmark: dark uses the legacy #667eea/#764ba2 indigo; light maps it onto
   the canonical violet gradient (matches the homepage .mock-logo treatment). */
html[data-theme="light"] .logo-text {
    background: linear-gradient(135deg, var(--lat-violet) 0%, var(--lat-violet-bright) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
/* The glow keyframe bakes in the legacy indigo drop-shadow; retint it violet in
   light so the wordmark halo stays on-palette (filter not overridable per-keyframe
   so we re-declare the animation pinned to the violet glow). */
@keyframes glowLightViolet {
    0%, 100% { filter: brightness(1) drop-shadow(0 0 10px rgba(108, 90, 224, 0.5)); }
    50% { filter: brightness(1.2) drop-shadow(0 0 20px rgba(108, 90, 224, 0.8)); }
}
html[data-theme="light"] .logo-text { animation-name: glowLightViolet; }
html[data-theme="light"] .nav-links a { color: rgba(21, 48, 59, 0.72); }
/* Nav-link hover underline: dark uses the legacy indigo gradient; map to violet. */
html[data-theme="light"] .nav-links a::after {
    background: linear-gradient(90deg, var(--lat-violet), var(--lat-violet-bright));
}
html[data-theme="light"] .nav-links a:hover { color: #15303B; }
html[data-theme="light"] .nav-user-icon {
    background: rgba(108, 90, 224, 0.10);
    border-color: rgba(108, 90, 224, 0.30);
}
html[data-theme="light"] .nav-user-icon:hover {
    background: rgba(108, 90, 224, 0.18);
    border-color: rgba(108, 90, 224, 0.5);
}
html[data-theme="light"] .nav-user-icon svg { stroke: rgba(21, 48, 59, 0.72); }
html[data-theme="light"] .nav-user-icon:hover svg { stroke: #15303B; }
html[data-theme="light"] .nav-toggle {
    background: rgba(24, 72, 104, 0.06);
    /* Hamburger border on the canonical border stop (was .16, between .12/.18). */
    border-color: var(--lat-border);
}
html[data-theme="light"] .nav-toggle span { background: #15303B; }
@media (max-width: 860px) {
    html[data-theme="light"] .nav-links {
        /* Mobile dropdown panel: near-opaque white. The translucent tile surface
           (.74) let the large hero text bleed through and made the menu unreadable;
           match the dark dropdown's ~.97 opacity so the panel reads as solid. */
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(14px);
        border-color: var(--lat-border);
        box-shadow: 0 24px 55px -22px rgba(40, 90, 120, 0.45);
    }
    html[data-theme="light"] .nav-links a { color: rgba(21, 48, 59, 0.85); }
    html[data-theme="light"] .nav-user-icon::before { color: rgba(21, 48, 59, 0.85); }
}
