/* ============================================
   CAMPUS LANE HOLDINGS - RESPONSIVE DESIGN
   Mobile-First Approach - Enhanced
   ============================================ */

/* ===== BASE STYLES (Mobile First - 320px+) ===== */

.container {
    width: 100%;
    max-width: var(--clh-max-width-xl);
    margin: 0 auto;
    padding: 0 var(--clh-space-4);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--clh-space-4);
}

.container-narrow {
    max-width: var(--clh-max-width-md);
}

.container-wide {
    max-width: var(--clh-max-width-2xl);
}

/* ===== GRID SYSTEM ===== */

.grid {
    display: grid;
    gap: var(--clh-space-6);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-6 { grid-template-columns: repeat(6, 1fr); }
.grid-cols-12 { grid-template-columns: repeat(12, 1fr); }

.grid-auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-auto-fill {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* ===== FLEXBOX UTILITIES ===== */

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-row {
    flex-direction: row;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-nowrap {
    flex-wrap: nowrap;
}

.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }

.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-center { align-items: center; }
.items-baseline { align-items: baseline; }
.items-stretch { align-items: stretch; }

.gap-1 { gap: var(--clh-space-1); }
.gap-2 { gap: var(--clh-space-2); }
.gap-3 { gap: var(--clh-space-3); }
.gap-4 { gap: var(--clh-space-4); }
.gap-6 { gap: var(--clh-space-6); }
.gap-8 { gap: var(--clh-space-8); }

/* ===== MOBILE NAVIGATION ===== */

.mobile-menu {
    display: none;
    position: fixed;
    top: var(--clh-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--clh-bg-primary);
    z-index: var(--clh-z-fixed);
    padding: var(--clh-space-6);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform var(--clh-transition-base);
}

.mobile-menu.active {
    display: block;
    transform: translateX(0);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--clh-space-2);
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--clh-text-primary);
    transition: all var(--clh-transition-base);
    border-radius: var(--clh-radius-sm);
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ===== RESPONSIVE TYPOGRAPHY ===== */

.text-xs { font-size: var(--clh-font-size-xs); }
.text-sm { font-size: var(--clh-font-size-sm); }
.text-base { font-size: var(--clh-font-size-base); }
.text-md { font-size: var(--clh-font-size-md); }
.text-lg { font-size: var(--clh-font-size-lg); }
.text-xl { font-size: var(--clh-font-size-xl); }
.text-2xl { font-size: var(--clh-font-size-2xl); }
.text-3xl { font-size: var(--clh-font-size-3xl); }
.text-4xl { font-size: var(--clh-font-size-4xl); }

/* ===== RESPONSIVE IMAGES ===== */

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-responsive {
    width: 100%;
    height: auto;
}

.img-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-contain {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===== ASPECT RATIOS ===== */

.aspect-square {
    aspect-ratio: 1 / 1;
}

.aspect-video {
    aspect-ratio: 16 / 9;
}

.aspect-4-3 {
    aspect-ratio: 4 / 3;
}

/* ===== VISIBILITY UTILITIES ===== */

.show-mobile { display: block; }
.show-tablet { display: none; }
.show-desktop { display: none; }
.hide-mobile { display: none; }
.hide-tablet { display: block; }
.hide-desktop { display: block; }

/* ===== TABLET (768px+) ===== */

@media (min-width: 768px) {
    .container {
        padding: 0 var(--clh-space-6);
    }

    /* Typography adjustments */
    h1 { font-size: 3rem; }
    h2 { font-size: 2.5rem; }
    h3 { font-size: 2rem; }

    /* Grid responsiveness */
    .grid-cols-md-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-md-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-cols-md-4 { grid-template-columns: repeat(4, 1fr); }

    /* Visibility */
    .show-mobile { display: none; }
    .show-tablet { display: block; }
    .hide-tablet { display: none; }

    /* Flexbox */
    .flex-md-row { flex-direction: row; }
    .flex-md-col { flex-direction: column; }

    /* Menu toggle hidden on tablet+ */
    .menu-toggle {
        display: none;
    }
}

/* ===== LAPTOP (1024px+) ===== */

@media (min-width: 1024px) {
    .container {
        padding: 0 var(--clh-space-8);
    }

    /* Typography */
    h1 { font-size: 3.5rem; }
    h2 { font-size: 3rem; }

    /* Grid */
    .grid-cols-lg-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-cols-lg-4 { grid-template-columns: repeat(4, 1fr); }
    .grid-cols-lg-6 { grid-template-columns: repeat(6, 1fr); }

    /* Flexbox */
    .flex-lg-row { flex-direction: row; }
    .flex-lg-col { flex-direction: column; }

    /* Visibility */
    .show-desktop { display: block; }
    .hide-desktop { display: none; }
}

/* ===== DESKTOP (1280px+) ===== */

@media (min-width: 1280px) {
    .container {
        padding: 0 var(--clh-space-10);
    }

    h1 { font-size: 4rem; }
    h2 { font-size: 3.5rem; }

    .grid-cols-xl-4 { grid-template-columns: repeat(4, 1fr); }
    .grid-cols-xl-6 { grid-template-columns: repeat(6, 1fr); }
}

/* ===== LARGE DESKTOP (1536px+) ===== */

@media (min-width: 1536px) {
    .container {
        padding: 0 var(--clh-space-12);
    }

    .grid-cols-2xl-6 { grid-template-columns: repeat(6, 1fr); }
}

/* ===== RESPONSIVE HEADER ===== */

@media (max-width: 767px) {
    .site-header {
        padding: var(--clh-space-3) 0;
    }

    .main-nav {
        display: none;
    }

    .main-nav.active {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: var(--clh-header-height);
        left: 0;
        right: 0;
        background: var(--clh-bg-primary);
        padding: var(--clh-space-6);
        box-shadow: var(--clh-shadow-lg);
        z-index: var(--clh-z-fixed);
    }

    .main-nav ul {
        flex-direction: column;
        gap: var(--clh-space-4);
    }

    .menu-toggle {
        display: flex;
    }
}

/* ===== RESPONSIVE HERO SECTION ===== */

.hero {
    min-height: 400px;
}

@media (min-width: 768px) {
    .hero {
        min-height: 500px;
    }
}

@media (min-width: 1024px) {
    .hero {
        min-height: 600px;
    }
}

/* ===== RESPONSIVE CARDS ===== */

.card {
    width: 100%;
}

@media (max-width: 767px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== RESPONSIVE FORMS ===== */

.form-group {
    margin-bottom: var(--clh-space-4);
}

@media (max-width: 767px) {
    .form-row {
        flex-direction: column;
    }

    .form-col {
        width: 100%;
    }
}

@media (min-width: 768px) {
    .form-row {
        display: flex;
        gap: var(--clh-space-4);
    }

    .form-col {
        flex: 1;
    }
}

/* ===== RESPONSIVE TABLES ===== */

@media (max-width: 767px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive table {
        min-width: 600px;
    }
}

/* ===== RESPONSIVE SPACING ===== */

/* Padding */
.p-0 { padding: 0; }
.p-1 { padding: var(--clh-space-1); }
.p-2 { padding: var(--clh-space-2); }
.p-3 { padding: var(--clh-space-3); }
.p-4 { padding: var(--clh-space-4); }
.p-6 { padding: var(--clh-space-6); }
.p-8 { padding: var(--clh-space-8); }

.px-4 { padding-left: var(--clh-space-4); padding-right: var(--clh-space-4); }
.py-4 { padding-top: var(--clh-space-4); padding-bottom: var(--clh-space-4); }

/* Margin */
.m-0 { margin: 0; }
.m-auto { margin: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }
.my-4 { margin-top: var(--clh-space-4); margin-bottom: var(--clh-space-4); }
.my-6 { margin-top: var(--clh-space-6); margin-bottom: var(--clh-space-6); }
.my-8 { margin-top: var(--clh-space-8); margin-bottom: var(--clh-space-8); }

/* ===== RESPONSIVE UTILITIES ===== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

@media (min-width: 768px) {
    .text-md-left { text-align: left; }
    .text-md-center { text-align: center; }
    .text-md-right { text-align: right; }
}

/* ===== RESPONSIVE DISPLAY ===== */

.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.hidden { display: none; }

/* ===== OVERFLOW ===== */

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-scroll { overflow: scroll; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* ===== POSITION ===== */

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* ===== WIDTH/HEIGHT ===== */

.w-full { width: 100%; }
.w-auto { width: auto; }
.w-screen { width: 100vw; }
.h-full { height: 100%; }
.h-auto { height: auto; }
.h-screen { height: 100vh; }

/* ===== MAX WIDTH/HEIGHT ===== */

.max-w-xs { max-width: var(--clh-max-width-xs); }
.max-w-sm { max-width: var(--clh-max-width-sm); }
.max-w-md { max-width: var(--clh-max-width-md); }
.max-w-lg { max-width: var(--clh-max-width-lg); }
.max-w-xl { max-width: var(--clh-max-width-xl); }
.max-w-2xl { max-width: var(--clh-max-width-2xl); }
.max-w-full { max-width: 100%; }

/* ===== PRINT STYLES ===== */

@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    a {
        text-decoration: underline;
    }

    .container {
        max-width: 100%;
    }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    button,
    a,
    input,
    select,
    textarea {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .hover-lift:hover {
        transform: none;
    }
}

/* ===== LANDSCAPE MOBILE ===== */

@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
    }

    .site-header {
        padding: var(--clh-space-2) 0;
    }
}

/* ===== ACCESSIBILITY - REDUCED MOTION ===== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== HIGH DPI DISPLAYS ===== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize for retina displays */
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}
