/*
 * Home (front-page.php) — Figma "Desktop - 1634" 3339:5227 · DESIGN-SPEC §9.2 · tokens only (--sh-*).
 * Desktop 1440 geometry (container 1120 at x=160): hero 150–616 · intro 616–980 · zone bar 1030–1196 ·
 * zones 1246–1799 · animal guide 1849–2289 (440 → 585 → 1087–1409) · trails 2339–3116 · zone 4/5 3156–3516 ·
 * footer 3556 (40 = --sh-footer-gap-top in base.css). Gaps between sections = 50 (40 above the footer / zone 4/5).
 * Tablet/mobile = responsive (D5, no frame).
 */

.sh-home {
	--sh-home-gap: var(--sh-space-40); /* section gap: 50 on desktop, 40 below 1024 */
}

/* ---- 1 · Hero cover [160,150 1120×466] ---- */
/*
 * Figma image fills 670:9367 / 670:9370 / 885:1201 are STRETCH fills with an imageTransform (a crop of the original
 * file). The originals are imported whole, so the crop is reproduced here: the <img> is placed inside its box at
 * left/top/width/height = share of the box (x = -tx/a · w = 1/a · y = -ty/d · h = 1/d, values from figma-file.json).
 * If the owner replaces one of these images with a picture already cut to the box size, remove its --sh-crop-* (DEFERRED).
 */
.sh-home-hero__frame,
.sh-home-intro__card,
.sh-home-zonebar__box {
	position: relative;
	overflow: hidden;
}

.sh-home-hero__img,
.sh-home-intro__img,
.sh-home-zonebar__img {
	position: absolute;
	left: calc(var(--sh-crop-x) * 100%);
	top: calc(var(--sh-crop-y) * 100%);
	width: calc(var(--sh-crop-w) * 100%);
	height: calc(var(--sh-crop-h) * 100%);
	max-width: none;
}

.sh-home-hero__frame {
	aspect-ratio: 1120 / 466;
}

.sh-home-hero__img {
	--sh-crop-x: 0;
	--sh-crop-y: -0.0943787;
	--sh-crop-w: 1;
	--sh-crop-h: 1.0943367;
}

/* ---- 2 · Introduction (padding 40/40 → section 364 tall) ---- */
.sh-home-intro {
	padding-block: var(--sh-space-40);
}

.sh-home-intro__row {
	display: grid;
	grid-template-columns: 551fr 549fr; /* 551 + gap 20 + 549 = 1120 */
	gap: var(--sh-space-20);
	align-items: start;
}

/*
 * Frames 12684 / 885:1200 have radius 22 + Drop Shadow/200 but do not clip and have no fill (no `clip` in the dump):
 * in frame 1470 the pictures keep square corners and the shadow follows the picture's alpha, so no border-radius
 * and the same two shadows (--sh-shadow-200 values, as filter) go on the cropped picture box.
 */
.sh-home-intro__card,
.sh-home-zonebar__box {
	filter: drop-shadow(0 1px 4px rgba(12, 12, 13, 0.05)) drop-shadow(0 1px 4px rgba(12, 12, 13, 0.1));
}

.sh-home-intro__card {
	aspect-ratio: 551 / 284;
}

.sh-home-intro__img {
	--sh-crop-x: 0.2088498;
	--sh-crop-y: -0.0788833;
	--sh-crop-w: 0.580323;
	--sh-crop-h: 1.1218216;
}

.sh-home-intro__text {
	display: flex;
	flex-direction: column;
	gap: var(--sh-space-20);
}

.sh-home-intro__text .sh-read-more-row,
.sh-home-trails__text .sh-read-more-row {
	font: var(--sh-type-read-more-home); /* strut = 22px so the row is 22 tall */
}

/* ---- 3 · Zone bar [160,1030 1120×166] (own section, 50 under Introduction) ---- */
.sh-home-zonebar {
	margin-top: var(--sh-home-gap);
}

.sh-home-zonebar__box {
	aspect-ratio: 1120 / 166;
}

.sh-home-zonebar__img {
	--sh-crop-x: -0.0269297;
	--sh-crop-y: -0.2361700;
	--sh-crop-w: 1.0537154;
	--sh-crop-h: 1.6749452;
}

/* ---- ZONE 1–5 tab hotspots (D56 · template-parts/zone/tabs.php): 5 × 20 % over the tab row (y 833–876 of 710–876 = from 74.1 %) ---- */
.sh-zbar__nav,
.sh-zbar__tabs {
	position: absolute;
	inset: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.sh-zbar__tab {
	position: absolute;
	top: 74.1%;
	bottom: 0;
	left: calc(var(--sh-zbar-i, 0) * 20%);
	width: 20%;
}

.sh-zbar__hit {
	display: block;
	width: 100%;
	height: 100%;
}

.sh-zbar__hit--link:focus-visible {
	outline: 2px solid var(--sh-color-neutral-800);
	outline-offset: -2px;
}

/* ---- 4/6 · Zone cards ---- */
.sh-home-zones__row {
	display: grid;
	align-items: start;
}

.sh-home-zones--main {
	margin-top: var(--sh-home-gap); /* 1196 → 1246 */
}

.sh-home-zones--main .sh-home-zones__row {
	grid-template-columns: repeat(3, 1fr); /* 373.333 each */
}

.sh-home-zones--extra {
	margin-top: var(--sh-space-40); /* AAMM 3116 → 3156 (and 40 more to the footer: base.css) */
}

.sh-home-zones--extra .sh-home-zones__row {
	grid-template-columns: repeat(2, 1fr); /* 560 each */
}

.sh-home-zone {
	display: flex;
	flex-direction: column;
	gap: var(--sh-space-16);
	color: inherit;
	text-decoration: none;
}

.sh-home-zone__media {
	position: relative;
	display: block;
	overflow: hidden;
}

.sh-home-zone--tall .sh-home-zone__media {
	aspect-ratio: 373.333 / 487;
}

.sh-home-zone--wide .sh-home-zone__media {
	aspect-ratio: 560 / 294;
}

.sh-home-zone__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: fill; /* Figma STRETCH (transform ≈ identity) */
}

.sh-home-zone--wide .sh-home-zone__img {
	object-fit: contain; /* Figma scale mode FIT on zone 4/5 */
}

.sh-home-zone__img--hover {
	opacity: 0;
	transition: opacity var(--sh-duration-card) var(--sh-ease);
}

.sh-home-zone:hover .sh-home-zone__img--hover,
.sh-home-zone:focus-visible .sh-home-zone__img--hover {
	opacity: 1;
}

.sh-home-zone:focus-visible {
	outline: 2px solid var(--sh-color-neutral-800);
	outline-offset: 2px;
}

.sh-home-zone__title {
	display: block;
	min-height: 50px; /* two 25px lines (zone 5 is one line but its card is the same 360 tall) */
	text-align: center;
}

.sh-home-zone__title strong {
	font-weight: inherit;
}

.sh-home-zone__sub {
	font-weight: var(--sh-fw-komet-regular);
}

/* ---- 5 · Trails ---- */
.sh-home-trails {
	/* §9.2 row 6: the animal guide (1849–2289) sits between Zone 123 and Trails → guide 2289 → Trails 2339 = 50
	   (D46's 120 applied to the layout without the guide). */
	margin-top: var(--sh-home-gap);
}

.sh-home-trails__text {
	display: flex;
	flex-direction: column;
	gap: var(--sh-space-20);
}

/*
 * Long paragraphs (Variant2 3117:4313: 18/22 left · gap 20). The gaps live inside the block (margin-top on each <p>,
 * the block pulls itself up by one gap) so its height can animate 0 ↔ full without a jump (home.js · 0.3s).
 */
.sh-home-trails__more {
	display: flow-root;
	margin-top: calc(-1 * var(--sh-space-20));
}

.sh-home-trails__more > p {
	margin-top: var(--sh-space-20);
}

.sh-home-trails__more.is-animating {
	overflow: hidden;
	transition: height var(--sh-duration-tile) var(--sh-ease);
}

/* Read more → long paragraphs. Hidden only once JS is ready to toggle them. */
.sh-js .sh-home-trails__more:not(.is-open) {
	display: none;
}

.sh-home-trails__text .sh-read-more-row {
	display: none;
}

.sh-js .sh-home-trails__text .sh-read-more-row {
	display: block;
}

.sh-home-trails__stage {
	display: grid;
	margin-top: var(--sh-space-20);
}

.sh-home-trails__stage > * {
	grid-area: 1 / 1;
}

.sh-home-trails__video {
	align-self: center;
	width: 100%;
	height: auto;
	aspect-ratio: 1120 / 630;
	object-fit: cover;
	pointer-events: none;
	transition: opacity var(--sh-duration-footprint-fade) var(--sh-ease);
}

.sh-home-trails__icons {
	align-self: center;
	display: flex;
	flex-direction: column;
	gap: var(--sh-space-20);
	transition: opacity var(--sh-duration-footprint-fade) var(--sh-ease);
}

.sh-home-trails__stage.is-armed:not(.is-revealed) .sh-home-trails__icons {
	visibility: hidden;
	opacity: 0;
}

.sh-home-trails__stage.is-revealed .sh-home-trails__video {
	opacity: 0;
}

.sh-home-trails__row {
	display: flex;
	justify-content: center;
	gap: 26px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.sh-home-trail {
	flex: 0 1 165px; /* 165 at 1440; shrinks with the container between 1024 and 1199 */
	min-width: 0;
	aspect-ratio: 1;
}

.sh-home-trail__link {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	text-decoration: none;
}

.sh-home-trail__link:focus-visible {
	outline: 2px solid var(--sh-color-neutral-800);
	outline-offset: 2px;
}

.sh-home-trail__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: opacity var(--sh-duration-tile) var(--sh-ease);
}

/* hover 185×185 centred on the 165×165 cell (+10px each side) */
.sh-home-trail__img--hover {
	inset: -6.0606%;
	width: 112.1212%;
	height: 112.1212%;
	z-index: 1;
	opacity: 0;
	pointer-events: none;
}

.sh-home-trail__link:hover .sh-home-trail__img--hover,
.sh-home-trail__link:focus-visible .sh-home-trail__img--hover {
	opacity: 1;
}

.sh-home-trail__link:hover .sh-home-trail__img:not(.sh-home-trail__img--hover),
.sh-home-trail__link:focus-visible .sh-home-trail__img:not(.sh-home-trail__img--hover) {
	opacity: 0;
}

/* Navigator dot 2 stops here: the whole ZONE 1–5 strip (animals + tabs) in view with room above it (BACKLOG #20). */
.sh-home-zonebar {
	scroll-margin-top: var(--sh-space-40);
}

/* ---- Navigator [176,587 30×150] · 4 dots 30×30 gap 10 ---- */
.sh-home-nav {
	position: fixed;
	top: min(587px, calc(100dvh - 170px));
	left: calc(max(var(--sh-tablet-margin), (100% - var(--sh-container)) / 2) + 16px); /* container x + 16 = 176 at 1440 */
	z-index: 5;
	display: none;
	flex-direction: column;
	gap: var(--sh-space-10);
}

.sh-home-nav__dot {
	display: block;
	width: 30px;
	height: 30px;
	border: var(--sh-border-navigator-dot);
	border-radius: 50%;
	background: var(--sh-color-white);
}

.sh-home-nav__dot:focus-visible {
	outline: 2px solid var(--sh-color-neutral-800);
	outline-offset: 2px;
}

/* ---- Desktop ---- */
@media (min-width: 1024px) {
	.sh-home {
		--sh-home-gap: var(--sh-space-50);
	}
}

/* Tablet and up (BACKLOG #20: the dots work at 768 too); phones keep the full text column clear. */
@media (min-width: 768px) {
	.sh-home-nav {
		display: flex;
	}
}

/* ---- Tablet: icons wrap, 4 per row. The icon grid is taller than the video here, so the stage shows the
   video first and swaps to the icons (no empty overlay area). ---- */
@media (max-width: 1023px) {
	.sh-home-trails__stage.is-armed:not(.is-revealed) .sh-home-trails__icons {
		display: none;
	}

	.sh-home-trails__stage.is-revealed .sh-home-trails__video {
		display: none;
	}

	.sh-home-trails__icons {
		flex-flow: row wrap;
		justify-content: center;
		gap: var(--sh-space-20);
	}

	.sh-home-trails__row {
		display: contents;
	}

	.sh-home-trail {
		flex: 0 0 calc((100% - 3 * var(--sh-space-20)) / 4);
	}
}

/* ---- Mobile ---- */
@media (max-width: 767px) {
	.sh-home-intro {
		padding-block: var(--sh-space-25);
	}

	.sh-home-intro__row {
		grid-template-columns: 1fr;
	}

	.sh-home-zones--main .sh-home-zones__row,
	.sh-home-zones--extra .sh-home-zones__row {
		grid-template-columns: 1fr;
		row-gap: var(--sh-space-30);
	}

	.sh-home-trail {
		flex-basis: calc((100% - 2 * var(--sh-space-20)) / 3);
	}
}

/* Zone bar: its "ZONE n" labels live in the image → below 640px keep them readable with a scrollable strip. */
@media (max-width: 639px) {
	.sh-home-zonebar__scroll {
		overflow-x: auto;
	}

	.sh-home-zonebar__box {
		min-width: 640px;
	}
}

@media (max-width: 479px) {
	.sh-home-trails__icons {
		gap: var(--sh-space-16);
	}

	.sh-home-trail {
		flex-basis: calc((100% - var(--sh-space-16)) / 2);
	}
}

@media (prefers-reduced-motion: reduce) {
	.sh-home-zone__img--hover,
	.sh-home-trail__img,
	.sh-home-trails__icons,
	.sh-home-trails__video {
		transition: none;
	}
}

/* ---- 5 · Your animal guide is... (D48 · §9.3 · Figma 3339:5265 [160,1849 1120×440]) ----
   Section = padding 40/40 · gap 50 · 440 tall at start. The result block (name · 3 words · Read more) slides open under
   the row (+50 gap) : 585 tall collapsed, 490 + H expanded. Type = Figma weights through the --sh-fw-komet-* tokens
   (Figma w500 = Komet-Regular · w700 = Bold · w800 = Heavy). */
.sh-guide {
	--sh-guide-text: #494538; /* §9.3 text column colour (no token) */
	--sh-guide-time: 0.3s;
	padding-block: var(--sh-space-40);
	margin-top: var(--sh-home-gap);
	color: var(--sh-color-neutral-900);
}

.sh-guide__title {
	margin: 0;
	font: var(--sh-fw-komet-heavy) 26px/28px var(--sh-font-komet); /* 26 per owner slide p.7 (Figma 30 · P-380) */
	text-align: center;
}

.sh-guide__row {
	display: flex;
	align-items: center;
	gap: var(--sh-space-30);
	margin-top: 45px; /* title → row */
	padding-left: min(190px, calc((100% - 720px) / 2)); /* 190 at 1440; centred when narrower */
}

.sh-guide__text {
	display: flex;
	flex-direction: column;
	gap: 15.5px;
	flex: 0 1 570px;
	min-width: 0;
	color: var(--sh-guide-text);
	font: var(--sh-type-collection); /* Komet 20/25 · Figma w500 */
}

.sh-guide__p {
	margin: 0;
}

.sh-guide__cta {
	align-self: flex-start;
	padding: 0;
	border: 0;
	background: none;
	color: var(--sh-color-neutral-800);
	font: var(--sh-type-collection-bold);
	text-align: left;
	cursor: pointer;
}

button.sh-guide__cta:hover,
button.sh-guide__cta:focus-visible {
	color: var(--sh-color-accent);
	text-decoration: underline;
}

span.sh-guide__cta {
	cursor: default;
}

/* card "?" / card of the animal on show · 120×190 · hand cursor (it is the random button) */
.sh-guide__card {
	position: relative;
	flex: none;
	width: 120px;
	height: 190px;
	padding: 0;
	border: 0;
	background: none;
	perspective: 600px;
	transition: transform 0.2s var(--sh-ease);
}

button.sh-guide__card {
	cursor: pointer;
}

.sh-guide__card-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transform-origin: 50% 50%;
	transition: filter 0.2s var(--sh-ease);
}

.sh-guide__card-fallback {
	display: grid;
	width: 100%;
	height: 100%;
	place-items: center;
	border: 2px solid var(--sh-color-neutral-800);
	border-radius: 10px;
	font: var(--sh-type-metadata);
}

/* flip (random): rotateY 0 → 90° (0.2s ease-in), swap, 90° → 0 (0.2s ease-out) */
.sh-guide__card-img.is-flip-out {
	transform: rotateY(90deg);
	transition: transform 0.2s ease-in;
}

.sh-guide__card-img.is-flip-in {
	transition: transform 0.2s ease-out;
}

@media (hover: hover) {
	button.sh-guide__card:hover,
	.sh-guide__big:hover {
		transform: translateY(-4px);
	}

	button.sh-guide__card:hover .sh-guide__card-img,
	.sh-guide__big:hover .sh-guide__big-img {
		filter: drop-shadow(0 1px 4px rgba(12, 12, 13, 0.05)) drop-shadow(0 1px 4px rgba(12, 12, 13, 0.1)); /* Drop Shadow/200 */
	}
}

.sh-guide__card:focus-visible,
.sh-guide__cta:focus-visible,
.sh-guide__big:focus-visible,
.sh-guide__follow:focus-visible {
	outline: 2px solid var(--sh-color-neutral-800);
	outline-offset: 4px;
}

/* ---- result block: opens 0 → auto with grid-template-rows (no fixed heights) ---- */
.sh-guide__result {
	display: grid;
	grid-template-rows: 0fr;
	visibility: hidden;
	transition: grid-template-rows var(--sh-guide-time) var(--sh-ease), visibility 0s linear var(--sh-guide-time);
}

.sh-guide__result.is-open {
	grid-template-rows: 1fr;
	visibility: visible;
	transition: grid-template-rows var(--sh-guide-time) var(--sh-ease), visibility 0s;
}

.sh-guide__result-clip {
	min-height: 0;
	overflow: hidden;
}

.sh-guide__result-pad {
	padding-top: 50px; /* row → result */
	text-align: center;
}

.sh-guide__name {
	margin: 0;
	font: var(--sh-fw-komet-heavy) 26px/28px var(--sh-font-komet); /* 26 per owner slide p.7 (Figma 30 · P-380) */
}

.sh-guide__words {
	margin: var(--sh-space-10) 0 0;
	font: var(--sh-type-collection-bold);
	transition: margin-top var(--sh-guide-time) var(--sh-ease);
}

/* Read more >> (centre) / Hide >> (right) · inner block unfolds with the same 0.3s */
.sh-guide__more {
	display: grid;
	grid-template-rows: 0fr;
	visibility: hidden;
	text-align: left;
	transition: grid-template-rows var(--sh-guide-time) var(--sh-ease), visibility 0s linear var(--sh-guide-time);
}

.sh-guide__more-clip {
	min-height: 0;
	overflow: hidden;
}

.sh-guide__more-pad {
	padding-top: var(--sh-space-15);
}

.sh-guide__body {
	display: flex;
	align-items: center;
	gap: var(--sh-space-20);
	min-height: 363px;
}

.sh-guide__big {
	display: flex;
	flex: none;
	justify-content: center;
	width: 360px;
	opacity: 0;
	transition: transform 0.2s var(--sh-ease), opacity var(--sh-guide-time) var(--sh-ease);
}

.sh-guide__big-img {
	display: block;
	width: 230px;
	height: 363px;
	object-fit: cover;
	transition: filter 0.2s var(--sh-ease);
}

.sh-guide__copy {
	flex: 1 1 0;
	min-width: 0;
	font: var(--sh-fw-komet-regular) 20px/23px var(--sh-font-komet); /* Figma w500 · lh 23 (frame of the cards) */
	text-align: justify; /* Figma: no hyphenation in the card text */
}

.sh-guide__copy p {
	margin: 0;
}

.sh-guide__copy p + p {
	margin-top: 23px; /* one blank line between paragraphs */
}

.sh-guide__follow {
	display: block;
	width: fit-content;
	margin-top: var(--sh-space-15);
	margin-left: 380px; /* x = 360 + 20 · under the text column */
	color: var(--sh-color-neutral-900);
	font: var(--sh-type-collection-bold);
	text-decoration: none;
}

.sh-guide__follow:hover,
.sh-guide__follow:focus-visible {
	color: var(--sh-color-accent);
	text-decoration: underline;
}

.sh-guide__toggle {
	margin-top: var(--sh-space-10);
	font: var(--sh-type-read-more-home); /* strut 22 = the row is 22 tall */
	text-align: center;
	transition: margin-top var(--sh-guide-time) var(--sh-ease);
}

.sh-guide__toggle .sh-read-more {
	font: var(--sh-type-read-more-home);
}

.sh-guide__toggle .sh-read-more:hover,
.sh-guide__toggle .sh-read-more:focus-visible {
	font: var(--sh-type-read-more-home-hover);
}

/* expanded (state 3): gap 15 everywhere · Hide >> on the right */
.sh-guide__result.is-expanded .sh-guide__words {
	margin-top: var(--sh-space-15);
}

.sh-guide__result.is-expanded .sh-guide__more {
	grid-template-rows: 1fr;
	visibility: visible;
	transition: grid-template-rows var(--sh-guide-time) var(--sh-ease), visibility 0s;
}

.sh-guide__result.is-expanded .sh-guide__big {
	opacity: 1;
}

.sh-guide__result.is-expanded .sh-guide__toggle {
	margin-top: var(--sh-space-15);
	text-align: right;
}

/* no JS → nothing to pick: the card "?" and the text stay (the buttons do nothing) */

/* ---- tablet: the card slot narrows ---- */
@media (max-width: 1023px) {
	.sh-guide__big {
		width: 250px;
	}

	.sh-guide__follow {
		margin-left: 270px;
	}
}

/* ---- mobile: everything stacks, the card goes under the text ---- */
@media (max-width: 767px) {
	.sh-guide {
		padding-block: var(--sh-space-30);
	}

	.sh-guide__title {
		font-size: 26px;
		line-height: 30px;
	}

	.sh-guide__row {
		flex-direction: column;
		margin-top: var(--sh-space-25);
		padding-left: 0;
		gap: var(--sh-space-25);
	}

	.sh-guide__text {
		flex-basis: auto;
		width: 100%;
	}

	.sh-guide__result-pad {
		padding-top: var(--sh-space-30);
	}

	.sh-guide__name {
		font-size: 26px;
		line-height: 30px;
	}

	.sh-guide__body {
		flex-direction: column;
		min-height: 0;
	}

	.sh-guide__copy {
		text-align: left; /* justify in ~330px leaves wide gaps */
	}

	.sh-guide__big {
		width: auto;
	}

	.sh-guide__follow {
		margin-left: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sh-guide__card,
	.sh-guide__card-img,
	.sh-guide__result,
	.sh-guide__result.is-open,
	.sh-guide__result.is-expanded .sh-guide__more,
	.sh-guide__more,
	.sh-guide__words,
	.sh-guide__toggle,
	.sh-guide__big,
	.sh-guide__big-img {
		transition: none;
	}

	.sh-guide__card-img.is-flip-out {
		transform: none;
	}
}
