/* ==========================================================================
   Ever After — storybook wedding album
   Palette: Burgundy #5B1826 · Cream #FEFCF9 · Silver #C1BDBC · Light Marigold #E9E9C0 · Ink #060101
   ========================================================================== */

:root {
	--burgundy: #5B1826;
	--burgundy-deep: #3a0e18;
	--burgundy-soft: #7d2a3d;
	--cream: #FEFCF9;
	--paper: #f8f3ea;
	--silver: #C1BDBC;
	--marigold: #E9E9C0;
	--ink: #060101;
	--text: #2b1418;

	--script: "Pinyon Script", "Snell Roundhand", cursive;
	--caps: "Cinzel", "Trajan Pro", Georgia, serif;
	--serif: "Cormorant Garamond", Garamond, Georgia, serif;

	--turn: 1150ms;
	--ease-turn: cubic-bezier(.45, .05, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body.ea {
	margin: 0;
	min-height: 100svh;
	overflow: hidden;
	color: var(--cream);
	font-family: var(--serif);
	background-color: var(--burgundy-deep);
	background-image:
		radial-gradient(ellipse 80% 60% at 50% 38%, rgba(233, 233, 192, .10), transparent 70%),
		radial-gradient(ellipse at 50% 40%, #6e1f31 0%, var(--burgundy) 38%, #2a0910 100%);
	-webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }

/* Floating motes of light — the "fantasy" atmosphere */
.ea-motes { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.ea-mote {
	position: absolute;
	bottom: -10px;
	width: var(--s, 4px);
	height: var(--s, 4px);
	border-radius: 50%;
	background: radial-gradient(circle, rgba(255, 252, 230, .95), rgba(233, 233, 192, .5) 40%, transparent 70%);
	opacity: 0;
	animation: ea-float var(--d, 14s) linear var(--delay, 0s) infinite;
}
@keyframes ea-float {
	0% { transform: translate3d(0, 0, 0); opacity: 0; }
	12% { opacity: var(--o, .7); }
	85% { opacity: var(--o, .7); }
	100% { transform: translate3d(var(--dx, 30px), -105vh, 0); opacity: 0; }
}

/* Scenes */
.ea-scene {
	position: fixed;
	inset: 0;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 900ms ease;
}
.ea-scene.is-active { opacity: 1; }

/* ==========================================================================
   1. Envelope
   ========================================================================== */
.ea-envelope-scene { gap: clamp(14px, 3.4vh, 32px); padding: 24px 16px; }

/* site title above the envelope */
.ea-site-title {
	margin: 0;
	font-family: var(--script);
	font-weight: 400;
	font-size: clamp(38px, 6.2vw, 76px);
	line-height: 1.1;
	text-align: center;
	text-wrap: balance;
	color: var(--cream);
	text-shadow: 0 2px 14px rgba(6, 1, 1, .55), 0 0 28px rgba(233, 233, 192, .18);
	transition: opacity 600ms ease, transform 900ms var(--ease-turn);
}
.ea-envelope-scene.is-opening .ea-site-title { opacity: 0; transform: translateY(-10px); }

.ea-envelope {
	position: relative;
	width: min(88vw, 660px, calc((100svh - 230px) * 1.5));
	aspect-ratio: 3 / 2;
	perspective: 1600px;
	transition: transform 900ms var(--ease-turn), opacity 900ms ease;
	filter: drop-shadow(0 30px 40px rgba(6, 1, 1, .55)) drop-shadow(0 6px 10px rgba(6, 1, 1, .35));
}

/* paper texture shared by envelope pieces */
.ea-env-back,
.ea-flap i,
.ea-flap-face--front i,
.ea-card {
	background-color: var(--cream);
	background-image:
		radial-gradient(rgba(91, 24, 38, .035) .8px, transparent 1px),
		linear-gradient(160deg, #fffefb 0%, #f7f1e6 100%);
	background-size: 4px 4px, 100% 100%;
}

/* inside of the envelope — burgundy liner with a fine marigold lattice */
.ea-env-back {
	position: absolute;
	inset: 0;
	border-radius: 6px;
	background-color: var(--burgundy);
	background-image:
		repeating-linear-gradient(45deg, rgba(233, 233, 192, .13) 0 1px, transparent 1px 18px),
		repeating-linear-gradient(-45deg, rgba(233, 233, 192, .13) 0 1px, transparent 1px 18px),
		radial-gradient(ellipse at 50% 0%, #7a2436, #3a0e18);
	background-size: auto;
}

.ea-card {
	position: absolute;
	left: 6%;
	right: 6%;
	top: 6%;
	height: 88%;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	color: var(--burgundy);
	padding: 6% 8%;
	border-radius: 3px;
	box-shadow: inset 0 0 0 7px var(--cream), inset 0 0 0 8px rgba(91, 24, 38, .5), inset 0 0 0 11px var(--cream), inset 0 0 0 12px rgba(193, 189, 188, .9), 0 2px 6px rgba(6, 1, 1, .2);
	transition: transform 1200ms var(--ease-turn);
}
.ea-card p { margin: 0; }
.ea-card-kicker { font-family: var(--caps); font-size: clamp(9px, 1.6vw, 13px); letter-spacing: .38em; text-transform: uppercase; color: var(--burgundy-soft); }
.ea-card-names { font-family: var(--script); font-size: clamp(30px, 6.4vw, 58px); line-height: 1.15; margin: .15em 0 .05em !important; }
.ea-card .ea-divider { width: 40%; color: var(--silver); margin: .3em 0 .6em; }
.ea-card-date { font-family: var(--serif); font-style: italic; font-size: clamp(13px, 2vw, 18px); color: var(--text); }

/* front flaps — wrapper carries the soft shadow, <i> carries the shape */
.ea-flap { position: absolute; inset: 0; z-index: 3; pointer-events: none; filter: drop-shadow(0 -1px 1.5px rgba(6, 1, 1, .18)); }
.ea-flap i { position: absolute; inset: 0; border-radius: 6px; }
.ea-flap--left i { clip-path: polygon(0 0, 50% 54%, 0 100%); background-image: radial-gradient(rgba(91,24,38,.035) .8px, transparent 1px), linear-gradient(90deg, #fbf7f0, #f1eadf); }
.ea-flap--right i { clip-path: polygon(100% 0, 50% 54%, 100% 100%); background-image: radial-gradient(rgba(91,24,38,.035) .8px, transparent 1px), linear-gradient(270deg, #fbf7f0, #f1eadf); }
.ea-flap--bottom { filter: drop-shadow(0 -2px 2px rgba(6, 1, 1, .16)); }
.ea-flap--bottom i { clip-path: polygon(0 100%, 0 99%, 50% 44%, 100% 99%, 100% 100%); background-image: radial-gradient(rgba(91,24,38,.035) .8px, transparent 1px), linear-gradient(0deg, #fffdf9, #f4ede2); }

/* top flap — two faces so the inside liner shows as it swings open */
.ea-flap-top {
	position: absolute;
	inset: 0;
	z-index: 4;
	transform-origin: 50% 0;
	transform-style: preserve-3d;
	transition: transform 950ms var(--ease-turn);
	pointer-events: none;
}
.ea-flap-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.ea-flap-face--front { filter: drop-shadow(0 3px 3px rgba(6, 1, 1, .22)); }
.ea-flap-face--front i { position: absolute; inset: 0; border-radius: 6px 6px 0 0; clip-path: polygon(0 0, 100% 0, 50% 60%); background-image: radial-gradient(rgba(91,24,38,.035) .8px, transparent 1px), linear-gradient(180deg, #fffefb, #f3ece0); }
.ea-flap-face--back { transform: rotateX(180deg); }
.ea-flap-face--back i {
	position: absolute; inset: 0;
	clip-path: polygon(0 100%, 100% 100%, 50% 40%);
	background-color: var(--burgundy);
	background-image:
		repeating-linear-gradient(45deg, rgba(233, 233, 192, .16) 0 1px, transparent 1px 18px),
		repeating-linear-gradient(-45deg, rgba(233, 233, 192, .16) 0 1px, transparent 1px 18px),
		linear-gradient(0deg, #6e1f31, #45111d);
}

/* photo envelope variant */
.ea-env-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 6px; transition: transform 1200ms var(--ease-turn), opacity 900ms ease; }
.ea-envelope--photo .ea-seal { top: 50%; }

/* wax seal */
.ea-seal {
	position: absolute;
	z-index: 6;
	left: 50%;
	top: 57%;
	width: clamp(84px, 19%, 128px);
	aspect-ratio: 1;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	filter: drop-shadow(0 4px 5px rgba(6, 1, 1, .45));
	transition: transform 300ms ease, filter 300ms ease;
	-webkit-tap-highlight-color: transparent;
}
.ea-seal::before {
	content: "";
	position: absolute;
	inset: -6%;
	border-radius: 50%;
	box-shadow: 0 0 0 0 rgba(233, 233, 192, .55);
	animation: ea-seal-pulse 2.6s ease-out infinite;
}
@keyframes ea-seal-pulse {
	0% { box-shadow: 0 0 0 0 rgba(233, 233, 192, .5); }
	70% { box-shadow: 0 0 0 22px rgba(233, 233, 192, 0); }
	100% { box-shadow: 0 0 0 0 rgba(233, 233, 192, 0); }
}
.ea-seal:hover, .ea-seal:focus-visible { transform: translate(-50%, -50%) scale(1.06); filter: drop-shadow(0 6px 10px rgba(6, 1, 1, .5)) drop-shadow(0 0 14px rgba(233, 233, 192, .35)); outline: none; }
.ea-seal-half { position: absolute; inset: 0; transition: transform 700ms cubic-bezier(.3, .7, .3, 1), opacity 600ms ease 250ms; }
.ea-seal-half svg { display: block; width: 100%; height: 100%; }
.ea-seal-half--l { clip-path: polygon(0 0, 52% 0, 47% 22%, 55% 41%, 46% 60%, 54% 79%, 48% 100%, 0 100%); }
.ea-seal-half--r { clip-path: polygon(52% 0, 100% 0, 100% 100%, 48% 100%, 54% 79%, 46% 60%, 55% 41%, 47% 22%); }

.ea-hint {
	margin: 0;
	font-family: var(--caps);
	font-size: clamp(11px, 1.6vw, 14px);
	letter-spacing: .45em;
	text-transform: uppercase;
	color: var(--marigold);
	opacity: .85;
	animation: ea-breathe 3s ease-in-out infinite;
	transition: opacity 400ms ease;
}
@keyframes ea-breathe { 50% { opacity: .45; } }

/* returning to the invitation: snap back without replaying the opening in reverse */
.ea-envelope.no-anim, .ea-envelope.no-anim * { transition: none !important; }

/* copyright line */
.ea-copyright {
	margin: 0;
	font-family: var(--serif);
	font-size: 13px;
	letter-spacing: .04em;
	color: var(--silver);
	opacity: .75;
	text-align: center;
	flex: none;
}
.ea-copyright a { color: inherit; text-decoration: none; border-bottom: 1px solid rgba(193, 189, 188, .35); }
.ea-copyright a:hover, .ea-copyright a:focus-visible { color: var(--cream); border-bottom-color: var(--marigold); outline: none; }
.ea-copyright--fixed {
	position: absolute;
	left: 0;
	right: 0;
	bottom: calc(14px + env(safe-area-inset-bottom, 0px));
	padding: 0 16px;
	transition: opacity 600ms ease;
}
.ea-envelope-scene.is-opening .ea-copyright--fixed { opacity: 0; }
.ea-album-scene .ea-copyright {
	position: fixed;
	z-index: 15;
	right: calc(16px + env(safe-area-inset-right, 0px));
	bottom: calc(18px + env(safe-area-inset-bottom, 0px));
	text-align: right;
}
@media (max-width: 600px) {
	.ea-album-scene .ea-copyright { position: static; margin-top: auto; padding: 14px 64px 4px; text-align: center; }
}

/* notes shown only to a logged-in site admin */
.ea-admin-note {
	position: fixed;
	z-index: 30;
	left: 50%;
	bottom: calc(14px + env(safe-area-inset-bottom, 0px));
	transform: translateX(-50%);
	width: max-content;
	max-width: calc(100vw - 32px);
	margin: 0;
	padding: 10px 16px;
	border: 1px dashed rgba(233, 233, 192, .7);
	border-radius: 10px;
	background: rgba(6, 1, 1, .78);
	color: var(--cream);
	font-family: var(--serif);
	font-size: 15px;
	line-height: 1.4;
	text-align: center;
}
.ea-admin-note a { color: var(--marigold); }

/* opening sequence (classes added by main.js) */
.ea-envelope.is-cracked .ea-seal { pointer-events: none; animation: none; filter: none; }
.ea-envelope.is-cracked .ea-seal::before { animation: none; }
.ea-envelope.is-cracked .ea-seal-half--l { transform: translate(-28%, 18%) rotate(-24deg); opacity: 0; }
.ea-envelope.is-cracked .ea-seal-half--r { transform: translate(28%, 22%) rotate(20deg); opacity: 0; }
.ea-envelope-scene.is-opening .ea-hint { opacity: 0; animation: none; }
.ea-envelope.is-flap-open .ea-flap-top { transform: rotateX(180deg); }
.ea-envelope.is-flap-back .ea-flap-top { z-index: 1; }
.ea-envelope.is-card-out .ea-card { transform: translateY(-60%); }
.ea-envelope.is-leaving { transform: scale(1.12) translateY(6%); opacity: 0; }
.ea-envelope--photo.is-flap-open .ea-env-photo { transform: scale(1.03); }

/* ==========================================================================
   2. Vow video
   ========================================================================== */
.ea-video-scene { background: var(--ink); z-index: 3; transition: opacity 1600ms ease; }
.ea-video-scene video { width: 100%; height: 100%; object-fit: contain; background: var(--ink); }
.ea-video-scene::after { /* soft vignette */
	content: ""; position: absolute; inset: 0; pointer-events: none;
	background: radial-gradient(ellipse at center, transparent 55%, rgba(6, 1, 1, .65) 100%);
}
.ea-skip, .ea-video-play {
	position: absolute;
	z-index: 2;
	border: 1px solid rgba(233, 233, 192, .55);
	background: rgba(6, 1, 1, .35);
	color: var(--cream);
	font-family: var(--caps);
	letter-spacing: .2em;
	text-transform: uppercase;
	cursor: pointer;
	border-radius: 999px;
	backdrop-filter: blur(4px);
	transition: background 250ms ease, border-color 250ms ease;
}
.ea-skip { right: clamp(16px, 3vw, 36px); bottom: clamp(16px, 3vw, 36px); font-size: 11px; padding: 10px 18px; }
.ea-video-play { font-size: 14px; padding: 16px 30px; }
.ea-skip:hover, .ea-video-play:hover { background: rgba(91, 24, 38, .75); border-color: var(--marigold); }

/* ==========================================================================
   3. Album
   ========================================================================== */
.ea-album-scene { justify-content: flex-start; padding: clamp(10px, 2.4vh, 26px) 16px 12px; gap: clamp(10px, 2vh, 20px); overflow-y: auto; }
.ea-album-head { text-align: center; line-height: 1; flex: none; }
.ea-album-kicker { margin: 0 0 4px; font-family: var(--caps); font-size: 11px; letter-spacing: .5em; text-transform: uppercase; color: var(--marigold); opacity: .85; }
.ea-album-title { margin: 0; font-family: var(--script); font-weight: 400; font-size: clamp(30px, 4.4vw, 52px); color: var(--cream); text-shadow: 0 2px 12px rgba(6, 1, 1, .5); }

.ea-book {
	--book-w: min(94vw, 1180px, calc((100svh - 235px) * 1.5));
	position: relative;
	flex: none;
	width: var(--book-w);
	aspect-ratio: 3 / 2;
	perspective: 3600px;
	container-type: inline-size;
	margin-top: 10px;
}
/* leather album cover peeking around the pages */
.ea-book::before {
	content: "";
	position: absolute;
	inset: -1.6% -1.4%;
	border-radius: 10px;
	background:
		linear-gradient(90deg, transparent 49.2%, rgba(6, 1, 1, .5) 50%, transparent 50.8%),
		radial-gradient(ellipse at 30% 20%, #6d2132, #3d0f19 70%);
	box-shadow: inset 0 0 0 2px rgba(233, 233, 192, .35), inset 0 0 0 5px #3d0f19, inset 0 0 0 6px rgba(233, 233, 192, .18), 0 30px 60px rgba(6, 1, 1, .6), 0 8px 16px rgba(6, 1, 1, .4);
}

.ea-page {
	position: absolute;
	top: 0;
	width: 50%;
	height: 100%;
	overflow: hidden;
	color: var(--text);
	background-color: var(--paper);
	background-image:
		radial-gradient(rgba(91, 24, 38, .03) .8px, transparent 1px),
		radial-gradient(ellipse at 50% 40%, var(--cream) 0%, var(--paper) 100%);
	background-size: 4px 4px, 100% 100%;
}
.ea-page::before { /* gutter shadow near the spine */
	content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
}
.ea-page--left { left: 0; border-radius: 4px 0 0 4px; box-shadow: -1px 0 0 #ece5d9, -2px 1px 0 #e2d9cb, -3px 2px 0 #d8cebe; }
.ea-page--left::before { background: linear-gradient(to left, rgba(58, 14, 24, .22), rgba(58, 14, 24, .06) 5%, transparent 13%); }
.ea-page--right { left: 50%; border-radius: 0 4px 4px 0; box-shadow: 1px 0 0 #ece5d9, 2px 1px 0 #e2d9cb, 3px 2px 0 #d8cebe; }
.ea-page--right::before { background: linear-gradient(to right, rgba(58, 14, 24, .22), rgba(58, 14, 24, .06) 5%, transparent 13%); }
.ea-page--single { display: none; }
.ea-spine { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; transform: translateX(-1px); background: rgba(58, 14, 24, .25); z-index: 3; pointer-events: none; }

/* the turning leaf */
.ea-leaf {
	position: absolute;
	top: 0;
	left: 50%;
	width: 50%;
	height: 100%;
	z-index: 6;
	transform-origin: 0 50%;
	transform-style: preserve-3d;
	transition: transform var(--turn) var(--ease-turn);
	will-change: transform;
}
.ea-leaf > .ea-page { left: 0; width: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.ea-leaf > .ea-leaf-back { transform: rotateY(180deg); }
.ea-leaf > .ea-page::after { /* light & shade sweeping across the turning paper */
	content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0;
	animation: ea-leaf-shade var(--turn) var(--ease-turn) forwards;
}
.ea-leaf > .ea-leaf-front::after { background: linear-gradient(to left, rgba(6, 1, 1, .35), rgba(6, 1, 1, .05) 60%, rgba(255, 255, 255, .15)); }
.ea-leaf > .ea-leaf-back::after { background: linear-gradient(to right, rgba(6, 1, 1, .35), rgba(6, 1, 1, .05) 60%, rgba(255, 255, 255, .15)); }
@keyframes ea-leaf-shade { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }
.ea-leaf.is-shadowed { filter: drop-shadow(0 10px 18px rgba(6, 1, 1, .3)); }

/* page content */
.ea-content { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 7% 9% 9%; }
.ea-content--story { align-items: center; text-align: center; }
.ea-chapter { margin: 0; font-family: var(--caps); font-size: clamp(9px, 1.05cqw, 13px); letter-spacing: .42em; text-transform: uppercase; color: var(--burgundy-soft); }
.ea-chapter-title { margin: .2em 0 0; font-family: var(--script); font-weight: 400; font-size: clamp(26px, 3.7cqw, 50px); line-height: 1.1; color: var(--burgundy); }
.ea-divider { display: block; width: clamp(120px, 16cqw, 210px); height: auto; color: var(--silver); margin: .5em auto .9em; flex: none; }
.ea-content--story .ea-divider { color: #b9a9a4; }
.ea-story {
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
	overflow-y: auto;
	text-align: left;
	font-size: clamp(14px, 1.42cqw, 19px);
	line-height: 1.62;
	color: var(--text);
	hyphens: auto;
	padding-right: 4px;
	scrollbar-width: thin;
	scrollbar-color: rgba(91, 24, 38, .35) transparent;
	-webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent);
	mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent);
	padding-bottom: 18px;
}
.ea-story p { margin: 0 0 .8em; }
.ea-story > p:first-child::first-letter {
	float: left;
	font-family: var(--caps);
	font-weight: 600;
	font-size: 3.35em;
	line-height: .82;
	margin: .07em .1em 0 0;
	color: var(--burgundy);
	text-shadow: 1px 1px 0 var(--marigold);
}
.ea-story em { color: var(--burgundy-soft); }
.ea-folio { position: absolute; left: 0; right: 0; bottom: 3.2%; margin: 0; text-align: center; font-family: var(--serif); font-style: italic; font-size: clamp(11px, 1.05cqw, 14px); color: #9a8a86; }
.ea-folio::before, .ea-folio::after { content: "—"; margin: 0 .6em; color: var(--silver); }

/* ---------- framed photographs ---------- */
.ea-content--photos { padding: 7.5% 8% 10%; }
.ea-photos { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 7% 8%; }

.ea-frame {
	--c-tl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%235B1826' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M3 30V10Q3 3 10 3h20'/%3E%3Cpath d='M9 22v-8q0-5 5-5h8'/%3E%3Cpath d='M15 15q5 0 5 5'/%3E%3C/g%3E%3Ccircle cx='15' cy='15' r='1.8' fill='%235B1826'/%3E%3C/svg%3E");
	--c-tr: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg transform='matrix(-1 0 0 1 40 0)'%3E%3Cg fill='none' stroke='%235B1826' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M3 30V10Q3 3 10 3h20'/%3E%3Cpath d='M9 22v-8q0-5 5-5h8'/%3E%3Cpath d='M15 15q5 0 5 5'/%3E%3C/g%3E%3Ccircle cx='15' cy='15' r='1.8' fill='%235B1826'/%3E%3C/g%3E%3C/svg%3E");
	--c-bl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg transform='matrix(1 0 0 -1 0 40)'%3E%3Cg fill='none' stroke='%235B1826' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M3 30V10Q3 3 10 3h20'/%3E%3Cpath d='M9 22v-8q0-5 5-5h8'/%3E%3Cpath d='M15 15q5 0 5 5'/%3E%3C/g%3E%3Ccircle cx='15' cy='15' r='1.8' fill='%235B1826'/%3E%3C/g%3E%3C/svg%3E");
	--c-br: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg transform='matrix(-1 0 0 -1 40 40)'%3E%3Cg fill='none' stroke='%235B1826' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M3 30V10Q3 3 10 3h20'/%3E%3Cpath d='M9 22v-8q0-5 5-5h8'/%3E%3Cpath d='M15 15q5 0 5 5'/%3E%3C/g%3E%3Ccircle cx='15' cy='15' r='1.8' fill='%235B1826'/%3E%3C/g%3E%3C/svg%3E");
	--cs: clamp(18px, 2.4cqw, 34px);
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	min-height: 0;
	padding: clamp(5px, .75cqw, 11px);
	border: 0;
	border-radius: 2px;
	cursor: zoom-in;
	background: linear-gradient(135deg, #8f8986 0%, #e4e1df 16%, var(--cream) 28%, var(--silver) 44%, var(--marigold) 58%, #fbfaf0 66%, #a8a3a1 82%, #d9d6c4 100%);
	box-shadow:
		inset 0 0 0 1px rgba(255, 255, 255, .7),
		inset 0 0 0 2px rgba(91, 24, 38, .25),
		0 1px 2px rgba(6, 1, 1, .3),
		0 8px 18px rgba(6, 1, 1, .22);
	transition: transform 350ms ease, box-shadow 350ms ease;
	-webkit-tap-highlight-color: transparent;
}
.ea-frame:nth-child(1) { transform: rotate(-.7deg); }
.ea-frame:nth-child(2) { transform: rotate(.6deg); }
.ea-frame:nth-child(3) { transform: rotate(.5deg); }
.ea-frame:nth-child(4) { transform: rotate(-.6deg); }
.ea-frame::after { /* engraved corner flourishes */
	content: "";
	position: absolute;
	inset: clamp(-6px, -.45cqw, -3px);
	z-index: 2;
	pointer-events: none;
	background:
		var(--c-tl) top left / var(--cs) no-repeat,
		var(--c-tr) top right / var(--cs) no-repeat,
		var(--c-bl) bottom left / var(--cs) no-repeat,
		var(--c-br) bottom right / var(--cs) no-repeat;
}
.ea-frame-mat {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	padding: clamp(5px, .9cqw, 13px);
	background: var(--cream);
	box-shadow:
		inset 0 0 0 1px rgba(91, 24, 38, .55),
		inset 0 0 0 4px var(--cream),
		inset 0 0 0 5px rgba(193, 189, 188, .95),
		inset 0 2px 7px rgba(6, 1, 1, .2);
}
.ea-frame-mat img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	box-shadow: 0 0 0 1px rgba(91, 24, 38, .4), 0 1px 3px rgba(6, 1, 1, .25);
	transition: filter 350ms ease;
}
.ea-frame:hover, .ea-frame:focus-visible {
	transform: translateY(-3px) rotate(0) scale(1.025);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7), inset 0 0 0 2px rgba(91, 24, 38, .25), 0 2px 4px rgba(6, 1, 1, .3), 0 16px 28px rgba(6, 1, 1, .3), 0 0 0 3px rgba(233, 233, 192, .6);
	outline: none;
	z-index: 1;
}
.ea-frame:hover img { filter: brightness(1.04) saturate(1.05); }
.ea-frame--empty { cursor: default; opacity: .55; }
.ea-frame--empty .ea-frame-mat { background: repeating-linear-gradient(45deg, #f4efe6 0 8px, #efe8dc 8px 16px); }
.ea-frame--empty:hover { transform: none; }

/* ---------- final spread ---------- */
.ea-content--end { justify-content: center; }
.ea-end-line { margin: 0; font-family: var(--script); font-size: clamp(28px, 3.6cqw, 50px); line-height: 1.25; color: var(--burgundy); max-width: 90%; }
.ea-end-date { margin: 0; font-style: italic; font-size: clamp(14px, 1.5cqw, 19px); color: var(--text); }
.ea-content--monogram { align-items: center; justify-content: center; text-align: center; }
.ea-monogram { width: clamp(110px, 17cqw, 220px); filter: drop-shadow(0 4px 6px rgba(6, 1, 1, .35)); }
.ea-monogram svg { display: block; width: 100%; height: auto; }
.ea-fin { margin: .5em 0 0; font-family: var(--caps); font-size: clamp(16px, 2cqw, 26px); letter-spacing: .4em; color: var(--burgundy); text-indent: .4em; }
.ea-fin-sub { margin: .2em 0 1.4em; font-family: var(--script); font-size: clamp(20px, 2.4cqw, 32px); color: var(--burgundy-soft); }
.ea-restart {
	border: 1px solid rgba(91, 24, 38, .45); background: transparent; color: var(--burgundy);
	font-family: var(--caps); font-size: clamp(9px, .95cqw, 12px); letter-spacing: .25em; text-transform: uppercase;
	padding: .9em 1.6em; border-radius: 999px; cursor: pointer; transition: background 250ms, color 250ms;
}
.ea-restart:hover { background: var(--burgundy); color: var(--cream); }

/* ---------- navigation ---------- */
.ea-nav { display: flex; align-items: center; gap: clamp(12px, 3vw, 32px); margin-top: clamp(8px, 2vh, 18px); flex: none; }
.ea-nav-btn {
	border: 1px solid rgba(233, 233, 192, .5);
	background: rgba(6, 1, 1, .15);
	color: var(--cream);
	font-family: var(--caps);
	font-size: 11px;
	letter-spacing: .24em;
	text-transform: uppercase;
	padding: 10px 18px;
	border-radius: 999px;
	cursor: pointer;
	transition: background 250ms, border-color 250ms, opacity 250ms;
}
.ea-nav-btn:hover:not(:disabled), .ea-nav-btn:focus-visible { background: rgba(233, 233, 192, .14); border-color: var(--marigold); outline: none; }
.ea-nav-btn:disabled { opacity: .3; cursor: default; }
.ea-counter { font-style: italic; font-size: 16px; color: var(--marigold); min-width: 7em; text-align: center; }
.ea-replay { margin: 4px 0 0; flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 28px; }
.ea-replay button { background: none; border: 0; color: var(--silver); font-style: italic; font-size: 15px; cursor: pointer; text-decoration: underline; text-decoration-color: rgba(193, 189, 188, .4); text-underline-offset: 4px; }
.ea-replay button:hover { color: var(--cream); }

/* ==========================================================================
   Background music toggle
   ========================================================================== */
.ea-music-toggle {
	position: fixed;
	z-index: 20;
	left: calc(16px + env(safe-area-inset-left, 0px));
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 14px 9px 11px;
	border: 1px solid rgba(233, 233, 192, .5);
	border-radius: 999px;
	background: rgba(58, 14, 24, .72);
	color: var(--cream);
	font-family: var(--caps);
	font-size: 10px;
	letter-spacing: .2em;
	text-transform: uppercase;
	cursor: pointer;
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	transition: background 250ms, border-color 250ms, opacity 250ms;
}
.ea-music-toggle svg { width: 18px; height: 18px; flex: none; }
.ea-music-toggle .ea-music-slash { opacity: 0; transition: opacity 200ms; }
.ea-music-toggle.is-off { opacity: .75; }
.ea-music-toggle.is-off .ea-music-slash { opacity: 1; }
.ea-music-toggle:not(.is-off) svg { animation: ea-note 2.4s ease-in-out infinite; }
@keyframes ea-note { 50% { transform: translateY(-2px); } }
.ea-music-toggle:hover, .ea-music-toggle:focus-visible { background: var(--burgundy); border-color: var(--marigold); outline: none; opacity: 1; }
@media (max-width: 600px) {
	.ea-music-toggle .ea-music-label { display: none; }
	.ea-music-toggle { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) { .ea-music-toggle svg { animation: none !important; } }

/* ==========================================================================
   Lightbox
   ========================================================================== */
.ea-lightbox {
	position: fixed;
	inset: 0;
	z-index: 50;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 4vh 70px;
	background: rgba(6, 1, 1, .86);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity 350ms ease;
}
.ea-lightbox.is-open { opacity: 1; }
.ea-lb-figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; transform: scale(.94); transition: transform 450ms cubic-bezier(.2, .8, .2, 1); max-width: 100%; }
.ea-lightbox.is-open .ea-lb-figure { transform: scale(1); }
.ea-lb-frame {
	display: block;
	padding: 12px;
	background: linear-gradient(135deg, #8f8986 0%, #e4e1df 16%, var(--cream) 28%, var(--silver) 44%, var(--marigold) 58%, #fbfaf0 66%, #a8a3a1 82%, #d9d6c4 100%);
	box-shadow: 0 30px 70px rgba(0, 0, 0, .6);
}
.ea-lb-frame img {
	display: block;
	max-width: min(86vw, 1400px);
	max-height: calc(100svh - 8vh - 90px);
	width: auto;
	height: auto;
	border: 10px solid var(--cream);
	outline: 1px solid rgba(91, 24, 38, .5);
	outline-offset: -11px;
	background: var(--cream);
}
#ea-lb-caption { font-style: italic; font-size: clamp(16px, 2vw, 20px); color: var(--cream); text-align: center; min-height: 1.2em; max-width: 60ch; }
.ea-lb-close, .ea-lb-arrow {
	position: absolute;
	display: grid;
	place-items: center;
	border: 1px solid rgba(233, 233, 192, .5);
	background: rgba(91, 24, 38, .55);
	color: var(--cream);
	border-radius: 50%;
	cursor: pointer;
	line-height: 1;
	transition: background 250ms, border-color 250ms, transform 250ms;
}
.ea-lb-close { top: 18px; right: 18px; width: 46px; height: 46px; font-size: 28px; }
.ea-lb-arrow { top: 50%; width: 48px; height: 48px; font-size: 30px; transform: translateY(-50%); }
.ea-lb-arrow--prev { left: 14px; }
.ea-lb-arrow--next { right: 14px; }
.ea-lb-close:hover, .ea-lb-arrow:hover, .ea-lb-close:focus-visible, .ea-lb-arrow:focus-visible { background: var(--burgundy); border-color: var(--marigold); outline: none; }
.ea-lb-close:hover { transform: rotate(90deg); }

/* ==========================================================================
   Single-page mode (phones / narrow portrait screens)
   ========================================================================== */
.ea-book.is-single {
	--book-w: min(92vw, 560px, calc((100svh - 190px) * .72));
	aspect-ratio: 5 / 7;
}
.ea-book.is-single::before { background: radial-gradient(ellipse at 30% 20%, #6d2132, #3d0f19 70%); inset: -2.2% -3% -2.2% -2.4%; }
.ea-book.is-single .ea-page--left,
.ea-book.is-single .ea-page--right,
.ea-book.is-single .ea-spine { display: none; }
.ea-book.is-single .ea-page--single { display: block; left: 0; width: 100%; border-radius: 2px 4px 4px 2px; box-shadow: 1px 0 0 #ece5d9, 2px 1px 0 #e2d9cb, 3px 2px 0 #d8cebe; }
.ea-book.is-single .ea-page--single::before { background: linear-gradient(to right, rgba(58, 14, 24, .2), transparent 7%); }
.ea-book.is-single .ea-leaf { left: 0; width: 100%; }
.ea-book.is-single .ea-content { padding: 9% 9% 12%; }
.ea-book.is-single .ea-chapter { font-size: clamp(9px, 2.2cqw, 13px); }
.ea-book.is-single .ea-chapter-title { font-size: clamp(28px, 8cqw, 46px); }
.ea-book.is-single .ea-story { font-size: clamp(15px, 3.6cqw, 19px); }
.ea-book.is-single .ea-folio { font-size: 12px; }
.ea-book.is-single .ea-photos { gap: 6% 7%; }
.ea-book.is-single .ea-frame { padding: clamp(5px, 1.5cqw, 10px); }
.ea-book.is-single .ea-frame-mat { padding: clamp(5px, 1.8cqw, 11px); }
.ea-book.is-single .ea-end-line { font-size: clamp(28px, 8cqw, 44px); }
.ea-book.is-single .ea-monogram { width: clamp(110px, 38cqw, 200px); }
.ea-book.is-single .ea-fin { font-size: clamp(16px, 5cqw, 24px); }
.ea-book.is-single .ea-fin-sub { font-size: clamp(20px, 6cqw, 30px); }
.ea-book.is-single .ea-restart { font-size: 10px; }
.ea-book.is-single .ea-leaf-back { background-image: radial-gradient(rgba(91, 24, 38, .03) .8px, transparent 1px), linear-gradient(to left, #efe7da, var(--paper)); }
.ea-book.is-single .ea-leaf.is-fading { opacity: 0; transition: transform var(--turn) var(--ease-turn), opacity calc(var(--turn) * .45) ease calc(var(--turn) * .55); }
.ea-book.is-single .ea-leaf.is-fading-in { transition: transform var(--turn) var(--ease-turn), opacity calc(var(--turn) * .4) ease; }

@media (max-width: 600px) {
	.ea-nav-btn { padding: 9px 13px; font-size: 10px; letter-spacing: .16em; }
	.ea-counter { min-width: 5em; font-size: 14px; }
	.ea-lightbox { padding: 70px 10px 90px; }
	.ea-lb-arrow { top: auto; bottom: 22px; transform: none; }
	.ea-lb-arrow--prev { left: calc(50% - 64px); }
	.ea-lb-arrow--next { right: calc(50% - 64px); }
	.ea-lb-frame { padding: 7px; }
	.ea-lb-frame img { border-width: 6px; max-height: calc(100svh - 200px); max-width: calc(100vw - 34px); }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
	:root { --turn: 1ms; }
	.ea-mote, .ea-seal::before, .ea-hint { animation: none !important; }
	.ea-envelope, .ea-card, .ea-flap-top, .ea-seal-half, .ea-scene, .ea-lb-figure { transition-duration: 1ms !important; }
}
