/*
 * ============================================================
 * TAX FREE RETIREMENT SPECIALISTS — HEADER STYLES
 * Design inspiration: Carson Wealth (carsonwealth.com)
 * File: header.css  (enqueue in functions.php)
 *
 * Color palette:
 *   --tfrs-navy      : #1B2A4A  (primary dark)
 *   --tfrs-navy-deep : #0F1C30  (hover / active)
 *   --tfrs-gold      : #B8952A  (accent)
 *   --tfrs-gold-dark : #9A7B1F  (hover gold)
 *   --tfrs-white     : #FFFFFF
 *   --tfrs-off-white : #F8F7F4
 *   --tfrs-border    : #E2DDD4
 *   --tfrs-text-muted: #6B6B6B
 * ============================================================
 */

/* ─── Custom Properties ─────────────────────────────────────── */
:root {
    --tfrs-navy      : #1B2A4A;
    --tfrs-navy-deep : #0F1C30;
    --tfrs-gold      : #B8952A;
    --tfrs-gold-dark : #9A7B1F;
    --tfrs-gold-light: #D4AF55;
    --tfrs-white     : #FFFFFF;
    --tfrs-off-white : #F8F7F4;
    --tfrs-border    : #E2DDD4;
    --tfrs-text-muted: #6B6B6B;

    --tfrs-header-height   : 80px;
    --tfrs-topbar-height   : 40px;
    --tfrs-total-offset    : calc(var(--tfrs-header-height) + var(--tfrs-topbar-height));
    --tfrs-transition      : 0.22s ease;
    --tfrs-font-nav        : 'Montserrat', 'Trebuchet MS', sans-serif;
    --tfrs-font-body       : 'Source Serif 4', Georgia, serif;
    --tfrs-dropdown-shadow : 0 8px 32px rgba(27, 42, 74, 0.14);
    --tfrs-z-topbar        : 100;
    --tfrs-z-header        : 110;
    --tfrs-z-dropdown      : 120;
    --tfrs-z-mobile        : 200;
}

/* ─── Reset / Base ──────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ─── Top Bar ───────────────────────────────────────────────── */
.tfrs-topbar {
    position: relative;
    z-index: var(--tfrs-z-topbar);
    background-color: var(--tfrs-white);
    border-bottom: 1px solid var(--tfrs-border);
    height: var(--tfrs-topbar-height);
}

.tfrs-topbar__inner {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
    height: 100%;
}

.tfrs-topbar__links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.tfrs-topbar__link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--tfrs-font-nav);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--tfrs-navy);
    text-decoration: none;
    text-transform: uppercase;
    transition: color var(--tfrs-transition);
}

.tfrs-topbar__link:hover {
    color: var(--tfrs-gold);
}

.tfrs-topbar__link .tfrs-icon,
.tfrs-topbar__cta .tfrs-icon {
    width: 14px;
    height: 14px;
    fill: var(--tfrs-gold);
    flex-shrink: 0;
}

.tfrs-topbar__cta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--tfrs-font-nav);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--tfrs-gold);
    text-decoration: none;
    text-transform: uppercase;
    transition: color var(--tfrs-transition);
}

.tfrs-topbar__cta:hover {
    color: var(--tfrs-gold-dark);
}

/* Divider between topbar links */
.tfrs-topbar__links .tfrs-topbar__link:not(:last-child)::after {
    content: '';
    display: inline-block;
    width: 1px;
    height: 12px;
    background: var(--tfrs-border);
    margin-left: 24px;
}

/* ─── Main Header ───────────────────────────────────────────── */
.tfrs-header {
    position: sticky;
    top: 0;
    z-index: var(--tfrs-z-header);
    background-color: var(--tfrs-white);
    height: var(--tfrs-header-height);
    border-bottom: 2px solid var(--tfrs-navy);
    box-shadow: 0 2px 12px rgba(27, 42, 74, 0.08);
    transition: box-shadow var(--tfrs-transition), background-color var(--tfrs-transition);
}

/* Scrolled state — JS adds .is-scrolled to <header> */
.tfrs-header.is-scrolled {
    box-shadow: 0 4px 24px rgba(27, 42, 74, 0.16);
}

.tfrs-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
    height: 100%;
}

/* ─── Logo ──────────────────────────────────────────────────── */
.tfrs-header__logo {
    flex-shrink: 0;
}

.tfrs-header__logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.tfrs-logo-img {
    display: block;
    max-height: 52px;
    width: auto;
    object-fit: contain;
}

/* Fallback text logo */
.tfrs-logo-text {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tfrs-logo-text__mark svg {
    display: block;
}

.tfrs-logo-text__name {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.tfrs-logo-text__name strong {
    font-family: var(--tfrs-font-nav);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--tfrs-navy);
    text-transform: uppercase;
}

.tfrs-logo-text__name em {
    font-family: var(--tfrs-font-nav);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--tfrs-gold);
    text-transform: uppercase;
    font-style: normal;
}

/* ─── Navigation ────────────────────────────────────────────── */
.tfrs-nav {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.tfrs-nav__menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0;
}

.tfrs-nav__item {
    position: relative;
    margin: 0;
    padding: 0;
}

.tfrs-nav__link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 16px;
    height: var(--tfrs-header-height);
    font-family: var(--tfrs-font-nav);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--tfrs-navy);
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--tfrs-transition);
    position: relative;
}

/* Underline hover bar — Carson style */
.tfrs-nav__link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 3px;
    background-color: var(--tfrs-gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--tfrs-transition);
}

.tfrs-nav__link:hover,
.tfrs-nav__item.current-menu-item > .tfrs-nav__link,
.tfrs-nav__item.current-menu-ancestor > .tfrs-nav__link {
    color: var(--tfrs-gold);
}

.tfrs-nav__link:hover::after,
.tfrs-nav__item.current-menu-item > .tfrs-nav__link::after,
.tfrs-nav__item.current-menu-ancestor > .tfrs-nav__link::after {
    transform: scaleX(1);
}

/* Chevron icon */
.tfrs-nav__chevron {
    width: 16px;
    height: 16px;
    fill: currentColor;
    transition: transform var(--tfrs-transition);
    flex-shrink: 0;
    margin-left: -2px;
}

.tfrs-nav__item:hover > .tfrs-nav__link .tfrs-nav__chevron {
    transform: rotate(180deg);
}

/* ─── Dropdown ──────────────────────────────────────────────── */
.tfrs-nav__dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    min-width: 220px;
    background-color: var(--tfrs-white);
    border-top: 3px solid var(--tfrs-gold);
    border-radius: 0 0 4px 4px;
    box-shadow: var(--tfrs-dropdown-shadow);
    list-style: none;
    margin: 0;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--tfrs-transition), transform var(--tfrs-transition), visibility var(--tfrs-transition);
    z-index: var(--tfrs-z-dropdown);
}

.tfrs-nav__item:hover > .tfrs-nav__dropdown,
.tfrs-nav__item:focus-within > .tfrs-nav__dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.tfrs-nav__dropdown .tfrs-nav__item {
    width: 100%;
}

.tfrs-nav__dropdown .tfrs-nav__link {
    display: block;
    height: auto;
    padding: 11px 20px;
    font-size: 11.5px;
    color: var(--tfrs-navy);
    border-bottom: 1px solid var(--tfrs-border);
    transition: background-color var(--tfrs-transition), color var(--tfrs-transition), padding-left var(--tfrs-transition);
}

.tfrs-nav__dropdown .tfrs-nav__link::after {
    display: none;
}

.tfrs-nav__dropdown .tfrs-nav__item:last-child .tfrs-nav__link {
    border-bottom: none;
}

.tfrs-nav__dropdown .tfrs-nav__link:hover {
    background-color: var(--tfrs-off-white);
    color: var(--tfrs-gold);
    padding-left: 26px;
}

/* ─── Header CTA Button ─────────────────────────────────────── */
.tfrs-header__actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.tfrs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 24px;
    height: 44px;
    font-family: var(--tfrs-font-nav);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 3px;
    border: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color var(--tfrs-transition), color var(--tfrs-transition), border-color var(--tfrs-transition), transform 0.1s ease;
}

.tfrs-btn:active {
    transform: scale(0.98);
}

/* Gold filled — matches Carson "Find an Advisor" button */
.tfrs-btn--primary {
    background-color: var(--tfrs-gold);
    color: var(--tfrs-white);
    border-color: var(--tfrs-gold);
}

.tfrs-btn--primary:hover {
    background-color: var(--tfrs-gold-dark);
    border-color: var(--tfrs-gold-dark);
    color: var(--tfrs-white);
}

/* Navy outlined */
.tfrs-btn--outline {
    background-color: transparent;
    color: var(--tfrs-navy);
    border-color: var(--tfrs-navy);
}

.tfrs-btn--outline:hover {
    background-color: var(--tfrs-navy);
    color: var(--tfrs-white);
}

/* Full width (mobile drawer) */
.tfrs-btn--full {
    width: 100%;
    margin-top: 8px;
}

/* ─── Hamburger ─────────────────────────────────────────────── */
.tfrs-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: 2px solid var(--tfrs-navy);
    border-radius: 3px;
    cursor: pointer;
    padding: 0;
    transition: border-color var(--tfrs-transition);
}

.tfrs-hamburger:hover {
    border-color: var(--tfrs-gold);
}

.tfrs-hamburger:hover .tfrs-hamburger__bar {
    background-color: var(--tfrs-gold);
}

.tfrs-hamburger__bar {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--tfrs-navy);
    border-radius: 2px;
    transition: background-color var(--tfrs-transition), transform 0.3s ease, opacity 0.2s ease;
}

/* Open state — X animation */
.tfrs-hamburger[aria-expanded="true"] .tfrs-hamburger__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.tfrs-hamburger[aria-expanded="true"] .tfrs-hamburger__bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.tfrs-hamburger[aria-expanded="true"] .tfrs-hamburger__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ─── Mobile Drawer ─────────────────────────────────────────── */
.tfrs-mobile-nav {
    position: fixed;
    inset: 0;
    z-index: var(--tfrs-z-mobile);
    display: flex;
    pointer-events: none;
}

.tfrs-mobile-nav:not([hidden]) {
    pointer-events: auto;
}

.tfrs-mobile-nav__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 28, 48, 0.55);
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.tfrs-mobile-nav:not([hidden]) .tfrs-mobile-nav__overlay {
    opacity: 1;
}

.tfrs-mobile-nav__drawer {
    position: relative;
    margin-left: auto;
    width: min(320px, 90vw);
    height: 100%;
    background-color: var(--tfrs-white);
    display: flex;
    flex-direction: column;
    padding: 24px 28px 32px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid var(--tfrs-gold);
}

.tfrs-mobile-nav:not([hidden]) .tfrs-mobile-nav__drawer {
    transform: translateX(0);
}

.tfrs-mobile-nav__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--tfrs-navy);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color var(--tfrs-transition);
}

.tfrs-mobile-nav__close:hover {
    background-color: var(--tfrs-off-white);
}

.tfrs-mobile-nav__logo {
    margin-bottom: 28px;
    padding-top: 8px;
}

.tfrs-mobile-nav__logo a {
    text-decoration: none;
}

.tfrs-mobile-logo-text {
    font-family: var(--tfrs-font-nav);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--tfrs-navy);
    text-transform: uppercase;
    line-height: 1.3;
}

.tfrs-mobile-logo-text em {
    font-style: normal;
    font-size: 10px;
    color: var(--tfrs-gold);
    letter-spacing: 0.1em;
}

/* Mobile menu items */
.tfrs-mobile-nav__menu {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.tfrs-mobile-nav__menu li {
    border-bottom: 1px solid var(--tfrs-border);
}

.tfrs-mobile-nav__menu li:first-child {
    border-top: 1px solid var(--tfrs-border);
}

.tfrs-mobile-nav__menu a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    font-family: var(--tfrs-font-nav);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--tfrs-navy);
    text-decoration: none;
    transition: color var(--tfrs-transition);
}

.tfrs-mobile-nav__menu a:hover,
.tfrs-mobile-nav__menu li.current-menu-item > a {
    color: var(--tfrs-gold);
}

/* Sub-menu in mobile */
.tfrs-mobile-nav__menu .sub-menu {
    list-style: none;
    padding: 0 0 8px 16px;
    margin: 0;
}

.tfrs-mobile-nav__menu .sub-menu li {
    border-bottom: none;
}

.tfrs-mobile-nav__menu .sub-menu a {
    font-size: 11px;
    padding: 8px 0;
    color: var(--tfrs-text-muted);
    font-weight: 600;
}

.tfrs-mobile-nav__menu .sub-menu a:hover {
    color: var(--tfrs-gold);
}

.tfrs-mobile-nav__footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 2px solid var(--tfrs-navy);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tfrs-mobile-nav__contact {
    font-family: var(--tfrs-font-nav);
    font-size: 15px;
    font-weight: 700;
    color: var(--tfrs-navy);
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
}

.tfrs-mobile-nav__contact:hover {
    color: var(--tfrs-gold);
}



/* ─── Responsive ────────────────────────────────────────────── */

/* 1200px — tighten nav spacing */
@media (max-width: 1200px) {
    .tfrs-nav__link {
        padding: 0 12px;
        font-size: 11px;
    }
    .tfrs-btn--primary {
        padding: 0 18px;
        font-size: 10.5px;
    }
}

/* 1024px — collapse nav, show hamburger */
@media (max-width: 1024px) {
    .tfrs-topbar__links {
        gap: 16px;
    }

    .tfrs-topbar__link:not(:last-child)::after {
        margin-left: 16px;
    }
}

/* 960px — hamburger appears */
@media (max-width: 960px) {
    .tfrs-nav {
        display: none;
    }

    .tfrs-hamburger {
        display: flex;
    }

    .tfrs-header__inner {
        padding: 0 20px;
    }

    .tfrs-topbar__inner {
        padding: 0 20px;
    }

    /* Hide desktop btn on small screens — mobile drawer has its own */
    .tfrs-btn--primary {
        display: none;
    }
}

/* 640px — hide topbar email, compress */
@media (max-width: 640px) {
    .tfrs-topbar__link:first-child {
        display: none;
    }
    .tfrs-topbar__links {
        gap: 12px;
    }
}

/* 480px */
@media (max-width: 480px) {
    .tfrs-header__inner {
        padding: 0 16px;
    }
    .tfrs-topbar__inner {
        padding: 0 16px;
    }
}

/* ─── Accessibility: focus-visible ─────────────────────────── */
.tfrs-nav__link:focus-visible,
.tfrs-btn:focus-visible,
.tfrs-hamburger:focus-visible,
.tfrs-topbar__link:focus-visible,
.tfrs-topbar__cta:focus-visible {
    outline: 2px solid var(--tfrs-gold);
    outline-offset: 3px;
    border-radius: 2px;
}

/* ─── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}