/**
 * Layout: full-width blocks, wrapper, grid and the main/sidebar split.
 * Breakpoints are the real ones of the live template (tokens.css, design-tokens.json → breakpoints).
 */

/* ---- Blocks (full width) ---- */
.block-header { position: relative; z-index: 10; }
.headerbar {
	background: var(--c-brand);
	border-bottom: 1px solid var(--c-border-headerbar);
}

.block-hero {
	background: var(--c-bg-hero) var(--hero-image, none) 50% 0 / cover repeat;
	box-shadow: var(--bs-hero);
}
.block-hero .wrapper { padding: var(--sp-gutter) 0; }
.hero__spacer { height: 365px; margin: var(--sp-gutter); }

.block-main {
	position: relative;
	padding: var(--sp-block-y) 0 var(--sp-main-bottom);
	background: var(--c-bg-main) var(--tx-fabric) 0 0 repeat;
}

.block-bottom {
	position: relative;
	padding: var(--sp-block-y) 0;
	background: var(--c-bg-bottom) var(--tx-fabric-dark) 0 0 repeat;
}

.block-footer {
	position: relative;
	padding: var(--sp-block-y) 0;
	border-top: 1px solid var(--c-border-footer);
	background: var(--c-bg-footer) var(--tx-fabric-dark) 0 0 repeat;
}

.wrapper { max-width: var(--w-wrapper); margin: 0 auto; }

/* Sticky header: desktop devices only, exactly as the live media query. */
@media (min-device-width: 1025px) and (min-width: 960px) {
	.block-header { position: fixed; top: 0; width: 100%; }
	.admin-bar .block-header { top: 32px; }
	.block-header + .block-hero,
	.block-header + .block-main { margin-top: var(--h-header); }
	.block-hero + .block-main { margin-top: 0; }
}

/* ---- Grid: cells carry the width, modules inside carry the 5px gutter ---- */
.grid { display: flex; flex-wrap: wrap; align-items: stretch; }
.grid__cell { display: flex; flex-direction: column; min-width: 0; }
.grid__cell > * { flex: 1 1 auto; }
.grid--4 > .grid__cell { width: 25%; }
.grid--2 > .grid__cell { width: 50%; }
.grid--1 > .grid__cell { width: 100%; }

/* ---- Main + sidebar ---- */
.main-row { display: flex; align-items: flex-start; }
.main-col { width: var(--w-main); min-width: 0; }
.sidebar { width: var(--w-sidebar); min-width: 0; }
.sidebar > .grid__cell { width: 100%; }
.content { margin: var(--sp-gutter); }

/* ---- ≤959px: tablets and phones ---- */
@media (max-width: 959px) {
	.headerbar > .wrapper { padding: 0 var(--sp-mobile); }
	.block-hero .wrapper,
	.block-main,
	.block-bottom,
	.block-footer { padding: var(--sp-mobile); }
	.hero__spacer { height: 375px; margin: 0 var(--sp-gutter); }

	.main-row { flex-wrap: wrap; }
	.main-col { width: 100%; }
	.sidebar { width: 100%; display: flex; flex-wrap: wrap; align-items: stretch; }
	.sidebar > .grid__cell { width: 50%; }
}

/* ---- 480–959px (tablets portrait, phones landscape): product boxes two per row ---- */
@media (min-width: 480px) and (max-width: 959px) {
	.grid--4 > .grid__cell { width: 50%; }
	.sidebar > .grid__cell:nth-child(odd):last-child { width: 100%; }
}

/* ---- ≤767px: phones ---- */
@media (max-width: 767px) {
	.headerbar > .wrapper { padding-bottom: var(--sp-mobile); }
}

/* ---- ≤479px: phones portrait, one column ---- */
@media (max-width: 479px) {
	.grid--4 > .grid__cell,
	.grid--2 > .grid__cell,
	.sidebar > .grid__cell { width: 100%; }
}
