/* Homepage stage. Artwork is placed in Hannah's Canva coordinates (a 360 x 504 page),
   scaled by --u (page 1 fit) and --u2 (page 2 fit, larger on tall phones).
   With WebGL the canvas performs the scene; the DOM images are the first paint and the fallback. */
.frwl-journey {
	position: relative; height: calc(100svh - var(--wp-admin--admin-bar--height, 0px)); background: #121a13;
	touch-action: none; overscroll-behavior: none; user-select: none; -webkit-user-select: none;
}
.frwl-viewport { position: relative; height: 100%; overflow: hidden; container-type: size; }
/* The homepage is a single stationary stage: nothing beneath it to scroll to */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.frwl-camera {
	position: absolute; inset: 0;
	--u: calc(min(100cqw / 318, 100cqh / 478)); /* fit the gold frame + balcony, trimming Hannah's green margin */
	--u2: max(var(--u), min(100cqh / 504, 100cqw * 0.9 / 185));
}
.frwl-camera img { display: block; max-width: none; height: auto; user-select: none; -webkit-user-drag: none; }
.frwl-bg { position: absolute; inset: 0; background: var(--frwl-green); }
.frwl-gl { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; opacity: 0; }
.is-gl .frwl-gl { opacity: 1; }
.is-gl .frwl-scene, .is-gl .frwl-window, .is-gl .frwl-logo { visibility: hidden; }

/* DOM scene (first paint + fallback) */
.frwl-scene {
	position: absolute; inset: 0; background: #121a13;
	clip-path: inset(calc(50% + (29.6 - 252) * var(--u)) calc(50% - (325.3 - 180) * var(--u)) calc(50% - (474 - 252) * var(--u)) calc(50% + (35 - 180) * var(--u)));
}
.frwl-l { position: absolute; transform-origin: 0 0; }
.frwl-curtain { left: calc(50% + (41.24 - 180) * var(--u)); top: calc(50% + (127.23 - 252) * var(--u)); width: calc(281.42 * var(--u)); }
.frwl-curtain-l { clip-path: inset(0 50% 0 0); }
.frwl-curtain-r { clip-path: inset(0 0 0 50%); }
.frwl-valance { left: calc(50% + (39.36 - 180) * var(--u)); top: calc(50% + (29.3 - 252) * var(--u)); width: calc(281.41 * var(--u)); }
.frwl-logo { left: calc(50% + (113.9 - 180) * var(--u)); top: calc(50% + (236.1 - 252) * var(--u)); width: calc(141 * var(--u)); z-index: 3; }

/* Page 1 frame: nearer the audience than the stage, so it drifts past out of focus */
.frwl-frame { position: absolute; inset: 0; z-index: 2; transform-origin: 0 0; will-change: transform, opacity, filter; }
.frwl-border {
	position: absolute; inset: clamp(6px, 1.8vmin, 16px); box-sizing: border-box;
	border: max(1px, calc(1.4 * var(--u))) solid; border-image: linear-gradient(90deg, #d4ad45, #efcb94, #b38a5e) 1;
}
.frwl-corner { position: absolute; width: clamp(64px, 19vmin, 150px); }
.frwl-c-bl { left: 0; bottom: 0; }
.frwl-c-tl { left: 0; top: 0; transform: scaleY(-1); }
.frwl-c-br { right: 0; bottom: 0; transform: scaleX(-1); }
.frwl-c-tr { right: 0; top: 0; transform: scale(-1, -1); }
.frwl-foil { left: calc(50% + (35 - 180) * var(--u)); top: calc(50% + (29.6 - 252) * var(--u)); width: calc(290.3 * var(--u)); }
.frwl-balcony { left: calc(50% + (35 - 180) * var(--u)); top: calc(50% + (416.9 - 252) * var(--u)); width: calc(290.3 * var(--u)); } /* fitted to the stage opening */

/* Page 2 window (DOM fallback) */
.frwl-window { position: absolute; inset: 0; z-index: 2; }
.frwl-garden, .frwl-arch { position: absolute; }
.frwl-garden { left: calc(50% + (97.65 - 180) * var(--u2)); top: calc(50% + (237.94 - 252) * var(--u2)); width: calc(165.86 * var(--u2)); }
.frwl-arch { left: calc(50% + (87.8 - 180) * var(--u2)); top: calc(50% + (225.1 - 252) * var(--u2)); width: calc(185.2 * var(--u2)); }

/* The three scrolls: real links, text set on the ribbon's curve */
.frwl-scrolls { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.frwl-scroll {
	position: absolute; display: block; pointer-events: auto; text-decoration: none;
	left: calc(50% + (100.9 - 180) * var(--u2)); width: calc(159 * var(--u2));
	top: calc(50% + (263.4 + var(--i) * 51.65 - 252) * var(--u2));
	transform-origin: 50% 40%;
}
.frwl-scroll svg { display: block; width: 100%; height: auto; overflow: visible; transition: transform .35s cubic-bezier(.3,1.4,.5,1), filter .35s ease; }
.frwl-scroll text { font: 56px "Arapey", "Arapey Scrolls", Georgia, serif; fill: #1f1f1c; letter-spacing: .5px; }
.frwl-scroll:hover svg, .frwl-scroll:focus-visible svg { transform: translateY(-3%) rotate(-1deg) scale(1.03); filter: drop-shadow(0 6px 6px rgb(0 0 0 / .35)); }
.frwl-scroll:focus-visible { outline: none; }
.frwl-scroll:focus-visible svg { outline: 2px solid #fae5c9; outline-offset: 2px; border-radius: 8px; }

.frwl-js .frwl-scroll { opacity: 0; pointer-events: none; }
.frwl-js .is-unfurled .frwl-scroll { pointer-events: auto; animation: frwl-unfurl 1.1s cubic-bezier(.2,.75,.25,1) calc(var(--i) * .2s) both; }
.frwl-js .is-unfurled.is-instant .frwl-scroll { animation: none; opacity: 1; }
@keyframes frwl-unfurl { /* opacity + transform only: no clipping, so phones never repaint mid-way */
	0%   { opacity: 0; transform: translateY(14%) rotate(-2.5deg) scaleX(.08) scaleY(.85); }
	35%  { opacity: 1; }
	70%  { transform: translateY(-2%) rotate(1deg) scaleX(1.02) scaleY(1.03); }
	100% { opacity: 1; transform: none; }
}
.frwl-js .frwl-journey.is-leaving .frwl-scroll { animation: frwl-away .7s cubic-bezier(.5,0,.75,0) calc(var(--i) * .07s) both; pointer-events: none; }
@keyframes frwl-away {
	from { opacity: 1; transform: none; }
	to   { opacity: 0; transform: translateY(-30%) rotate(3deg) scale(.9); filter: blur(3px); }
}

.frwl-cue {
	position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%);
	margin: 0; padding: 10px 20px; border-radius: 40px; white-space: nowrap; z-index: 6; cursor: pointer;
	background: rgb(36 56 44 / .88); color: #fae7c7; border: 1px solid #b6ad7e;
	font: 13px/1 Georgia, serif; letter-spacing: .08em; transition: opacity .5s ease;
	animation: frwl-breathe 2.8s ease-in-out infinite;
}
@keyframes frwl-breathe { 50% { box-shadow: 0 0 0 6px rgb(250 231 199 / .12); } }
.frwl-skip {
	position: absolute; top: 12px; right: 12px; z-index: 6; cursor: pointer;
	background: rgb(36 56 44 / .7); color: #fae7c7; border: 1px solid #b6ad7e; border-radius: 30px;
	padding: 7px 14px; font: 12px/1 Georgia, serif; letter-spacing: .06em; transition: opacity .5s ease;
}
.frwl-cue:focus-visible, .frwl-skip:focus-visible { outline: 2px solid #fae5c9; outline-offset: 2px; }
.is-open .frwl-cue, .is-done .frwl-skip { opacity: 0; pointer-events: none; }
.frwl-js .frwl-journey.is-furling .frwl-scroll { animation: frwl-away .55s cubic-bezier(.5,0,.75,0) calc((2 - var(--i)) * .06s) both; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
	.frwl-cue, .frwl-skip { display: none; }
	.frwl-js .is-unfurled .frwl-scroll { animation: none; opacity: 1; }
}

/* The stage runs edge to edge */
body, .wp-site-blocks { padding-left: 0 !important; padding-right: 0 !important; }
.wp-site-blocks > .frwl-journey, .wp-site-blocks > footer { margin-block: 0; }

/* Nothing on the stage shows until every piece has loaded; then the whole scene fades in at once */
.frwl-js .frwl-camera, .frwl-js .frwl-cue, .frwl-js .frwl-skip { opacity: 0; }
.frwl-js .frwl-journey.is-ready .frwl-camera { opacity: 1; transition: opacity .7s ease; }
.frwl-js .frwl-journey.is-ready .frwl-cue, .frwl-js .frwl-journey.is-ready .frwl-skip { opacity: 1; transition: opacity .7s ease .5s; }
.frwl-js .frwl-journey.is-ready.is-open .frwl-cue, .frwl-js .frwl-journey.is-ready.is-done .frwl-skip { opacity: 0; transition-delay: 0s; }
/* The garden window belongs to the second view: hidden until the show reaches it */
.frwl-js .frwl-journey:not(.is-gl) .frwl-window { opacity: 0; }
.frwl-journey { background: var(--frwl-green); }

/* Keep each scroll on its own steady layer, before, during and after the unfurl, so it never blinks */
.frwl-scroll, .frwl-scroll svg { will-change: transform, opacity; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.frwl-scroll { transform: translateZ(0); }
