/* Metrix Realty - Comprehensive Responsive Enhancement CSS */
/* This file ensures excellent display across all screen sizes and devices */

/* ===== GLOBAL RESPONSIVE FOUNDATION ===== */

/* CSS Custom Properties for Consistent Spacing */
:root {
    --header-height: 80px;
    --header-height-mobile: 70px;
    --container-padding: clamp(1rem, 4vw, 2rem);
    --section-padding: clamp(3rem, 8vw, 6rem);
    --card-padding: clamp(1.5rem, 4vw, 2.5rem);
    --button-height: clamp(44px, 6vw, 56px);
    --touch-target: 44px;
}

/* Improved Viewport Units for Mobile */
.full-height {
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
}

/* ===== TYPOGRAPHY SCALING ===== */

/* Responsive Typography Scale */
.text-responsive-xs { font-size: clamp(0.75rem, 2.5vw, 0.875rem); }
.text-responsive-sm { font-size: clamp(0.875rem, 2.5vw, 1rem); }
.text-responsive-base { font-size: clamp(1rem, 2.5vw, 1.125rem); }
.text-responsive-lg { font-size: clamp(1.125rem, 3vw, 1.25rem); }
.text-responsive-xl { font-size: clamp(1.25rem, 3.5vw, 1.5rem); }
.text-responsive-2xl { font-size: clamp(1.5rem, 4vw, 2rem); }
.text-responsive-3xl { font-size: clamp(2rem, 5vw, 2.5rem); }
.text-responsive-4xl { font-size: clamp(2.5rem, 6vw, 3.5rem); }
.text-responsive-5xl { font-size: clamp(3rem, 7vw, 4.5rem); }
.text-responsive-6xl { font-size: clamp(3.5rem, 8vw, 6rem); }

/* Improved Line Heights for Readability */
.leading-responsive {
    line-height: clamp(1.4, 0.05vw + 1.35, 1.6);
}

/* ===== TOUCH TARGET OPTIMIZATION ===== */

/* Ensure All Interactive Elements Meet 44px Minimum */
.touch-optimized,
button,
a[href],
input,
select,
textarea,
[role="button"],
[tabindex="0"] {
    min-height: var(--touch-target);
    min-width: var(--touch-target);
    position: relative;
}

/* Expand Touch Area Without Affecting Visual Design */
.touch-expand::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: var(--touch-target);
    min-height: var(--touch-target);
    z-index: -1;
}

/* ===== MOBILE NAVIGATION ENHANCEMENTS ===== */

/* Improved Mobile Menu */
@media (max-width: 768px) {
    .mobile-menu {
        width: min(90vw, 350px);
        backdrop-filter: blur(10px);
    }
    
    .mobile-nav-link {
        padding: 1rem 0;
        font-size: 1.125rem;
        min-height: var(--touch-target);
        display: flex;
        align-items: center;
    }
    
    .hamburger {
        padding: 0.75rem;
        min-width: var(--touch-target);
        min-height: var(--touch-target);
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ===== FORM OPTIMIZATION ===== */

/* Enhanced Form Fields for Mobile */
@media (max-width: 768px) {
    .form-field input,
    .form-field select,
    .form-field textarea {
        padding: 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: var(--touch-target);
        border-radius: 8px;
    }
    
    .form-field label {
        font-size: 0.875rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
    }
    
    /* Grid Forms Stack on Mobile */
    .grid.grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* ===== BUTTON OPTIMIZATION ===== */

/* Responsive Button Sizing */
.btn-responsive {
    padding: clamp(0.75rem, 2vw, 1rem) clamp(1.5rem, 4vw, 2rem);
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    min-height: var(--button-height);
    border-radius: clamp(6px, 1vw, 8px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Improved CTA Buttons */
.cta-button {
    width: 100%;
    justify-content: center;
}

@media (min-width: 640px) {
    .cta-button {
        width: auto;
        min-width: 200px;
    }
}

/* ===== CARD AND GRID OPTIMIZATION ===== */

/* Responsive Card Layouts */
.card-responsive {
    padding: var(--card-padding);
    border-radius: clamp(8px, 2vw, 16px);
}

/* Improved Service Cards */
@media (max-width: 768px) {
    .service-card {
        text-align: center;
        padding: 2rem 1.5rem;
    }
    
    .service-card h3 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .service-card p {
        font-size: 0.9375rem;
        line-height: 1.6;
    }
}

/* Grid System Improvements */
@media (max-width: 640px) {
    .grid-responsive {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (min-width: 641px) and (max-width: 1023px) {
    .grid-responsive {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 1024px) {
    .grid-responsive {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }
}

/* ===== IMAGE OPTIMIZATION ===== */

/* Responsive Images */
.image-responsive {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: clamp(8px, 2vw, 12px);
}

/* Hero Images */
.hero-image {
    width: 100%;
    height: clamp(200px, 50vw, 400px);
    object-fit: cover;
}

/* Logo Sizing */
.logo-responsive {
    height: clamp(32px, 8vw, 48px);
    width: auto;
    object-fit: contain;
}

/* Professional Logos Grid */
@media (max-width: 640px) {
    .logos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (min-width: 641px) and (max-width: 1023px) {
    .logos-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

/* ===== SPACING IMPROVEMENTS ===== */

/* Container Padding */
.container-responsive {
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
}

/* Section Spacing */
.section-responsive {
    padding-top: var(--section-padding);
    padding-bottom: var(--section-padding);
}

/* ===== HERO SECTION OPTIMIZATION ===== */

/* Better Hero Spacing */
.hero-responsive {
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
    padding-top: clamp(5rem, 12vw, 8rem);
    padding-bottom: clamp(3rem, 8vw, 6rem);
}

/* Hero Text Optimization */
.hero-title-responsive {
    font-size: clamp(2rem, 8vw, 5rem);
    line-height: 1.1;
    margin-bottom: clamp(1rem, 4vw, 2rem);
}

.hero-subtitle-responsive {
    font-size: clamp(1rem, 3vw, 1.5rem);
    line-height: 1.5;
    margin-bottom: clamp(2rem, 6vw, 3rem);
}

/* ===== NAVIGATION IMPROVEMENTS ===== */

/* Better Nav Link Spacing */
@media (min-width: 1024px) {
    .nav-link {
        padding: 0.75rem 1rem;
        margin: 0 0.25rem;
        border-radius: 6px;
        transition: all 0.2s ease;
    }
}

/* Improved Mega Menu */
@media (max-width: 1024px) {
    .mega-menu {
        position: static;
        width: 100%;
        transform: none;
        box-shadow: none;
        border-radius: 0;
        border-top: 1px solid #e5e7eb;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */

/* Focus States */
*:focus-visible {
    outline: 2px solid #233c75;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .bg-gray-50 { background-color: #ffffff; }
    .text-gray-600 { color: #000000; }
    .border-gray-200 { border-color: #000000; }
}

/* ===== PRINT STYLES ===== */

@media print {
    .mobile-menu,
    .hamburger,
    .nav-button,
    .cta-button {
        display: none !important;
    }
    
    .hero-section {
        min-height: auto;
        padding: 2rem 0;
    }
    
    .section-responsive {
        padding: 1rem 0;
    }
}

/* ===== DEVICE-SPECIFIC OPTIMIZATIONS ===== */

/* Small Mobile Devices (320px - 374px) */
@media (max-width: 374px) {
    :root {
        --container-padding: 1rem;
        --section-padding: 2rem;
        --card-padding: 1rem;
    }
    
    .text-xs { font-size: 0.75rem; }
    .text-sm { font-size: 0.8125rem; }
    .text-base { font-size: 0.875rem; }
    
    .px-4 { padding-left: 1rem; padding-right: 1rem; }
    .px-6 { padding-left: 1rem; padding-right: 1rem; }
    
    .gap-4 { gap: 0.75rem; }
    .gap-6 { gap: 1rem; }
}

/* Large Mobile Devices (375px - 640px) */
@media (min-width: 375px) and (max-width: 640px) {
    .hero-responsive {
        padding-top: 6rem;
    }
    
    .grid-cols-1 {
        gap: 1.5rem;
    }
}

/* Tablet Devices (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
    .hero-responsive {
        padding-top: 7rem;
    }
    
    .container-responsive {
        max-width: 100%;
        padding: 0 2rem;
    }
}

/* Desktop Devices (1025px+) */
@media (min-width: 1025px) {
    .container-responsive {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .hero-responsive {
        padding-top: 8rem;
    }
}

/* ===== LANDSCAPE ORIENTATION FIXES ===== */

@media (orientation: landscape) and (max-height: 500px) {
    .hero-responsive {
        min-height: auto;
        padding-top: 4rem;
        padding-bottom: 2rem;
    }
    
    .mobile-menu {
        height: 100vh;
        overflow-y: auto;
    }
}

/* ===== UTILITY CLASSES ===== */

/* Hide/Show Elements Responsively */
.mobile-only { display: block; }
.desktop-only { display: none; }

@media (min-width: 768px) {
    .mobile-only { display: none; }
    .desktop-only { display: block; }
}

/* Responsive Flexbox Utilities */
.flex-responsive {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 640px) {
    .flex-responsive {
        flex-direction: row;
        align-items: center;
        gap: 1.5rem;
    }
}

/* Responsive Text Alignment */
.text-center-mobile {
    text-align: center;
}

@media (min-width: 768px) {
    .text-center-mobile {
        text-align: left;
    }
}

/* ===== ENHANCED TEXT READABILITY ===== */

/* Improved Contrast and Text Colors */
.text-enhanced-dark { color: #111827 !important; } /* Darker than standard gray-900 */
.text-enhanced-medium { color: #374151 !important; } /* Better contrast than gray-600 */
.text-enhanced-light { color: #6b7280 !important; } /* For secondary text */

/* Enhanced Typography with Better Readability */
.text-readable {
    color: #111827;
    line-height: 1.7;
    letter-spacing: 0.01em;
}

.text-readable-large {
    font-size: clamp(1.125rem, 3vw, 1.25rem);
    line-height: 1.6;
    color: #111827;
    letter-spacing: 0.005em;
}

.text-readable-small {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    line-height: 1.7;
    color: #374151;
    letter-spacing: 0.01em;
}

/* Enhanced Headings with Better Contrast */
.heading-enhanced {
    color: #111827 !important;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

/* Better Text Shadows for Light Backgrounds */
.text-shadow-readable {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Enhanced Link Readability */
.link-readable {
    color: #1f2937 !important;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: all 0.2s ease;
}

.link-readable:hover {
    color: #000000 !important;
    text-decoration-thickness: 2px;
}

/* Improved Button Text Readability */
.btn-text-readable {
    font-weight: 600;
    letter-spacing: 0.025em;
    text-shadow: none;
}

/* Enhanced Form Text */
.form-text-readable input,
.form-text-readable textarea,
.form-text-readable select {
    color: #111827 !important;
    font-size: clamp(1rem, 2.5vw, 1.125rem) !important;
    line-height: 1.5 !important;
}

.form-text-readable label {
    color: #111827 !important;
    font-weight: 600 !important;
    font-size: clamp(0.875rem, 2.5vw, 1rem) !important;
}

/* Better Readability for Small Text */
.small-text-enhanced {
    font-size: clamp(0.8125rem, 2.5vw, 0.9375rem) !important;
    line-height: 1.6 !important;
    color: #374151 !important;
    letter-spacing: 0.01em;
}

/* Enhanced Navigation Text */
.nav-text-enhanced {
    font-size: clamp(0.9375rem, 2.5vw, 1rem) !important;
    font-weight: 500 !important;
    color: #111827 !important;
    letter-spacing: 0.01em;
}

/* Mobile-Specific Text Enhancements */
@media (max-width: 768px) {
    .mobile-text-enhanced {
        font-size: 1.125rem !important;
        line-height: 1.7 !important;
        color: #111827 !important;
    }
    
    .mobile-heading-enhanced {
        font-size: clamp(1.5rem, 6vw, 2rem) !important;
        line-height: 1.3 !important;
        color: #111827 !important;
        font-weight: 700 !important;
    }
    
    .mobile-small-text {
        font-size: 1rem !important;
        line-height: 1.6 !important;
        color: #374151 !important;
    }
}

/* High Contrast Mode Improvements */
@media (prefers-contrast: high) {
    .text-enhanced-dark,
    .text-readable,
    .heading-enhanced,
    .nav-text-enhanced {
        color: #000000 !important;
        font-weight: 600 !important;
    }
    
    .text-enhanced-medium,
    .text-readable-small {
        color: #111827 !important;
        font-weight: 500 !important;
    }
    
    .link-readable {
        color: #000000 !important;
        text-decoration-thickness: 2px !important;
    }
}

/* Font Smoothing for Better Readability */
.text-smooth {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Focus States for Better Accessibility */
.focus-readable:focus,
.focus-readable:focus-visible {
    outline: 3px solid #3b82f6 !important;
    outline-offset: 2px !important;
    background-color: #eff6ff !important;
    color: #111827 !important;
} 