/* =========================================
   Navbar — Premium Creative Animated Design
   2 Aces Designing & Construction
   ========================================= */

/* === NAVBAR BASE — Always visible glass === */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    padding: 8px 0;
    background: rgba(12, 15, 22, 0.7);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border-bottom: 1px solid rgba(16, 185, 129, 0.1);
    transition: all var(--duration-normal) var(--ease-out);
    animation: navSlideDown 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Animated gradient top border — always visible */
.navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
            var(--color-primary) 0%,
            var(--color-accent) 25%,
            var(--color-secondary) 50%,
            var(--color-accent) 75%,
            var(--color-primary) 100%);
    background-size: 200% 100%;
    animation: accentSlide 3s linear infinite;
    z-index: 1;
}

/* Bottom glow line */
.navbar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg,
            transparent,
            rgba(16, 185, 129, 0.3),
            rgba(245, 158, 11, 0.2),
            rgba(16, 185, 129, 0.3),
            transparent);
    z-index: 1;
}

@keyframes accentSlide {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

/* Scrolled state — slightly darker */
.navbar.scrolled {
    background: rgba(12, 15, 22, 0.88);
    backdrop-filter: blur(28px) saturate(1.5);
    -webkit-backdrop-filter: blur(28px) saturate(1.5);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 1px 0 rgba(16, 185, 129, 0.08) inset;
}

.navbar.nav-hidden {
    transform: translateY(-100%) !important;
    box-shadow: none;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ========== LOGO & BRAND ========== */
.nav-logo {
    display: flex;
    flex-direction: column;
    z-index: 1001;
    text-decoration: none;
    position: relative;
    animation: logoFadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

@keyframes logoFadeIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Row 1: Logo + "2 ACES" */
.nav-brand-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Logo circle */
.nav-logo-icon {
    position: relative;
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
}

.nav-logo-icon img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    z-index: 2;
    border: 2px solid rgba(16, 185, 129, 0.3);
    transition: all var(--duration-normal) var(--ease-out);
}

/* Spinning ring */
.nav-logo-icon::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
            var(--color-primary),
            var(--color-accent),
            var(--color-secondary),
            var(--color-primary));
    z-index: 1;
    animation: logoSpin 4s linear infinite;
    opacity: 0;
    transition: opacity var(--duration-normal) ease;
}

/* Glow */
.nav-logo-icon::after {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.3) 0%, transparent 70%);
    z-index: 0;
    filter: blur(12px);
    opacity: 0;
    transition: opacity var(--duration-normal) ease;
}

.nav-logo:hover .nav-logo-icon::before,
.nav-logo:hover .nav-logo-icon::after {
    opacity: 1;
}

.nav-logo:hover .nav-logo-icon img {
    border-color: var(--color-primary);
    transform: scale(1.06);
}

@keyframes logoSpin {
    to {
        transform: rotate(360deg);
    }
}

/* "2 ACES" text */
.nav-brand-name {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 2rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
    color: var(--color-text);
    white-space: nowrap;
    position: relative;
    transition: all var(--duration-normal) ease;
}

/* Shimmer on hover */
.nav-brand-name::before {
    content: '2 ACES';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(16, 185, 129, 0.9) 45%,
            rgba(245, 158, 11, 0.9) 55%,
            transparent 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0;
    transition: opacity var(--duration-normal) ease;
    animation: nameShimmer 3s ease-in-out infinite;
}

.nav-logo:hover .nav-brand-name::before {
    opacity: 1;
}

@keyframes nameShimmer {
    0% {
        background-position: 200% center;
    }

    100% {
        background-position: -200% center;
    }
}

/* Tagline */
.nav-brand-tagline {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--color-text-dim);
    white-space: nowrap;
    margin-top: 3px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.nav-brand-tagline::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent), var(--color-primary));
    background-size: 200% 100%;
    border-radius: 2px;
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-logo:hover .nav-brand-tagline {
    color: var(--color-primary-light);
    letter-spacing: 0.3em;
}

.nav-logo:hover .nav-brand-tagline::after {
    width: 100%;
}

/* ========== Nav Links — Glass Pill Container ========== */
.nav-links {
    display: none;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    padding: 5px 6px;
    animation: linksFadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}

@keyframes linksFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-link {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-muted);
    padding: 8px 20px;
    border-radius: 50px;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

/* Hover glow background */
.nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(99, 102, 241, 0.08));
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: -1;
}

.nav-link:hover {
    color: var(--color-text);
}

.nav-link:hover::before {
    opacity: 1;
}

/* Active nav link — emerald filled pill */
.nav-link.active {
    color: white;
    font-weight: 600;
}

.nav-link.active::before {
    opacity: 1;
    background: linear-gradient(135deg, var(--color-primary), rgba(16, 185, 129, 0.7));
    box-shadow: 0 2px 16px rgba(16, 185, 129, 0.3);
}

/* Glowing dot under active */
.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {

    0%,
    100% {
        box-shadow: 0 0 4px rgba(255, 255, 255, 0.4);
    }

    50% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    }
}

/* ========== CTA Button ========== */
.nav-cta {
    padding: 10px 26px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 50px;
    position: relative;
    overflow: hidden;
    z-index: 1;
    animation: ctaFadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.7s both;
}

@keyframes ctaFadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.desktop-only {
    display: none;
}

/* ========== Burger Menu ========== */
.nav-burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    z-index: 1001;
    padding: 4px;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.nav-burger:hover {
    background: rgba(16, 185, 129, 0.1);
}

.nav-burger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: all var(--duration-normal) var(--ease-out);
    transform-origin: center;
}

.nav-burger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
    background: var(--color-primary);
}

.nav-burger.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.nav-burger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
    background: var(--color-primary);
}

/* ========== Mobile Menu ========== */
.mobile-menu {
    position: fixed;
    inset: 0;
    background: rgba(12, 15, 22, 0.97);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-slow) var(--ease-out);
}

.mobile-menu::before {
    content: '';
    position: absolute;
    top: 15%;
    right: 10%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.mobile-menu::after {
    content: '';
    position: absolute;
    bottom: 15%;
    left: 10%;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.04) 0%, transparent 70%);
    pointer-events: none;
}

.mobile-menu.open {
    opacity: 1;
    visibility: visible;
}

.mobile-link {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--color-text-muted);
    opacity: 0;
    transform: translateY(30px);
    transition: all var(--duration-normal) var(--ease-out), color var(--duration-fast) ease;
    position: relative;
    padding: 4px 0;
}

.mobile-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: 2px;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-link:hover::after {
    width: 80%;
}

.mobile-menu.open .mobile-link {
    opacity: 1;
    transform: translateY(0);
}

.mobile-menu.open .mobile-link:nth-child(1) {
    transition-delay: 0.1s;
}

.mobile-menu.open .mobile-link:nth-child(2) {
    transition-delay: 0.15s;
}

.mobile-menu.open .mobile-link:nth-child(3) {
    transition-delay: 0.2s;
}

.mobile-menu.open .mobile-link:nth-child(4) {
    transition-delay: 0.25s;
}

.mobile-menu.open .mobile-link:nth-child(5) {
    transition-delay: 0.3s;
}

.mobile-menu.open .mobile-link:nth-child(6) {
    transition-delay: 0.35s;
}

.mobile-link:hover,
.mobile-link.active {
    color: var(--color-primary-light);
}

.mobile-cta {
    margin-top: var(--space-xl);
    opacity: 0;
    transform: translateY(30px);
    transition: all var(--duration-normal) var(--ease-out);
    font-size: var(--text-lg);
    padding: 14px 36px;
}

.mobile-menu.open .mobile-cta {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.4s;
}

/* ========== Desktop: show nav links, hide burger ========== */
@media (min-width: 769px) {
    .nav-links {
        display: flex;
    }

    .desktop-only {
        display: inline-flex;
    }

    .nav-burger {
        display: none;
    }
}

/* ========== Mobile adjustments ========== */
@media (max-width: 768px) {
    .nav-logo-icon {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
    }

    .nav-brand-name {
        font-size: 1.5rem;
    }

    .nav-brand-tagline {
        font-size: 0.55rem;
        letter-spacing: 0.16em;
    }
}

@media (max-width: 400px) {
    .nav-logo-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .nav-brand-name {
        font-size: 1.2rem;
    }

    .nav-brand-tagline {
        font-size: 0.48rem;
        letter-spacing: 0.1em;
    }
}