/**
 * Humbrella Design System - Layout
 * Version: 1.0
 * 
 * Containers, grid system, and responsive utilities.
 * Requires: variables.css
 */

/* =========================================
   CONTAINER
   ========================================= */
.container {
    width: 100%;
    max-width: var(--container-xl);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-5);
    padding-right: var(--space-5);
}

.container-sm { max-width: var(--container-sm); }
.container-md { max-width: var(--container-md); }
.container-lg { max-width: var(--container-lg); }
.container-xl { max-width: var(--container-xl); }
.container-2xl { max-width: var(--container-2xl); }
.container-full { max-width: 100%; }

/* =========================================
   PAGE LAYOUT WITH SIDEBAR
   ========================================= */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Body adjustment for fixed sidebar (desktop) */
.has-sidebar {
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition);
}

/* Main content area */
.main-content {
    flex: 1;
    padding: var(--space-5);
    transition: margin-left var(--transition);
}

/* Full-width sections (break out of container) */
.full-width {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

/* =========================================
   SECTIONS
   ========================================= */
.section {
    padding-top: var(--section-padding-y);
    padding-bottom: var(--section-padding-y);
    padding-left: var(--section-padding-x);
    padding-right: var(--section-padding-x);
}

.section-sm {
    padding-top: var(--space-12);
    padding-bottom: var(--space-12);
}

.section-lg {
    padding-top: var(--space-32);
    padding-bottom: var(--space-32);
}

/* Section backgrounds */
.section-gradient {
    background: var(--gradient-brand);
    color: var(--color-text-light);
}

.section-cream {
    background: var(--gradient-cream);
}

.section-teal {
    background: var(--color-primary);
    color: var(--color-text-light);
}

.section-magenta {
    background: var(--color-magenta);
    color: var(--color-text-light);
}

.section-magenta-dark {
    background: var(--gradient-magenta-dark);
    color: var(--color-text-light);
}

.section-teal-dark {
    background: var(--gradient-teal-dark);
    color: var(--color-text-light);
}

/* =========================================
   CSS GRID
   ========================================= */
.grid {
    display: grid;
    gap: var(--space-6);
}

/* Grid columns */
.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-5 { grid-template-columns: repeat(5, 1fr); }
.grid-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* Auto-fit responsive grid */
.grid-auto-sm { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-auto-md { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-auto-lg { grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); }

/* Grid gap variants */
.gap-0 { gap: 0; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.gap-10 { gap: var(--space-10); }

/* =========================================
   FLEXBOX
   ========================================= */
.flex { display: flex; }
.inline-flex { display: inline-flex; }

/* Direction */
.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-row-reverse { flex-direction: row-reverse; }
.flex-col-reverse { flex-direction: column-reverse; }

/* Wrap */
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

/* Justify content */
.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; }

/* Align items */
.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; }

/* Align self */
.self-start { align-self: flex-start; }
.self-end { align-self: flex-end; }
.self-center { align-self: center; }
.self-stretch { align-self: stretch; }

/* Flex grow/shrink */
.flex-1 { flex: 1 1 0%; }
.flex-auto { flex: 1 1 auto; }
.flex-none { flex: none; }
.grow { flex-grow: 1; }
.shrink-0 { flex-shrink: 0; }

/* =========================================
   TWO-COLUMN LAYOUTS
   ========================================= */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-10);
    align-items: center;
}

.two-col-60-40 {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: var(--space-10);
    align-items: center;
}

.two-col-40-60 {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: var(--space-10);
    align-items: center;
}

/* =========================================
   HERO LAYOUTS
   ========================================= */
.hero {
    position: relative;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-full {
    min-height: 100vh;
}

.hero-short {
    min-height: 50vh;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
}

.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(var(--color-primary-rgb), 0.25) 0%,
        rgba(var(--color-magenta-rgb), 0.35) 50%,
        rgba(var(--color-magenta-rgb), 0.4) 100%
    );
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: var(--space-8);
    max-width: 900px;
}

/* =========================================
   RESPONSIVE BREAKPOINTS
   ========================================= */

/* Tablet (768px and below) */
@media (max-width: 900px) {
    .has-sidebar {
        margin-left: var(--sidebar-width-tablet);
    }
    
    .grid-cols-3,
    .grid-cols-4,
    .grid-cols-5,
    .grid-cols-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .two-col,
    .two-col-60-40,
    .two-col-40-60 {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }
    
    /* Tablet-specific utilities */
    .md\:grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .md\:flex-col { flex-direction: column; }
    .md\:text-center { text-align: center; }
}

/* Mobile (600px and below) */
@media (max-width: 600px) {
    :root {
        --section-padding-y: var(--space-16);
    }
    
    .has-sidebar {
        margin-left: 0;
    }
    
    .main-content {
        padding-bottom: 80px; /* Room for FAB nav */
    }
    
    .container {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }
    
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
    
    .hero {
        min-height: 55vh;
    }
    
    h1 { font-size: var(--text-4xl); }
    h2 { font-size: var(--text-3xl); }
    h3 { font-size: var(--text-2xl); }
    
    /* Mobile-specific utilities */
    .sm\:hidden { display: none; }
    .sm\:flex-col { flex-direction: column; }
    .sm\:text-center { text-align: center; }
    .sm\:gap-4 { gap: var(--space-4); }
}

/* Large screens (1200px and above) */
@media (min-width: 1200px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* =========================================
   VISIBILITY & DISPLAY
   ========================================= */
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }

/* Responsive visibility */
.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

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

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =========================================
   POSITION
   ========================================= */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; top: 0; }

.inset-0 { inset: 0; }
.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }

/* =========================================
   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; }

/* =========================================
   ASPECT RATIOS
   ========================================= */
.aspect-square { aspect-ratio: 1 / 1; }
.aspect-video { aspect-ratio: 16 / 9; }
.aspect-4-3 { aspect-ratio: 4 / 3; }
.aspect-3-2 { aspect-ratio: 3 / 2; }
