/**
 * Layout foundation.
 *
 * Containers, section spacing, structural landmarks, and a small set of
 * layout primitives (grid/stack/cluster). No homepage or content-page
 * specific layout belongs here — see SF-TASK-02 report for file scope.
 */

/* ---------------------------------------------------------------------
 * Shell — the ONE container of the site (approved grid spec 2026-10-27).
 *
 * Every container — top-bar content, header bar, mega-menu panel inner,
 * search panel, mobile drawer, page header / breadcrumb, inner-page
 * content, every homepage section, footer — is `.sf-shell`. Backgrounds,
 * borders, brand motifs, the top-bar marquee and the hero portrait are
 * full-bleed and live OUTSIDE (or behind) the shell; all text and controls
 * sit inside it.
 *
 *   max content width  --sf-page-max (1280px)
 *   side gutter        --sf-page-gutter, fixed per breakpoint (tokens.css)
 *
 * Content edges land at: 390 → 20 · 768 → 40 · 1024 → 64 · 1280 → 80 ·
 * 1440 → 80 · 1680 → 200 · 1920 → 320. Never wider than 1280.
 *
 *   .sf-cols  (add to the same element, or to a nested one) the column grid:
 *             4 / 8 / 12 columns with --sf-col-gap. Place children with
 *             grid-column; a block that spans the shell and wants thirds or
 *             halves can use repeat(n, 1fr) with the same --sf-col-gap — the
 *             tracks are identical to the 12-column spans (3 × 4 cols, 2 × 6).
 *   .sf-measure-narrow  a centred 720px measure INSIDE the shell.
 *
 * Nothing else may declare a container width or horizontal gutter.
 * ------------------------------------------------------------------- */
:root {
	/* Left edge of the content column at the current width: where .sf-shell's text starts
	   (390 → 20 · 1440 → 80 · 1920 → 320). For fixed elements that must line up with the grid. */
	--sf-shell-edge: calc((100% - min(100%, var(--sf-page-max) + 2 * var(--sf-page-gutter))) / 2 + var(--sf-page-gutter));
}

.sf-shell {
	width: 100%;
	max-width: calc(var(--sf-page-max) + 2 * var(--sf-page-gutter));
	margin-inline: auto;
	padding-inline: var(--sf-page-gutter);
}

.sf-cols {
	display: grid;
	grid-template-columns: repeat(var(--sf-columns), minmax(0, 1fr));
	column-gap: var(--sf-col-gap);
}

.sf-measure-narrow {
	max-width: var(--sf-container-narrow);
	margin-inline: auto;
}

/* ---------------------------------------------------------------------
 * Section spacing — fluid vertical rhythm for editorial content blocks.
 * ------------------------------------------------------------------- */
.sf-section {
	padding-block: var(--sf-section-md);
}

.sf-section--sm {
	padding-block: var(--sf-section-sm);
}

.sf-section--lg {
	padding-block: var(--sf-section-lg);
}

.sf-section--xl {
	padding-block: var(--sf-section-xl);
}

/* ---------------------------------------------------------------------
 * Grid — a small set of auto-collapsing patterns (the "RAM" technique:
 * repeat/auto-fit/minmax). Each column count is really a target at wide
 * viewports; every one collapses to fewer columns, down to a single
 * column, without a single breakpoint or horizontal scrolling.
 * ------------------------------------------------------------------- */
.sf-grid {
	display: grid;
	gap: var(--sf-space-lg);
}

.sf-grid-2 {
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}

.sf-grid-3 {
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
}

.sf-grid-4 {
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
}

/* ---------------------------------------------------------------------
 * Stack / Cluster — the two most commonly needed flex primitives.
 * Deliberately just two: more would start duplicating what utility-first
 * frameworks do, which this theme is not (see utilities.css).
 * ------------------------------------------------------------------- */
.sf-stack {
	display: flex;
	flex-direction: column;
	gap: var(--sf-space-md);
}

.sf-cluster {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sf-space-sm);
}

/* ---------------------------------------------------------------------
 * Structural landmarks.
 *
 * .site-header itself is defined in components.css (the real header —
 * branding, primary nav, mega menus, search, mobile drawer). The header
 * row is `.site-header__bar.sf-shell`, so it shares the page's content
 * edge; .site-header carries only the full-bleed background and border.
 * ------------------------------------------------------------------- */

.site-main {
	min-height: 40vh;
}

/* Temporary placeholder layout — removed once real homepage sections exist. */
.front-page-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 60vh;
	gap: var(--sf-space-sm);
	text-align: center;
}

