/*
Theme Name: Vale XV
Description: Invitación interactiva de quince años.
Version: 0.4.3
Requires at least: 6.3
Requires PHP: 7.4
Text Domain: valexv
*/

@font-face {
	font-family: Cormorant;
	src: url("assets/fonts/cormorant.woff2") format("woff2");
	font-weight: 500;
	font-display: swap;
}

@font-face {
	font-family: "Great Vibes";
	src: url("assets/fonts/great-vibes.woff2") format("woff2");
	font-weight: 400;
	font-display: swap;
}

:root {
	color-scheme: dark;
	--night: #100a19;
	--gold: #f3d598;
	--cream: #fff0d8;
	--ink: #402042;
	--vellum: url("assets/images/pergamino.jpg");
	--serif: Cormorant, Georgia, serif;
	--script: "Great Vibes", "Brush Script MT", cursive;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--night); color: var(--cream); font: 500 1.2rem / 1.35 var(--serif); }
h1, h2, p, dl, dd { margin: 0; }
a { color: inherit; }
a:focus-visible { outline: 2px solid currentColor; outline-offset: 6px; }
.standard-page { max-width: 50rem; margin: auto; padding: 4rem 1.5rem; }
.standard-page img { max-width: 100%; height: auto; }

.opening, .chapter { position: relative; isolation: isolate; }
.opening__stage, .chapter__stage {
	min-height: 100vh;
	min-height: 100svh;
	overflow: clip;
}
.opening__stage {
	position: relative;
	height: 100vh;
	height: 100svh;
	--lift: 35%;
	--unfold: 0deg;
	--seal-opacity: 1;
	--seal-drop: 0%;
	--seal-turn: 0deg;
	--zoom: 1;
	--glow: 0;
}

.motion .opening { min-height: 215vh; min-height: 215svh; }
.motion .opening__stage { position: sticky; top: 0; }
.admin-bar .motion .opening__stage { top: var(--wp-admin--admin-bar--height, 32px); }

.scenery {
	position: absolute;
	inset: 0;
	z-index: -2;
	background: #1f1230;
	overflow: hidden;
}

.scenery img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center var(--image-position, 50%);
	transform: scale(var(--zoom, 1));
}

.scenery--opening { --image-position: 55%; }
.scenery--garden { --image-position: 58%; }

.scenery::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, #100a196b 0%, transparent 27%, transparent 65%, #100a19 100%);
}

@media (min-width: 48rem) {
	.scenery::before {
		content: "";
		position: absolute;
		inset: -2.5rem;
		background: var(--illustration) center 48% / cover;
		filter: blur(35px) brightness(.44) saturate(.9);
	}
	.scenery img {
		position: relative;
		margin-inline: auto;
		width: clamp(36rem, 82svh, 60rem);
		mask-image: linear-gradient(90deg, transparent, black 12%, black 88%, transparent);
	}
	.scenery--opening { --illustration: url("assets/images/torre.jpg"); }
	.scenery--lake, .scenery--farewell { --illustration: url("assets/images/lago.jpg"); }
	.scenery--garden { --illustration: url("assets/images/jardin.jpg"); }
}

.opening__glow {
	position: absolute;
	inset: 0;
	z-index: -1;
	opacity: var(--glow);
	background: radial-gradient(ellipse at 50% 56%, #ffca7652, transparent 54%);
	pointer-events: none;
}

.opening__title {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.ornament {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .55rem;
	margin: 0 auto .45rem;
	width: min(9rem, 45%);
	color: var(--gold);
	line-height: 1;
}

.ornament::before, .ornament::after {
	content: "";
	height: 1px;
	flex: 1;
	background: linear-gradient(90deg, transparent, currentColor);
}

.ornament::after { transform: scaleX(-1); }

.envelope {
	--paper: url("assets/images/papel-ciruela.jpg");
	--paper-grain: url("assets/images/fibra-ciruela.jpg");
	--flap-shape: polygon(
		0 0, 100% 0, 99.2% 14%, 97.1% 26%, 93.2% 39%, 87.8% 51%,
		63.5% 91%, 58.7% 97%, 54% 100%, 46% 100%, 41.3% 97%, 36.5% 91%,
		12.2% 51%, 6.8% 39%, 2.9% 26%, .8% 14%
	);
	position: absolute;
	isolation: isolate;
	left: 50%;
	bottom: max(13.7svh, 5.3rem);
	width: min(86vw, 57svh, 32rem);
	aspect-ratio: 1.55;
	transform: translateX(-50%);
	perspective: 1000px;
	container-type: inline-size;
}

.envelope::before {
	content: "";
	position: absolute;
	z-index: -1;
	inset: auto -5% -10%;
	height: 25%;
	border-radius: 50%;
	background: radial-gradient(ellipse, #08030bef 8%, #0b0310b8 45%, transparent 72%);
	filter: blur(9px);
}

.envelope__back, .envelope__pocket {
	position: absolute;
	inset: 0;
	border-radius: .3rem .3rem .45rem .45rem / .22rem .22rem .5rem .5rem;
}

.envelope__back {
	border: 1px solid #b8869766;
	background:
		radial-gradient(ellipse at 50% -15%, #6b3c4f30, #1c0d23dc 80%),
		var(--paper-grain) center / cover #45283b;
	box-shadow: inset 0 0 1.1rem #140b21, 0 .55rem 1.1rem #0a040d9c;
}

.envelope__sleeve {
	position: absolute;
	inset: -125% 0 0;
	z-index: 2;
	overflow: hidden;
	border-radius: .3rem;
}

.letter {
	position: absolute;
	inset: auto 9% 4%;
	height: 60%;
	display: grid;
	padding: 4%;
	transform: translateY(var(--lift)) rotate(var(--letter-tilt, 0deg));
	transform-origin: 50% 90%;
	color: var(--ink);
	background:
		linear-gradient(135deg, #ffecd01a, transparent 42%, #61332129),
		var(--vellum) center / 100% 100% #eccc93;
	border: 1px solid #9b683d;
	box-shadow: 0 8px 28px #221025bd, inset 0 0 1.1rem #8e50182e, inset 0 0 0 1px #fdf0bca3;
	text-align: center;
}

.letter__border {
	display: grid;
	place-content: center;
	justify-items: center;
	border: 3px double #9d6b3c80;
	box-shadow: 0 0 0 1px #fae2ab6b, inset 0 0 0 1px #fae2ab6b;
}

.letter__star {
	display: block;
	width: clamp(1.4rem, 7.5cqw, 2.65rem);
	height: auto;
	margin-bottom: .55rem;
	filter: drop-shadow(0 1px .65px #7b411b9c);
}
.letter__script { font: 400 clamp(1.65rem, 5.8svh, 4rem) / .92 var(--script); }
.letter__number { color: #845928; font: 500 clamp(3rem, 11svh, 7.4rem) / .83 var(--serif); }
.letter__flourish { color: #906025; margin-top: .65rem; line-height: 1; }

.envelope__pocket {
	z-index: 3;
	overflow: hidden;
	clip-path: polygon(0 0, 9% 19%, 49% 58%, 51% 58%, 91% 19%, 100% 0, 100% 100%, 0 100%);
	background:
		radial-gradient(ellipse at 0 60%, #f09b4b59, transparent 43%),
		linear-gradient(145deg, #150a16d9, #3d2137a1 38%, #1a0e23d6 100%),
		var(--paper-grain) center / cover #45283b;
	box-shadow: inset 0 0 0 1px #efbec03a, inset .3rem -.15rem .9rem #160a1dba;
}

.envelope__fold {
	position: absolute;
	inset: 0;
}

.envelope__fold--left {
	clip-path: polygon(0 0, 54% 57%, 0 100%);
	background:
		radial-gradient(ellipse at -8% 70%, #ee96597a, #99565019 37%, #160a1aab 72%),
		var(--paper-grain) left center / cover #4a293e;
	box-shadow: inset 1px 0 #f5a97891;
}

.envelope__fold--right {
	clip-path: polygon(100% 0, 46% 57%, 100% 100%);
	background:
		linear-gradient(245deg, #170b20 11%, #4a2a40a1 54%, #28132fb3),
		var(--paper-grain) right center / cover #3c253b;
	box-shadow: inset -1px 0 #a06f8d58;
}

.envelope__fold--bottom {
	clip-path: polygon(0 100%, 43% 42%, 57% 42%, 100% 100%);
	background:
		linear-gradient(180deg, #9a6a7638 25%, #3c21363d 66%, #1f0e25dc 100%),
		var(--paper-grain) 50% 75% / cover #47273e;
}

.envelope__fold--bottom::before,
.envelope__fold--bottom::after {
	content: "";
	position: absolute;
	top: 42.5%;
	width: 43.2%;
	height: 58%;
	background: linear-gradient(180deg, #d29a9a5e, #edd0a44d 35%, #9d5e7b38 69%, transparent);
}

.envelope__fold--bottom::before {
	left: 0;
	clip-path: polygon(100% 0, 100% 1%, 0 100%, 0 99%);
}

.envelope__fold--bottom::after {
	right: 0;
	clip-path: polygon(0 0, 0 1%, 100% 100%, 100% 99%);
}

.envelope__flap {
	position: absolute;
	inset: 0 0 auto;
	height: 68%;
	z-index: 4;
	transform-origin: center top;
	transform-style: preserve-3d;
	transform: rotateX(var(--unfold));
}

.flap-open .envelope__flap { z-index: 1; }

.envelope__flap-face {
	position: absolute;
	inset: 0;
	backface-visibility: hidden;
}

.envelope__flap-face::before {
	content: "";
	position: absolute;
	inset: 0;
	clip-path: var(--flap-shape);
}

.envelope__flap-face--outer {
	filter: drop-shadow(0 .45rem .24rem #140817ca) drop-shadow(0 .7rem .55rem #19081c73);
}

.envelope__flap-face--outer::before {
	border-radius: .28rem .28rem 0 0;
	background:
		linear-gradient(180deg, #ffe0b145 0, transparent 2.2%, transparent 47%, #17091d73 100%),
		var(--paper) center 1% / 100% auto #66404e;
	box-shadow: inset 0 1px rgba(255, 224, 194, .56);
}

.envelope__lettering {
	position: absolute;
	inset: 42% 0 auto;
	transform: translateY(-50%);
	text-align: center;
	color: #edc28a;
	font-size: 7.3cqw;
	font-style: italic;
	line-height: 1.05;
	text-shadow: 0 1px 1px #542b2c, 0 -1px #ffcf9b61;
}

.envelope__flap-face--inner { transform: rotateX(180deg); }
.envelope__flap-face--inner::before {
	background:
		radial-gradient(ellipse at 44% 0%, #be826756, #30162d5e 73%),
		var(--paper-grain) center 38% / cover #603c50;
	border-top: 1px solid #c387aa;
}

.envelope__seal {
	position: absolute;
	z-index: 5;
	top: 66%;
	left: 50%;
	display: block;
	width: 28%;
	height: auto;
	transform: translate(-50%, calc(-50% + var(--seal-drop))) rotate(var(--seal-turn));
	opacity: var(--seal-opacity);
	filter: drop-shadow(-.05rem .25rem .17rem #140410b6) drop-shadow(0 .35rem .52rem #0a0311bd);
}

.opening__action, .back-to-top {
	position: absolute;
	left: 50%;
	bottom: max(1.6rem, env(safe-area-inset-bottom));
	transform: translateX(-50%);
	display: grid;
	justify-items: center;
	gap: .45rem;
	min-height: 44px;
	padding: .5rem .85rem .65rem;
	color: #fff0cc;
	text-shadow: 0 1px 8px #170c1e;
	text-align: center;
	text-decoration: none;
	font-size: .85rem;
	letter-spacing: .14em;
	text-transform: uppercase;
	white-space: nowrap;
}

.opening__action:hover, .back-to-top:hover { color: #ffd487; }
.opening__chevron { width: .58rem; height: .58rem; transform: rotate(45deg); border: solid currentColor; border-width: 0 1px 1px 0; }
.motion .opening__chevron { animation: beckon 2.1s ease-in-out infinite; }

@keyframes beckon {
	50% { transform: translateY(.28rem) rotate(45deg); }
}

.chapter { scroll-margin-top: var(--wp-admin--admin-bar--height, 0px); }

.chapter__stage {
	position: relative;
	display: grid;
	place-items: center;
	padding: 5.5rem 1.35rem;
}

.motion .chapter__stage {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
}

.motion .chapter::after {
	content: "";
	display: block;
	height: 62vh;
	height: 62svh;
	pointer-events: none;
}

.chapter .scenery::after {
	background:
		radial-gradient(ellipse at 50% 49%, #170c2a9c, transparent 75%),
		linear-gradient(180deg, #100a19 0%, transparent 16%, transparent 77%, #100a19 100%);
}

.chapter__content { position: relative; width: min(100%, 29rem); text-align: center; }

.motion [data-reveal-step] {
	opacity: var(--ink-opacity, 0);
	mask-image: linear-gradient(105deg,
		#000 calc(var(--ink-edge, -3%) - 24%),
		#0009 calc(var(--ink-edge, -3%) - 12%),
		#0002 calc(var(--ink-edge, -3%) - 3%),
		transparent var(--ink-edge, -3%));
}

.motion [data-reveal-step].ink-complete,
.motion [data-reveal]:focus-within [data-reveal-step] {
	opacity: 1;
	mask-image: none;
}

.motion :is(h2, p)[data-reveal-step] { position: relative; }

.motion :is(h2, p)[data-reveal-step]::after {
	content: "";
	position: absolute;
	top: 35%;
	left: clamp(0%, calc(var(--ink-edge, -3%) - 12%), 97%);
	width: 1.6rem;
	aspect-ratio: 1;
	background:
		radial-gradient(circle at 65% 28%, #fff4cd 0 3%, transparent 12%),
		radial-gradient(circle at 24% 70%, #ffc873 0 4%, transparent 14%),
		radial-gradient(circle, #ffe9b0 0 6%, #ffcc757a 23%, transparent 67%);
	opacity: var(--ink-glow, 0);
	transform: translate(-50%, -50%);
	pointer-events: none;
}

.chapter h2 { font: 400 clamp(3.6rem, 12vw, 6.4rem) / .96 var(--script); }
.welcome, .farewell { color: #ffebbf; text-shadow: 0 2px 18px #090511, 0 2px 6px #180b23; }
.welcome p, .farewell p { font-size: clamp(1.37rem, 4vw, 1.75rem); line-height: 1.2; margin: 1rem auto; max-width: 20rem; }
.welcome .welcome__name { font-size: clamp(1.8rem, 6vw, 2.7rem); }
.crest { display: inline-block; margin-bottom: 1rem; color: #ffdc94; font-size: 3rem; line-height: 1; text-shadow: 0 0 1.2rem #eaa536; }

.parchment {
	--molding: linear-gradient(180deg, #3e2113 0%, #98602d 13%, #ecc481 23%, #b77b37 32%, #50301a 53%, #200e09 83%, #704320 95%, #c99653 100%);
	isolation: isolate;
	margin-block: 2.8rem 1.4rem;
	padding: 3.3rem clamp(1.4rem, 6vw, 3rem) 2.75rem;
	color: var(--ink);
	border: 5px ridge #97612c;
	border-radius: .35rem;
	background:
		radial-gradient(ellipse at 48% 46%, #fff8e13b 24%, transparent 66%),
		var(--vellum) center / 100% 100% #eccc93;
	box-shadow: 0 0 0 1px #2c160f, inset 0 0 .6rem #6e3e1d80, 0 1.2rem 2.4rem #090511b5;
}

.parchment::before, .parchment::after {
	content: "";
	position: absolute;
	z-index: -1;
	left: -.62rem;
	right: -.62rem;
	height: .88rem;
	border: 1px solid #523018;
	border-radius: .35rem;
	background:
		linear-gradient(90deg, #431f11 0, transparent 7%, transparent 92%, #3d1b0c 100%),
		var(--molding);
	box-shadow: inset 0 -1px #e3ad5e83, 0 .18rem .33rem #4925159c;
}

.parchment::before { top: -.56rem; }
.parchment::after { bottom: -.56rem; }

.parchment h2 {
	font-size: clamp(2.75rem, 9.1vw, 4.3rem);
	overflow-wrap: anywhere;
	text-shadow: 0 1px #fff6d285;
}

.parchment .ornament {
	margin: .95rem auto 0;
	color: #895025;
}

.parchment__crown {
	position: absolute;
	z-index: 1;
	left: 50%;
	top: .28rem;
	width: min(78%, 19rem);
	aspect-ratio: 3.35;
	transform: translate(-50%, -92%);
	background: url("assets/images/filigrana-dorada.png") center / contain no-repeat;
	filter: drop-shadow(0 .16rem .19rem #271216c4);
	pointer-events: none;
}

.details { width: min(100%, 19rem); margin: 1.3rem auto 0; }

.details > div + div {
	position: relative;
	margin-top: .8rem;
	padding-top: .8rem;
	background: linear-gradient(90deg, transparent, #864c2d7a 28%, #864c2d7a 72%, transparent) top center / 100% 1px no-repeat;
}

.details > div + div::before {
	content: "";
	position: absolute;
	top: 0;
	left: 50%;
	width: .3rem;
	aspect-ratio: 1;
	border: 1px solid #8a552f;
	background: #e7b967;
	transform: translate(-50%, -38%) rotate(45deg);
}

.details dt {
	color: #694020;
	font-size: .87rem;
	letter-spacing: .18em;
	text-transform: uppercase;
}

.details dd {
	margin-top: .13rem;
	font-size: clamp(1.55rem, 5vw, 1.85rem);
	line-height: 1.1;
	overflow-wrap: anywhere;
}

.details__address { display: block; margin-top: .35rem; font-size: 1.19rem; }
.details__map { display: inline-block; margin-top: .85rem; padding: .5rem .65rem; text-underline-offset: .2em; }

.chapter--farewell .chapter__stage { min-height: 88vh; min-height: 88svh; }
.motion .chapter--farewell .chapter__stage { min-height: 100vh; min-height: 100svh; }
.scenery--farewell img { object-position: center 72%; }
.farewell .ornament { margin-bottom: 1rem; }
.rsvp {
	display: inline-flex;
	min-height: 48px;
	align-items: center;
	justify-content: center;
	margin-top: 1.4rem;
	padding: .65rem 1.3rem;
	border: 3px double #dfaa61;
	border-radius: .3rem;
	background: #4a264d;
	color: #fff1d9;
	text-decoration: none;
}
.rsvp:hover { background: #633762; }
.back-to-top { display: flex; align-items: center; }

.spark-field {
	position: absolute;
	inset: 0;
	z-index: -1;
	overflow: hidden;
	pointer-events: none;
}

.spark-field i {
	position: absolute;
	left: var(--x);
	top: var(--y);
	width: var(--size);
	aspect-ratio: 1;
	border-radius: 50%;
	background: #fff0b9;
	box-shadow: 0 0 .45rem .06rem #ffa94d;
	opacity: .55;
	animation: shimmer var(--duration) var(--delay) ease-in-out infinite;
	animation-play-state: paused;
}

.spark-field .spark--lantern {
	aspect-ratio: .81;
	border-radius: 25% 25% 32% 32% / 10% 10% 14% 14%;
	background: radial-gradient(ellipse at 50% 83%, #fff7d2, #f8b95e 25%, #9b4128 99%);
	border: 1px solid #ffbb70a6;
	box-shadow: 0 0 .65rem #ef973cbd;
	animation-name: float-lantern;
	animation-timing-function: linear;
}

.spark-field.is-visible i { animation-play-state: running; }

@keyframes shimmer {
	0%, 100% { transform: translate(0, .4rem) scale(.65); opacity: .19; }
	50% { transform: translate(.42rem, -.55rem) scale(1.1); opacity: .86; }
}

@keyframes float-lantern {
	0% { transform: translate(0, 4.2rem) rotate(-6deg); opacity: 0; }
	22% { opacity: .86; }
	76% { opacity: .78; }
	100% { transform: translate(1rem, -6rem) rotate(7deg); opacity: 0; }
}

@media (max-height: 40rem) and (orientation: landscape) {
	.envelope { width: 47svh; bottom: 17.5svh; }
	.opening__action { bottom: .3rem; }
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { animation: none !important; transition: none !important; }
}
