/* =========================================================================
 * Hero 001 — Two Homes Switcher
 *
 * One grid inside an inset, rounded frame:
 *
 *   top   top        corner labels
 *   copy  cards      eyebrow, h1, the home's line  |  the two home cards
 *   foot  foot       the home's label · scroll · counter, with the 7 s line
 *
 * The frame is drawn with clip-path, not margins: the section stays a normal
 * full-width band (the theme's alignfull geometry is left alone, AGENTS.md
 * "CSS traps") and only its visible part is inset. State classes come from
 * pattern.js: `is-second` (the second home is showing), `is-paused`.
 * ========================================================================= */

.hero-001 {
	--hero-001-card-w: clamp(200px, 20vw, 320px);
	--hero-001-card-h: clamp(105px, 10.3vw, 165px);
	/* The copy's inset inside the frame: 4% of the screen, as the draft (4% of
	   the frame) — a composition offset that keeps growing past 1600 px, where
	   the spacing scale stops. */
	--hero-001-pad: calc(var(--hero-inset) + 4vw);

	position: relative;
	isolation: isolate;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-rows: auto 1fr auto;
	grid-template-areas:
		"top  top"
		"copy cards"
		"foot foot";
	column-gap: var(--space-lg);
	/* 16:9 like the draft, never taller than the screen under the header. A
	   height, not aspect-ratio: with a max-height, aspect-ratio narrows the
	   frame instead of shortening it. */
	height: clamp(36rem, 56.25vw, calc(100svh - var(--header-height) - var(--hero-inset)));
	padding: var(--space-md) var(--hero-001-pad) var(--space-sm);
	overflow: hidden;
	clip-path: inset(0 var(--hero-inset) round var(--radius-lg));
	color: var(--color-on-dark);
}

/* Core's flow layout spaces every child; this grid places them itself. */
.hero-001.hero-001 > * {
	margin: 0;
}

/* The shade over the photos: light at the top, deeper at the foot. */
.hero-001::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(
		180deg,
		color-mix(in srgb, var(--color-primary-dark) 19%, transparent),
		color-mix(in srgb, var(--color-primary-dark) 6%, transparent) 20%,
		color-mix(in srgb, var(--color-primary-dark) 55%, transparent) 100%
	);
	pointer-events: none;
}

/* The two photos fill the frame; the second fades in over the first. Doubled
   class: the editor makes every block position:relative (AGENTS.md). */
.hero-001__image.hero-001__image {
	position: absolute;
	inset: 0;
	z-index: -2;
	margin: 0;
	transition: opacity 1s ease;
}

.hero-001__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center 58%;
	transform: scale(1.04);
}

.hero-001__image + .hero-001__image {
	opacity: 0;
}

.hero-001.is-second .hero-001__image + .hero-001__image {
	opacity: 1;
}

/* Corner labels. */
.hero-001__top {
	grid-area: top;
	font-size: var(--wp--preset--font-size--xs);
	letter-spacing: 0.17em;
	text-transform: uppercase;
}

.hero-001__top p {
	margin: 0;
}

/* The copy. */
.hero-001__copy {
	grid-area: copy;
	align-self: end;
	padding-bottom: var(--space-xs);
}

.hero-001__copy > * {
	margin: 0;
}

/* The display line: the h1 step up to a 1440 laptop, then growing on its own
   to the draft's 120 px at 1920 (its big-screen composition). One curve, no
   jump: the clamp's floor is the h1 step, and the line leaves it at 1440,
   where the two are equal (67.5 px). Bespoke: the hero's line only. */
.hero-001 h1 {
	margin-block: var(--space-sm);
	font-size: clamp(var(--heading-1), -5.625rem + 10.9375vw, 7.5rem);
	color: inherit;
}

.hero-001__line {
	max-width: 22rem;
	font-size: var(--wp--preset--font-size--sm);
	line-height: 1.6;
}

/* One line per home: the second shows when the second home does. Counted
   among the lines only (`of`): the eyebrow is a paragraph too. */
.hero-001__line + .hero-001__line,
.hero-001.is-second .hero-001__line:nth-child(1 of .hero-001__line) {
	display: none;
}

.hero-001.is-second .hero-001__line + .hero-001__line {
	display: block;
}

/* The home cards. */
.hero-001__cards {
	grid-area: cards;
	align-self: end;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: var(--space-sm);
}

/* The wrapper pattern.js puts around each card. The cards group is a flow
   layout, whose block gap (a top margin on every child) would add to the flex
   gap above; doubled class to out-weigh core's (0,1,0) rule. */
.hero-001__slot.hero-001__slot {
	position: relative;
	margin: 0;
}

.hero-001__card {
	position: relative;
	isolation: isolate;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	width: var(--hero-001-card-w);
	height: var(--hero-001-card-h);
	margin: 0;
	padding: var(--space-sm);
	overflow: hidden;
	border: 1px solid color-mix(in srgb, var(--color-on-dark) 44%, transparent);
	border-radius: var(--radius);
	background: var(--color-primary);
	box-shadow: 0 8px 25px color-mix(in srgb, var(--color-primary-dark) 13%, transparent);
	cursor: pointer;
}

.hero-001__card.is-active {
	border: 2px solid var(--color-on-dark);
}

.hero-001__card > * {
	margin: 0;
}

.hero-001__card-image.hero-001__card-image {
	position: absolute;
	inset: 0;
	z-index: -2;
	margin: 0;
}

.hero-001__card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s;
}

.hero-001__card:hover .hero-001__card-image img {
	transform: scale(1.04);
}

/* A soft shade from the lower left, so the name reads over any photo. Over
   the photo inside its own layer, not on the card's ::after: the block editor draws its selection outline on a block's own ::after
   (stretched with inset: 0), so a decoration there bends the outline to its
   own size
   (and the card's ::before is its arrow). */
.hero-001__card-image::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background: linear-gradient(
		to bottom left,
		transparent 20%,
		color-mix(in srgb, var(--color-primary-dark) 8%, transparent) 48%,
		color-mix(in srgb, var(--color-primary-dark) 50%, transparent) 100%
	);
}

/* The arrow in the top corner of a card you can switch to. */
.hero-001__card::before {
	content: "";
	position: absolute;
	top: var(--space-xs);
	right: var(--space-xs);
	width: 27px;
	height: 27px;
	background-color: currentColor;
	-webkit-mask: url("../../assets/masks/arrow-up-right.svg") center / contain no-repeat;
	mask: url("../../assets/masks/arrow-up-right.svg") center / contain no-repeat;
}

.hero-001__card.is-active::before {
	visibility: hidden;
}

.hero-001__card-label {
	font-size: var(--wp--preset--font-size--xs);
	letter-spacing: 0.11em;
	text-transform: uppercase;
}

.hero-001__card-name {
	margin-top: var(--space-xs) !important;
	font-family: var(--font-display);
	font-size: var(--wp--preset--font-size--xl);
	line-height: 1.1;
	letter-spacing: -0.02em;
	text-shadow: 0 1px 8px color-mix(in srgb, var(--color-primary-dark) 33%, transparent);
}

.hero-001__card-place {
	margin-top: var(--space-xs) !important;
	font-size: var(--wp--preset--font-size--sm);
	color: color-mix(in srgb, var(--color-on-dark) 88%, transparent);
}

.hero-001__card:focus-visible {
	outline-color: var(--color-on-dark);
}

/* Pause / play, on the active card's corner (added by pattern.js). */
.hero-001__pause {
	position: absolute;
	top: 5px;
	right: 7px;
	z-index: 3;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--color-on-dark);
	cursor: pointer;
}

.hero-001__pause::before {
	content: "";
	width: 24px;
	height: 24px;
	background-color: currentColor;
	-webkit-mask: url("../../assets/masks/pause.svg") center / contain no-repeat;
	mask: url("../../assets/masks/pause.svg") center / contain no-repeat;
}

.hero-001.is-paused .hero-001__pause::before {
	-webkit-mask-image: url("../../assets/masks/play.svg");
	mask-image: url("../../assets/masks/play.svg");
}

.hero-001__pause:hover {
	background: color-mix(in srgb, var(--color-on-dark) 13%, transparent);
}

.hero-001__pause[hidden] {
	display: none;
}

/* The foot: label · scroll · counter, over a line that fills in 7 seconds. */
.hero-001__foot {
	grid-area: foot;
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	margin-top: var(--space-sm) !important;
	padding-top: var(--space-sm);
	border-top: 1px solid color-mix(in srgb, var(--color-on-dark) 31%, transparent);
	font-size: var(--wp--preset--font-size--xs);
	letter-spacing: 0.17em;
	text-transform: uppercase;
}

.hero-001__foot::before {
	content: "";
	position: absolute;
	top: -1px;
	left: 0;
	width: 100%;
	height: 1px;
	background: var(--color-on-dark);
	box-shadow: 0 0 5px color-mix(in srgb, var(--color-on-dark) 25%, transparent);
	transform: scaleX(var(--hero-progress, 0));
	transform-origin: left;
	pointer-events: none;
}

.hero-001__foot p {
	margin: 0;
}

.hero-001__label {
	grid-column: 1;
	grid-row: 1;
}

.hero-001__label + .hero-001__label,
.hero-001.is-second .hero-001__label:nth-child(1 of .hero-001__label) {
	visibility: hidden;
}

.hero-001.is-second .hero-001__label + .hero-001__label {
	visibility: visible;
}

.hero-001__scroll {
	grid-column: 2;
	grid-row: 1;
}

.hero-001__scroll a {
	display: inline-flex;
	align-items: center;
	gap: var(--space-sm);
	color: inherit;
	text-decoration: none;
	white-space: nowrap;
}

/* The arrow glides; the words carry a slow light sweeping across them. */
.hero-001__scroll a::after {
	content: "↓";
	font-size: var(--wp--preset--font-size--lg);
	letter-spacing: 0;
	animation: hero-001-glide 3s cubic-bezier(0.45, 0, 0.2, 1) infinite;
}

.hero-001__count {
	grid-column: 3;
	grid-row: 1;
	text-align: right;
}

@media (prefers-reduced-motion: no-preference) {
	/* The photo settles in from a little closer; the copy rises in. Transform
	   and opacity only, from the first paint: nothing waits on a script. */
	.hero-001__image:first-of-type img {
		animation: hero-001-settle 2.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
	}

	.hero-001__copy > * {
		animation: hero-001-rise 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
	}

	.hero-001__copy > :nth-child(1) { animation-delay: 0.15s; }
	.hero-001__copy > :nth-child(2) { animation-delay: 0.3s; }
	.hero-001__copy > :nth-child(n + 3) { animation-delay: 0.45s; }

	.hero-001__scroll a {
		background: linear-gradient(
			105deg,
			color-mix(in srgb, var(--color-on-dark) 65%, transparent) 43%,
			var(--color-on-dark) 49%,
			var(--color-on-dark) 51%,
			color-mix(in srgb, var(--color-on-dark) 65%, transparent) 57%
		) 100% 0 / 300% 100% no-repeat;
		-webkit-background-clip: text;
		background-clip: text;
		-webkit-text-fill-color: transparent;
		animation: hero-001-shimmer 4s linear infinite;
	}

	.hero-001__scroll a::after {
		-webkit-text-fill-color: var(--color-on-dark);
	}

	.hero-001__scroll a:hover {
		-webkit-text-fill-color: var(--color-on-dark);
	}

	.hero-001__scroll a:hover::after {
		animation-duration: 1.7s;
	}
}

@keyframes hero-001-settle {
	from { transform: scale(1.12); }
}

@keyframes hero-001-rise {
	from { opacity: 0; transform: translateY(25px); }
}

@keyframes hero-001-glide {
	0%, 15%   { transform: translateY(-4px); opacity: 0.45; }
	55%       { transform: translateY(4px); opacity: 1; }
	85%, 100% { transform: translateY(-4px); opacity: 0.45; }
}

@keyframes hero-001-shimmer {
	0%, 12%   { background-position: 100% 0; }
	72%, 100% { background-position: 0% 0; }
}

/* Big screens (over 1600 px): the draft's own composition there — the two
   cards side by side, level with the lead, a larger lead (the display line grows on its own curve, above).
   100rem is the site's declared fourth breakpoint, `xl` (SYSTEM.md,
   "Breakpoints"). */
@media (min-width: 100rem) {
	.hero-001 {
		--hero-001-card-h: 13.125rem;
	}

	.hero-001__foot {
		margin-top: calc(var(--space-md) + var(--space-xs)) !important;
	}

	.hero-001 h1 {
		margin-block: var(--space-sm) var(--space-md);
	}

	.hero-001__line {
		max-width: 26rem;
		font-size: var(--wp--preset--font-size--base);
	}

	.hero-001__cards {
		flex-direction: row;
		align-items: flex-end;
	}
}

/* Phones: edge to edge, a column — copy at the top, the two cards side by
   side at the bottom, the foot under them. */
@media (max-width: 40rem) {
	.hero-001 {
		--hero-001-pad: var(--space-sm);

		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto minmax(0, 1fr) auto auto;
		grid-template-areas: "top" "copy" "cards" "foot";
		row-gap: var(--space-sm);
		height: calc(100svh - var(--wp--custom--header-height-sm) - var(--space-xs));
		padding: var(--space-md) var(--space-sm) var(--space-sm);
		clip-path: none;
	}

	.hero-001__top p:last-child {
		display: none;
	}

	.hero-001__copy {
		align-self: start;
		padding-top: var(--space-sm);
	}

	.hero-001 h1 {
		margin-block: var(--space-xs) var(--space-sm);
	}

	.hero-001__line {
		font-size: var(--wp--preset--font-size--xs);
		line-height: 1.5;
	}

	.hero-001__cards {
		flex-direction: row;
		align-items: stretch;
		gap: var(--space-xs);
	}

	.hero-001__slot {
		flex: 1;
		min-width: 0;
	}

	.hero-001__card {
		width: 100%;
		height: clamp(92px, 18svh, 145px);
		padding: var(--space-xs) var(--space-sm) var(--space-sm);
	}

	.hero-001__card-name {
		font-size: var(--wp--preset--font-size--lg);
	}

	.hero-001__card-place {
		font-size: var(--wp--preset--font-size--xs);
	}

	.hero-001__pause {
		top: 2px;
		right: 2px;
	}

	.hero-001__foot {
		grid-template-columns: minmax(0, 1fr) auto;
		gap: var(--space-xs);
		letter-spacing: 0.06em;
	}

	.hero-001__count {
		display: none;
	}
}
