/**
 * Kuwy PanAm FinTax Ltd - Global Stylesheet
 * Header, Footer, and Common Styles
 */

/* ===== Variables ===== */
:root {
    --primary: #0a2540;
    --primary-light: #1a3a5c;
    --primary-dark: #061729;
    --secondary: #c9a227;
    --secondary-light: #e8c547;
    --accent: #00d4aa;
    --white: #ffffff;
    --light: #f8fafc;
    --light-gray: #f8fafc;
    --gray: #e2e8f0;
    --mid-gray: #e2e8f0;
    --dark-gray: #64748b;
    --text: #1e293b;
    --text-light: #475569;
    --gradient: linear-gradient(135deg, #0a2540 0%, #1a3a5c 100%);
    --gradient-primary: linear-gradient(135deg, #0a2540 0%, #1a3a5c 50%, #0d3251 100%);
    --gradient-hero: linear-gradient(135deg, #0a2540 0%, #0d3251 40%, #1a4a6c 100%);
    --shadow: 0 4px 20px rgba(10, 37, 64, 0.1);
    --shadow-sm: 0 2px 10px rgba(10, 37, 64, 0.06);
    --shadow-md: 0 4px 20px rgba(10, 37, 64, 0.1);
    --shadow-lg: 0 10px 40px rgba(10, 37, 64, 0.15);
    --shadow-xl: 0 20px 60px rgba(10, 37, 64, 0.2);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s ease;
}

/* ===== Accessibility ===== */
.skip-nav {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 99999;
    background: var(--secondary);
    color: var(--primary);
    padding: 12px 24px;
    border-radius: 0 0 8px 8px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    transition: top 0.2s ease;
}
.skip-nav:focus {
    top: 0;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    line-height: 1.6;
    background: var(--white);
}
h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    line-height: 1.2;
}
a { text-decoration: none; color: inherit; transition: var(--transition); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--secondary); outline-offset: 2px; border-radius: 4px; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

/* Global overflow protection */
body { overflow-x: hidden; }
.section-inner, .footer-container { overflow: hidden; }

/* ===== HEADER ===== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 2px 20px rgba(10, 37, 64, 0.05);
    transition: var(--transition);
}
.site-header.scrolled { box-shadow: var(--shadow); }

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    z-index: 10001;
    flex-shrink: 0;
}
.nexus-logo-svg {
    height: 48px;
    width: auto;
    min-width: 180px;
    display: block;
    overflow: visible;
    transition: height 0.3s ease;
}
.site-header.scrolled .nexus-logo-svg {
    height: 40px;
}
.logo-img {
    height: 44px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    transition: height 0.3s ease;
}
.site-header.scrolled .logo-img {
    height: 36px;
}

/* Navigation */
.main-nav .nav-list {
    display: flex;
    align-items: center;
    gap: 4px;
}
.main-nav .nav-list > li > a {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    border-radius: 8px;
    transition: var(--transition);
}
.main-nav .nav-list > li > a:hover,
.main-nav .nav-list > li > a.active {
    background: var(--light);
    color: var(--primary);
}
.main-nav .nav-list > li > a svg {
    transition: transform 0.2s ease;
}

/* Dropdown */
.has-dropdown {
    position: relative;
}
.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    border: 1px solid var(--gray);
}
.has-dropdown:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.has-dropdown:hover > a svg {
    transform: rotate(180deg);
}
.dropdown li a {
    display: block;
    padding: 10px 14px;
    font-size: 14px;
    border-radius: 6px;
}
.dropdown li a:hover {
    background: var(--light);
    color: var(--primary);
}

/* Nav CTA Button */
.nav-cta {
    background: var(--gradient) !important;
    color: var(--white) !important;
    padding: 12px 24px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 15px rgba(10, 37, 64, 0.25);
}
.nav-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(10, 37, 64, 0.35);
}

/* ===== FOOTER ===== */
.site-footer {
    background: linear-gradient(135deg, #0a2540 0%, #0d3158 50%, #0f3a6b 100%);
    color: var(--white);
    padding: 80px 40px 40px;
}
.footer-container {
    max-width: 1400px;
    margin: 0 auto;
}
.footer-main {
    display: grid;
    grid-template-columns: 1.2fr 2.8fr;
    gap: 60px;
    margin-bottom: 50px;
    align-items: start;
}
.footer-brand {
    display: flex;
    flex-direction: column;
}
.footer-brand .footer-logo {
    display: inline-block;
    margin-bottom: 20px;
}
.footer-logo .nexus-logo-svg {
    height: 46px;
    width: auto;
    display: block;
}
.footer-logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}
.footer-brand > p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.7;
}
.footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}
.footer-col h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 20px;
}
.footer-col ul li {
    margin-bottom: 10px;
}
.footer-col ul li a {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}
.footer-col ul li a:hover {
    color: var(--secondary);
}
.footer-col .contact-list li a {
    color: var(--secondary);
}
.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.footer-bottom p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}
.footer-social a {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
}
.footer-social a:hover {
    background: var(--secondary);
    color: var(--primary);
}

/* ===== COMMON SECTIONS ===== */
.page-hero {
    background: var(--gradient);
    padding: 160px 40px 100px;
    position: relative;
    overflow: hidden;
}
.page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.page-hero-inner, .page-hero-content {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    text-align: center;
}
.page-hero h1 {
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 800;
    color: var(--white);
    margin-bottom: 16px;
}
.page-hero p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.85);
    max-width: 600px;
    margin: 0 auto;
}

.section {
    padding: 80px 40px;
}
.section-inner {
    max-width: 1400px;
    margin: 0 auto;
}
.section-header {
    text-align: center;
    margin-bottom: 50px;
}
.section-label {
    display: inline-block;
    background: rgba(201, 162, 39, 0.15);
    color: var(--secondary);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}
.section-header h2 {
    font-size: clamp(28px, 4vw, 42px);
    margin-bottom: 12px;
}
.section-header p {
    font-size: 17px;
    color: var(--dark-gray);
    max-width: 600px;
    margin: 0 auto;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--secondary);
    color: var(--primary);
    padding: 14px 28px;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(201, 162, 39, 0.4);
}
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: var(--white);
    padding: 14px 28px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--secondary);
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray);
    transition: var(--transition);
}
.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--secondary);
}

/* ===== RESPONSIVE ===== */

/* Tablet - 1024px */
@media (max-width: 1024px) {
    .main-nav { display: none !important; }
    .mobile-menu-btn { display: block !important; }
    .mobile-nav { display: block !important; }
    .footer-main { grid-template-columns: 1fr; gap: 40px; }
    .footer-links { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile - 768px */
@media (max-width: 768px) {
    /* Base font scaling */
    html { font-size: 15px; }
    
    /* Header - solid white background on mobile to prevent images showing through */
    .site-header {
        background: #ffffff;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    
    /* Header */
    .header-container { padding: 0 16px; height: 65px; }
    .logo-img { height: 34px; max-width: 150px; }
    .nexus-logo-svg { height: 40px; min-width: 150px; }
    
    /* Mobile menu button - larger touch target, always visible */
    .mobile-menu-btn { 
        padding: 12px; 
        margin-right: -12px;
        min-width: 48px;
        min-height: 48px;
        z-index: 10001;
        position: relative;
    }
    
    /* Page hero optimization */
    .page-hero { 
        padding: 110px 20px 60px; 
        min-height: auto;
    }
    .page-hero h1 { 
        font-size: 28px; 
        line-height: 1.2;
    }
    .page-hero p { 
        font-size: 16px; 
        line-height: 1.6;
    }
    
    /* Sections */
    .section { padding: 50px 16px; }
    .section-header { margin-bottom: 40px; }
    .section-header h2 { font-size: 26px; }
    .section-header p { font-size: 15px; }
    .section-label { font-size: 11px; padding: 6px 14px; }
    
    /* Footer */
    .site-footer { padding: 50px 16px 24px; }
    .footer-links { grid-template-columns: 1fr 1fr; gap: 30px; }
    .footer-col h4 { font-size: 15px; margin-bottom: 16px; }
    .footer-col ul li { margin-bottom: 12px; }
    .footer-col ul li a { 
        font-size: 14px; 
        padding: 4px 0;
        display: inline-block;
    }
    .footer-bottom { 
        flex-direction: column; 
        gap: 20px; 
        text-align: center; 
        padding-top: 24px;
    }
    
    /* Buttons - larger touch targets */
    .btn-primary, .btn-secondary {
        padding: 16px 24px;
        font-size: 15px;
        min-height: 50px;
        justify-content: center;
    }
}

/* Small Mobile - 480px */
@media (max-width: 480px) {
    html { font-size: 14px; }
    
    .header-container { padding: 0 12px; height: 60px; }
    .logo-img { height: 30px; max-width: 130px; }
    .nexus-logo-svg { height: 34px; min-width: 130px; }
    
    .page-hero { padding: 100px 16px 50px; }
    .page-hero h1 { font-size: 24px; }
    .page-hero p { font-size: 15px; }
    
    .section { padding: 40px 12px; }
    .section-header h2 { font-size: 22px; }
    
    .footer-links { grid-template-columns: 1fr; gap: 24px; }
    .footer-brand p { font-size: 14px; }
}

/* ===== MOBILE MENU ENHANCEMENTS ===== */
.mobile-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    box-shadow: 0 10px 40px rgba(10, 37, 64, 0.2);
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                padding 0.3s ease,
                opacity 0.3s ease;
    opacity: 0;
    z-index: 10000;
}

.mobile-nav.active {
    max-height: calc(100vh - 65px);
    padding: 16px;
    opacity: 1;
    overflow-y: auto;
}

.mobile-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav ul li {
    margin-bottom: 4px;
    transform: translateX(-20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-nav.active ul li {
    transform: translateX(0);
    opacity: 1;
}

/* Staggered animation for menu items */
.mobile-nav.active ul li:nth-child(1) { transition-delay: 0.05s; }
.mobile-nav.active ul li:nth-child(2) { transition-delay: 0.1s; }
.mobile-nav.active ul li:nth-child(3) { transition-delay: 0.15s; }
.mobile-nav.active ul li:nth-child(4) { transition-delay: 0.2s; }
.mobile-nav.active ul li:nth-child(5) { transition-delay: 0.25s; }
.mobile-nav.active ul li:nth-child(6) { transition-delay: 0.3s; }
.mobile-nav.active ul li:nth-child(7) { transition-delay: 0.35s; }
.mobile-nav.active ul li:nth-child(8) { transition-delay: 0.4s; }

.mobile-nav ul li a {
    display: block;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 10px;
    color: var(--text);
    min-height: 52px;
    display: flex;
    align-items: center;
}

.mobile-nav ul li a:hover,
.mobile-nav ul li a:active {
    background: var(--light);
    color: var(--primary);
}

.mobile-nav ul li.sub a {
    padding-left: 36px;
    font-size: 15px;
    color: var(--dark-gray);
    min-height: 48px;
}

.mobile-cta {
    background: var(--gradient) !important;
    color: var(--white) !important;
    text-align: center;
    justify-content: center;
    margin-top: 12px;
    font-weight: 600;
    border-radius: 10px;
}

/* Mobile menu button animation */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 10001;
    position: relative;
    flex-shrink: 0;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--primary);
    margin: 6px 0;
    border-radius: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease,
                background 0.2s ease;
    transform-origin: center;
}

.mobile-menu-btn.active span {
    background: var(--secondary);
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

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

/* ===== STICKY CONTACT BUTTON (Mobile) ===== */
.mobile-sticky-cta {
    display: none;
}

@media (max-width: 768px) {
    .mobile-sticky-cta {
        display: flex;
        position: fixed;
        bottom: 20px;
        left: 16px;
        right: 16px;
        z-index: 999;
        background: var(--secondary);
        color: var(--primary);
        padding: 16px 24px;
        border-radius: 14px;
        font-weight: 700;
        font-size: 16px;
        text-align: center;
        justify-content: center;
        align-items: center;
        gap: 10px;
        box-shadow: 0 8px 30px rgba(201, 162, 39, 0.4),
                    0 4px 12px rgba(0, 0, 0, 0.15);
        text-decoration: none;
        transform: translateY(100px);
        opacity: 0;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.3s ease,
                    box-shadow 0.2s ease;
    }
    
    .mobile-sticky-cta.visible {
        transform: translateY(0);
        opacity: 1;
    }
    
    .mobile-sticky-cta:active {
        transform: scale(0.98);
        box-shadow: 0 4px 20px rgba(201, 162, 39, 0.3);
    }
    
    .mobile-sticky-cta svg {
        width: 20px;
        height: 20px;
    }
    
    /* Add padding to footer to prevent overlap */
    .site-footer {
        padding-bottom: 100px;
    }
}

/* ===== TOUCH IMPROVEMENTS ===== */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .card:hover,
    .service-card:hover,
    .value-card:hover,
    .partner-card:hover,
    .team-card:hover,
    .story-card:hover {
        transform: none;
    }
    
    /* Add active states instead */
    .card:active,
    .service-card:active,
    .value-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* Larger touch targets for links */
    .footer-col ul li a,
    .dropdown li a,
    .nav-list > li > a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Prevent text selection on buttons */
    .btn-primary,
    .btn-secondary,
    .mobile-menu-btn,
    .nav-cta {
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .page-hero {
        min-height: auto;
        padding: 90px 20px 40px;
    }
    
    .mobile-nav.active {
        max-height: 70vh;
    }
    
    .mobile-nav ul li a {
        padding: 12px 20px;
        min-height: 44px;
    }
}

/* ===== SAFE AREA (Notch) SUPPORT ===== */
@supports (padding: max(0px)) {
    .site-header {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    
    .mobile-sticky-cta {
        bottom: max(20px, env(safe-area-inset-bottom));
        left: max(16px, env(safe-area-inset-left));
        right: max(16px, env(safe-area-inset-right));
    }
    
    .site-footer {
        padding-bottom: max(100px, calc(80px + env(safe-area-inset-bottom)));
    }
}