/*
 * SGHR home page sections — styles for the pattern-driven sections
 * (audience, promanu teaser, membership CTA) inserted into the Home
 * Page. The CPT-backed custom blocks (home-finder, home-events,
 * home-news) ship their own per-block stylesheets via block.json
 * `style` so they only load when the block actually renders.
 *
 * Token-only: no hex literals, every visual value resolves to a
 * theme.json preset via `var(--wp--preset--*)` or a CSS custom
 * property declared here. A brand refresh is a pure tokens edit.
 *
 * Breakpoints kept in lockstep with chrome.css:
 *   - `min-width: 880px`  -- two-column promanu / membership layouts
 *                           switch from stacked to side-by-side.
 *   - `min-width: 1180px` -- desktop final spacing; audience grid
 *                           reaches its three-up max.
 */

:root {
	--sghr-section-pad-y: clamp(3rem, 4rem + 3vw, 5.5rem);
	--sghr-section-pad-x: clamp(1.25rem, 1.5rem + 4vw, 7.5rem);
	--sghr-card-radius:   var(--wp--custom--radius--lg, 16px);
	--sghr-card-shadow:   var(--wp--custom--shadow--lg, 0 10px 28px rgba(26, 31, 38, 0.09), 0 0 0 1px rgba(26, 31, 38, 0.04));
	--sghr-pill-radius:   var(--wp--custom--radius--pill, 999px);
}

/* ------------------------------------------------------------------ *
 * Full-bleed section frame                                            *
 * Shared by every home section -- pattern markup and custom blocks    *
 * alike apply `.sghr-section` to the outer container so background    *
 * colors set via `backgroundColor` extend edge-to-edge with the same  *
 * vertical rhythm everywhere. We use the class directly (not a `>`    *
 * combinator) because `wp:post-content` may wrap its inner blocks in  *
 * an `.entry-content` div, depending on the layout setting.           *
 * ------------------------------------------------------------------ */

/* True viewport-edge full-bleed.
 *
 * Why this is more aggressive than a normal CSS reset:
 *
 * WordPress' core block layout system emits per-page inline `<style>`
 * tags in `<head>` for every constrained / flex / grid layout group
 * on the page. Those inline rules look like
 *   `:where(.is-layout-constrained) > .alignfull { max-width:none;
 *    margin-left:calc(-1*var(--wp--style--root--padding-left)); ... }`
 * Specificity is 1 (single class via `:where()`), exactly the same as
 * our `.sghr-section` selector -- and the inline `<style>` typically
 * lands AFTER our external `home.css`, so on cascade-order WP wins
 * and our 100vw ramp loses, leaving the section stuck inside the
 * 80rem-capped main.
 *
 * Two compounding mitigations: (a) bump our selector specificity by
 * pairing `.sghr-section` with `.alignfull` (every home section
 * carries both), giving us spec 2; (b) mark the four declarations
 * that actually matter as `!important` so even a future WP version
 * that adds `!important` of its own can't overrun us.
 */
.sghr-section.alignfull,
.sghr-section {
	width: 100vw !important;
	max-width: 100vw !important;
	margin-left:  calc(50% - 50vw) !important;
	margin-right: calc(50% - 50vw) !important;
	padding-block:  var(--sghr-section-pad-y);
	padding-inline: var(--sghr-section-pad-x);
	box-sizing: border-box;
}

/* Constrain inner content; the section background still spans full-width. */
.sghr-section > .wp-block-columns,
.sghr-section > .wp-block-group,
.sghr-section > .wp-block-list {
	max-width: 80rem;
	margin-inline: auto;
}

/* ------------------------------------------------------------------ *
 * Kill block-gap between vertically stacked, fully-bleeded sections   *
 * so coloured backgrounds touch edge-to-edge instead of leaving a     *
 * strip of body-colour between them.                                  *
 *                                                                     *
 * Two scopes:                                                         *
 *                                                                     *
 *  1. Top-level children of `wp:site-blocks` on the homepage. WP's    *
 *     core layout system emits `:where(.wp-site-blocks)>*{margin-     *
 *     block-start: var(--block-gap)}`, which puts a 1.5rem strip      *
 *     between header / hero / main / footer. Scoping our zero-out     *
 *     to `body.home` makes sure it only applies to the front page;    *
 *     sub-pages keep their natural breather between sections.         *
 *                                                                     *
 *  2. Direct children of `wp:post-content` inside main. The same     *
 *     global block-gap is re-applied between each section the editor *
 *     places inside the home page. Vertical rhythm INSIDE each       *
 *     section (paragraph + heading + button stacks) keeps its         *
 *     normal theme.json block-gap because this rule only targets the *
 *     immediate children of post-content.                             *
 *                                                                     *
 * Both rules use `!important` because WP's emitted layout CSS lands  *
 * inline in the document head and uses the same specificity (spec 1) *
 * via `:where()`, so cascade order is unpredictable.                 *
 * ------------------------------------------------------------------ */

body.home .wp-site-blocks > * {
	margin-block-start: 0 !important;
}

/* `.sghr-footer` (in `chrome.css`) carries its own `margin-top:
 * clamp(2rem,4vw,4rem)` to give a breather between content and
 * the footer on regular pages. On the homepage we want every
 * coloured section to butt directly against the footer, so we
 * zero that margin out here.
 *
 * Why this is separate from the `.wp-site-blocks > *` rule
 * above: that rule targets the OUTER `<footer class="wp-block-
 * template-part">`. The `margin-top` actually comes from the
 * INNER `<footer class="sghr-footer">` (the custom block) and
 * collapses up through the empty template-part wrapper, so it
 * shows as a gap above the entire footer despite the outer
 * wrapper having `margin-block-start: 0`. */
body.home .sghr-footer {
	margin-top: 0 !important;
}

.sghr-front-main > .wp-block-post-content > * + *,
.sghr-front-main > .wp-block-post-content > .wp-block-group + .wp-block-group {
	margin-block-start: 0 !important;
}

/* `width: 100vw` includes scrollbar width on platforms with
 * traditional (non-overlay) scrollbars -- Windows desktop in
 * particular. Without a clip somewhere, the homepage would gain a
 * 15-17px horizontal scrollbar there.
 *
 * CRITICAL: the clip MUST live on a viewport-wide ancestor (body or
 * the WP site-blocks wrapper), NOT on `.sghr-front-main`. Main is
 * itself constrained to 80rem by the template's `layout.constrained`
 * setting, so clipping on main would chop the section's 100vw
 * background DOWN to 80rem -- defeating the entire full-bleed point
 * and producing the symptom we just spent a round chasing.
 *
 * `overflow: clip` (not `hidden`) is intentional: it forbids
 * scrolling without establishing a new scroll container, so the
 * sticky header still has `html` as its scrolling ancestor and
 * sticky positioning keeps working. */
body.home,
body.page-template-front-page,
.wp-site-blocks {
	overflow-x: clip;
}

/* ------------------------------------------------------------------ *
 * Section: Audience cards (sghr-audience)                             *
 * Three primary-soft cards beneath the hero. At <782px wp:columns     *
 * stacks them automatically; we just style each card's chrome.        *
 * ------------------------------------------------------------------ */

.sghr-audience__grid {
	gap: 1.25rem !important;
}

.sghr-audience__card {
	position: relative;
	display: flex;
	flex-direction: column;
	padding: 2.25rem;
	background: var(--wp--preset--color--primary-soft);
	border-radius: var(--sghr-card-radius);
	transition: transform var(--sghr-chrome-dur, 200ms) var(--sghr-chrome-ease, ease),
	            box-shadow var(--sghr-chrome-dur, 200ms) var(--sghr-chrome-ease, ease);
}

.sghr-audience__card:hover,
.sghr-audience__card:focus-within {
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(26, 31, 38, 0.08);
}

/* Fixed gap between the icon row and the title. The Pencil source
 * sets `gap: 18` on the card, but it also sets
 * `justifyContent: space_between` on a fixed-height (224px) card --
 * so the 18 is just the MINIMUM gap, and any leftover vertical
 * space (~20px on top of the 18) gets distributed between the two
 * children. The effective visual gap in the design is therefore
 * ~38px, not 18px. We pin that here instead of going back to
 * `margin-top: auto` + a fixed card height, because letting the
 * gap stretch with min-height felt like wasted vertical air at
 * our typical viewport. */
.sghr-audience__head + .sghr-audience__title {
	margin-top: 2.375rem;
}

.sghr-audience__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.875rem;
}

.sghr-audience__icon {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/* Override the icon block's inline width/height -- the badge is
	 * a 3.5rem white pill that hosts the 1.75rem lucide glyph. */
	width: 3.5rem !important;
	height: 3.5rem !important;
	padding: 0.875rem;
	background: var(--wp--preset--color--surface);
	border-radius: 0.875rem;
	color: var(--wp--preset--color--primary);
}

.sghr-audience__arrow {
	display: inline-flex;
	color: var(--wp--preset--color--primary);
	transition: transform var(--sghr-chrome-dur, 200ms) var(--sghr-chrome-ease, ease);
}

.sghr-audience__card:hover .sghr-audience__arrow {
	transform: translate(3px, -3px);
}

.sghr-audience__title {
	margin: 0;
	font-size: var(--wp--preset--font-size--xl);
	font-weight: 600;
	line-height: 1.2;
	color: var(--wp--preset--color--ink);
}

.sghr-audience__title a {
	color: inherit;
	text-decoration: none;
}

.sghr-audience__title a::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
}

.sghr-audience__title a:focus-visible {
	outline: none;
}

.sghr-audience__card:focus-within {
	box-shadow: 0 0 0 3px var(--wp--preset--color--primary);
}

.sghr-audience__desc {
	margin: 0.5rem 0 0;
	font-size: var(--wp--preset--font-size--base);
	color: var(--wp--preset--color--ink-muted);
	line-height: 1.55;
}

/* ------------------------------------------------------------------ *
 * Section: Promanu magazine teaser (sghr-promanu)                     *
 * Cover image left, text block right at desktop; stacks at <880px.    *
 * ------------------------------------------------------------------ */

.sghr-promanu__inner {
	gap: clamp(2rem, 3rem + 2vw, 5rem) !important;
	align-items: center;
}

.sghr-promanu__cover {
	flex: 0 0 auto;
	margin: 0;
}

.sghr-promanu__cover img {
	display: block;
	width: 100%;
	max-width: 20rem;
	height: auto;
	border-radius: 6px;
	box-shadow: 0 24px 40px rgba(26, 31, 38, 0.25);
}

.sghr-promanu__text {
	flex: 1 1 22rem;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.sghr-promanu__kicker {
	margin: 0;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	color: var(--wp--preset--color--primary);
}

.sghr-promanu__title {
	margin: 0;
	font-weight: 600;
	line-height: 1.15;
	color: var(--wp--preset--color--ink);
}

.sghr-promanu__desc {
	margin: 0;
	line-height: 1.55;
	color: var(--wp--preset--color--ink-muted);
}

/* ------------------------------------------------------------------ *
 * Section: Membership CTA (sghr-membership)                           *
 * ------------------------------------------------------------------ */

.sghr-membership__inner {
	gap: clamp(2rem, 3rem + 2vw, 5rem) !important;
	align-items: center;
}

.sghr-membership__lead {
	flex: 1 1 22rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.sghr-membership__kicker {
	margin: 0;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	color: var(--wp--preset--color--primary);
}

.sghr-membership__title {
	margin: 0;
	font-weight: 600;
	line-height: 1.15;
	color: var(--wp--preset--color--ink);
}

.sghr-membership__desc {
	margin: 0;
	line-height: 1.55;
	color: var(--wp--preset--color--ink-muted);
}

.sghr-membership__benefits {
	flex: 1 1 22rem;
	display: flex;
	flex-direction: column;
	gap: 1.125rem;
}

/* The benefits container is a `wp:group` with the default flow
 * layout, so WordPress injects `margin-block-start:
 * var(--wp--style--block-gap)` (=1.5rem) onto each non-first
 * child via the `:where(.is-layout-flow) > *` selector. That
 * compounds with our `gap: 1.125rem` above, making the rows sit
 * ~42px apart instead of the design's 18px. Zero out the
 * WP-injected margin so the flex gap is the only thing spacing
 * the rows. */
.sghr-membership__benefits > * {
	margin-block-start: 0 !important;
}

.sghr-membership__benefit {
	display: flex;
	align-items: center;
	gap: 0.875rem;
}

.sghr-membership__benefit-label {
	margin: 0;
	font-weight: 500;
	color: var(--wp--preset--color--ink);
	line-height: 1.4;
}

.sghr-membership__check {
	flex: 0 0 auto;
	box-sizing: border-box;
	/* Override the inline width/height the icon block sets so the
	 * check icon sits inside a 2rem pill background. The icon block
	 * uses `style=" width: <size>; height: <size>"` inline, which is
	 * higher specificity than a regular declaration -- hence the
	 * `!important` on the badge dimensions. */
	width: 2rem !important;
	height: 2rem !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--wp--preset--color--surface);
	border-radius: var(--sghr-pill-radius);
	color: var(--wp--preset--color--primary);
	padding: 0.4375rem;
}

/* The `is-style-sghr-pill` button style lives in `assets/css/
 * chrome.css` -- it's a theme-wide variant, not a home-page
 * concern, so the CSS sits next to the rest of the reusable
 * chrome (header, footer, etc.) and is loaded on every page. */
