/* YorkBee motion. Ported from the mockup <style> block (docs/02 "Motion").
   One easing, slow and calm, transform and opacity only.
   - Reveals run only after motion.js sets [data-motion] on <html>, so every
     page reads fully with JavaScript off or delayed.
   - Scroll-driven effects live inside @supports (animation-timeline: scroll()).
   - prefers-reduced-motion switches everything off. */

@keyframes yb-rise { from { transform: translateY(112%); } to { transform: none; } }
@keyframes yb-fade { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes yb-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes yb-up { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes yb-settle { from { transform: scale(1.16); } to { transform: none; } }
@keyframes yb-logoin { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: none; } }
@keyframes yb-light {
	0% { transform: translate(-11%, -4%); }
	25% { transform: translate(-2%, 5%); }
	50% { transform: translate(9%, -3%); }
	75% { transform: translate(3%, 5%); }
	100% { transform: translate(-7%, 2%); }
}
@keyframes yb-rule { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes yb-cue {
	0% { transform: scaleY(0); transform-origin: top; }
	45% { transform: scaleY(1); transform-origin: top; }
	55% { transform: scaleY(1); transform-origin: bottom; }
	100% { transform: scaleY(0); transform-origin: bottom; }
}
@keyframes yb-morph {
	from { transform: translateY(var(--ly, 0px)) scale(1); }
	to { transform: translateY(0) scale(var(--ls, .25)); }
}
@keyframes yb-par-a { to { transform: translateY(-60px); } }
@keyframes yb-par-b { to { transform: translateY(-130px); } }
/* Hero lights: each breathes on its own clock; the near layer moves faster
   than the photos as you scroll (depth), the far layer slower. */
@keyframes yb-bk-breathe { 0%, 100% { opacity: calc(var(--o) * .72); scale: .98; } 50% { opacity: var(--o); scale: 1.02; } }
@keyframes yb-bk-near { to { transform: translateY(-150px); } }
@keyframes yb-bk-far { to { transform: translateY(-30px); } }
@keyframes yb-par-c { to { transform: translateY(-36px); opacity: 0; } }
@keyframes yb-drift { from { transform: translateY(-3.5%) scale(1.09); } to { transform: translateY(3.5%) scale(1.09); } }
@keyframes yb-glint { 0% { transform: translateX(-60%); } 100% { transform: translateX(60%); } }
@keyframes yb-frin { from { opacity: 0; transform: translate(var(--fx, 16px), var(--fy, 16px)); } to { opacity: 1; transform: none; } }

/* ---- Hero light (after timbermere.com): a gold sheen sweeps across the
   italic "Nothing else." every 9s, and tiny four-point glints twinkle where
   the light catches the gold lids in the photos. Motion-only: without it the
   headline is plain ivory and the glints never show. ---- */
@keyframes yb-sheen { 0% { background-position: 100% 0; } 30%, 100% { background-position: 0 0; } }
@keyframes yb-twinkle {
	0%, 84%, 100% { opacity: 0; transform: scale(.25) rotate(0deg); }
	90% { opacity: .9; transform: scale(1) rotate(40deg); }
	96% { opacity: 0; transform: scale(.45) rotate(80deg); }
}
.yb-glints { position: absolute; inset: 0; pointer-events: none; }
.yb-glints .yb-glint { display: none; }
@media (prefers-reduced-motion: no-preference) {
	.yb-hero__title em {
		padding-right: .08em;
		margin-right: -.08em;
		background: linear-gradient(100deg, var(--yb-paper) 0%, var(--yb-paper) 40%, #ecd28f 47%, #fff4d6 50%, #ecd28f 53%, var(--yb-paper) 60%, var(--yb-paper) 100%) 100% 0 / 300% 100% no-repeat;
		-webkit-background-clip: text;
		background-clip: text;
		-webkit-text-fill-color: transparent;
		animation: yb-sheen 9s ease-in-out 2.6s infinite;
	}
	.yb-glints .yb-glint {
		display: block;
		position: absolute;
		left: var(--gx);
		top: var(--gy);
		width: 16px;
		aspect-ratio: 1;
		margin: -8px 0 0 -8px;
		clip-path: polygon(50% 0, 54% 46%, 100% 50%, 54% 54%, 50% 100%, 46% 54%, 0 50%, 46% 46%);
		background: radial-gradient(circle, #fff 0, #ffe8b4 24%, rgba(255, 216, 150, 0) 64%);
		opacity: 0;
		animation: yb-twinkle var(--gt, 9s) ease-out var(--gd, 3s) infinite;
	}
	/* Hero lights fade in after the photos, then breathe. */
	.yb-bokeh { animation: yb-in 2.4s ease both .8s; }
	.yb-bk { animation: yb-bk-breathe calc(var(--t, 9s) * 1.5) ease-in-out var(--d, 0s) infinite; }
}
@media (min-width: 782px) and (prefers-reduced-motion: no-preference) {
	.yb-glints .yb-glint { width: 24px; margin: -12px 0 0 -12px; }
}

/* ---- Home logo layers (inc/logo.php): lettering, gold halo, bee. Stacked
   they are the usual logo; the halo is invisible until the scroll transition. ---- */
.yb-logo__layers { position: relative; display: block; width: 100%; height: 100%; }
.yb-logo__layers > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.yb-logo__halo { overflow: visible; opacity: 0; }
.yb-logo__halo circle { fill: none; stroke: var(--yb-gold); stroke-width: 6; stroke-dasharray: 100; stroke-dashoffset: 100; }
@keyframes yb-ring-turn {
	0% { transform: rotate(0deg); opacity: 1; }
	45% { transform: rotate(-38deg); opacity: .1; }
	100% { transform: rotate(0deg); opacity: 1; }
}
@keyframes yb-halo-draw {
	0% { opacity: 0; }
	15% { opacity: 1; }
	70% { opacity: .85; }
	100% { opacity: 0; }
}
@keyframes yb-halo-line { 0% { stroke-dashoffset: 100; } 50% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; } }
@keyframes yb-bee-land {
	0% { transform: none; }
	45% { transform: translate(1.5%, -5%) rotate(-7deg); }
	80% { transform: translate(0, 1%) rotate(1deg); }
	100% { transform: none; }
}

/* Header bar and logo arrive softly on load (CSS only; no JS needed). */
.yb-head__bar { animation: yb-in 1.6s ease both .9s; }
/* The plain logo image, or the home page's layers as one (their own motion is scroll-driven). */
.home .yb-logo img:not([class*="yb-logo__"]),
.home .yb-logo .yb-logo__layers { animation: yb-logoin 2.2s var(--yb-ease) both .1s; }

/* The honeycomb light drifts very slowly. */
.is-style-atmosphere::after,
.is-style-brown::after,
.yb-foot::after { animation: yb-light 44s ease-in-out infinite alternate; }

/* Line-by-line heading rise (.yc-l). */
.yb-l { display: block; overflow: hidden; padding-bottom: .14em; margin-bottom: -.14em; }
.yb-l > span { display: block; animation: yb-rise 1.6s var(--yb-ease) both; }

/* Hover: cards lift, photos zoom ~3%, button arrows slide (base.css). */
.yb-zoom { transition: transform 2.2s var(--yb-ease); will-change: transform; }

/* ---- Reveals ([data-rv] in the mockup → .yb-rv / .yb-rv-ph / .yb-rv-ln) ----
   Stagger with .yb-d1….yb-d6 (or --d). */
.yb-d1 { --d: .08s; } .yb-d2 { --d: .16s; } .yb-d3 { --d: .24s; }
.yb-d4 { --d: .32s; } .yb-d5 { --d: .4s; } .yb-d6 { --d: .48s; }

[data-motion] .yb-rv { opacity: 0; transform: translateY(34px); }
[data-motion] .yb-rv.is-in {
	opacity: 1;
	transform: none;
	transition: opacity 1.5s cubic-bezier(.22, .61, .36, 1) var(--d, 0s), transform 1.9s var(--yb-ease) var(--d, 0s);
}
/* Photos: clip-path wipe upwards plus a slow settle from 1.16 to 1. */
[data-motion] .yb-rv-ph img { clip-path: inset(100% 0 0 0); transform: scale(1.16); }
[data-motion] .yb-rv-ph.is-in img {
	clip-path: inset(0 0 0 0);
	transform: none;
	transition: clip-path 2s var(--yb-ease) var(--d, 0s), transform 2.6s var(--yb-ease) var(--d, 0s);
}
/* Hairlines draw from the left. */
[data-motion] .yb-rv-ln { transform: scaleX(0); transform-origin: left; }
[data-motion] .yb-rv-ln.is-in { transform: scaleX(1); transition: transform 2s var(--yb-ease) var(--d, 0s); }
/* Framed photos: the hairline frame slides in after the photo. */
[data-motion] .yb-rv-ph::before { opacity: 0; transform: translate(var(--fx, 16px), var(--fy, 16px)); }
[data-motion] .yb-rv-ph.is-in::before {
	opacity: 1;
	transform: none;
	transition: opacity 1.4s ease calc(var(--d, 0s) + .7s), transform 2s var(--yb-ease) calc(var(--d, 0s) + .7s);
}
/* Anything revealed late (script delayed until first interaction) appears at once. */
[data-motion] .is-instant { transition: none !important; }

/* ---- Scroll-driven (enhancement only) ---- */
@supports (animation-timeline: scroll()) {
	@media (prefers-reduced-motion: no-preference) {
		/* Progress line on every page. */
		.yb-head::after { animation: yb-rule linear both; animation-timeline: scroll(root); }

		/* Home: the big hero logo shrinks into the bar over the first 240px,
		   and the glass fades in between 30 and 200px. */
		.home .yb-logo {
			transform: translateY(var(--ly)) scale(1);
			animation: yb-morph linear both;
			animation-timeline: scroll(root);
			animation-range: 0px 240px;
		}
		.home .yb-head::before {
			animation: yb-in linear both;
			animation-timeline: scroll(root);
			animation-range: 30px 200px;
		}
		/* Ring and landing: during the same 240px the lettering turns around
		   the bee (pivot at the arc's centre) and fades into a gold halo, the
		   bee lifts and settles, and the lettering closes around it again. */
		.home .yb-logo .yb-logo__ring { transform-origin: 39.3% 48.2%; animation: yb-ring-turn linear both; animation-timeline: scroll(root); animation-range: 0px 240px; }
		.home .yb-logo__halo { animation: yb-halo-draw linear both; animation-timeline: scroll(root); animation-range: 0px 240px; }
		.home .yb-logo__halo circle { animation: yb-halo-line linear both; animation-timeline: scroll(root); animation-range: 0px 240px; }
		.home .yb-logo .yb-logo__bee { transform-origin: 62% 55%; animation: yb-bee-land linear both; animation-timeline: scroll(root); animation-range: 0px 240px; }
		/* Menu open: the logo docks into the bar, or it would sit on top of
		   the menu (and scroll timelines stop while the page is locked). */
		.home .yb-head:has(.yb-menu[open]) .yb-logo { transform: scale(var(--ls)); animation: none; }
		.home .yb-head:has(.yb-menu[open]) .yb-logo :is(.yb-logo__ring, .yb-logo__halo, .yb-logo__halo circle, .yb-logo__bee) { animation: none; }
		/* The hero keeps a static copy of the logo for browsers without
		   scroll timelines; hide it where the header logo morphs instead. */
		.home .yb-hero-logo { visibility: hidden; }

		/* Hero parallax: left photo −60px, right −130px over 1000px;
		   hero text drifts up and fades between 160 and 760px. */
		.yb-par-a { animation: yb-par-a linear both; animation-timeline: scroll(root); animation-range: 0px 1000px; }
		.yb-par-b { animation: yb-par-b linear both; animation-timeline: scroll(root); animation-range: 0px 1000px; }
		.yb-bokeh--near { animation: yb-in 2.4s ease both .8s, yb-bk-near linear both; animation-timeline: auto, scroll(root); animation-range: normal, 0px 1000px; }
		.yb-bokeh--far { animation: yb-in 2.4s ease both .8s, yb-bk-far linear both; animation-timeline: auto, scroll(root); animation-range: normal, 0px 1000px; }
		.yb-par-c { animation: yb-par-c linear both; animation-timeline: scroll(root); animation-range: 160px 760px; }
		.yb-drift { animation: yb-drift linear both; animation-timeline: view(); }
	}
}

/* ---- Reduced motion: no animation or transition anywhere. The logo sits docked. ---- */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation: none !important;
		transition: none !important;
		scroll-behavior: auto !important;
	}
}
