@import url("/public/fonts.css");

/* Tokens */
:root {
	--bg: #F4F2ED;
	--ink: #2E3630;
	--muted: #4A5A50;
	--faint: #5C6B60;
	--accent: #7A9383;
	--line: #D3D7CE;
	--rule: #C9CEC5;
	--paper: #FAF9F5;
	--shadow: rgba(46, 54, 48, 0.28);
	--serif: Newsreader, Georgia, serif;
	--mono: 'IBM Plex Mono', monospace;
}

/* Base */
html {
	background: var(--bg);
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--serif);
}

h1,
h2,
h3,
p,
dl,
dd {
	margin: 0;
}

a {
	color: var(--muted);
	text-decoration: none;
}

a:hover {
	color: var(--accent);
}

::selection {
	background: var(--accent);
	color: var(--bg);
}

@keyframes mcrl-bg-in {
	from {
		opacity: 0;
	}

	to {
		opacity: 0.16;
	}
}

@keyframes mcrl-logo-in {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes mcrl-rise {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

/* Layout shared by every page */
.page {
	min-height: 100vh;
	box-sizing: border-box;
	background: var(--bg);
	padding: 32px clamp(20px, 5vw, 64px) 28px;
}

.page--home {
	display: grid;
	grid-template-rows: auto 1fr auto;
	gap: 40px;
}

.page--event {
	position: relative;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	gap: clamp(48px, 7vw, 88px);
	padding-bottom: 56px;
}

.page--event>* {
	position: relative;
	z-index: 1;
}

.topbar,
.footer {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	font-family: var(--mono);
	font-size: 11px;
}

.topbar {
	align-items: center;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--muted);
}

.footer {
	align-items: flex-end;
	letter-spacing: 0.1em;
	color: var(--faint);
}

.est {
	margin-left: auto;
}

.page--event .topbar {
	animation: mcrl-logo-in 0.7s ease both;
}

.page--event .footer {
	animation: mcrl-logo-in 0.7s ease 0.3s both;
}

/* Hero (centred intro block) */
.hero {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	animation: mcrl-rise 0.7s ease both;
}

.page--home .hero {
	gap: clamp(24px, 4vw, 40px);
}

.page--event .hero {
	flex: 1;
	gap: clamp(22px, 3.5vw, 34px);
}

.logo {
	display: block;
	width: clamp(112px, 15vw, 160px);
	height: auto;
}

.logo--sm {
	width: clamp(88px, 11vw, 120px);
	height: clamp(88px, 11vw, 120px);
	aspect-ratio: 1 / 1;
	animation: mcrl-logo-in 500ms ease both;
}

.intro {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	max-width: 620px;
}

.intro--narrow {
	gap: 18px;
	max-width: 560px;
}

.lede {
	font-size: clamp(17px, 2.2vw, 22px);
	line-height: 1.55;
	color: var(--muted);
	text-wrap: pretty;
}

.eyebrow {
	font-family: var(--mono);
	font-size: 11px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--muted);
}

h1 {
	font-weight: 300;
	font-size: clamp(34px, 5.4vw, 58px);
	line-height: 1.08;
	letter-spacing: 0.01em;
	text-wrap: balance;
}

.divider {
	display: flex;
	align-items: center;
	gap: 14px;

	&::before,
	&::after {
		content: "";
		width: 26px;
		height: 1px;
		background: var(--rule);
	}
}

.dot {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--accent);
}

nav {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
}

.label {
	font-family: var(--mono);
	font-size: 10px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--muted);
}

/* Event details */
.details {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px 40px;
	font-family: var(--mono);
	font-size: 12px;
	letter-spacing: 0.08em;
	color: var(--muted);

	&>div {
		display: flex;
		flex-direction: column;
		gap: 5px;
	}
}

/* Invite sheets: papers staggered vertically, each top sticking out above the one in front */
.sheets {
	--overlap: 18px;
	--ease: cubic-bezier(0.22, 1, 0.36, 1);
	width: 100%;
	max-width: 760px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	padding-top: var(--overlap);
}

.sheet {
	position: relative;
	z-index: calc(var(--i) + 1);
	margin-top: calc(var(--overlap) * -1);
	border: 1px solid var(--line);
	border-radius: 3px;
	background: var(--paper);
	box-shadow: 0 1px 0 rgba(46, 54, 48, 0.04), 0 10px 24px -18px var(--shadow), 0 -6px 14px -10px var(--shadow);
	animation: mcrl-rise 0.7s ease calc(0.15s + var(--i) * 0.1s) both;
	transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease);

	&.is-open {
		transform: translateY(-4px);
		box-shadow: 0 1px 0 rgba(46, 54, 48, 0.04), 0 22px 40px -26px var(--shadow), 0 -6px 14px -10px var(--shadow);
	}
}

.sheet-head {
	font: inherit;
}

.sheet-tab {
	display: flex;
	align-items: baseline;
	gap: 16px;
	width: 100%;
	padding: 22px 28px calc(22px + var(--overlap));
	border: 0;
	background: transparent;
	color: var(--ink);
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition: padding 0.6s var(--ease);

	&:focus-visible {
		outline: 1px solid var(--accent);
		outline-offset: -6px;
	}

	&:hover .sheet-title,
	&[aria-expanded="true"] .sheet-title {
		color: var(--ink);
	}

	&:hover .sheet-toggle {
		border-color: var(--accent);
	}
}

/* The sheet in front covers the bottom of the one behind */
.sheet:last-child .sheet-tab,
.sheet.is-open .sheet-tab {
	padding-bottom: 22px;
}

.sheet-num {
	min-width: 2.2em;
	font-family: var(--mono);
	font-size: 11px;
	letter-spacing: 0.14em;
	color: var(--faint);
}

.sheet-title {
	flex: 1;
	font-weight: 300;
	font-size: clamp(24px, 3.2vw, 32px);
	letter-spacing: 0.01em;
	color: var(--muted);
	transition: color 0.3s ease;
}

.sheet-toggle {
	position: relative;
	flex: none;
	align-self: center;
	width: 28px;
	height: 28px;
	border: 1px solid var(--line);
	border-radius: 50%;
	transition: transform 0.5s var(--ease), border-color 0.3s ease;

	&::before,
	&::after {
		content: "";
		position: absolute;
		top: 50%;
		left: 50%;
		width: 10px;
		height: 1px;
		background: var(--muted);
		transform: translate(-50%, -50%);
	}

	&::after {
		transform: translate(-50%, -50%) rotate(90deg);
	}
}

.sheet.is-open .sheet-toggle {
	transform: rotate(135deg);
}

.sheet-body {
	display: grid;
	grid-template-rows: 0fr;
	visibility: hidden;
	transition: grid-template-rows 0.6s var(--ease), visibility 0s linear 0.6s;
}

.sheet.is-open .sheet-body {
	grid-template-rows: 1fr;
	visibility: visible;
	transition: grid-template-rows 0.6s var(--ease), visibility 0s;
}

.sheet-inner {
	min-height: 0;
	overflow: hidden;

	&>* {
		margin: 0 28px;
	}

	&>:first-child {
		padding-top: 22px;
		border-top: 1px solid var(--line);
	}

	&>:last-child {
		margin-bottom: calc(28px + var(--overlap));
	}

	&>*+* {
		margin-top: 24px;
	}
}

.sheet:last-child .sheet-inner>:last-child {
	margin-bottom: 28px;
}

.sheet-lede {
	font-size: 18px;
	line-height: 1.6;
	color: var(--muted);
	text-wrap: pretty;
}

.details--sheet {
	justify-content: flex-start;
	font-size: 14px;

	& dd {
		color: var(--ink);
	}
}

.stops {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 20px;
}

.stop {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.map {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	margin-top: 6px;
	border: 1px solid var(--line);
	border-radius: 4px;
	background: var(--bg);
	overflow: hidden;

	& .maplibregl-ctrl-group {
		border: 1px solid var(--line);
		border-radius: 4px;
		background: var(--paper);
		box-shadow: none;

		& button+button {
			border-top-color: var(--line);
		}
	}

	& .maplibregl-ctrl-attrib {
		font-family: var(--mono);
		font-size: 10px;
		background: var(--paper);
		color: var(--faint);

		& a {
			color: var(--muted);
		}
	}
}

.map-pin {
	width: 12px;
	height: 12px;
	border: 3px solid var(--paper);
	border-radius: 50%;
	background: var(--ink);
	box-shadow: 0 1px 4px var(--shadow);
	cursor: default;
}

.stop-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 6px;

	& .pill--sm {
		margin-top: 0;
	}
}

a.pill {
	text-align: center;
}

@media (prefers-reduced-motion: reduce) {

	.sheet,
	.sheet-tab,
	.sheet-body,
	.sheet-toggle {
		transition: none;
	}

	.sheet.is-open {
		transform: none;
	}
}

.gifts-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 20px;
}

.card {
	position: relative;
	overflow: hidden;
	isolation: isolate;
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 28px;
	min-height: 260px;
	border: 1px solid var(--line);
	border-radius: 4px;
	background: transparent;

	& h3 {
		font-weight: 400;
		font-size: 21px;
	}

	& p {
		font-size: 16px;
		line-height: 1.6;
		color: var(--muted);
		text-wrap: pretty;
	}
}

.card-bg {
	position: absolute;
	z-index: -1;
	height: auto;
	opacity: 0.16;
	pointer-events: none;
	animation: mcrl-bg-in 1.2s ease both;
}

.card-bg--gift {
	right: -70px;
	bottom: -80px;
	width: 300px;
	aspect-ratio: 191 / 197;
}

.card-bg--pagoda {
	right: -110px;
	bottom: -40px;
	width: 400px;
	aspect-ratio: 501 / 461;
}

.iban {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-top: 14px;
	border-top: 1px solid var(--line);
	font-family: var(--mono);
	font-size: 11px;
	letter-spacing: 0.06em;
	color: var(--muted);
}

.iban-value {
	font-size: 14px;
	letter-spacing: 0.04em;
	color: var(--ink);
	word-break: break-word;
}

/* Pill buttons and links */
nav>a,
.pill {
	padding: 11px 22px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: transparent;
	font-family: var(--mono);
	font-size: 12px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--muted);
	cursor: pointer;

	&:hover {
		border-color: var(--accent);
		color: var(--ink);
	}
}

.pill--sm {
	align-self: flex-start;
	margin-top: 6px;
	padding: 9px 18px;
	font-size: 11px;
}
