/*
 * The Shop of Wonders: standalone landing page (template-shop-of-wonders.php).
 * The shop stylesheet is not loaded on this page, so everything it needs is here.
 *
 * Two scenes:
 *   .wd-street  the shop door at night, fixed over the page until it opens
 *   .wd-shop    the page behind the door
 */

@font-face {
	font-family: "IM Fell English";
	src: url("../fonts/im-fell-english-regular.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "IM Fell English";
	src: url("../fonts/im-fell-english-italic.woff2") format("woff2");
	font-weight: 400;
	font-style: italic;
	font-display: swap;
}

:root {
	--wd-night: #0a0c10;
	--wd-green: #0d0d0e;
	--wd-green-lit: #2a2a2b;
	--wd-brass: #ffffff;
	--wd-lamp: #ffd98f;
	--wd-paper: #f7f6f3;
	--wd-ink: #141414;
	--wd-oxblood: #141414;
	--wd-wood: #5b3b24;
	--wd-sign: "IM Fell English", "Iowan Old Style", Georgia, serif;
	--wd-text: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html.wd-outside { overflow: hidden; }

body.wonders {
	margin: 0;
	background: var(--wd-paper);
	color: var(--wd-ink);
	font-family: var(--wd-text);
	font-size: 17px;
	line-height: 1.5;
}

.wonders a { color: inherit; }
.wonders a:focus-visible,
.wonders button:focus-visible,
.wonders h1:focus-visible { outline: 3px solid var(--wd-brass); outline-offset: 3px; }
.wonders img { display: block; max-width: 100%; height: auto; }

/* ------------------------------------------------------------------ street */

.wd-street {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: none;
	overflow: hidden;
	/* Beside the drawing on a wide screen: dark wall above, pavement below.
	   The split matches the pavement line of the drawing (622 of 740). */
	--wd-street-background: linear-gradient(#0c0e15 0, #12141d 84%, #2b3140 84%, #151a25 100%);
	background: var(--wd-street-background);
	color: var(--wd-paper);
}
html.wd-outside .wd-street { display: block; }

/* The camera is what moves through the doorway. Its origin is the middle of
   the doorway in the drawing. */
.wd-camera {
	position: absolute;
	inset: 0;
	display: flex;
	justify-content: center;
	transform-origin: 50% 58%;
	will-change: transform;
}

/* The drawing is 390 x 740 units. It always fills the height, so on a phone
   held upright a little of each side window is off the screen. */
.wd-stage {
	position: relative;
	flex: 0 0 auto;
	height: 100%;
	aspect-ratio: 390 / 740;
}
.wd-scene { display: block; width: 100%; height: 100%; overflow: visible; }

.wd-lights circle { animation: wd-twinkle 3.2s ease-in-out infinite; }
.wd-lights circle:nth-child(3n) { animation-delay: -1.1s; }
.wd-lights circle:nth-child(3n + 1) { animation-delay: -2.2s; }
@keyframes wd-twinkle {
	0%, 100% { opacity: 1; }
	50% { opacity: .35; }
}

.wd-spill { opacity: .45; transition: opacity 1s .2s; }

/* The two leaves sit over the doorway of the drawing: x 122 to 268, y 250 to 610. */
.wd-doors {
	position: absolute;
	left: 31.282%;
	top: 33.784%;
	width: 37.436%;
	height: 48.649%;
	display: flex;
	perspective: 900px;
	perspective-origin: 50% 45%;
}
.wd-leaf {
	flex: 1 1 50%;
	transition: transform 1.25s cubic-bezier(.55, .02, .2, 1), filter 1.25s;
	backface-visibility: hidden;
}
.wd-leaf svg { display: block; width: 100%; height: 100%; }
.wd-leaf--left { transform-origin: 0 50%; }
.wd-leaf--right { transform-origin: 100% 50%; }
.wd-leaf--right svg { transform: scaleX(-1); }

/* Snow: three sheets of dots that fall at different speeds, in front of the shop. */
.wd-snow,
.wd-snow::before,
.wd-snow::after {
	position: absolute;
	inset: -100% 0 0;
	content: "";
	pointer-events: none;
	background-repeat: repeat;
}
.wd-snow {
	background-image:
		radial-gradient(1.6px 1.6px at 20px 30px, #fff 50%, transparent 51%),
		radial-gradient(1.4px 1.4px at 110px 140px, #fff 50%, transparent 51%),
		radial-gradient(1.8px 1.8px at 170px 70px, #fff 50%, transparent 51%);
	background-size: 220px 220px;
	opacity: .5;
	animation: wd-fall 14s linear infinite;
}
.wd-snow::before {
	background-image:
		radial-gradient(2.4px 2.4px at 40px 90px, #fff 50%, transparent 51%),
		radial-gradient(2px 2px at 150px 200px, #fff 50%, transparent 51%);
	background-size: 260px 260px;
	opacity: .75;
	animation: wd-fall 9s linear infinite;
}
.wd-snow::after {
	background-image: radial-gradient(3.2px 3.2px at 90px 60px, #fff 50%, transparent 51%);
	background-size: 340px 340px;
	opacity: .85;
	animation: wd-fall 6.5s linear infinite;
}
@keyframes wd-fall { to { transform: translateY(50%); } }

.wd-prompt {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 0 20px max(22px, env(safe-area-inset-bottom));
	text-align: center;
	transition: opacity .35s;
}
.wd-enter {
	min-width: min(280px, 100%);
	padding: 15px 28px 16px;
	border: 0;
	border-radius: 3px;
	background: var(--wd-brass);
	color: #111111;
	font-family: var(--wd-sign);
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .45), 0 0 0 0 rgba(255, 217, 143, .6);
	animation: wd-beckon 2.6s ease-out infinite;
}
@keyframes wd-beckon {
	0% { box-shadow: 0 6px 18px rgba(0, 0, 0, .45), 0 0 0 0 rgba(255, 217, 143, .55); }
	70%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, .45), 0 0 0 16px rgba(255, 217, 143, 0); }
}

/* Opening: show the real shop through the space between the leaves. */
.wd-street.is-opening .wd-prompt { opacity: 0; pointer-events: none; }
.wd-street.is-opening .wd-enter { animation: none; }
.wd-street.is-opening .wd-snow { opacity: 0; transition: opacity .8s .7s; }
.wd-street.is-opening { animation: wd-arrive .4s ease-in forwards; }

@media (prefers-reduced-motion: no-preference) {
	.wd-street.has-doorway.is-opening { background: none; animation: wd-arrive .36s 1.2s ease-in forwards; }
	.wd-street.has-doorway.is-opening .wd-camera { animation: wd-through 1.14s .42s cubic-bezier(.57, 0, .38, 1) forwards; }
	.wd-street.has-doorway.is-opening .wd-camera::before {
		content: "";
		position: absolute;
		inset: 0;
		background: var(--wd-street-background);
		/* Trace the viewport and then the doorway so only the opening is clear. */
		clip-path: polygon(evenodd,
			0 0, 100% 0, 100% 100%, 0 100%, 0 0,
			var(--wd-door-left) var(--wd-door-top),
			var(--wd-door-left) var(--wd-door-bottom),
			var(--wd-door-right) var(--wd-door-bottom),
			var(--wd-door-right) var(--wd-door-top),
			var(--wd-door-left) var(--wd-door-top), 0 0);
	}
	.wd-street.has-doorway.is-opening .wd-room { display: none; }
	.wd-street.has-doorway.is-opening .wd-leaf--left { transform: rotateY(84deg); filter: brightness(.6); }
	.wd-street.has-doorway.is-opening .wd-leaf--right { transform: rotateY(-84deg); filter: brightness(.6); }
	.wd-street.has-doorway.is-opening .wd-spill { opacity: 1; }
}
@keyframes wd-through { to { transform: scale(var(--wd-door-zoom)); } }
@keyframes wd-arrive { to { opacity: 0; } }

/* ------------------------------------------------------------------- shop */

.wd-shop { min-height: 100vh; }
html.wd-outside .wd-shop { visibility: hidden; }
html.wd-outside.wd-arriving .wd-shop { visibility: visible; }

@media (max-width: 699.98px) and (prefers-reduced-motion: no-preference) {
	html.wd-outside.wd-arriving .wd-street.has-doorway ~ .wd-shop {
		animation: wd-interior-arrive 1.34s .22s cubic-bezier(.48, 0, .55, 1) both;
	}
}
@keyframes wd-interior-arrive {
	from { transform: translateY(-104px); }
	to { transform: translateY(0); }
}

.wd-top {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 20px;
	background: var(--wd-green);
	color: var(--wd-paper);
	font-size: 15px;
}
.wd-top a { text-decoration: none; }
.wd-top__name { font-family: var(--wd-sign); font-size: 19px; }
.wd-top__basket { border-bottom: 1px solid var(--wd-brass); padding-bottom: 1px; }

.wd-welcome {
	padding: 40px 20px 34px;
	background:
		radial-gradient(80% 120% at 50% -30%, rgba(255, 255, 255, .12), transparent 60%),
		var(--wd-green);
	color: var(--wd-paper);
	text-align: center;
}
.wd-welcome h1 {
	max-width: 11ch;
	margin: 0 auto 16px;
	font-family: var(--wd-sign);
	font-weight: 400;
	font-size: clamp(46px, 13vw, 92px);
	line-height: .96;
	color: var(--wd-brass);
}
.wd-welcome > p {
	max-width: 34ch;
	margin: 0 auto;
	font-size: 18px;
	line-height: 1.55;
	color: #e6e6e6;
}

.wd-who { margin-top: 30px; }
.wd-who__ask {
	margin: 0 0 12px;
	font-family: var(--wd-sign);
	font-style: italic;
	font-size: 22px;
	color: var(--wd-paper);
}
.wd-who ul {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	max-width: 520px;
	margin: 0 auto;
	padding: 0;
	list-style: none;
}
.wd-who a {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 58px;
	padding: 8px 12px;
	border: 1px solid var(--wd-brass);
	border-radius: 3px;
	color: var(--wd-paper);
	font-family: var(--wd-sign);
	font-size: 20px;
	line-height: 1.1;
	text-decoration: none;
}
.wd-who a:active { background: var(--wd-brass); color: #111111; }

/* A shelf: heading, a row of things you can push along, and the board they sit on. */
.wd-shelf { padding-top: 38px; scroll-margin-top: 8px; }
.wd-shelf__head { padding: 0 20px 14px; }
.wd-shelf__head h2,
.wd-more h2,
.wd-visit h2 {
	margin: 0;
	font-family: var(--wd-sign);
	font-weight: 400;
	font-size: clamp(32px, 8.5vw, 46px);
	line-height: 1.05;
	color: var(--wd-green);
}
.wd-shelf__head p { margin: 6px 0 0; color: #555555; }

.wd-rail {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	margin: 0;
	padding: 6px 20px 0;
	list-style: none;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	scroll-padding-left: 20px;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}
.wd-rail::-webkit-scrollbar { display: none; }

.wd-item { flex: 0 0 44vw; max-width: 220px; scroll-snap-align: start; }
.wd-item a { display: block; padding-bottom: 14px; text-decoration: none; }
.wd-item__photo {
	display: block;
	aspect-ratio: 1 / 1;
	margin-bottom: 10px;
	background: #fff;
	border: 1px solid #e2e0da;
	overflow: hidden;
}
.wd-item__photo img { width: 100%; height: 100%; object-fit: contain; }
.wd-item__name {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	font-size: 15px;
	line-height: 1.3;
}
.wd-item__price { display: block; margin-top: 4px; font-weight: 600; color: var(--wd-oxblood); }
.wd-item__price del { font-weight: 400; color: #777777; }
.wd-item__price ins { text-decoration: none; }

.wd-item--all a {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1 / 1;
	margin-bottom: 14px;
	padding: 16px;
	background: var(--wd-green);
	color: var(--wd-brass);
	font-family: var(--wd-sign);
	font-size: 22px;
	line-height: 1.15;
	text-align: center;
}

.wd-shelf__board {
	height: 14px;
	background: linear-gradient(#3a3a3a, #1c1c1c 45%, #0a0a0a);
	box-shadow: 0 10px 14px -8px rgba(40, 24, 10, .55);
}

.wd-more,
.wd-visit { padding: 44px 20px 0; }
.wd-more ul {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 16px 0 0;
	padding: 0;
	list-style: none;
}
.wd-more a {
	display: block;
	padding: 11px 16px;
	border: 1px solid var(--wd-green);
	border-radius: 3px;
	text-decoration: none;
	color: var(--wd-green);
}

.wd-visit { padding-bottom: 48px; }
.wd-visit p { max-width: 38ch; margin: 10px 0 0; }
.wd-visit address { margin: 16px 0 18px; font-style: normal; font-weight: 600; }
.wd-visit__map {
	display: inline-block;
	padding: 14px 24px;
	border-radius: 3px;
	background: var(--wd-green);
	color: var(--wd-paper);
	text-decoration: none;
}
.wonders .wd-visit__map { color: var(--wd-paper); }

.wd-foot {
	padding: 20px;
	background: var(--wd-green);
	color: #cfcfcf;
	font-size: 14px;
	text-align: center;
}

.wd-logo { display: block; width: min(78vw, 340px); height: auto; margin: 0 auto 18px; }

/* The mid-century shelf: a darker room with bigger photographs. */
.wd-feature { padding: 40px 0 34px; background: #0d0d0e; color: var(--wd-paper); }
.wd-feature__head { padding: 0 20px 18px; }
.wd-feature__head h2 {
	margin: 0;
	font-family: var(--wd-sign);
	font-weight: 400;
	font-size: clamp(36px, 10vw, 54px);
	line-height: 1.02;
	color: var(--wd-brass);
}
.wd-feature__head p { margin: 8px 0 0; max-width: 34ch; color: #cfcfcf; }
.wd-rail--feature { gap: 16px; }
.wd-rail--feature .wd-item { flex-basis: 72vw; max-width: 340px; }
.wd-rail--feature .wd-item a { padding-bottom: 0; }
.wd-rail--feature .wd-item__photo { aspect-ratio: 4 / 5; border: 0; margin-bottom: 12px; }
.wd-rail--feature .wd-item__photo img { object-fit: cover; }
.wd-rail--feature .wd-item__name { font-size: 17px; }
.wd-rail--feature .wd-item__price { color: var(--wd-brass); font-size: 18px; }
.wd-rail--feature .wd-item--all a { aspect-ratio: 4 / 5; margin: 0; background: transparent; border: 1px solid var(--wd-brass); font-size: 26px; }

@media (max-width: 699.98px) {
	.wd-welcome { padding-block: 20px 22px; }
	.wd-logo { width: 150px; margin-bottom: 10px; }
	.wd-welcome h1 { max-width: none; font-size: clamp(32px, 9.1vw, 39px); margin-bottom: 10px; }
	.wd-welcome > p { max-width: 36ch; font-size: 16px; line-height: 1.4; }
	.wd-who { margin-top: 16px; }
	.wd-who__ask { margin-bottom: 9px; font-size: 20px; }
	.wd-who ul { gap: 8px; }
	.wd-who a { min-height: 48px; font-size: 18px; }
	.wd-feature { padding-top: 22px; }
	.wd-feature__head { padding-bottom: 8px; }
	.wd-feature__head h2 { font-size: clamp(28px, 8.4vw, 36px); }
	.wd-rail--feature .wd-item { flex-basis: 60vw; }
	.wd-rail--feature .wd-item__photo,
	.wd-rail--feature .wd-item--all a { aspect-ratio: 1; }
}

@media (min-width: 700px) {
	.wd-feature__head { padding-inline: max(32px, calc((100vw - 1100px) / 2)); }
	.wd-rail--feature .wd-item { flex-basis: 340px; }
	.wd-top { padding-inline: max(32px, calc((100vw - 1100px) / 2)); }
	.wd-welcome { padding-block: 64px 54px; }
	.wd-who ul { grid-template-columns: repeat(4, 1fr); max-width: 860px; }
	.wd-shelf__head,
	.wd-more,
	.wd-visit { padding-inline: max(32px, calc((100vw - 1100px) / 2)); }
	.wd-rail { padding-inline: max(32px, calc((100vw - 1100px) / 2)); scroll-padding-left: max(32px, calc((100vw - 1100px) / 2)); gap: 22px; }
	.wd-item { flex-basis: 220px; }
}

/* No script: no door, the page is simply there. */
html.wd-js-off .wd-street { display: none; }

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.wd-snow, .wd-snow::before, .wd-snow::after, .wd-lights circle, .wd-enter { animation: none; }
	.wd-leaf, .wd-spill { transition: none; }
}
