/* 
 * HEADER.CSS - Single source of truth for header layout and logo sizing
 * Clean breakpoint strategy: Desktop (≥1024px) | Tablet (769-1023px) | Mobile (≤768px)
 * Decoupled logo sizing from navigation layout changes
 */

/* Logo-driven header height - logo size determines header size */

/* ===== DESKTOP HEADER (≥1024px) ===== */
.site-header {
    position: relative;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1000;
    width: 100%;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* Logo - Fixed sizing independent of layout */
.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.logo img {
    height: 100px;  /* Large logo height for testing */
    width: auto;
    object-fit: contain;
    display: block;
}

.logo:hover img {
    transform: scale(1.02);
}

/* Navigation */
.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;  /* Prevent wrapping on desktop */
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-size: var(--fs-body);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    transition: all 0.2s ease;
    white-space: nowrap;  /* Prevent text wrapping */
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

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

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

/* CTA Button */
.cta-phone {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: var(--fs-sm);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.cta-phone:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Mobile menu button (hidden on desktop) */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    width: 100px;
    height: 100px;
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

.hamburger:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.hamburger:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.hamburger span {
    display: block;
    width: 36px;
    height: 4px;
    background: var(--text-color);
    margin: 5px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.mobile-actions {
    display: none;
}


/* ===== MOBILE HEADER (≤1023px) ===== */
@media (max-width: 1023px) {
    .site-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 1000;
    }

    .header-container {
        padding: 0 1rem;
    }

    body {
        padding-top: 120px; /* Approximate header height with 100px logo */
    }

    .logo {
        flex-shrink: 0;
        align-items: center;
        padding: 0;
    }

    /* Mobile logo height - drives header height */
    .logo img {
        height: 100px;
        object-fit: contain;
    }

    /* Mobile navigation */
    .nav-links {
        position: fixed;
        top: 120px; /* Below header */
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        flex-direction: column;
        padding: 2rem 1rem;
        gap: 1.5rem;
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        z-index: 999;
    }

    .nav-links.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-links a {
        font-size: 1.1rem;
        padding: 1rem 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .nav-links a:hover,
    .nav-links a:focus-visible {
        background: rgba(231, 90, 53, 0.05);
        color: var(--primary-color);
    }

    .hamburger {
        display: flex;
    }

    .mobile-actions {
        display: flex;
        align-items: center;
        gap: 2rem;
    }

    .mobile-phone-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100px;
        height: 100px;
        padding: var(--spacing-lg);
        background: none;
        border: none;
        color: var(--primary-color);
        text-decoration: none;
        border-radius: var(--border-radius-sm);
        transition: all 0.2s ease;
    }

    .mobile-phone-icon:hover {
        background-color: rgba(231, 90, 53, 0.1);
        transform: scale(1.05);
    }

    /* Hide CTA button on mobile, replaced by phone icon */
    .cta-phone {
        display: none;
    }
}

/* ===== SMALL MOBILE (≤549px) ===== */
@media (max-width: 549px) {
    /* Smaller logo for very small screens */
    .logo img {
        height: 50px;
        object-fit: contain;
    }

    /* Smaller hamburger for small screens */
    .hamburger {
        width: 50px;
        height: 50px;
        padding: var(--spacing-xs);
    }

    /* Reset hamburger lines to be more visible */
    .hamburger span {
        width: 20px;
        height: 2px;
        margin: 2px 0;
        background: var(--text-color);
        display: block;
        transition: all 0.3s ease;
        border-radius: 1px;
    }

    /* Smaller phone icon for small screens */
    .mobile-phone-icon {
        width: 50px;
        height: 50px;
        padding: var(--spacing-xs);
    }

    .mobile-phone-icon .phone-svg {
        width: 24px;
        height: 24px;
    }

    /* Adjust body padding for smaller header */
    body {
        padding-top: 70px; /* Smaller header height */
    }

    /* Adjust mobile navigation position */
    .nav-links {
        top: 70px;
    }

    .site-header.mobile-active .nav-links {
        top: 70px;
    }
}

/* ===== TABLET/MOBILE BREAKPOINT (≤1023px) ===== */
/* This triggers hamburger menu earlier to prevent navigation wrapping */
@media (max-width: 1023px) {
    .site-header.mobile-active .nav-links {
        display: none;
        position: fixed;
        top: 120px; /* Below header regardless of breakpoint */
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        flex-direction: column;
        padding: 2rem 1rem;
        gap: 1.5rem;
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        z-index: 999;
    }
    
    .site-header.mobile-active .nav-links.active {
        display: flex;
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .site-header.mobile-active .nav-links a {
        font-size: 1.1rem;
        padding: 1rem 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        text-align: center;
    }
    
    .site-header.mobile-active .nav-links a:hover,
    .site-header.mobile-active .nav-links a:focus-visible {
        background: rgba(231, 90, 53, 0.05);
        color: var(--primary-color);
    }
    
    .site-header.mobile-active .hamburger {
        display: flex;
    }

    /* Hide CTA button when hamburger is active (tablet/mobile) */
    .site-header.mobile-active .cta-phone {
        display: none;
    }
}

/* Logo hover effect works on all screen sizes */
.logo:hover img {
    transform: scale(1.02);
}

/* Ensure consistent logo aspect ratio and loading */
.logo img {
    object-position: left center;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}