/* Animated angle for bezel light rotation */
@property --nav-bezel-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* ==========================================================================
   Header & Navigation System
   Income Lab — incomelaboratory.com
   ========================================================================== */

:root {
    --il-banner-height: 40px;
    --il-header-height: 64px;
    --il-nav-total-height: calc(var(--il-banner-height) + var(--il-header-height));
    --il-navy: #041835;
    --il-amber: #D4A853;
    --il-amber-light: #e0bb6e;
}

.il-banner-dismissed {
    --il-banner-height: 0px;
    --il-nav-total-height: var(--il-header-height);
}

/* ==========================================================================
   Announcement Bar
   ========================================================================== */

.il-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--il-banner-height);
    background: var(--il-navy);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.il-banner--hidden {
    transform: translateY(calc(-1 * var(--il-banner-height)));
    pointer-events: none;
}

.il-banner-dismissed .il-banner {
    display: none;
}

.il-banner__link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    padding: 0 40px;
}

.il-banner__text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.il-banner__cta {
    color: var(--il-amber);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: color 0.2s ease;
}

.il-banner__link:hover .il-banner__cta {
    color: var(--il-amber-light);
}

.il-banner__arrow {
    display: inline-block;
    transition: transform 0.2s ease;
}

.il-banner__link:hover .il-banner__arrow {
    transform: translateX(3px);
}

.il-banner__dismiss {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s ease;
}

.il-banner__dismiss:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* WP admin bar offset */
.admin-bar .il-banner {
    top: 32px;
}

/* ==========================================================================
   Header
   ========================================================================== */

.il-header {
    position: fixed;
    top: var(--il-banner-height);
    left: 0;
    width: 100%;
    height: var(--il-header-height);
    background: #041835;
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    z-index: 1000;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.il-banner-dismissed .il-header {
    top: 0;
}

.il-header--banner-hidden {
    transform: translateY(calc(-1 * var(--il-banner-height)));
}

/* Scrolled state — deeper glassmorphism + ledger line */
.il-header--scrolled {
    box-shadow: 0 1px 20px rgba(0, 0, 0, 0.3);
}

/* Ledger line at bottom — only visible on scroll */
.il-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 200px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 168, 83, 0.4) 20%, rgba(212, 168, 83, 0.6) 50%, rgba(212, 168, 83, 0.4) 80%, transparent);
    transition: transform 0.4s ease;
}

.il-header--scrolled::after {
    transform: translateX(-50%) scaleX(1);
}

/* WP admin bar offset */
.admin-bar .il-header {
    top: calc(var(--il-banner-height) + 32px);
}

.admin-bar .il-banner-dismissed .il-header {
    top: 32px;
}

/* Inner container */
.il-header__inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 100%;
    gap: 0;
}

/* ==========================================================================
   Logo
   ========================================================================== */

.il-header__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}

.il-header__logo:hover {
    opacity: 0.85;
}

.il-header__logo img {
    width: 140px;
    height: auto;
    display: block;
}

/* Logo separator — vertical ruled line like a spreadsheet column divider */
.il-header__separator {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 20px;
    flex-shrink: 0;
}

/* ==========================================================================
   Desktop Navigation
   ========================================================================== */

.il-nav {
    flex: 1;
    display: flex;
    align-items: center;
}

.il-nav__list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 4px;
}

.il-nav__item {
    position: relative;
}

.il-nav__link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.il-nav__link:hover {
    color: var(--il-amber-light);
}

/* Ledger-line active indicator */
.il-nav__link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 168, 83, 0.6) 30%, rgba(212, 168, 83, 0.8) 50%, rgba(212, 168, 83, 0.6) 70%, transparent);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.il-nav__link:hover::after,
.il-nav__item--active .il-nav__link::after {
    transform: scaleX(1);
}

/* Chevron for dropdown items */
.il-nav__chevron {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    margin-left: 2px;
    transition: transform 0.2s ease;
}

.il-nav__item--has-mega .il-nav__link[aria-expanded="true"] .il-nav__chevron {
    transform: rotate(180deg);
}

/* ==========================================================================
   Header Actions (CTAs + Login)
   ========================================================================== */

.il-header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}

.il-header__login {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    padding: 6px 10px;
    transition: color 0.2s ease;
}

.il-header__login:hover {
    color: rgba(255, 255, 255, 1);
}

.il-header__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

/* Ghost button — Try Free */
.il-header__cta--trial {
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: transparent;
}

.il-header__cta--trial:hover {
    background: rgba(255, 255, 255, 1);
    color: var(--il-navy);
    border-color: rgba(255, 255, 255, 1);
}

/* Bezel wrapper — Book a Demo */
.il-header__demo-bezel {
    position: relative;
    display: inline-flex;
    border-radius: 8px;
    transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.il-header__demo-bezel::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 8px;
    background: conic-gradient(
        from var(--nav-bezel-angle),
        #8B6914 0deg,
        #A67D4A 30deg,
        #B8915A 55deg,
        #C9A46E 80deg,
        #D4B88A 90deg,
        #C9A46E 100deg,
        #B8915A 125deg,
        #A67D4A 155deg,
        #8B6914 180deg,
        #9A7340 210deg,
        #B8915A 235deg,
        #C9A46E 260deg,
        #D4B88A 270deg,
        #C9A46E 280deg,
        #B8915A 305deg,
        #9A7340 335deg,
        #8B6914 360deg
    );
    z-index: -1;
    animation: nav-bezel-rotate 8s linear infinite;
}

.il-header__demo-bezel:hover {
    transform: scale(1.06) translateY(-1px);
}

/* Refined dark gold — Book a Demo */
.il-header__cta--demo {
    background: #A6842E;
    color: #fff;
    border: none;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    position: relative;
}

.il-header__cta--demo:hover {
    background: #BF9A38;
    color: #fff;
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, 0.08),
        0 0 20px rgba(191, 154, 56, 0.3);
}

@keyframes nav-bezel-rotate {
    to { --nav-bezel-angle: 360deg; }
}

@keyframes nav-gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .il-header__demo-bezel::before {
        animation: none;
        background: #B8915A;
    }
    .il-header__cta--demo {
        background: #B8915A;
    }
}

/* ==========================================================================
   Mobile Toggle (hamburger)
   ========================================================================== */

.il-header__mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
}

.il-header__hamburger {
    display: block;
    width: 22px;
    height: 2px;
    background: rgba(255, 255, 255, 0.8);
    position: relative;
    transition: background 0.2s ease;
}

.il-header__hamburger::before,
.il-header__hamburger::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 2px;
    background: rgba(255, 255, 255, 0.8);
    left: 0;
    transition: transform 0.3s ease;
}

.il-header__hamburger::before {
    top: -7px;
}

.il-header__hamburger::after {
    bottom: -7px;
}

/* Active state — X */
.il-header__mobile-toggle[aria-expanded="true"] .il-header__hamburger {
    background: transparent;
}

.il-header__mobile-toggle[aria-expanded="true"] .il-header__hamburger::before {
    top: 0;
    transform: rotate(45deg);
}

.il-header__mobile-toggle[aria-expanded="true"] .il-header__hamburger::after {
    bottom: 0;
    transform: rotate(-45deg);
}

/* ==========================================================================
   Mega-Menu
   ========================================================================== */

.il-mega {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 620px;
    background: rgba(4, 24, 53, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 28px 32px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.il-mega--open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.il-mega__inner {
    display: flex;
    gap: 0;
}

/* Column dividers — vertical ledger lines */
.il-mega__divider {
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.08) 20%, rgba(255, 255, 255, 0.08) 80%, transparent);
    margin: 0 24px;
    flex-shrink: 0;
}

.il-mega__column {
    flex: 1;
    min-width: 0;
}

.il-mega__heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    margin: 0 0 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Horizontal ledger line under column headings */
.il-mega__rule {
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04) 80%, transparent);
    margin: 10px 0 14px 0;
}

/* "New" badge — styled like a cell reference indicator */
.il-mega__badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    background: rgba(212, 168, 83, 0.15);
    color: var(--il-amber);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: 3px;
    border: 1px solid rgba(212, 168, 83, 0.2);
}

.il-mega__links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.il-mega__links li {
    margin: 0;
    padding: 0;
}

.il-mega__links a {
    display: block;
    padding: 7px 0;
    color: rgba(255, 255, 255, 0.75);
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
    transition: color 0.15s ease, transform 0.15s ease;
}

.il-mega__links a:hover {
    color: rgba(255, 255, 255, 1);
    transform: translateX(2px);
}

/* ==========================================================================
   Mobile Navigation — Slide-out Panel
   ========================================================================== */

.il-mobile-nav {
    position: fixed;
    inset: 0;
    z-index: 1002;
    pointer-events: none;
    visibility: hidden;
}

.il-mobile-nav--open {
    pointer-events: auto;
    visibility: visible;
}

/* Backdrop */
.il-mobile-nav__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
}

.il-mobile-nav--open .il-mobile-nav__backdrop {
    background: rgba(0, 0, 0, 0.5);
}

/* Panel */
.il-mobile-nav__panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 100vw;
    height: 100%;
    background: rgba(4, 24, 53, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.il-mobile-nav--open .il-mobile-nav__panel {
    transform: translateX(0);
}

/* Mobile panel header */
.il-mobile-nav__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.il-mobile-nav__logo {
    width: 120px;
    height: auto;
}

.il-mobile-nav__close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 28px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s ease;
}

.il-mobile-nav__close:hover {
    color: rgba(255, 255, 255, 1);
}

/* Mobile nav body */
.il-mobile-nav__body {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.il-mobile-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.il-mobile-nav__item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.il-mobile-nav__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 24px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: color 0.2s ease, background 0.2s ease;
}

.il-mobile-nav__link:hover {
    color: rgba(255, 255, 255, 1);
    background: rgba(255, 255, 255, 0.03);
}

/* Mobile chevron */
.il-mobile-nav__chevron {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.il-mobile-nav__link[aria-expanded="true"] .il-mobile-nav__chevron {
    transform: rotate(180deg);
}

/* Mobile sub-menu (accordion) */
.il-mobile-nav__sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 24px;
}

.il-mobile-nav__item--has-sub .il-mobile-nav__link[aria-expanded="true"] + .il-mobile-nav__sub {
    max-height: 600px;
}

.il-mobile-nav__sub-heading {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.35);
    padding: 12px 0 6px 0;
}

.il-mobile-nav__sub-heading:first-child {
    padding-top: 4px;
}

.il-mobile-nav__sub a {
    display: block;
    padding: 8px 0 8px 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    text-decoration: none;
    transition: color 0.15s ease;
}

.il-mobile-nav__sub a:hover {
    color: rgba(255, 255, 255, 1);
}

/* Ledger-line dividers in mobile sub-menu */
.il-mobile-nav__rule {
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), transparent);
    margin: 8px 0;
}

/* Mobile footer CTAs */
.il-mobile-nav__footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.il-mobile-nav__login {
    display: block;
    text-align: center;
    padding: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.il-mobile-nav__login:hover {
    color: rgba(255, 255, 255, 1);
}

.il-mobile-nav__cta {
    display: block;
    text-align: center;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    background: var(--il-amber);
    color: var(--il-navy);
}

.il-mobile-nav__cta:hover {
    background: var(--il-amber-light);
}

.il-mobile-nav__cta--secondary {
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.il-mobile-nav__cta--secondary:hover {
    background: rgba(255, 255, 255, 1);
    color: var(--il-navy);
    border-color: rgba(255, 255, 255, 1);
}

/* Body scroll lock when mobile nav is open */
.il-mobile-nav-open {
    overflow: hidden;
}

/* ==========================================================================
   Override old header/banner styles
   ========================================================================== */

.banner-top-header {
    display: none !important;
}

.main-header {
    display: none !important;
}

/* ==========================================================================
   Page-specific margin-top cascade
   ========================================================================== */

body .page-content,
body #content {
    margin-top: var(--il-nav-total-height);
}

/* Pages with specific hero patterns */
body.home .hero,
body.home .hero-home {
    margin-top: var(--il-nav-total-height);
}

/* ==========================================================================
   Responsive — 1024px breakpoint
   ========================================================================== */

@media screen and (max-width: 1280px) {
    .il-header__inner {
        padding: 0 20px;
    }

    .il-nav__link {
        padding: 8px 10px;
        font-size: 13px;
    }

    .il-header__cta {
        padding: 7px 14px;
        font-size: 12px;
    }

    .il-header__login {
        font-size: 12px;
    }
}

@media screen and (max-width: 1024px) {
    :root {
        --il-banner-height: 36px;
    }

    /* Hide desktop nav + actions */
    .il-nav,
    .il-header__separator,
    .il-header__actions {
        display: none;
    }

    /* Show mobile toggle */
    .il-header__mobile-toggle {
        display: block;
    }

    .il-header__logo img {
        width: 120px;
    }

    /* Admin bar adjustments at mobile WP admin bar height */
    .admin-bar .il-banner {
        top: 46px;
    }

    .admin-bar .il-header {
        top: calc(var(--il-banner-height) + 46px);
    }

    .admin-bar .il-banner-dismissed .il-header {
        top: 46px;
    }

}

@media screen and (max-width: 768px) {
    .il-banner__text {
        font-size: 11px;
        line-height: 1.2;
    }

    .il-banner__cta {
        font-size: 11px;
        white-space: nowrap;
    }

    .il-banner__link {
        gap: 6px;
        padding: 0 32px 0 12px;
    }

    .il-mobile-nav__panel {
        width: 100vw;
    }
}
