/**
 * Layout System
 * ---------------------------------------------------------------------------
 * File: assets/css/layout.css
 * Enqueued by: inc/enqueue.php (handle: gdq-layout), depends on
 * gdq-variables, gdq-base, gdq-typography.
 *
 * Structural layout primitives and utility classes only: containers, grid/
 * flex utilities, section spacing, content-width helpers, alignment. No
 * component (button, card, nav, hero) lives here — those are Sprint 2B+
 * and will be built as their own files that CONSUME these utilities
 * (e.g. a future .card-grid will be `.grid .grid--3` plus its own
 * component-specific rules), not duplicate layout logic themselves.
 *
 * Utility naming: short, functional, BEM-modifier style for variants
 * (`.grid--3`, not `.grid-three-columns`) — matches the naming convention
 * documented in the theme README.
 */

/* ==========================================================================
   CONTAINERS
   Three named widths (narrow/max/wide) per the container tokens in
   variables.css. `.container` (no modifier) is the default used by every
   template file built in Sprint 1 — kept as the unmodified base case so
   no existing template markup needs to change.
   ========================================================================== */
.container {
	width: 100%;
	max-width: var(--gdq-container-max);
	margin-inline: auto;
	padding-inline: var(--gdq-space-3);
}

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

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

/* Container padding increases at tablet — matches the wider gutters
   observed once a page has room to breathe beyond mobile. */
@media (min-width: 768px) { /* mirrors --gdq-bp-tablet */
	.container {
		padding-inline: var(--gdq-space-4);
	}
}

/* ==========================================================================
   SECTION SPACING
   Every analysed page uses generous, consistent vertical rhythm between
   major sections (~96–120px desktop, per Design Spec §3.3). Exposed as a
   utility rather than baked into a "section" component tag, since section
   backgrounds/content vary but the vertical rhythm is the one constant.
   ========================================================================== */
.section-padding {
	padding-block: var(--gdq-space-6); /* 64px mobile baseline */
}

@media (min-width: 768px) { /* mirrors --gdq-bp-tablet */
	.section-padding {
		padding-block: var(--gdq-space-7); /* 96px */
	}
}

@media (min-width: 1200px) { /* mirrors --gdq-bp-desktop */
	.section-padding {
		padding-block: var(--gdq-space-8); /* 120px */
	}
}

/* Half-height variant, for sections that sit directly after another
   section with no visual break needed (e.g. a CTA banner immediately
   following a content section) — avoids doubled-up whitespace. */
.section-padding--sm {
	padding-block: var(--gdq-space-4);
}

@media (min-width: 768px) { /* mirrors --gdq-bp-tablet */
	.section-padding--sm {
		padding-block: var(--gdq-space-5);
	}
}

/* ==========================================================================
   GRID UTILITIES
   Mobile-first: single column by default, explicit column counts apply
   from tablet up. Every grid collapses to 1 column below tablet regardless
   of its desktop column count, matching the "everything stacks on mobile"
   responsive rule confirmed across all 6 pages.
   ========================================================================== */
.grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--gdq-space-4);
}

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

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

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

@media (min-width: 768px) { /* mirrors --gdq-bp-tablet */
	/* Tablet: 3- and 4-column grids reflow to 2 columns per the
	   responsive rule documented for every icon-tile/service-card grid
	   in the Design Spec; 2-column grids stay 2-column. */
	.grid--2 {
		grid-template-columns: repeat(2, 1fr);
	}

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

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

@media (min-width: 1200px) { /* mirrors --gdq-bp-desktop */
	.grid--3 {
		grid-template-columns: repeat(3, 1fr);
	}

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

/* Gap size modifiers — default grid gap is --gdq-space-4 (32px); these
   cover the tighter/looser gutters seen in different grids across the
   6 pages (e.g. compact icon-tile grids sit tighter than card grids). */
.grid--gap-sm {
	gap: var(--gdq-space-3);
}

.grid--gap-lg {
	gap: var(--gdq-space-5);
}

/* ==========================================================================
   FLEX UTILITIES
   ========================================================================== */
.flex {
	display: flex;
}

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

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

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

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

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

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

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

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

/* ==========================================================================
   CONTENT WIDTH UTILITIES
   For constraining a single element's measure independent of its parent
   container — e.g. a heading that should stay narrower than the full
   section width it sits in, matching the "Comprehensive creative
   solutions for the modern enterprise." style headings observed capped
   at roughly half the container width across several sections.
   ========================================================================== */
.content-width--narrow {
	max-width: var(--gdq-container-narrow);
}

.content-width--half {
	max-width: 50%;
}

@media (max-width: 767px) { /* below --gdq-bp-tablet */
	/* Never force a half-width constraint on mobile — full width below
	   tablet regardless of the desktop intent. */
	.content-width--half {
		max-width: 100%;
	}
}

/* ==========================================================================
   ALIGNMENT UTILITIES
   ========================================================================== */
.text-center {
	text-align: center;
}

.text-left {
	text-align: left;
}

.text-right {
	text-align: right;
}

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

.justify-center {
	justify-content: center;
}

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

.mx-auto {
	margin-inline: auto;
}

/* ==========================================================================
   VISUALLY HIDDEN (non-accessibility use)
   Distinct from .screen-reader-text in base.css: this hides an element
   from ALL users (not just visually, but also from assistive tech),
   useful for e.g. a template-part placeholder region with no content yet.
   ========================================================================== */
.is-hidden {
	display: none !important;
}

@media (min-width: 768px) { /* mirrors --gdq-bp-tablet */
	.is-hidden-tablet-up {
		display: none !important;
	}
}

@media (max-width: 767px) { /* below --gdq-bp-tablet */
	.is-hidden-mobile {
		display: none !important;
	}
}
