/* Palette, radii and field treatment follow Joiner's PDL tokens in poe2
   (poe-tiles-packages/pdl-design-tokens). Apple devices get the system font
   PDL uses; everyone else gets Inter instead of a generic fallback. */
@font-face {
	font-family: "Inter";
	src: url("/fonts/inter-latin.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
}

:root {
	--yellow: oklch(0.8927 0.1839 96.61); /* yellow-9, accent-base */
	--ink: oklch(0.1591 0.0025 255); /* fg-base */
	--ink-hover: oklch(0.2981 0.004 255);
	--paper: #fff;
	--fg-muted: oklch(0.4828 0.004 255);
	--field-border: oklch(0.64 0.004 255); /* 3:1 against white */
	--error: oklch(0.52 0.19 30);
	--error-bg: oklch(0.97 0.02 30);
	--radius-control: 12px;
	--font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

[hidden] {
	display: none !important;
}

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

html {
	-webkit-text-size-adjust: 100%;
	background: var(--paper);
}

body {
	margin: 0;
	color: var(--ink);
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.5;
	font-feature-settings: "cv11", "ss01";
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

h1,
h2,
p {
	margin: 0;
}

a {
	color: inherit;
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
}

:focus-visible {
	outline: 2px solid var(--ink);
	outline-offset: 3px;
}

/* Two halves of one invitation: the event (yellow) and the reply (white). */
.invite {
	display: grid;
	min-height: 100svh;
}

.poster {
	container-type: inline-size;
	display: flex;
	flex-direction: column;
	gap: 40px;
	padding: 24px 24px 40px;
	background: var(--yellow);
	color: var(--ink);
}

/* Only the /1 and /2 variations show the logo. */
.brand {
	display: inline-flex;
	align-self: flex-start;
	border-radius: 6px;
}

.logo {
	display: block;
	height: 28px;
	width: auto;
}

.brand + .tag {
	margin-top: -16px;
}

/* Mirrors the "Private event" pill on the link-preview image. */
.tag {
	display: inline-flex;
	align-self: flex-start;
	align-items: center;
	gap: 8px;
	height: 32px;
	padding: 0 14px 0 12px;
	border-radius: 999px;
	background: var(--ink);
	color: var(--yellow);
	font-size: 14px;
	font-weight: 650;
	letter-spacing: 0.01em;
}

.tag svg {
	width: 14px;
	height: 14px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.tag + .date {
	margin-top: -24px;
}

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

.date-day {
	font-size: 18px;
	font-weight: 600;
	letter-spacing: -0.01em;
}

/* "Nov 7" spans the poster's full width at every size. */
.date-main {
	font-size: 42.5cqi;
	font-weight: 800;
	line-height: 0.84;
	letter-spacing: -0.045em;
	word-spacing: -0.04em;
	margin-left: -0.05em;
}

.poster-body {
	display: flex;
	flex-direction: column;
	gap: 12px;
	max-width: 34em;
}

.poster-title {
	font-size: clamp(26px, 6.5vw, 34px);
	font-weight: 650;
	line-height: 1.1;
	letter-spacing: -0.025em;
	text-wrap: balance;
}

.lede {
	font-size: 17px;
	text-wrap: pretty;
}

/* Details held back until signup, shown as redacted lines. */
.reveal {
	display: flex;
	flex-direction: column;
	gap: 16px;
	max-width: 34em;
}

.redacted {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 20px;
	margin: 0;
}

.redacted dt {
	margin-bottom: 8px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.redacted dd {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
}

/* Each bar is sized like a blacked-out word. */
.redacted .line {
	display: flex;
	gap: 6px;
}

.redacted i {
	display: block;
	height: 18px;
	border-radius: 2px;
	background: var(--ink);
}

.redacted .w16 { width: 16%; }
.redacted .w20 { width: 20%; }
.redacted .w24 { width: 24%; }
.redacted .w28 { width: 28%; }
.redacted .w32 { width: 32%; }
.redacted .w44 { width: 44%; }
.redacted .w48 { width: 48%; }
.redacted .w56 { width: 56%; }

.reveal-note {
	font-size: 15px;
}

/* Reply */
.reply {
	display: flex;
	flex-direction: column;
	background: var(--paper);
}

.reply-inner {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 24px;
	width: 100%;
	max-width: 440px;
	margin: 0 auto;
	padding: 32px 24px;
}

.reply-title {
	font-size: 24px;
	font-weight: 650;
	line-height: 1.2;
	letter-spacing: -0.02em;
	text-wrap: balance;
}

form {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
}

.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.field label {
	font-size: 14px;
	font-weight: 600;
}

.field input {
	display: block;
	width: 100%;
	height: 52px;
	padding: 0 16px;
	border: 1.5px solid var(--field-border);
	border-radius: var(--radius-control);
	background: var(--paper);
	color: var(--ink);
	font: inherit;
	font-size: 17px;
	transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.field input::placeholder {
	color: oklch(0.6163 0.004 255);
}

.field input:hover {
	border-color: var(--ink);
}

.field input:focus {
	outline: none;
	border-color: var(--ink);
	box-shadow: 0 0 0 4px oklch(0.8927 0.1839 96.61 / 0.55);
}

.field input[aria-invalid="true"] {
	background: var(--error-bg);
	border-color: var(--error);
}

.field input[aria-invalid="true"]:focus {
	box-shadow: 0 0 0 4px oklch(0.52 0.19 30 / 0.15);
}

.error {
	font-size: 14px;
	font-weight: 500;
	color: var(--error);
}

.error:empty {
	display: none;
}

.trap {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.check {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	margin-top: 4px;
	font-size: 15px;
	line-height: 22px;
	cursor: pointer;
}

.check input {
	appearance: none;
	flex: none;
	display: grid;
	place-items: center;
	width: 22px;
	height: 22px;
	margin: 0;
	border: 1.5px solid var(--field-border);
	border-radius: 7px;
	background: var(--paper);
	cursor: pointer;
	transition: background-color 0.12s, border-color 0.12s;
}

.check input::after {
	content: "";
	width: 10px;
	height: 6px;
	margin-top: -2px;
	border-left: 2px solid var(--yellow);
	border-bottom: 2px solid var(--yellow);
	transform: rotate(-45deg) scale(0);
	transition: transform 0.12s;
}

.check input:hover {
	border-color: var(--ink);
}

.check input:checked {
	background: var(--ink);
	border-color: var(--ink);
}

.check input:checked::after {
	transform: rotate(-45deg) scale(1);
}

.actions {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-top: 8px;
}

.submit {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 56px;
	border: 0;
	border-radius: 999px;
	background: var(--ink);
	color: var(--paper);
	font: inherit;
	font-size: 17px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.15s, transform 0.08s;
}

.submit:hover {
	background: var(--ink-hover);
}

.submit:active {
	transform: scale(0.99);
}

.submit:focus-visible {
	outline: 3px solid var(--yellow);
	outline-offset: 2px;
	box-shadow: 0 0 0 2px var(--paper);
}

.submit[aria-busy="true"] {
	cursor: progress;
}

.submit[aria-busy="true"] .label {
	visibility: hidden;
}

.spinner {
	display: none;
	position: absolute;
	width: 22px;
	height: 22px;
	border: 2.5px solid rgb(255 255 255 / 0.25);
	border-top-color: var(--yellow);
	border-radius: 50%;
	animation: spin 0.7s linear infinite;
}

.submit[aria-busy="true"] .spinner {
	display: block;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

.legal {
	font-size: 13px;
	line-height: 1.5;
	color: var(--fg-muted);
	text-wrap: pretty;
}

.legal a {
	color: var(--ink);
	font-weight: 500;
}

.alert {
	padding: 12px 16px;
	border-radius: var(--radius-control);
	background: var(--error-bg);
	color: var(--error);
	font-size: 15px;
	font-weight: 500;
}

/* Success */
.done {
	justify-content: center;
	gap: 12px;
	outline: none;
}

.done-mark {
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	margin-bottom: 12px;
	border-radius: 20px;
	background: var(--yellow);
	animation: pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.done-mark svg {
	width: 30px;
	height: 30px;
	fill: none;
	stroke: var(--ink);
	stroke-width: 2.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.done p {
	font-size: 17px;
	text-wrap: pretty;
}

.done strong {
	font-weight: 600;
	overflow-wrap: anywhere;
}

.done .done-sign {
	margin-top: 8px;
	color: var(--fg-muted);
}

@keyframes pop {
	from {
		transform: scale(0.6);
		opacity: 0;
	}
}

.footer {
	display: flex;
	gap: 20px;
	width: 100%;
	max-width: 440px;
	margin: 0 auto;
	padding: 0 24px 24px;
	font-size: 13px;
	color: var(--fg-muted);
}

.footer a:hover {
	color: var(--ink);
}

@media (min-width: 560px) {
	.row {
		grid-template-columns: 1fr 1fr;
	}

	.poster {
		padding: 40px;
	}
}

@media (min-width: 960px) {
	.invite {
		grid-template-columns: minmax(0, 1fr) minmax(480px, 40%);
	}

	/* Shared lines across the split: the form's heading sits on the date's
	   line, and both panels end on the same bottom margin. */
	.poster {
		position: sticky;
		top: 0;
		min-height: 100svh;
		gap: 0;
		padding: 48px 56px;
	}

	.tag {
		margin-bottom: 24px;
	}

	.poster-body {
		margin-bottom: 40px;
	}

	/* On short screens the details stay one row of three, as on phones;
	   tall screens stack them down the poster. */
	.redacted i {
		height: 22px;
	}

	/* The note sits on the footer's bottom line across the split. */
	.reveal {
		margin-top: auto;
	}

	.tag + .date {
		margin-top: 0;
	}

	.date {
		margin-bottom: 32px;
	}

	.poster-title {
		font-size: 44px;
		letter-spacing: -0.035em;
	}

	.reply-inner {
		padding: 104px 40px 48px;
	}

	.logo {
		height: 36px;
	}

	.brand {
		margin-bottom: 28px;
	}

	.brand + .tag {
		margin-top: 0;
	}

	/* Keep the form heading on the "Saturday" line below the logo. */
	.has-logo .reply-inner {
		padding-top: 168px;
	}

	/* Height of everything in the poster except "Nov 7", so the date can
	   shrink to keep the page on one screen (a 14" MacBook is ~1512x865,
	   a 13" Air ~1440x780). Remeasure if the poster's contents change. */
	.invite {
		--poster-rest: 520px;
	}

	.invite.has-logo {
		--poster-rest: 584px;
	}

	.invite.is-unbranded {
		--poster-rest: 568px;
	}

	.invite.has-logo.is-unbranded {
		--poster-rest: 632px;
	}

	.date-main {
		font-size: clamp(120px, calc((100svh - var(--poster-rest)) / 0.84), 42.5cqi);
	}

	.footer {
		padding: 0 40px 48px;
	}
}

@media (min-width: 960px) and (min-height: 900px) {
	.redacted {
		grid-template-columns: 1fr;
		max-width: 340px;
		gap: 16px;
	}

	.invite {
		--poster-rest: 652px;
	}

	.invite.has-logo {
		--poster-rest: 716px;
	}

	.invite.is-unbranded {
		--poster-rest: 700px;
	}

	.invite.has-logo.is-unbranded {
		--poster-rest: 764px;
	}
}

/* Short laptop screens: trim the outer padding on both sides. */
@media (min-width: 960px) and (max-height: 820px) {
	.poster {
		padding-top: 32px;
		padding-bottom: 32px;
	}

	.reply-inner {
		padding-top: 88px;
	}

	.has-logo .reply-inner {
		padding-top: 152px;
	}

	.footer {
		padding-bottom: 32px;
	}

	.invite {
		--poster-rest: 488px;
	}

	.invite.has-logo {
		--poster-rest: 552px;
	}

	.invite.is-unbranded {
		--poster-rest: 536px;
	}

	.invite.has-logo.is-unbranded {
		--poster-rest: 600px;
	}
}

/* Very short windows: the form can't also line up with "Saturday". */
@media (min-width: 960px) and (max-height: 740px) {
	.reply-inner,
	.has-logo .reply-inner {
		padding-top: 48px;
	}
}

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

	.submit[aria-busy="true"] .spinner {
		animation: spin 1.5s linear infinite !important;
	}
}
