/*
 * Home page opening (inc/intro.php, assets/js/intro.js) — front page only, every view,
 * never with reduced motion or forced colors. Choreography after the Museco opening, drawn with SPG's own logo and theme:
 * blue field → a white dot rises and opens into a white page → the logo mark appears, settles, slides left
 * as the wordmark is revealed → tagline → a blue panel with a curved top rises →
 * the page enters (header, hero image; the hero title lines keep their own GSAP reveal in sections.js).
 * html.spg-intro-active is set by the inline script in <head> before the first paint, so content never
 * flashes; every rule here is scoped to that class or to the overlay, so no other page or state changes.
 */
:root {
	/* From the theme's dark blue to the hero's own background (HomeHero .hero / .media), so the curtain
	   hands over to the hero without a colour jump. */
	--spg-intro-field: linear-gradient(140deg, var(--color-primary-dark), #1d3266);
}

html.spg-intro-active { overflow: hidden; }
html.spg-intro-active body::before {
	content: ""; position: fixed; inset: 0; z-index: 100000;
	background: var(--spg-intro-field);
}
html.spg-intro-mounted body::before { content: none; }

/* Above every layer of the site, the WordPress admin bar (99999) included. */
.spg-intro {
	position: fixed; inset: 0; z-index: 100000; overflow: hidden; cursor: pointer;
	background: var(--spg-intro-field);
	font-family: var(--font-body);
}
.spg-intro-paper { position: absolute; inset: 0; background: var(--color-surface); clip-path: circle(0 at 50% 64%); }
.spg-intro-stage {
	position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
	gap: clamp(14px, 2vw, 28px); padding: 0 20px 2vh;
}
/* The logo (assets/images/logo.png, 1601 × 158) is 10:1: the mark spans x 0–147, the wordmark x 173–1600.
   The mask (.spg-intro-wipe) and the logo move in opposite directions to reveal the wordmark (intro.js,
   MARK = 150 / 1601): transforms only, so nothing is repainted while it moves. */
.spg-intro-lockup { width: min(88vw, 880px); opacity: 0; visibility: hidden; will-change: transform, opacity; }
.spg-intro-wipe { display: block; overflow: hidden; will-change: transform; }
.spg-intro-logo { display: block; width: 100%; max-width: none; height: auto; will-change: transform; }
.spg-intro-tagline {
	max-width: min(88vw, 880px); margin: 0;
	color: var(--color-primary); font-size: clamp(12px, 1.3vw, 19px); font-weight: 700;
	letter-spacing: 0.1em; line-height: 1.35; text-align: center; text-transform: uppercase; text-wrap: balance;
	opacity: 0; visibility: hidden;
}
/* Chinese has no capitals and is much shorter: a size up, so it reads as a line, not a caption. */
.spg-intro-tagline:lang(zh) { font-size: clamp(15px, 1.6vw, 23px); letter-spacing: 0.16em; }
/* The curtain rises on the compositor (intro.js), and gets its own layer when the opening holds still. */
.spg-intro-curtain {
	position: absolute; top: 100%; right: -10vw; left: -10vw; height: 135vh;
	background: var(--spg-intro-field);
	border-radius: 50% 50% 0 0 / 22vh 22vh 0 0; /* convex top edge, like a rising hill */
}

.spg-intro-skip {
	position: fixed; z-index: 100001; right: max(18px, 3vw); bottom: max(18px, 3.5vh);
	display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 16px;
	border: 1px solid rgb(255 255 255 / 35%); border-radius: 999px; background: rgb(255 255 255 / 8%); color: #fff;
	font: 600 13px/1 var(--font-body); letter-spacing: 0.06em; cursor: pointer;
	opacity: 0; visibility: hidden; /* out of the tab order and the accessibility tree until it is shown */
	transition: opacity 0.3s ease, visibility 0s linear 0.3s, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.spg-intro-skip.is-visible { opacity: 1; visibility: visible; transition-delay: 0s; }
.spg-intro-skip.is-on-paper {
	border-color: color-mix(in srgb, var(--color-primary) 22%, transparent);
	background: rgb(255 255 255 / 72%); color: var(--color-primary);
}
.spg-intro-skip:hover { border-color: var(--color-accent); }
/* On the blue field: white ring, as the home video modal's close button; on the white page: the site's ring. */
.spg-intro-skip:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.spg-intro-skip.is-on-paper:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }

/* The page enters once the opening lifts: the header slides down, the hero image settles. */
html.spg-intro-entrance .Header-header { animation: spg-intro-enter-down 0.6s var(--ease-brand) backwards; }
html.spg-intro-entrance .HomeHero-media { animation: spg-intro-hero-settle 1.4s var(--ease-brand) backwards; }
@keyframes spg-intro-enter-down { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spg-intro-hero-settle { from { transform: scale(1.06); } to { transform: none; } }

/* Main content focused after Skip (keyboard and screen-reader users): no outline for a pointer user. */
.SiteLayout-main[data-spg-intro-focus]:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce), (forced-colors: active) {
	html.spg-intro-active { overflow: visible; }
	html.spg-intro-active body::before, .spg-intro, .spg-intro-skip { display: none; }
	html.spg-intro-entrance .Header-header, html.spg-intro-entrance .HomeHero-media { animation: none; }
}
