/*
 * met-core shared primitives: section wrapper, container, eyebrow, buttons,
 * icons and scroll-reveal states. Mobile-first, tokens only.
 * Loaded on the front end and in the editor iframe.
 */

/* ── Section wrapper (shared controls: colour theme, spacing, panel) ───────── */

/* Sections stack flush: beat core's flow-layout block gap (:root :where(...)). */
html .met-section {
	margin-block: 0;
}

.met-section {
	--met-section-bg: var(--wp--preset--color--ink);
	--met-section-pad: var(--wp--custom--section--md);
	position: relative;
	box-sizing: border-box;
	background-color: var(--met-section-bg);
	padding-block: var(--met-section-pad);
	padding-inline: var(--wp--custom--layout--gutter);
	color: var(--wp--preset--color--grout);
}

.met-section--theme-ink { --met-section-bg: var(--wp--preset--color--ink); }
.met-section--theme-charcoal { --met-section-bg: var(--wp--preset--color--charcoal); }
.met-section--theme-slate { --met-section-bg: var(--wp--preset--color--slate); }

.met-section--space-none { --met-section-pad: var(--wp--custom--section--none); }
.met-section--space-sm { --met-section-pad: var(--wp--custom--section--sm); }
.met-section--space-md { --met-section-pad: var(--wp--custom--section--md); }
.met-section--space-lg { --met-section-pad: var(--wp--custom--section--lg); }

/* Inset: stay inside the content padding instead of breaking out full-bleed (alignfull). */
html body .met-section--panel-inset {
	margin-inline: 0;
	padding-inline: var(--wp--preset--spacing--24);
}

@media (min-width: 1024px) {
	.met-section--panel-inset {
		padding-inline: var(--wp--preset--spacing--64);
	}
}

.met-container {
	width: 100%;
	max-width: var(--wp--custom--layout--content);
	margin-inline: auto;
}

.met-section :where(h1, h2, h3, h4, p) {
	margin: 0;
}

/* ── Section header (eyebrow + heading + lede) ─────────────────────────────── */

.met-section-header {
	display: flex;
	flex-direction: column;
	gap: 28px;
}

.met-section-header__title {
	display: flex;
	flex-direction: column;
	gap: 28px;
}

.met-section-header__heading {
	color: var(--wp--preset--color--white);
	font-family: var(--wp--custom--type--heading-2--family);
	font-size: var(--wp--custom--type--heading-2--size);
	font-weight: var(--wp--custom--type--heading-2--weight);
	line-height: var(--wp--custom--type--heading-2--line-height);
	letter-spacing: var(--wp--custom--type--heading-2--letter-spacing);
}

.met-section-header__lede {
	font-family: var(--wp--custom--type--body--family);
	font-size: var(--wp--custom--type--body--size);
	line-height: var(--wp--custom--type--body--line-height);
	color: var(--wp--preset--color--grout);
}

/* Larger lede (gallery subtitle: Body/Default → Body/Large) */
.met-section-header--lede-large .met-section-header__lede {
	font-size: var(--wp--custom--type--body-large--size);
	line-height: var(--wp--custom--type--body-large--line-height);
}

/* Tight mobile stack (gallery header: 16px between items) */
.met-section-header--tight,
.met-section-header--tight .met-section-header__title {
	gap: 16px;
}

@media (min-width: 1024px) {
	.met-section-header--tight {
		gap: var(--wp--preset--spacing--48);
	}

	.met-section-header--tight .met-section-header__title {
		gap: 20px;
	}

	.met-section-header--split.met-section-header--lede-large .met-section-header__lede {
		flex: 0 0 auto;
	}

	.met-section-header--split {
		flex-direction: row;
		align-items: flex-end;
		justify-content: space-between;
		gap: var(--wp--preset--spacing--48);
	}

	.met-section-header__title {
		gap: 20px;
	}

	.met-section-header--split .met-section-header__lede {
		flex: 0 1 420px;
	}
}

/* ── Eyebrow ───────────────────────────────────────────────────────────────── */

.met-eyebrow,
p.is-style-eyebrow {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	color: var(--wp--preset--color--grout);
	font-family: var(--wp--custom--type--eyebrow--family);
	font-size: var(--wp--custom--type--eyebrow--size);
	font-weight: var(--wp--custom--type--eyebrow--weight);
	line-height: var(--wp--custom--type--eyebrow--line-height);
	letter-spacing: var(--wp--custom--type--eyebrow--letter-spacing);
	text-transform: uppercase;
}

.met-eyebrow::before,
p.is-style-eyebrow::before {
	content: "";
	flex: 0 0 24px;
	height: 2px;
	background: var(--wp--preset--color--edge-orange);
}

@media (min-width: 1024px) {
	.met-eyebrow::before,
	p.is-style-eyebrow::before {
		flex-basis: 32px;
	}
}

/* ── Icons ─────────────────────────────────────────────────────────────────── */

.met-icon {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	display: block;
}

/* ── Buttons: Figma "Button" (Primary / Secondary / Text) ──────────────────── */

.wp-block-buttons {
	gap: var(--wp--preset--spacing--16);
}

.wp-block-button .wp-block-button__link,
.met-button {
	--met-btn-bg: var(--wp--preset--color--edge-orange);
	--met-btn-fg: var(--wp--preset--color--ink);
	--met-btn-border: transparent;
	--met-btn-arrow: currentColor;
	display: inline-flex;
	align-items: center;
	gap: 12px;
	box-sizing: border-box;
	padding: 18px 24px 18px 28px;
	border: 0;
	border-radius: var(--wp--custom--radius--sm);
	background-color: var(--met-btn-bg);
	color: var(--met-btn-fg);
	font-family: var(--wp--custom--type--button--family);
	font-size: var(--wp--custom--type--button--size);
	font-weight: var(--wp--custom--type--button--weight);
	line-height: var(--wp--custom--type--button--line-height);
	letter-spacing: var(--wp--custom--type--button--letter-spacing);
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition:
		gap var(--wp--custom--motion--duration--button) var(--wp--custom--motion--easing--out),
		background-color var(--wp--custom--motion--duration--button) var(--wp--custom--motion--easing--out),
		border-color var(--wp--custom--motion--duration--button) var(--wp--custom--motion--easing--out),
		color var(--wp--custom--motion--duration--button) var(--wp--custom--motion--easing--out),
		background-size var(--wp--custom--motion--duration--button) var(--wp--custom--motion--easing--out);
}

.wp-block-button .wp-block-button__link:hover,
.met-button:hover {
	--met-btn-bg: var(--wp--preset--color--edge-orange-hover);
	gap: 16px;
	color: var(--met-btn-fg);
}

.wp-block-button .wp-block-button__link:active,
.met-button:active {
	--met-btn-bg: var(--wp--preset--color--edge-orange-pressed);
	gap: 12px;
}

.wp-block-button .wp-block-button__link:focus-visible,
.met-button:focus-visible {
	outline: none;
	box-shadow: inset 0 0 0 2px var(--wp--preset--color--marble);
}

/* Small (header + quote bar CTA): 48px tall. */
.met-button--sm {
	padding-block: 14px;
}

/* Secondary (outline). */
.wp-block-button.is-style-secondary .wp-block-button__link,
.met-button--secondary {
	--met-btn-bg: transparent;
	--met-btn-fg: var(--wp--preset--color--marble);
	--met-btn-border: var(--wp--custom--color--marble-40);
	border: 1px solid var(--met-btn-border);
}

.wp-block-button.is-style-secondary .wp-block-button__link:hover,
.met-button--secondary:hover {
	--met-btn-bg: var(--wp--custom--color--white-6);
	--met-btn-fg: var(--wp--preset--color--white);
	--met-btn-border: var(--wp--preset--color--edge-orange);
}

.wp-block-button.is-style-secondary .wp-block-button__link:active,
.met-button--secondary:active {
	--met-btn-bg: var(--wp--custom--color--white-12);
	--met-btn-fg: var(--wp--preset--color--white);
	--met-btn-border: var(--wp--preset--color--edge-orange);
}

.wp-block-button.is-style-secondary .wp-block-button__link:focus-visible,
.met-button--secondary:focus-visible {
	--met-btn-border: var(--wp--preset--color--edge-orange);
	--met-btn-fg: var(--wp--preset--color--white);
	box-shadow: 0 0 0 1px var(--wp--preset--color--edge-orange);
}

/* Text link (label + arrow, orange underline that grows on hover). */
.wp-block-button.is-style-text .wp-block-button__link,
.met-button--text {
	--met-btn-bg: transparent;
	--met-btn-fg: var(--wp--preset--color--marble);
	--met-btn-arrow: var(--wp--preset--color--edge-orange);
	gap: 8px;
	padding: 0 0 7.5px;
	border: 0;
	border-radius: 0;
	background-image: linear-gradient(var(--wp--preset--color--edge-orange), var(--wp--preset--color--edge-orange));
	background-repeat: no-repeat;
	background-position: 0 100%;
	background-size: 24px 1.5px;
}

.wp-block-button.is-style-text .wp-block-button__link:hover,
.met-button--text:hover {
	--met-btn-bg: transparent;
	--met-btn-fg: var(--wp--preset--color--white);
	gap: 12px;
	background-size: 100% 1.5px;
}

.wp-block-button.is-style-text .wp-block-button__link:active,
.met-button--text:active {
	--met-btn-bg: transparent;
	--met-btn-fg: var(--wp--preset--color--white);
	gap: 8px;
	opacity: 0.75;
}

.wp-block-button.is-style-text .wp-block-button__link:focus-visible,
.met-button--text:focus-visible {
	box-shadow: none;
	outline: 2px solid var(--wp--preset--color--edge-orange);
	outline-offset: 4px;
}

/* Arrow (Figma "Show arrow"): core/button gets .has-met-arrow from the editor toggle. */
.wp-block-button.has-met-arrow .wp-block-button__link::after,
.met-button--arrow::after {
	content: "";
	flex: 0 0 20px;
	width: 20px;
	height: 20px;
	background-color: var(--met-btn-arrow);
	-webkit-mask: url(../icons/arrow-right.svg) center / 20px 20px no-repeat;
	mask: url(../icons/arrow-right.svg) center / 20px 20px no-repeat;
}

/* ── Scroll reveal (Figma "Scroll Reveal — Demo") ──────────────────────────── */

[data-met-reveal] {
	--met-reveal-x: 0px;
	--met-reveal-y: 32px;
	--met-reveal-duration: var(--wp--custom--motion--duration--reveal);
}

[data-met-reveal="card"] {
	--met-reveal-y: 40px;
	--met-reveal-duration: 800ms;
}

[data-met-reveal="left"] {
	--met-reveal-x: -40px;
	--met-reveal-y: 0px;
	--met-reveal-duration: 900ms;
}

.met-js:not(.met-no-motion) [data-met-reveal] {
	transition:
		opacity var(--met-reveal-duration) var(--wp--custom--motion--easing--reveal) var(--met-reveal-delay, 0ms),
		translate var(--met-reveal-duration) var(--wp--custom--motion--easing--reveal) var(--met-reveal-delay, 0ms);
}

.met-js:not(.met-no-motion) [data-met-reveal]:not(.is-revealed) {
	opacity: 0;
	translate: var(--met-reveal-x) var(--met-reveal-y);
}

@media (prefers-reduced-motion: reduce) {
	.met-js [data-met-reveal] {
		opacity: 1 !important;
		translate: none !important;
		transition: none !important;
	}
}

/* ── Utilities ─────────────────────────────────────────────────────────────── */

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.met-accent {
	color: var(--wp--preset--color--edge-orange);
}

/* Temporary anchored placeholders for sections that land in Phase 2 (seeded homepage). */
.met-placeholder {
	padding-block: var(--wp--custom--section--md);
	border-block: 1px dashed var(--wp--custom--color--grout-12);
	color: var(--wp--preset--color--stone);
	text-align: center;
}

/* Editor: image pickers inside blocks match the dark design instead of a white box. */
.met-media-placeholder.components-placeholder {
	min-height: 100%;
	background: var(--wp--preset--color--slate);
	color: var(--wp--preset--color--grout);
	box-shadow: inset 0 0 0 1px var(--wp--custom--color--grout-12);
}

.met-media-placeholder.components-placeholder .components-placeholder__label,
.met-media-placeholder.components-placeholder .components-placeholder__instructions {
	color: var(--wp--preset--color--grout);
}
