/* ==========================================================================
   Layout — Containers, Grid, Sections
   ========================================================================== */

/* --- Main layout --- */
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
}

/* --- Containers --- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
}

.container-wide {
    max-width: var(--container-wide);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
}

/* --- Sections --- */
.section {
    padding-top: var(--space-3xl);
    padding-bottom: var(--space-3xl);
}

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

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

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

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

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

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

.section-ink h1,
.section-ink h2,
.section-ink h3,
.section-ink h4 {
    color: var(--color-paper);
}

.section-ink a {
    color: var(--color-rust-light);
}

.section-ink a:hover {
    color: var(--color-white);
}

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

.section-rust h1,
.section-rust h2,
.section-rust h3 {
    color: var(--color-white);
}

.section-rust a {
    color: var(--color-white);
    text-decoration: underline;
}

/* --- Section header --- */
.section-header {
    margin-bottom: var(--space-2xl);
}

.section-header h2 {
    margin-bottom: var(--space-sm);
}

.section-header p {
    color: var(--color-steel);
    font-size: var(--text-md);
}

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

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

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

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

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

.grid-auto-sm {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* --- Flex utilities --- */
.flex {
    display: flex;
}

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

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

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

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

.flex-start {
    align-items: flex-start;
}

.items-center {
    align-items: center;
}

.gap-xs  { gap: var(--space-xs); }
.gap-sm  { gap: var(--space-sm); }
.gap-md  { gap: var(--space-md); }
.gap-lg  { gap: var(--space-lg); }
.gap-xl  { gap: var(--space-xl); }

/* --- Two-column layout with sidebar --- */
.layout-sidebar {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: var(--space-2xl);
    align-items: start;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-md) 0;
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    color: var(--color-steel);
}

.breadcrumbs a {
    color: var(--color-steel);
}

.breadcrumbs a:hover {
    color: var(--color-rust);
}

.breadcrumbs .sep {
    color: var(--color-concrete);
    margin: 0 var(--space-xs);
}

.breadcrumbs .current {
    color: var(--color-ink);
    font-weight: 500;
}

/* --- Divider with text --- */
.divider-text {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--color-steel);
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--color-concrete);
}
