/* ========================================
   COMPREHENSIVE TYPOGRAPHY FIX
   Unified responsive typography system
   Fixes all text sizing issues across the project
   ======================================== */

/* ========================================
   BASE TYPOGRAPHY SCALE
   Professional scaling from mobile to desktop
   ======================================== */

/* ========================================
   1. HTML HEADINGS (h1-h6)
   ======================================== */

/* H1 - Main Page Titles */
h1, .h1 {
    font-size: clamp(1.75rem, 4vw, 2.75rem) !important;
    line-height: 1.2 !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    color: #0f172a !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

/* H2 - Section Headings */
h2, .h2 {
    font-size: clamp(1.5rem, 3.5vw, 2.25rem) !important;
    line-height: 1.3 !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em !important;
    color: #0f172a !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

/* H3 - Subsection Headings */
h3, .h3 {
    font-size: clamp(1.25rem, 3vw, 1.875rem) !important;
    line-height: 1.3 !important;
    font-weight: 600 !important;
    letter-spacing: -0.01em !important;
    color: #0f172a !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

/* H4 - Card Titles, Small Headings */
h4, .h4 {
    font-size: clamp(1.125rem, 2.5vw, 1.5rem) !important;
    line-height: 1.4 !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

/* H5 - Small Headings */
h5, .h5 {
    font-size: clamp(1rem, 2.2vw, 1.25rem) !important;
    line-height: 1.4 !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

/* H6 - Smallest Headings */
h6, .h6 {
    font-size: clamp(0.875rem, 2vw, 1.125rem) !important;
    line-height: 1.4 !important;
    font-weight: 500 !important;
    color: #0f172a !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

/* ========================================
   2. BODY TEXT & PARAGRAPHS
   ======================================== */

/* Base Paragraph Text */
p, .text-body, body {
    font-size: clamp(0.9375rem, 1.5vw, 1.0625rem) !important;
    line-height: 1.7 !important;
    font-weight: 400 !important;
    color: #475569 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Large Body Text */
.text-large, .text-body-large, p.text-large {
    font-size: clamp(1.0625rem, 1.8vw, 1.25rem) !important;
    line-height: 1.7 !important;
    font-weight: 400 !important;
}

/* Small Body Text */
.text-small, .text-body-small, small, .small {
    font-size: clamp(0.8125rem, 1.3vw, 0.9375rem) !important;
    line-height: 1.6 !important;
    font-weight: 400 !important;
}

/* Extra Small Text */
.text-xs, .text-extra-small {
    font-size: clamp(0.75rem, 1.2vw, 0.875rem) !important;
    line-height: 1.5 !important;
    font-weight: 400 !important;
}

/* ========================================
   3. HERO SECTION TYPOGRAPHY
   ======================================== */

/* Hero Main Heading */
.modern-hero-heading,
.hero-title,
.page-title,
.home-hero-section h1 {
    font-size: clamp(1.75rem, 5vw, 3rem) !important;
    line-height: 1.2 !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em !important;
    color: #0f172a !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

/* Hero Text/Description */
.modern-hero-text,
.hero-text,
.hero-description {
    font-size: clamp(1rem, 1.8vw, 1.25rem) !important;
    line-height: 1.7 !important;
    font-weight: 400 !important;
    color: #475569 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

/* ========================================
   4. SECTION HEADINGS
   ======================================== */

/* Section Titles */
.section-title,
.section-heading,
.products-section-heading,
.trusted-by-heading,
.why-moneypex-heading,
.testimonials-heading,
.benefits-wrapper-modern h2,
.empowering-businesses-section h2,
.features-wrapper h2,
.industries-section h2,
.pricing-section h2,
.counter-wrapper h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem) !important;
    line-height: 1.2 !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    color: #0f172a !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

/* Section Subtitles/Descriptions */
.section-subtitle,
.section-description,
.products-section-subtitle,
.modern-section-subtitle {
    font-size: clamp(0.9375rem, 1.8vw, 1.125rem) !important;
    line-height: 1.7 !important;
    font-weight: 400 !important;
    color: #64748b !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* ========================================
   5. CARD TYPOGRAPHY
   ======================================== */

/* Card Titles */
.modern-card-title,
.mp-products-card__title,
.why-card-title,
.product-card-title,
.benefit-card-title,
.testimonial-card-title {
    font-size: clamp(1.125rem, 2.5vw, 1.375rem) !important;
    line-height: 1.3 !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    letter-spacing: -0.01em !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

/* Card Text/Description */
.modern-card-text,
.mp-products-card__description,
.why-card-text,
.product-card-text,
.benefit-card-text,
.testimonial-card-text {
    font-size: clamp(0.9375rem, 1.5vw, 1.0625rem) !important;
    line-height: 1.6 !important;
    font-weight: 400 !important;
    color: #64748b !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

/* ========================================
   6. BUTTON TYPOGRAPHY
   ======================================== */

/* Primary Buttons */
.btn-premium,
.btn-primary,
.btn-modern,
.btn-signup-primary,
button.btn-primary {
    font-size: clamp(0.9375rem, 1.5vw, 1.0625rem) !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* Secondary Buttons */
.btn-secondary,
.btn-outline,
.btn-premium-outline {
    font-size: clamp(0.9375rem, 1.5vw, 1.0625rem) !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* Small Buttons */
.btn-sm,
button.btn-sm {
    font-size: clamp(0.8125rem, 1.3vw, 0.9375rem) !important;
    font-weight: 600 !important;
}

/* ========================================
   7. NAVIGATION TYPOGRAPHY
   ======================================== */

/* Nav Links */
.nav-link,
.nav-link-modern,
.navbar-nav .nav-link {
    font-size: clamp(0.9375rem, 1.3vw, 1rem) !important;
    font-weight: 500 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* Nav Brand/Logo Text */
.navbar-brand {
    font-size: clamp(1.125rem, 2vw, 1.5rem) !important;
    font-weight: 700 !important;
}

/* ========================================
   8. FORM TYPOGRAPHY
   ======================================== */

/* Form Labels */
.form-label,
.form-label-modern,
label {
    font-size: clamp(0.875rem, 1.3vw, 1rem) !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* Form Inputs */
.form-control,
.form-input-modern,
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    font-size: clamp(0.9375rem, 1.4vw, 1.0625rem) !important;
    line-height: 1.5 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* Form Help Text */
.form-text,
.help-text,
.form-help {
    font-size: clamp(0.8125rem, 1.2vw, 0.875rem) !important;
    line-height: 1.5 !important;
    color: #64748b !important;
}

/* Error Messages */
.error-message,
.error-message-modern,
.text-danger {
    font-size: clamp(0.8125rem, 1.2vw, 0.875rem) !important;
    line-height: 1.5 !important;
    font-weight: 500 !important;
}

/* ========================================
   9. SPECIAL SECTIONS
   ======================================== */

/* Why Moneypex Heading */
.why-moneypex-heading {
    font-size: clamp(1.5rem, 4vw, 2.75rem) !important;
    line-height: 1.2 !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
}

/* Why Moneypex Description */
.why-moneypex-description {
    font-size: clamp(1rem, 1.8vw, 1.125rem) !important;
    line-height: 1.7 !important;
    font-weight: 400 !important;
}

/* Why Moneypex CTA */
.why-moneypex-cta {
    font-size: clamp(0.9375rem, 1.5vw, 1.0625rem) !important;
    line-height: 1.6 !important;
    font-weight: 600 !important;
}

/* Trusted By Heading */
.trusted-by-heading {
    font-size: clamp(1.5rem, 4vw, 2.5rem) !important;
    line-height: 1.2 !important;
    font-weight: 800 !important;
}

/* ========================================
   10. LIST TYPOGRAPHY
   ======================================== */

/* List Items */
li, ul li, ol li {
    font-size: clamp(0.9375rem, 1.5vw, 1.0625rem) !important;
    line-height: 1.7 !important;
    font-weight: 400 !important;
    color: #475569 !important;
}

/* ========================================
   11. LINK TYPOGRAPHY
   ======================================== */

/* Standard Links */
a, .link, .link-modern {
    font-size: clamp(0.9375rem, 1.4vw, 1.0625rem) !important;
    font-weight: 500 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* ========================================
   12. MOBILE-SPECIFIC FIXES
   ======================================== */

@media (max-width: 767px) {
    /* Ensure readable minimum sizes on mobile */
    body, p, span, div {
        font-size: clamp(0.9375rem, 4vw, 1.0625rem) !important;
    }
    
    /* Prevent text from being too small */
    small, .small, .text-small {
        font-size: clamp(0.8125rem, 3.5vw, 0.9375rem) !important;
    }
    
    /* Ensure headings are readable but not too large */
    h1, .h1 {
        font-size: clamp(1.75rem, 8vw, 2.25rem) !important;
    }
    
    h2, .h2 {
        font-size: clamp(1.5rem, 7vw, 2rem) !important;
    }
    
    h3, .h3 {
        font-size: clamp(1.25rem, 6vw, 1.75rem) !important;
    }
    
    /* Hero text adjustments for mobile */
    .modern-hero-text,
    .hero-text {
        font-size: clamp(0.9375rem, 4vw, 1.0625rem) !important;
        line-height: 1.65 !important;
    }
    
    /* Card text on mobile */
    .modern-card-text,
    .card-text {
        font-size: clamp(0.9375rem, 4vw, 1rem) !important;
    }
}

/* ========================================
   13. TABLET-SPECIFIC FIXES
   ======================================== */

@media (min-width: 768px) and (max-width: 991px) {
    /* Balanced sizes for tablet */
    h1, .h1 {
        font-size: clamp(2rem, 4.5vw, 2.5rem) !important;
    }
    
    h2, .h2 {
        font-size: clamp(1.75rem, 4vw, 2.25rem) !important;
    }
    
    p, body {
        font-size: clamp(1rem, 1.6vw, 1.125rem) !important;
    }
}

/* ========================================
   14. DESKTOP OPTIMIZATIONS
   ======================================== */

@media (min-width: 992px) {
    /* Optimal sizes for desktop */
    body, p {
        font-size: 1.0625rem !important; /* 17px - optimal reading size */
    }
    
    h1, .h1 {
        font-size: clamp(2.5rem, 3.5vw, 3rem) !important;
    }
    
    h2, .h2 {
        font-size: clamp(2rem, 3vw, 2.5rem) !important;
    }
}

/* ========================================
   15. FIX OVERLY LARGE TEXT ON MOBILE
   ======================================== */

@media (max-width: 767px) {
    /* Specific fixes for common oversized elements */
    .modern-hero-heading {
        font-size: clamp(1.75rem, 8vw, 2.25rem) !important;
    }
    
    .section-title,
    .products-section-heading {
        font-size: clamp(1.5rem, 7vw, 2rem) !important;
    }
    
    /* Prevent headings from being too large */
    h1, .h1 {
        font-size: clamp(1.75rem, 8vw, 2.5rem) !important;
    }
    
    h2, .h2 {
        font-size: clamp(1.5rem, 7vw, 2rem) !important;
    }
}

/* ========================================
   16. FIX OVERLY SMALL TEXT ON MOBILE
   ======================================== */

@media (max-width: 767px) {
    /* Ensure minimum readable sizes using clamp() */
    p, span, div, li {
        font-size: clamp(0.9375rem, 4vw, 1.0625rem) !important; /* 15px-17px */
    }
    
    small, .small {
        font-size: clamp(0.8125rem, 3.5vw, 0.9375rem) !important; /* 13px-15px */
    }
    
    /* Buttons should never be too small */
    button, .btn, .btn-premium, .btn-primary {
        font-size: clamp(0.9375rem, 4vw, 1.0625rem) !important;
    }
    
    /* Form inputs readable */
    input, textarea, select, .form-control {
        font-size: clamp(0.9375rem, 4vw, 1.0625rem) !important;
    }
    
    /* Links readable */
    a, .link {
        font-size: clamp(0.9375rem, 4vw, 1.0625rem) !important;
    }
}

/* ========================================
   17. CONSISTENT LINE HEIGHTS
   ======================================== */

/* Headings */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    line-height: 1.2 !important;
}

/* Body text */
p, body, span, div, li {
    line-height: 1.7 !important;
}

/* Cards */
.card-text, .modern-card-text {
    line-height: 1.6 !important;
}

/* ========================================
   18. FONT SMOOTHING (All Screens)
   ======================================== */

* {
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
}

/* ========================================
   19. PREVENT TEXT OVERFLOW
   ======================================== */

h1, h2, h3, h4, h5, h6,
p, span, div, li, a {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
}

/* ========================================
   20. FIX SPECIFIC PROBLEMATIC ELEMENTS
   ======================================== */

/* Fix any elements with fixed pixel sizes */
@media (max-width: 767px) {
    /* Convert fixed sizes to responsive */
    [style*="font-size"] {
        font-size: clamp(0.9375rem, 4vw, 1.5rem) !important;
    }
}

/* Ensure consistent color contrast */
p, span, div, li, .text-body {
    color: #475569 !important; /* Good contrast ratio */
}

/* Headings darker for hierarchy */
h1, h2, h3, h4, h5, h6 {
    color: #0f172a !important; /* Darker for emphasis */
}

