/*
 * Educational Empire Hub - Layout System
 * Grid systems, containers, and structural layouts
 */

/* ===================================
   BASE LAYOUT
   =================================== */

body {
    font-family: var(--font-body);
    font-size: var(--text-body);
    line-height: var(--leading-normal);
    color: var(--color-text);
    background-color: var(--color-background);
    overflow-x: hidden;
}

/* ===================================
   CONTAINERS
   =================================== */

.container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--space-md);
}

.container--wide {
    max-width: var(--container-wide);
}

.container--narrow {
    max-width: var(--container-narrow);
}

.container--text {
    max-width: var(--container-text);
}

.container--full {
    max-width: none;
    padding-inline: 0;
}

/* ===================================
   SECTIONS
   =================================== */

.section {
    position: relative;
    padding-block: var(--space-2xl);
}

.section--hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-block: 0;
}

.section--full {
    padding-block: 0;
}

.section--dark {
    background-color: var(--color-neutral-dark);
    color: var(--color-text-inverse);
}

.section--accent {
    background-color: var(--color-accent);
}

/* ===================================
   SECTION DIVIDERS
   =================================== */

.section-divider {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-divider__ornament {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--gradient-hero);
    opacity: 0.1;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120'%3E%3Cpath d='M0,60 C200,0 400,120 600,60 C800,0 1000,120 1200,60 L1200,120 L0,120 Z'/%3E%3C/svg%3E");
    mask-size: cover;
    mask-repeat: no-repeat;
}

/* ===================================
   GRID SYSTEMS
   =================================== */

/* Basic Flexbox Grid */
.flex {
    display: flex;
}

.flex--wrap {
    flex-wrap: wrap;
}

.flex--center {
    align-items: center;
    justify-content: center;
}

.flex--between {
    justify-content: space-between;
}

.flex--column {
    flex-direction: column;
}

.flex--gap-sm {
    gap: var(--space-sm);
}

.flex--gap-md {
    gap: var(--space-md);
}

.flex--gap-lg {
    gap: var(--space-lg);
}

/* CSS Grid */
.grid {
    display: grid;
    gap: var(--space-md);
}

.grid--2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Auto-fit grids */
.grid--auto-sm {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid--auto-md {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid--auto-lg {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

/* Magazine Editorial Layout (About section) */
.grid--editorial {
    grid-template-columns: 2fr 3fr;
    gap: var(--space-xl);
    align-items: start;
}

/* Bento Box Layout (Daily Sublime) */
.grid--bento {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, minmax(150px, auto));
    gap: var(--space-md);
}

.grid--bento .bento-featured {
    grid-column: span 3;
    grid-row: span 2;
}

.grid--bento .bento-description {
    grid-column: span 3;
    grid-row: span 3;
}

.grid--bento .bento-stat {
    grid-column: span 1;
    grid-row: span 1;
}

.grid--bento .bento-samples {
    grid-column: span 2;
    grid-row: span 2;
}

.grid--bento .bento-testimonial {
    grid-column: span 2;
    grid-row: span 1;
}

/* ===================================
   HORIZONTAL SCROLL (Hustle Course)
   =================================== */

.scroll-container {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.scroll-container::-webkit-scrollbar {
    display: none;
}

.scroll-track {
    display: flex;
    width: max-content;
}

.scroll-panel {
    flex-shrink: 0;
    width: 100vw;
    min-height: 100vh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--space-xl);
}

/* ===================================
   CARD GRID (Resource Library)
   =================================== */

.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
}

/* ===================================
   STACK LAYOUTS
   =================================== */

.stack {
    display: flex;
    flex-direction: column;
}

.stack--sm>*+* {
    margin-top: var(--space-sm);
}

.stack--md>*+* {
    margin-top: var(--space-md);
}

.stack--lg>*+* {
    margin-top: var(--space-lg);
}

.stack--xl>*+* {
    margin-top: var(--space-xl);
}

/* ===================================
   SPLIT LAYOUTS
   =================================== */

.split {
    display: flex;
    gap: var(--space-lg);
}

.split--40-60 {
    /* Left side 40%, right side 60% */
}

.split--40-60> :first-child {
    flex: 0 0 40%;
}

.split--40-60> :last-child {
    flex: 0 0 calc(60% - var(--space-lg));
}

.split--50-50 {
    /* Equal split */
}

.split--50-50>* {
    flex: 1;
}

/* ===================================
   ASPECT RATIOS
   =================================== */

.aspect-square {
    aspect-ratio: 1;
}

.aspect-video {
    aspect-ratio: 16 / 9;
}

.aspect-portrait {
    aspect-ratio: 3 / 4;
}

.aspect-wide {
    aspect-ratio: 21 / 9;
}

/* ===================================
   POSITIONING UTILITIES
   =================================== */

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.sticky {
    position: sticky;
}

.inset-0 {
    inset: 0;
}

.top-0 {
    top: 0;
}

.right-0 {
    right: 0;
}

.bottom-0 {
    bottom: 0;
}

.left-0 {
    left: 0;
}

/* Center absolute element */
.absolute-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ===================================
   OVERFLOW
   =================================== */

.overflow-hidden {
    overflow: hidden;
}

.overflow-visible {
    overflow: visible;
}

.overflow-auto {
    overflow: auto;
}

/* ===================================
   VISIBILITY & DISPLAY
   =================================== */

.hidden {
    display: none !important;
}

.visible {
    visibility: visible;
}

.invisible {
    visibility: hidden;
}

.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;
}

/* ===================================
   RESPONSIVE LAYOUT OVERRIDES
   =================================== */

@media (max-width: 1023px) {
    .grid--4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid--bento {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
    }

    .grid--bento .bento-featured,
    .grid--bento .bento-description,
    .grid--bento .bento-samples {
        grid-column: span 2;
        grid-row: span 1;
    }

    .grid--bento .bento-stat,
    .grid--bento .bento-testimonial {
        grid-column: span 1;
    }

    .grid--editorial {
        grid-template-columns: 1fr;
    }

    .split {
        flex-direction: column;
    }

    .split--40-60> :first-child,
    .split--40-60> :last-child {
        flex: 1;
    }
}

@media (max-width: 767px) {

    .grid--2,
    .grid--3,
    .grid--4,
    .card-grid {
        grid-template-columns: 1fr;
    }

    .grid--bento .bento-stat {
        grid-column: span 2;
    }

    .scroll-panel {
        width: 100vw;
        padding: var(--space-lg) var(--space-md);
    }
}