/* ============================================
   RESPONSIVE IMPROVEMENTS - OPTIMIZATION SUITE
   ============================================ */

/* ROOT VARIABLES FOR RESPONSIVE DESIGN */
:root {
    /* Mobile-First Font Sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    
    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
}

/* ============================================
   MOBILE-FIRST RESPONSIVE TYPOGRAPHY
   ============================================ */

/* HEADING RESPONSIVE SIZING */
h1, .text-h1 {
    font-size: clamp(1.875rem, 6vw, 3.75rem);
    line-height: 1.2;
    margin: 1.5rem 0 1rem 0;
}

h2, .text-h2 {
    font-size: clamp(1.5rem, 5vw, 2.25rem);
    line-height: 1.3;
    margin: 1.5rem 0 0.75rem 0;
}

h3, .text-h3 {
    font-size: clamp(1.25rem, 4vw, 1.875rem);
    line-height: 1.4;
    margin: 1.25rem 0 0.5rem 0;
}

h4, .text-h4 {
    font-size: clamp(1rem, 3vw, 1.25rem);
    line-height: 1.5;
}

h5, .text-h5 {
    font-size: clamp(0.875rem, 2.5vw, 1.125rem);
    line-height: 1.5;
}

h6, .text-h6 {
    font-size: clamp(0.75rem, 2vw, 1rem);
    line-height: 1.6;
}

/* BODY TEXT RESPONSIVE SIZING */
p, body {
    font-size: clamp(0.875rem, 2vw, 1.0625rem);
    line-height: 1.6;
}

small, .text-small {
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
}

.text-xl {
    font-size: clamp(1rem, 3vw, 1.25rem);
}

.text-2xl {
    font-size: clamp(1.25rem, 4vw, 1.5rem);
}

.text-3xl {
    font-size: clamp(1.5rem, 5vw, 1.875rem);
}

.text-4xl {
    font-size: clamp(1.875rem, 6vw, 2.25rem);
}

.text-5xl {
    font-size: clamp(2.25rem, 7vw, 3rem);
}

.text-6xl {
    font-size: clamp(3rem, 8vw, 3.75rem);
}

/* ============================================
   RESPONSIVE SPACING & PADDING
   ============================================ */

/* RESPONSIVE SECTION PADDING */
section {
    padding: clamp(2rem, 5vw, 4rem) var(--space-4);
}

@media (min-width: 640px) {
    section {
        padding: clamp(3rem, 6vw, 5rem) var(--space-6);
    }
}

@media (min-width: 1024px) {
    section {
        padding: clamp(4rem, 8vw, 6rem) var(--space-8);
    }
}

/* CONTAINER RESPONSIVE PADDING */
.container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

@media (min-width: 640px) {
    .container {
        padding-left: var(--space-6);
        padding-right: var(--space-6);
    }
}

@media (min-width: 768px) {
    .container {
        padding-left: var(--space-8);
        padding-right: var(--space-8);
    }
}

/* ============================================
   RESPONSIVE GAP FOR GRIDS & FLEX
   ============================================ */

.gap-responsive {
    gap: clamp(1rem, 3vw, 2rem);
}

.gap-responsive-lg {
    gap: clamp(1.5rem, 4vw, 3rem);
}

.gap-responsive-sm {
    gap: clamp(0.5rem, 2vw, 1rem);
}

/* ============================================
   RESPONSIVE BUTTON & TOUCH TARGETS
   ============================================ */

/* ENSURE TOUCH TARGETS ARE AT LEAST 48x48px */
button, a.btn, input[type="button"], input[type="submit"], 
.btn-like, [role="button"] {
    min-height: 3rem; /* 48px */
    min-width: 3rem;  /* 48px */
    padding: clamp(0.5rem, 2vh, 0.75rem) clamp(1rem, 3vw, 1.5rem);
    font-size: clamp(0.875rem, 2vw, 1rem);
    border-radius: clamp(0.375rem, 1vw, 0.5rem);
    transition: all 0.2s ease;
}

@media (max-width: 768px) {
    button, a.btn, input[type="button"], input[type="submit"] {
        min-height: 2.75rem; /* 44px for mobile - Apple guideline */
    }
}

/* FORM INPUTS RESPONSIVE */
input, textarea, select {
    min-height: 2.75rem; /* 44px */
    padding: clamp(0.5rem, 1.5vh, 0.75rem) clamp(0.75rem, 2vw, 1rem);
    font-size: clamp(0.875rem, 2vw, 1rem);
    border-radius: clamp(0.25rem, 1vw, 0.375rem);
}

/* ============================================
   RESPONSIVE IMAGE HANDLING
   ============================================ */

img, picture, video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* RESPONSIVE IMAGE CONTAINERS */
.image-responsive {
    width: 100%;
    max-width: 100%;
    height: auto;
}

.img-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* ============================================
   RESPONSIVE HERO SECTIONS
   ============================================ */

.hero, .video-slider {
    min-height: clamp(300px, 50vh, 600px);
}

@media (min-width: 768px) {
    .hero, .video-slider {
        min-height: clamp(400px, 60vh, 700px);
    }
}

/* ============================================
   RESPONSIVE CARD GRID SYSTEM
   ============================================ */

.grid-responsive-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: clamp(1rem, 3vw, 2rem);
}

.grid-responsive-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(1rem, 3vw, 2rem);
}

@media (min-width: 640px) {
    .grid-responsive-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid-responsive-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.grid-responsive-3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(1rem, 3vw, 2rem);
}

@media (min-width: 640px) {
    .grid-responsive-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid-responsive-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

.grid-responsive-4 {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(1rem, 3vw, 2rem);
}

@media (min-width: 768px) {
    .grid-responsive-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid-responsive-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   RESPONSIVE MARGIN & PADDING UTILITIES
   ============================================ */

.p-responsive {
    padding: clamp(1rem, 4vw, 2rem);
}

.p-responsive-sm {
    padding: clamp(0.5rem, 2vw, 1rem);
}

.p-responsive-lg {
    padding: clamp(2rem, 6vw, 3rem);
}

.m-responsive {
    margin: clamp(1rem, 4vw, 2rem);
}

.my-responsive {
    margin-top: clamp(1rem, 4vw, 2rem);
    margin-bottom: clamp(1rem, 4vw, 2rem);
}

.mx-responsive {
    margin-left: clamp(1rem, 4vw, 2rem);
    margin-right: clamp(1rem, 4vw, 2rem);
}

/* ============================================
   RESPONSIVE FLEX LAYOUT
   ============================================ */

.flex-responsive {
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 3vw, 2rem);
}

@media (min-width: 768px) {
    .flex-responsive {
        flex-direction: row;
    }
}

.flex-responsive-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(0.5rem, 2vw, 1rem);
}

@media (min-width: 768px) {
    .flex-responsive-center {
        flex-direction: row;
    }
}

/* ============================================
   RESPONSIVE MOBILE MENU
   ============================================ */

.mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3rem;
    min-height: 3rem;
    padding: 0.5rem;
    font-size: 1.25rem;
    border: none;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-toggle:active {
    opacity: 0.7;
}

/* ============================================
   RESPONSIVE SLIDER/CAROUSEL
   ============================================ */

.slider-arrow {
    min-width: 2.5rem;
    min-height: 2.5rem;
    width: clamp(2.5rem, 6vw, 3.5rem);
    height: clamp(2.5rem, 6vw, 3.5rem);
}

@media (max-width: 640px) {
    .slider-arrow {
        min-width: 2.25rem;
        min-height: 2.25rem;
    }
}

/* ============================================
   RESPONSIVE BREAKPOINT VISIBILITY
   ============================================ */

.hide-mobile {
    display: none;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block;
    }
    
    .show-mobile {
        display: none;
    }
}

.show-mobile {
    display: block;
}

@media (min-width: 1024px) {
    .hide-desktop {
        display: none;
    }
}

/* ============================================
   RESPONSIVE OVERFLOW HANDLING
   ============================================ */

.overflow-x-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
    table {
        display: table;
        overflow-x: visible;
    }
}

/* ============================================
   RESPONSIVE ASPECT RATIO
   ============================================ */

.aspect-video-responsive {
    position: relative;
    padding-bottom: 56.25%;
}

.aspect-video-responsive > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.aspect-square-responsive {
    position: relative;
    padding-bottom: 100%;
}

.aspect-square-responsive > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ============================================
   RESPONSIVE SIDEBAR/MAIN LAYOUT
   ============================================ */

.layout-responsive {
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 3vw, 2rem);
}

@media (min-width: 1024px) {
    .layout-responsive {
        flex-direction: row;
    }
}

.sidebar-responsive {
    width: 100%;
}

@media (min-width: 1024px) {
    .sidebar-responsive {
        width: clamp(250px, 25%, 400px);
        flex-shrink: 0;
    }
}

.main-responsive {
    width: 100%;
    flex: 1;
}

/* ============================================
   RESPONSIVE FOOTER
   ============================================ */

footer {
    padding: clamp(2rem, 5vw, 3rem) var(--space-4);
}

@media (min-width: 768px) {
    footer {
        padding: clamp(3rem, 6vw, 4rem) var(--space-6);
    }
}

footer .grid-responsive-4 {
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    footer .grid-responsive-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    footer .grid-responsive-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   RESPONSIVE ACCESSIBILITY
   ============================================ */

/* High contrast mode support */
@media (prefers-contrast: more) {
    button, a.btn {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   RESPONSIVE PRINT STYLES
   ============================================ */

@media print {
    * {
        margin: 0;
        padding: 0;
        background: transparent;
        color: #000;
        text-shadow: none;
        box-shadow: none;
    }
    
    a, a:visited {
        text-decoration: underline;
    }
    
    p {
        orphans: 3;
        widows: 3;
    }
}

/* ============================================
   SMALL DEVICES (320px - 374px)
   ============================================ */

@media (max-width: 374px) {
    h1, .text-h1 {
        font-size: 1.5rem;
    }
    
    h2, .text-h2 {
        font-size: 1.25rem;
    }
    
    button, a.btn {
        min-height: 2.5rem;
        padding: 0.4rem 0.75rem;
    }
}

/* ============================================
   EXTRA LARGE DEVICES (1440px+)
   ============================================ */

@media (min-width: 1440px) {
    :root {
        font-size: 18px;
    }
    
    h1, .text-h1 {
        font-size: 3.75rem;
    }
    
    h2, .text-h2 {
        font-size: 2.5rem;
    }
    
    section {
        padding: 5rem var(--space-8);
    }
}

/* ============================================
   LANDSCAPE ORIENTATION ADJUSTMENTS
   ============================================ */

@media (max-height: 600px) and (orientation: landscape) {
    h1, .text-h1 {
        font-size: 1.5rem;
        margin: 0.5rem 0;
    }
    
    h2, .text-h2 {
        font-size: 1.25rem;
    }
    
    section {
        padding: 1rem var(--space-4);
    }
}
