/*
 * Introduction page (D50 · DESIGN-SPEC §9.4 · Figma 3339:6117–6228). Auto-enqueued for page-intro.php.
 * Order at 1440 (y from the page top): header 0–150 (core) · orange head 150–1248 · heading 1248–1477 · map 1477–2286 ·
 * chapter sections from 2285/2286 (ch1 → 4356 · ch2 → 5317 · ch3 → 5183 · ch4 → 3813).
 * ≥1280: blocks are placed from the layout JSON (x, y inside the section, width) · <1280: everything stacks (§9.4 E.6).
 * Komet is not installed yet (D6) → glyph metrics differ from Figma; sizes/line-heights/weights are the Figma values.
 */

.sh-intro {
	--intro-margin: max(var(--sh-tablet-margin), calc((100% - var(--sh-container)) / 2));
	--intro-text: var(--sh-color-neutral-800);
	overflow-x: clip;
}

/* ---- B. Orange head [0,150 1440×1098] #DD7F6A ---- */
.sh-intro__head {
	position: relative;
	background: var(--bg, #dd7f6a);
	color: #fff9ef;
}

.sh-intro__head-in {
	padding: 66px var(--intro-margin) 70.9px;
}

.sh-intro__head-top {
	display: flex;
	align-items: flex-start;
	gap: 55.8px; /* emblem right 485.2 → title x 541 */
}

.sh-intro__emblem {
	position: relative;
	flex: 0 0 325.2px;
	width: 325.2px;
	height: 320.5px;
	overflow: hidden;
}

.sh-intro__head-title {
	flex: 0 1 739px;
	min-width: 0;
	margin-top: 118px; /* 334 − 216 */
	color: var(--c, #f4f1e6);
	font-family: var(--sh-font-komet);
	font-size: var(--fs, 40px);
	font-weight: var(--fw, var(--sh-fw-komet-heavy));
	line-height: var(--lh, 51.85px);
	text-align: var(--ta, left);
}

.sh-intro__head-text {
	margin-top: 35.6px; /* 572.1 − 536.5 */
}

.sh-intro__head-p,
.sh-intro__head-credit {
	font-family: var(--sh-font-komet);
	font-size: var(--fs, 20px);
	font-weight: var(--fw, var(--sh-fw-komet-medium));
	line-height: var(--lh, 26px);
	color: var(--c, #fff9ef);
	text-align: var(--ta, justify);
}

.sh-intro__head-p + .sh-intro__head-p,
.sh-intro__head-p + .sh-intro__head-credit {
	margin-top: 40px;
}

.sh-intro__head-credit {
	font-weight: var(--fw, var(--sh-fw-komet-regular));
	line-height: var(--lh, 28.28px);
	text-align: var(--ta, left);
}

/* "Continue down" (P-273 default): 42.4×30.6 tab hanging 18.1 below the orange band, scrolls to the map. */
.sh-intro__down {
	position: absolute;
	z-index: 2;
	top: calc(100% - 11.5px);
	left: calc(50% - 20px);
	display: grid;
	place-items: center;
	width: 42.4px;
	height: 30.6px;
	border-radius: 0 0 4px 4px;
	background: var(--bg, #dd7f6a);
	color: #fff;
}

.sh-intro__down:focus-visible,
.sh-intro__tab:focus-visible,
.sh-intro__arrow:focus-visible {
	outline: 2px solid #403b2f;
	outline-offset: 2px;
}

/* ---- C. Heading [0,1248 1440×229] ---- */
.sh-intro__env {
	display: flex;
	align-items: center;
	min-height: 229px;
	padding: 30px var(--intro-margin);
}

.sh-intro__env-title {
	color: var(--c, #403b2f);
	font-family: var(--sh-font-komet);
	font-size: clamp(24px, 5.2vw, var(--fs, 40px));
	font-weight: var(--fw, var(--sh-fw-komet-heavy));
	line-height: 53.03px;
	text-align: left;
}

/* ---- Map + controls ---- */
.sh-intro__stage {
	position: relative;
}

.sh-intro__map {
	position: relative;
	max-width: 1440px;
	margin-inline: auto;
	aspect-ratio: var(--bw, 1440) / var(--bh, 809);
	overflow: hidden;
}

.sh-intro__fill {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

.sh-intro__map--fit .sh-intro__fill,
.sh-intro__fig--fit .sh-intro__fill {
	object-fit: contain;
}

.sh-intro__crop {
	position: absolute;
	max-width: none;
}

.sh-intro__controls {
	position: absolute;
	z-index: 3;
	top: 0;
	right: 0;
	left: 0;
	max-width: 1440px;
	margin-inline: auto;
	aspect-ratio: 1440 / 809;
	pointer-events: none;
}

.sh-intro__tabs {
	position: absolute;
	top: 30px;
	right: 40px; /* 1440 − (1356 + 44) */
	display: flex;
	gap: 12px;
}

.sh-intro__tab {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border: 1.5px solid #403b2f;
	border-radius: 23px;
	background: var(--inactive, #dedcc3);
	color: #403b2f;
	font-family: var(--sh-font-komet);
	font-size: 22px;
	font-weight: var(--sh-fw-komet-regular);
	line-height: 1;
	text-decoration: none;
	pointer-events: auto;
}

.sh-intro__tab.is-active {
	background: var(--active, #d1cc5c);
}

.sh-intro__arrow {
	position: absolute;
	top: calc(362.9 / 809 * 100%);
	display: grid;
	place-items: center;
	width: 28.3px;
	height: 56.6px;
	padding: 0;
	border: 0;
	background: none;
	color: #000;
	cursor: pointer;
	pointer-events: auto;
}

.sh-intro__arrow[hidden] {
	display: none;
}

.sh-intro__arrow.is-off {
	visibility: hidden;
}

.sh-intro__arrow--prev {
	left: 35.4px;
	transform: scaleX(-1);
}

.sh-intro__arrow--next {
	right: 30.6px; /* 1440 − (1381.1 + 28.3) */
}

/* ---- D. Chapter content ---- */
.sh-intro__chapter {
	transition: opacity 0.2s var(--sh-ease);
}

.sh-intro__chapter.is-fading {
	opacity: 0;
}

/* first paint with JS: only the chapter of the hash (page-intro.php inline script · removed by intro.js) */
.sh-intro-js .sh-intro__chapter {
	display: none;
}

.sh-intro-c1 #chapter-1,
.sh-intro-c2 #chapter-2,
.sh-intro-c3 #chapter-3,
.sh-intro-c4 #chapter-4 {
	display: block;
}

.sh-intro__sec {
	background: var(--bg, #fff);
}

.sh-intro__sec-in {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 30px;
	max-width: 1440px;
	margin-inline: auto;
	padding: 40px var(--intro-margin);
}

.sh-intro__row,
.sh-intro__col {
	display: contents; /* <1280: blocks stack in order (rows / columns only matter at ≥1280) */
}

.sh-intro__block {
	position: relative;
	width: 100%;
}

.sh-intro__fig {
	aspect-ratio: var(--bw) / var(--bh);
	overflow: hidden;
}

.sh-intro__h,
.sh-intro__p {
	font-family: var(--sh-font-komet);
	font-size: var(--fs, 20px);
	font-weight: var(--fw, var(--sh-fw-komet-regular));
	line-height: var(--lh, 32px);
	color: var(--c, var(--intro-text));
	text-align: left;
}

.sh-intro__h {
	color: var(--c, var(--accent, var(--intro-text)));
	font-size: min(var(--fs, 38px), 28px);
	font-weight: var(--fw, var(--sh-fw-komet-heavy));
	line-height: 1.35;
	text-align: left;
}

.sh-intro__p p + p {
	margin-top: 16px;
}

.sh-intro__p strong,
.sh-intro__p b {
	font-weight: var(--sh-fw-komet-bold);
}

.sh-intro__p em,
.sh-intro__p i {
	font-style: italic;
}

/* tablet 768–1279: justified text stays (§9.4 E.6) · phones: left */
@media (min-width: 768px) {
	.sh-intro__p {
		text-align: var(--ta, justify);
	}

	.sh-intro__h {
		font-size: min(var(--fs, 38px), 34px);
		text-align: var(--ta, left);
	}
}

@media (max-width: 767.98px) {
	.sh-intro__head-in {
		padding-bottom: 60px;
	}

	.sh-intro__head-top {
		flex-direction: column;
		align-items: center;
		gap: 24px;
	}

	.sh-intro__emblem {
		flex-basis: auto;
		width: min(70vw, 325.2px);
		height: auto;
		aspect-ratio: 325.2 / 320.5;
	}

	.sh-intro__head-title {
		flex: 0 0 auto;
		margin-top: 0;
		font-size: min(var(--fs, 40px), 28px);
		line-height: 1.3;
		text-align: left;
	}

	.sh-intro__head-text {
		margin-top: 24px;
	}

	.sh-intro__head-p,
	.sh-intro__head-credit {
		font-size: 18px;
		line-height: 1.5;
		text-align: left;
	}

	.sh-intro__head-p + .sh-intro__head-p,
	.sh-intro__head-p + .sh-intro__head-credit {
		margin-top: 20px;
	}

	.sh-intro__env {
		min-height: 0;
		padding-block: 40px 24px;
	}

	.sh-intro__env-title {
		line-height: 1.3;
	}

	.sh-intro__tabs {
		top: 10px;
		right: 10px;
		gap: 8px;
	}

	.sh-intro__tab {
		width: 36px;
		height: 36px;
		font-size: 18px;
	}

	.sh-intro__arrow {
		top: 50%;
		width: 14px;
		height: 28px;
		margin-top: -14px;
	}

	.sh-intro__arrow--prev {
		left: 8px;
	}

	.sh-intro__arrow--next {
		right: 8px;
	}

	.sh-intro__arrow svg {
		width: 100%;
		height: 100%;
	}

	.sh-intro__sec-in {
		padding-block: 32px;
		gap: 24px;
	}
}

/* ≥1280: rows / columns / blocks with the Figma gaps as margins (design px; widths and x offsets scale by frame width / 1440) */
@media (min-width: 1280px) {
	.sh-intro__head-in,
	.sh-intro__env {
		max-width: 1440px;
		margin-inline: auto;
		padding-inline: calc(160 / 1440 * 100%);
	}

	.sh-intro__head-in {
		min-height: 1098px;
	}

	.sh-intro__sec-in {
		display: block;
		padding: calc(var(--pt, 0) * 1px) 0 calc(var(--pb, 0) * 1px);
	}

	.sh-intro__row {
		display: flex;
		align-items: flex-start;
		margin-top: calc(var(--mt, 0) * 1px);
	}

	.sh-intro__col {
		display: block;
		flex: none;
		margin-left: calc(var(--ml, 0) / 1440 * 100%);
		width: calc(var(--cw) / 1440 * 100%);
	}

	/* block widths / x offsets are fractions of its column */
	.sh-intro__col .sh-intro__block {
		margin-top: calc(var(--mt, 0) * 1px);
		margin-left: calc(var(--ox, 0) / var(--cw) * 100%);
		width: calc(var(--bw) / var(--cw) * 100%);
	}

	/* Figma box height = the least height of a text block (longer text grows it) */
	.sh-intro__h,
	.sh-intro__p {
		min-height: calc(var(--bh) * 1px);
	}

	.sh-intro__h {
		font-size: var(--fs, 38px);
		line-height: var(--lh, 56px);
		text-align: var(--ta, left);
	}

	/* Figma overhang (a picture that starts above its section, e.g. the boat): absolute */
	.sh-intro__sec-in > .sh-intro__block {
		position: absolute;
		top: calc(var(--y) * 1px);
		left: calc(var(--x) / 1440 * 100%);
		width: calc(var(--bw) / 1440 * 100%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.sh-intro__chapter {
		transition: none;
	}
}
