/* Responsive Typography System using clamp() */

/* CSS Custom Properties for Typography Scale */
:root {
    /* Base font sizes for fluid typography */
    --font-size-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --font-size-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
    --font-size-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
    --font-size-lg: clamp(1.125rem, 1rem + 0.625vw, 1.25rem);
    --font-size-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
    --font-size-2xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);
    --font-size-3xl: clamp(1.875rem, 1.5rem + 1.875vw, 2.5rem);
    --font-size-4xl: clamp(2.25rem, 1.8rem + 2.25vw, 3rem);
    --font-size-5xl: clamp(2.5rem, 2rem + 2.5vw, 3.5rem);
    --font-size-6xl: clamp(3rem, 2.2rem + 4vw, 4rem);
    --font-size-7xl: clamp(3.5rem, 2.5rem + 5vw, 5rem);
    
    /* Line heights for better readability */
    --line-height-tight: 1.1;
    --line-height-normal: 1.4;
    --line-height-relaxed: 1.6;
    --line-height-loose: 1.8;
    
    /* Letter spacing for different text sizes */
    --letter-spacing-tight: -0.03em;
    --letter-spacing-normal: 0;
    --letter-spacing-wide: 0.025em;
    --letter-spacing-wider: 0.05em;
}

/* Fluid Typography Classes */
.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }
.text-4xl { font-size: var(--font-size-4xl); }
.text-5xl { font-size: var(--font-size-5xl); }
.text-6xl { font-size: var(--font-size-6xl); }
.text-7xl { font-size: var(--font-size-7xl); }

/* Hero Section Typography */
.hero h1,
.hero-title {
    font-size: var(--font-size-6xl) !important;
    line-height: var(--line-height-tight) !important;
    letter-spacing: var(--letter-spacing-tight) !important;
    font-weight: 900 !important;
    margin-bottom: clamp(1rem, 2vw, 2rem) !important;
    
    /* Ensure text wrapping and overflow handling */
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    max-width: 100% !important;
    
    /* Override any inline styles */
    position: relative !important;
    text-align: center !important;
}

/* Section Titles */
.section-title,
h2.section-title {
    font-size: var(--font-size-4xl) !important;
    line-height: var(--line-height-tight) !important;
    margin-bottom: clamp(1rem, 3vw, 2rem) !important;
    
    /* Text overflow handling */
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Major headings throughout the site */
h1 {
    font-size: var(--font-size-5xl);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
    font-weight: 900;
    margin-bottom: clamp(0.75rem, 2vw, 1.5rem);
}

h2 {
    font-size: var(--font-size-4xl);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
    font-weight: 700;
    margin-bottom: clamp(0.5rem, 1.5vw, 1.25rem);
}

h3 {
    font-size: var(--font-size-3xl);
    line-height: var(--line-height-normal);
    font-weight: 600;
    margin-bottom: clamp(0.5rem, 1vw, 1rem);
}

h4 {
    font-size: var(--font-size-2xl);
    line-height: var(--line-height-normal);
    font-weight: 600;
    margin-bottom: clamp(0.25rem, 0.75vw, 0.75rem);
}

h5 {
    font-size: var(--font-size-xl);
    line-height: var(--line-height-normal);
    font-weight: 500;
    margin-bottom: clamp(0.25rem, 0.5vw, 0.5rem);
}

h6 {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-normal);
    font-weight: 500;
    margin-bottom: clamp(0.25rem, 0.5vw, 0.5rem);
}

/* Body text and paragraphs */
p {
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    margin-bottom: clamp(0.75rem, 1.5vw, 1.25rem);
    
    /* Better text wrapping */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Specific component typography fixes */

/* Logo title */
.petgascoin-title {
    font-size: var(--font-size-2xl) !important;
    line-height: var(--line-height-tight) !important;
    
    /* Preserve gradient effects on mobile */
    background: linear-gradient(90deg, #FFD700, #FFA500, #FFD700) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    color: transparent !important;
    background-size: 200% auto !important;
    animation: shine 3s linear infinite !important;
    
    /* Text overflow handling */
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Stats section */
.stat-value {
    font-size: var(--font-size-4xl) !important;
    line-height: var(--line-height-tight) !important;
    font-weight: 800;
}

.stat-label {
    font-size: var(--font-size-base) !important;
    line-height: var(--line-height-normal) !important;
    letter-spacing: var(--letter-spacing-wide);
}

.stat-description {
    font-size: var(--font-size-sm) !important;
    line-height: var(--line-height-relaxed) !important;
}

/* Impact cards */
.impact-card h3 {
    font-size: var(--font-size-3xl) !important;
    line-height: var(--line-height-tight) !important;
}

.impact-card p {
    font-size: var(--font-size-base) !important;
    line-height: var(--line-height-relaxed) !important;
}

/* Timeline content */
.timeline-content h3 {
    font-size: var(--font-size-2xl) !important;
    line-height: var(--line-height-tight) !important;
}

.timeline-content p {
    font-size: var(--font-size-base) !important;
    line-height: var(--line-height-relaxed) !important;
}

/* CTA section */
.cta h2 {
    font-size: var(--font-size-5xl) !important;
    line-height: var(--line-height-tight) !important;
    letter-spacing: var(--letter-spacing-tight) !important;
    
    /* Text overflow handling */
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.cta p {
    font-size: var(--font-size-lg) !important;
    line-height: var(--line-height-relaxed) !important;
}

/* Press section */
.press .section-header h2 {
    font-size: var(--font-size-4xl) !important;
    line-height: var(--line-height-tight) !important;
}

.press-release h3 {
    font-size: var(--font-size-2xl) !important;
    line-height: var(--line-height-normal) !important;
    
    /* Text overflow handling */
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Navigation typography */
.nav-menu-btn {
    font-size: var(--font-size-sm) !important;
    line-height: var(--line-height-normal) !important;
    letter-spacing: var(--letter-spacing-wide) !important;
}

/* Button typography */
.btn {
    font-size: var(--font-size-base) !important;
    line-height: var(--line-height-normal) !important;
    letter-spacing: var(--letter-spacing-wide) !important;
}

.btn-dapp {
    font-size: var(--font-size-base) !important;
    line-height: var(--line-height-normal) !important;
}

/* Mobile-specific typography adjustments */
@media (max-width: 768px) {
    /* Ensure hero title doesn't get cut off on mobile */
    .hero h1,
    .hero-title {
        font-size: clamp(2rem, 8vw, 3.5rem) !important;
        line-height: 1.1 !important;
        margin-bottom: 1rem !important;
        
        /* Better mobile text handling */
        word-break: break-word;
        overflow-wrap: anywhere;
        hyphens: auto;
        -webkit-hyphens: auto;
        -ms-hyphens: auto;
        
        /* Ensure typing animation works on mobile */
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* Override any conflicting inline styles */
    .hero h1[style],
    .hero-title[style] {
        font-size: clamp(2rem, 8vw, 3.5rem) !important;
        line-height: 1.1 !important;
    }
    
    /* Adjust section titles for mobile */
    .section-title,
    h2.section-title {
        font-size: clamp(1.5rem, 6vw, 2.5rem) !important;
        line-height: 1.2 !important;
        margin-bottom: 1rem !important;
    }
    
    /* Mobile navigation typography */
    .mobile-menu .nav-menu-btn {
        font-size: var(--font-size-lg) !important;
        line-height: var(--line-height-normal) !important;
    }
    
    /* Mobile logo */
    .petgascoin-title {
        font-size: clamp(1rem, 4vw, 1.5rem) !important;
    }
    
    /* Mobile stats */
    .stat-value {
        font-size: clamp(1.5rem, 6vw, 2.5rem) !important;
    }
    
    /* Mobile CTA */
    .cta h2 {
        font-size: clamp(2rem, 8vw, 3rem) !important;
        line-height: 1.1 !important;
    }
}

/* Tablet-specific adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .hero h1 {
        font-size: clamp(3rem, 6vw, 4rem) !important;
    }
    
    .section-title,
    h2.section-title {
        font-size: clamp(2rem, 4vw, 2.5rem) !important;
    }
}

/* Large screen optimizations */
@media (min-width: 1200px) {
    .hero h1 {
        font-size: clamp(4rem, 5vw, 5rem) !important;
    }
}

/* Preserve gradient text effects on all devices */
.gradient-text,
.typing-text,
.bsc-gradient,
.hero h1 span,
.section-title.gradient {
    background: linear-gradient(90deg, #FFD700, #FFA500, #FFD700) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    color: transparent !important;
    background-size: 200% auto !important;
    animation: shine 3s linear infinite !important;
    
    /* Ensure gradient text doesn't break on mobile */
    -webkit-text-fill-color: transparent !important;
    background-attachment: scroll !important;
}

/* Typing animation fixes for mobile */
.typing-text {
    /* Ensure proper text wrapping */
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    max-width: 100% !important;
    
    /* Prevent text from overflowing container */
    display: inline-block !important;
    width: auto !important;
    min-width: 0 !important;
}

.typing-cursor {
    /* Ensure cursor doesn't cause overflow */
    display: inline-block !important;
    width: 0.6em !important;
    height: 0.6em !important;
    margin-left: 2px !important;
    vertical-align: middle !important;
    flex-shrink: 0 !important;
}

/* Hero typing text specific fixes */
#typing-text-part1,
#typing-text-part2 {
    /* Ensure each part can wrap properly */
    display: block !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    max-width: 100% !important;
    
    /* Preserve gradient effects */
    background: linear-gradient(90deg, #FFD700, #FFA500, #FFD700) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    color: transparent !important;
    background-size: 200% auto !important;
    animation: shine 3s linear infinite !important;
}

#typing-cursor {
    /* Hero cursor specific styling */
    border-right: 3px solid #FFD700 !important;
    animation: blink 0.7s infinite !important;
    display: inline-block !important;
    margin-left: 2px !important;
    height: 1em !important;
    vertical-align: baseline !important;
}

/* Fallback for browsers that don't support clamp() */
@supports not (font-size: clamp(1rem, 2vw, 2rem)) {
    .hero h1 {
        font-size: 4rem !important;
    }
    
    @media (max-width: 768px) {
        .hero h1 {
            font-size: 2.5rem !important;
        }
    }
    
    @media (max-width: 480px) {
        .hero h1 {
            font-size: 2rem !important;
        }
    }
}

/* Text selection styling */
::selection {
    background: rgba(255, 215, 0, 0.3);
    color: inherit;
}

::-moz-selection {
    background: rgba(255, 215, 0, 0.3);
    color: inherit;
}

/* Improve text rendering */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Prevent text overflow in containers */
.container,
.hero-content,
.section {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Tablet-specific layout adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    /* iPad portrait and landscape general styles */
    .hero h1,
    .hero-title {
        font-size: clamp(3rem, 6vw, 4rem) !important;
        line-height: 1.1 !important;
    }
    
    .section-title,
    h2.section-title {
        font-size: clamp(2rem, 4vw, 2.5rem) !important;
    }
    
    /* Better navigation for tablets */
    .mobile-menu .nav-menu-btn {
        font-size: 1.1rem !important;
        padding: 12px 16px;
        margin: 2px 10px;
    }
    
    /* Optimize content width for tablets */
    .hero-content {
        max-width: 85% !important;
        padding: 0 30px !important;
    }
    
    /* Better spacing for tablet screens */
    .section {
        padding: 60px 0 !important;
    }
}

/* iPad landscape specific optimizations */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .hero h1,
    .hero-title {
        font-size: clamp(3.5rem, 5vw, 4.5rem) !important;
        margin-bottom: 1.5rem !important;
    }
    
    .section-title,
    h2.section-title {
        font-size: clamp(2.25rem, 3.5vw, 2.75rem) !important;
    }
    
    /* Better use of horizontal space in landscape */
    .hero-content {
        max-width: 90% !important;
        padding: 0 40px !important;
    }
    
    /* Adjust navigation for landscape */
    .navbar {
        padding: 10px 30px !important;
    }
    
    /* Optimize sections for landscape viewing */
    .section {
        padding: 80px 0 !important;
    }
}

/* iPad portrait specific optimizations */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .hero h1,
    .hero-title {
        font-size: clamp(2.5rem, 7vw, 3.5rem) !important;
        line-height: 1.2 !important;
    }
    
    .section-title,
    h2.section-title {
        font-size: clamp(1.75rem, 5vw, 2.25rem) !important;
    }
    
    /* Portrait-specific content adjustments */
    .hero-content {
        max-width: 80% !important;
        padding: 0 25px !important;
    }
}

/* iPad Pro and larger tablets */
@media (min-width: 1024px) and (max-width: 1366px) {
    .hero h1,
    .hero-title {
        font-size: clamp(4rem, 5vw, 5rem) !important;
    }
    
    .section-title,
    h2.section-title {
        font-size: clamp(2.5rem, 3vw, 3rem) !important;
    }
    
    /* Larger tablet optimizations */
    .hero-content {
        max-width: 95% !important;
        padding: 0 50px !important;
    }
}

/* Hero content container fixes */
.hero-content {
    /* Ensure proper containment */
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 20px !important;
    box-sizing: border-box !important;
    
    /* Prevent horizontal overflow */
    overflow-x: hidden !important;
    
    /* Center content properly */
    margin: 0 auto !important;
    text-align: center !important;
}

/* Section header typography fixes */
.section-header-title {
    /* Ensure proper text wrapping */
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    max-width: 100% !important;
    
    /* Prevent inline-block from causing overflow */
    display: block !important;
    width: 100% !important;
}

/* Long title handling */
.section-header-title .typing-text {
    /* Allow long titles to wrap */
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    
    /* Ensure proper display */
    display: inline !important;
    max-width: 100% !important;
}

/* Mobile-specific text overflow fixes */
@media (max-width: 768px) {
    /* Hero content mobile fixes */
    .hero-content {
        padding: 0 15px !important;
        margin: 10px auto !important;
    }
    
    /* Section headers on mobile */
    .section-header-title {
        font-size: clamp(1.5rem, 6vw, 2.5rem) !important;
        line-height: 1.2 !important;
        margin-bottom: 1rem !important;
        padding: 0 10px !important;
    }
    
    /* Typing text mobile adjustments */
    .typing-text {
        font-size: inherit !important;
        line-height: inherit !important;
        white-space: normal !important;
        word-break: break-word !important;
    }
    
    /* Ensure all major titles fit on mobile */
    h1, h2, h3, .section-title, .hero-title {
        padding: 0 10px !important;
        box-sizing: border-box !important;
        max-width: 100% !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
    }
    
    /* Fix for very long words or URLs */
    * {
        word-break: break-word !important;
        overflow-wrap: break-word !important;
    }
}

/* Extra small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
    .hero h1,
    .hero-title {
        font-size: clamp(1.5rem, 10vw, 2.5rem) !important;
        line-height: 1.1 !important;
        padding: 0 5px !important;
    }
    
    .section-title,
    h2.section-title {
        font-size: clamp(1.25rem, 8vw, 2rem) !important;
        padding: 0 5px !important;
    }
    
    .hero-content {
        padding: 0 10px !important;
    }
}

/* Landscape mobile orientation fixes */
@media (max-width: 768px) and (orientation: landscape) {
    .hero h1,
    .hero-title {
        font-size: clamp(1.5rem, 6vh, 2.5rem) !important;
        line-height: 1.1 !important;
    }
    
    .section-title,
    h2.section-title {
        font-size: clamp(1.25rem, 5vh, 2rem) !important;
    }
}

/* Ensure proper line-height for readability */
.hero h1,
.hero-title,
.section-title,
h1, h2, h3 {
    line-height: var(--line-height-tight) !important;
    
    /* Better spacing for mobile */
    margin-top: 0 !important;
    margin-bottom: clamp(0.5rem, 2vw, 1.5rem) !important;
}

/* Text that should never overflow */
.no-overflow {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* Text that should always wrap */
.force-wrap {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    hyphens: auto !important;
    white-space: normal !important;
}