/* Mobile-First Responsive Utilities for RH Group Website */

/* ===== RESPONSIVE SPACING ===== */
:root {
    --spacing-xs: 0.5rem;
    /* 8px */
    --spacing-sm: 0.75rem;
    /* 12px */
    --spacing-md: 1rem;
    /* 16px */
    --spacing-lg: 1.5rem;
    /* 24px */
    --spacing-xl: 2rem;
    /* 32px */
    --spacing-2xl: 3rem;
    /* 48px */
    --spacing-3xl: 4rem;
    /* 64px */
    --spacing-section: 3rem;
    /* 48px on mobile */
}

@media (min-width: 768px) {
    :root {
        --spacing-section: 8rem;
        /* 128px on desktop */
    }
}

/* ===== RESPONSIVE TYPOGRAPHY ===== */
.text-responsive-xs {
    font-size: clamp(0.75rem, 2vw, 0.875rem);
}

.text-responsive-sm {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
}

.text-responsive-base {
    font-size: clamp(1rem, 3vw, 1.125rem);
}

.text-responsive-lg {
    font-size: clamp(1.125rem, 3.5vw, 1.25rem);
}

.text-responsive-xl {
    font-size: clamp(1.25rem, 4vw, 1.5rem);
}

.text-responsive-2xl {
    font-size: clamp(1.5rem, 5vw, 2rem);
}

.text-responsive-3xl {
    font-size: clamp(1.875rem, 6vw, 3rem);
}

.text-responsive-4xl {
    font-size: clamp(2rem, 8vw, 3.75rem);
}

/* ===== TOUCH-FRIENDLY ELEMENTS ===== */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Larger touch targets for mobile */
@media (max-width: 767px) {

    button,
    a.btn,
    .btn-primary,
    .btn-secondary {
        min-height: 48px;
        padding: 0.875rem 1.5rem;
    }
}

/* ===== MOBILE-OPTIMIZED CONTAINERS ===== */
.container-mobile {
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container-mobile {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 768px) {
    .container-mobile {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* ===== RESPONSIVE GRID GAPS ===== */
.gap-responsive-sm {
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .gap-responsive-sm {
        gap: 1rem;
    }
}

.gap-responsive-md {
    gap: 1rem;
}

@media (min-width: 768px) {
    .gap-responsive-md {
        gap: 1.5rem;
    }
}

.gap-responsive-lg {
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .gap-responsive-lg {
        gap: 2rem;
    }
}

/* ===== DISABLE HOVER EFFECTS ON TOUCH DEVICES ===== */
@media (hover: none) and (pointer: coarse) {

    .card:hover,
    .btn-primary:hover,
    .research-card:hover,
    .stat-item:hover,
    .award-card:hover {
        transform: none !important;
    }
}

/* ===== MOBILE-FRIENDLY TABLES ===== */
@media (max-width: 767px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive table {
        min-width: 600px;
    }
}

/* ===== MOBILE NAVIGATION IMPROVEMENTS ===== */
@media (max-width: 1023px) {
    .mobile-menu-link {
        padding: 0.75rem 0;
        font-size: 1.125rem;
        line-height: 1.5;
    }
}

/* ===== RESPONSIVE IMAGES ===== */
.img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== MOBILE CARD OPTIMIZATION ===== */
@media (max-width: 767px) {
    .card-mobile-compact {
        padding: 1.25rem;
        border-radius: 10px;
    }
}

/* ===== SAFE AREA PADDING (for notched devices) ===== */
@supports (padding: max(0px)) {
    .safe-area-padding {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* ===== MOBILE SECTION SPACING ===== */
.section-mobile {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

@media (min-width: 768px) {
    .section-mobile {
        padding-top: 6rem;
        padding-bottom: 6rem;
    }
}

@media (min-width: 1024px) {
    .section-mobile {
        padding-top: 8rem;
        padding-bottom: 8rem;
    }
}

/* ===== MOBILE TYPOGRAPHY ADJUSTMENTS ===== */
@media (max-width: 767px) {
    h1 {
        font-size: clamp(2rem, 8vw, 2.5rem);
        line-height: 1.2;
    }

    h2 {
        font-size: clamp(1.75rem, 6vw, 2rem);
        line-height: 1.25;
    }

    h3 {
        font-size: clamp(1.5rem, 5vw, 1.75rem);
        line-height: 1.3;
    }

    p {
        font-size: 1rem;
        line-height: 1.6;
    }
}

/* ===== MOBILE SCROLL IMPROVEMENTS ===== */
@media (max-width: 767px) {
    html {
        -webkit-overflow-scrolling: touch;
    }

    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }
}

/* ===== MOBILE FORM IMPROVEMENTS ===== */
@media (max-width: 767px) {

    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px;
        /* Prevents zoom on iOS */
        min-height: 44px;
    }
}

/* ===== MOBILE STICKY ELEMENTS ===== */
@media (max-width: 767px) {
    .sticky-mobile-disable {
        position: relative !important;
        top: auto !important;
    }
}

/* ===== MOBILE GRID IMPROVEMENTS ===== */
@media (max-width: 639px) {
    .grid-mobile-single {
        grid-template-columns: 1fr !important;
    }
}

/* ===== MOBILE FLEXBOX UTILITIES ===== */
.flex-mobile-column {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .flex-mobile-column {
        flex-direction: row;
    }
}

/* ===== MOBILE VISIBILITY UTILITIES ===== */
.hide-mobile {
    display: none;
}

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

.show-mobile {
    display: block;
}

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

/* ===== MOBILE PERFORMANCE OPTIMIZATIONS ===== */
@media (max-width: 767px) {

    /* Reduce animation complexity on mobile */
    * {
        animation-duration: 0.2s !important;
        transition-duration: 0.2s !important;
    }

    /* Disable parallax and complex transforms on mobile */
    .parallax,
    .complex-transform {
        transform: none !important;
    }
}

/* ===== MOBILE ACCESSIBILITY ===== */
@media (max-width: 767px) {

    /* Ensure text is readable */
    body {
        font-size: 16px;
        line-height: 1.5;
    }

    /* Improve tap target spacing */
    a,
    button {
        margin: 0.25rem 0;
    }
}