/* =========================================================================
   NEXAPROP GLOBAL ENHANCEMENTS
   Elevating the UI with Liquid Gold gradients, dynamic glassmorphism, 
   and micro-animations. Overrides applied safely with !important.
   ========================================================================= */

/* 0. NATIVE BEHAVIORS */
html {
    scroll-behavior: smooth !important;
}

/* 1. LIQUID GOLD TYPOGRAPHY */
h1 em, h2 em, h3 em, 
.section-title em, .trust-heading em, .hero h1 em {
    font-style: normal !important; 
    color: transparent !important; 
    background: linear-gradient(120deg, var(--champagne-dark) 0%, var(--champagne) 50%, #B89B6E 100%) !important; 
    -webkit-background-clip: text !important; 
    background-clip: text !important;
}

/* 2. BUTTON SHIMMER & GLOW */
.btn-primary, .cta-primary, .btn-cta {
    position: relative !important; 
    overflow: hidden !important;
}
.btn-primary::after, .cta-primary::after, .btn-cta::after {
    content: '' !important; 
    position: absolute !important; 
    width: 200% !important; 
    height: 200% !important; 
    top: -50% !important; 
    left: -200% !important; 
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent) !important; 
    transition: left 0.6s cubic-bezier(0.16,1,0.3,1) !important;
}
.btn-primary:hover::after, .cta-primary:hover::after, .btn-cta:hover::after {
    left: 100% !important;
}

/* 3. GLASSMORPHISM DEPTH AND PHYSICS (LIGHT & DARK CARDS) */
/* Light Theme Cards */
.slide-card, .why-card, .expertise-card, .cred-box, .testimonial-card,
.overview-cell, .related-card, .verdict-item, .intel-card {
    transition: transform 0.5s cubic-bezier(0.16,1,0.3,1), box-shadow 0.5s cubic-bezier(0.16,1,0.3,1) !important;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.4), 0 2px 10px rgba(0,0,0,0.02) !important;
    border-radius: 14px;
}
.slide-card:hover, .why-card:hover, .expertise-card:hover, .cred-box:hover, .testimonial-card:hover,
.overview-cell:hover, .related-card:hover, .verdict-item:hover, .intel-card:hover {
    transform: translateY(-6px) scale(1.01) !important; 
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.6), 0 16px 40px rgba(34,45,82,0.08) !important;
    z-index: 2; /* Bring active card up */
}

/* Dark Theme Cards */
.intent-card, .philosophy-card, .profile-card, .data-callout {
    transition: transform 0.5s cubic-bezier(0.16,1,0.3,1), box-shadow 0.5s cubic-bezier(0.16,1,0.3,1) !important;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.05), 0 4px 20px rgba(0,0,0,0.15) !important;
}
.intent-card:hover, .philosophy-card:hover, .profile-card:hover, .data-callout:hover {
    transform: translateY(-5px) scale(1.01) !important; 
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.1), 0 12px 40px rgba(0,0,0,0.25) !important;
}

/* Specific Intent Card Pulsing Glow */
.intent-card::after {
    transition: all 0.6s cubic-bezier(0.16,1,0.3,1) !important;
}
.intent-card:hover::after {
    transform: scale(2.5) !important; 
    opacity: 0.06 !important;
}

/* 4. ICON & ASSET MICRO-ANIMATIONS */
.slide-card-icon svg, .intent-card-icon svg, .expertise-icon, .cred-number, .data-callout-num, .ov-icon {
    transition: transform 0.4s cubic-bezier(0.16,1,0.3,1), color 0.4s ease !important;
}
.slide-card:hover .slide-card-icon svg, 
.intent-card:hover .intent-card-icon svg, 
.expertise-card:hover .expertise-icon, 
.cred-box:hover .cred-number,
.data-callout:hover .data-callout-num,
.overview-cell:hover .ov-icon {
    transform: scale(1.15) !important;
    stroke-width: 1.8 !important; /* mostly affects SVG strokes */
}


/* ===== 5. UNIVERSAL IMAGE ARCHITECTURE & UX ===== */

/* High-End Card Feature Images (School Cards, Audience Cards, Area Cards) */
.card-feature-img {
    width: calc(100% + 3.2rem); 
    margin: -1.6rem -1.6rem 1.6rem -1.6rem; 
    height: 170px; 
    object-fit: cover; 
    border-radius: 14px 14px 0 0; 
    display: block;
    opacity: 0; 
    animation: imgFadeIn 0.8s ease forwards;
    border-bottom: 1px solid var(--border-light, rgba(210,182,138,0.2));
}

/* Specific overrides for cards with different padding */
.aud-card .card-feature-img {
    width: calc(100% + 3.6rem);
    margin: -2rem -1.8rem 1.6rem -1.8rem;
}

.why-item .card-feature-img {
    width: calc(100% + 2.4rem);
    margin: -1.6rem -1.2rem 1.2rem -1.2rem;
    height: 120px;
}

/* Parallax Interruption Banners */
.parallax-divider {
    width: 100%;
    height: 50vh;
    min-height: 400px;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
    box-shadow: inset 0 20px 40px rgba(0,0,0,0.15), inset 0 -20px 40px rgba(0,0,0,0.15);
}
.parallax-divider::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, var(--silk) 0%, transparent 15%, transparent 85%, var(--silk) 100%);
}

@keyframes imgFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dynamic Hero Overrides */
.hero-bg, .hero-bg-photo {
    background-size: cover !important;
    background-position: center !important;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, transparent 100%) !important;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, transparent 100%) !important;
}


/* ===== 6. GLOBAL MOBILE OVERRIDES & UX SYNC ===== */

/* Touch Device Protections: Remove hover physics on swipe */
@media (hover: none), (max-width: 768px) {
    .slide-card:hover, .why-card:hover, .expertise-card:hover, .cred-box:hover, .testimonial-card:hover,
    .overview-cell:hover, .related-card:hover, .verdict-item:hover, .intel-card:hover,
    .intent-card:hover, .philosophy-card:hover, .profile-card:hover, .data-callout:hover {
        transform: none !important; 
        box-shadow: inherit !important;
        z-index: auto !important;
    }
    
    .btn-primary:hover, .cta-primary:hover, .btn-cta:hover {
        transform: none !important;
    }

    .slide-card:hover .slide-card-icon svg, 
    .intent-card:hover .intent-card-icon svg, 
    .expertise-card:hover .expertise-icon, 
    .cred-box:hover .cred-number,
    .data-callout:hover .data-callout-num,
    .overview-cell:hover .ov-icon {
        transform: scale(1) !important;
    }
}

/* Mobile Alignment & Spacing Optimization (< 768px) */
@media (max-width: 768px) {
    
    /* Downscale typographical hero titles to prevent line breaking errors */
    .hero h1, .page-header h1 {
        font-size: clamp(1.8rem, 8vw, 2.4rem) !important;
        line-height: 1.2 !important;
    }

    /* Shrink the heavy parallax visual dividers so they dont take up 100% of phone screen */
    .parallax-divider {
        min-height: 220px !important;
        height: 30vh !important;
        margin: 2.5rem 0 !important;
    }

    /* Optimize the newly injected header cards. 
       If base HTML uses responsive padding, we must lock padding universally 
       so the negative-margin Image edge matches mathematically without horizontal scroll. */
    .aud-card, .school-card, .why-item, .overview-cell {
        padding: 1.25rem !important; 
    }
    
    .card-feature-img {
        width: calc(100% + 2.5rem) !important;
        margin: -1.25rem -1.25rem 1.25rem -1.25rem !important;
        height: 140px !important;
    }
    
    /* Specific overrides for specific cards */
    .aud-card .card-feature-img {
        width: calc(100% + 2.5rem) !important;
        margin: -1.25rem -1.25rem 1.25rem -1.25rem !important;
    }
    
    .why-item .card-feature-img {
        width: calc(100% + 2.5rem) !important;
        margin: -1.25rem -1.25rem 1.25rem -1.25rem !important;
        height: 110px !important;
    }
    
    /* Synchronize global container gutters to 1.25rem minimum */
    .section-wrap, .page-header, .featured, .blog-grid-section, .newsletter {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }
}


/* ===== 7. UI/UX AUDIT FIXES ===== */

/* --- Fix 1: WhatsApp Button Mobile Resize --- */
@media (max-width: 768px) {
    .wa-float {
        bottom: 1rem !important;
        right: 1rem !important;
    }
    .wa-float-btn {
        width: 46px !important;
        height: 46px !important;
        border-radius: 14px !important;
    }
    .wa-float-btn svg {
        width: 22px !important;
        height: 22px !important;
    }
    .wa-float-label {
        display: none !important;
    }
    .wa-float-pulse {
        border-radius: 16px !important;
    }
}

/* --- Fix 2: Nav CTA Mobile Resize --- */
@media (max-width: 768px) {
    .nav-cta {
        padding: 0.35rem 0.8rem !important;
        font-size: 0.7rem !important;
    }
}

/* --- Fix 3: Body Scroll Lock for Mobile Menu --- */
body.no-scroll {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* --- Fix 6: Newsletter Input Normalization --- */
.newsletter-input {
    background: var(--pearl, #FDFFFF) !important;
    color: var(--text-primary, #1A1F2E) !important;
    border: 1.5px solid var(--border-light, rgba(210,182,138,0.18)) !important;
}
.newsletter-input:focus {
    border-color: var(--champagne, #D2B68A) !important;
    box-shadow: 0 0 0 3px rgba(210,182,138,0.12) !important;
}
.newsletter-input::placeholder {
    color: var(--text-muted, #8F94A5) !important;
}
.newsletter-title {
    color: var(--velvet, #222D52) !important;
}
.newsletter-desc {
    color: var(--text-secondary, #5C6175) !important;
}

/* --- Fix 7: Focus-Visible Accessibility --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--champagne, #D2B68A) !important;
    outline-offset: 2px !important;
    border-radius: 4px;
}
/* Remove the default ugly blue chrome outline for mouse users */
:focus:not(:focus-visible) {
    outline: none !important;
}

/* --- Fix 8: Section Spacing Rhythm Normalization --- */
.section-wrap {
    padding-top: 5rem !important;
    padding-bottom: 5rem !important;
}
@media (max-width: 768px) {
    .section-wrap {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
}

/* --- Fix 9: iOS Parallax Fallback --- */
@supports (-webkit-touch-callout: none) {
    .parallax-divider {
        background-attachment: scroll !important;
    }
}
@media (hover: none) {
    .parallax-divider {
        background-attachment: scroll !important;
    }
}

/* --- Fix 10: Blog Card Images Visibility --- */
.blog-card-img .img-card {
    opacity: 1 !important;
    position: relative !important;
    z-index: 1 !important;
    animation: none !important;
}
.blog-card-img-icon {
    z-index: 2 !important;
}

/* --- Fix 11: Traditional Chinese (lang-hk) Fallback to Simplified Chinese ---
   When lang-hk is selected but no .lang-hk span exists in the same parent,
   show the .lang-cn span instead so content is never blank.
   :last-of-type targets the lang-cn span only when no lang-hk sibling follows it. */
body.lang-hk .lang-cn:last-of-type {
    display: inline !important;
}
/* Block-level fallback (for any lang-cn divs/paragraphs) */
body.lang-hk div.lang-cn:last-of-type,
body.lang-hk p.lang-cn:last-of-type {
    display: block !important;
}
