/* ─────────────────────────────────────────────────────────────────────────
   MODAL — shared chrome for ALL overlays on the site.
   Triage modal (Home, About), event-form modal (Events, future),
   contact modal (future), any other modal — all inherit this motion.

   Architecture note: modal stays in layout always (no display:none) so that
   inner transitions have a starting state to animate from. Visibility and
   click-blocking are handled via opacity on children + pointer-events on
   the wrapper. This is what makes the card's rise animation actually fire.
   ───────────────────────────────────────────────────────────────────── */

.modal{
	position:fixed;
	inset:0;
	z-index:200;
	display:flex;                        /* always in layout */
	align-items:center;
	justify-content:center;
	padding:24px;
	pointer-events:none;                 /* let clicks pass through when closed */
}
.modal.is-open{
	pointer-events:auto;
}


/* ── Backdrop — soft tint + blur ──────────────────────────────────────── */
.modal-backdrop{
	position:absolute;
	inset:0;
	background:rgba(12,30,18,.5);
	backdrop-filter:blur(12px);
	-webkit-backdrop-filter:blur(12px);
	cursor:pointer;

	/* close: brisk fade */
	opacity:0;
	transition:opacity 280ms ease-in;
}
.modal.is-open .modal-backdrop{
	opacity:1;
	/* open: slow, even fade */
	transition:opacity 650ms cubic-bezier(0.32, 0.72, 0, 1);
}


/* ── Card — rises into place ──────────────────────────────────────────── */
.modal-card{
	position:relative;
	z-index:1;
	background:#fff;
	border-radius:12px;
	max-width:560px;
	width:100%;
	max-height:calc(100vh - 48px);
	overflow-y:auto;
	padding:48px 40px;
	box-shadow:0 32px 96px rgba(12,30,18,.32);

	/* close: accelerates away */
	transform:translateY(40px) scale(0.96);
	opacity:0;
	transition:
		transform 280ms cubic-bezier(0.4, 0, 1, 1),
		opacity 220ms ease-in;
}
.modal.is-open .modal-card{
	transform:translateY(0) scale(1);
	opacity:1;
	/* open: 800ms with iOS easing — motion is visible the whole way */
	transition:
		transform 800ms cubic-bezier(0.32, 0.72, 0, 1),
		opacity 600ms cubic-bezier(0.32, 0.72, 0, 1);
}


/* ── Close button ─────────────────────────────────────────────────────── */
.modal-close{
	position:absolute;
	top:14px;right:14px;
	width:40px;height:40px;
	border:none;background:none;
	cursor:pointer;
	font-size:28px;line-height:1;
	color:var(--surface-forest);
	border-radius:50%;
	display:flex;align-items:center;justify-content:center;
	transition:background 150ms ease;
	-webkit-tap-highlight-color:transparent;
	touch-action:manipulation;
}
.modal-close:hover,
.modal-close:focus-visible{
	background:rgba(27,58,45,.08);
}


/* ── Header ───────────────────────────────────────────────────────────── */
.modal-header{margin-bottom:28px;}
.modal-brow{
	font-size:11px;font-weight:500;
	letter-spacing:.14em;text-transform:uppercase;
	color:var(--on-light-body);
	margin-bottom:8px;
}
.modal-h{
	font-family:'CooperBT',serif;
	font-size:28px;font-weight:500;line-height:1.2;
	color:var(--surface-forest);
	margin:0;
	text-wrap:balance;
}


/* ── Options list ─────────────────────────────────────────────────────── */
.modal-options{
	list-style:none;
	padding:0;margin:0;
	display:flex;flex-direction:column;
	gap:10px;
}

/* Options fade-up into place after the card lands.
   `backwards` makes them respect the delay (invisible until their turn). */
.modal.is-open .modal-options > * {
	animation:modal-opt-in 500ms cubic-bezier(0.32, 0.72, 0, 1) backwards;
}
.modal.is-open .modal-options > *:nth-child(1){animation-delay:380ms;}
.modal.is-open .modal-options > *:nth-child(2){animation-delay:460ms;}
.modal.is-open .modal-options > *:nth-child(3){animation-delay:540ms;}
.modal.is-open .modal-options > *:nth-child(4){animation-delay:620ms;}
.modal.is-open .modal-options > *:nth-child(5){animation-delay:700ms;}
.modal.is-open .modal-options > *:nth-child(6){animation-delay:780ms;}

@keyframes modal-opt-in {
	from {opacity:0; transform:translateY(8px);}
	to   {opacity:1; transform:translateY(0);}
}

/* Hide options before their reveal animation starts.
   Without this they'd flash visible briefly while the card is rising. */
.modal-options > * {
	opacity:0;
}
.modal.is-open .modal-options > * {
	opacity:1; /* set by the animation, but kept here as a fallback */
}

.modal-opt{
	display:grid;
	grid-template-columns:4px 1fr auto;
	align-items:center;
	gap:18px;
	padding:18px 16px 18px 14px;
	border:1px solid rgba(27,58,45,.1);
	border-radius:8px;
	min-height:64px;
	transition:
		border-color 200ms ease,
		background 200ms ease,
		transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-opt:hover,
.modal-opt:focus-visible{
	border-color:rgba(27,58,45,.25);
	background:rgba(245,240,232,.5);
	transform:translateX(2px);
}

.modal-opt-bar{
	height:36px;
	width:4px;
	border-radius:2px;
}
.modal-opt-body{display:flex;flex-direction:column;gap:2px;}
.modal-opt-h{
	font-size:16px;font-weight:500;
	color:var(--surface-forest);
	letter-spacing:.01em;
}
.modal-opt-p{
	font-size:14px;
	color:var(--on-light-body);
	line-height:1.55;
	text-wrap:pretty;
}
.modal-opt-arrow{
	font-size:18px;
	color:var(--on-light-body);
	transition:transform 200ms cubic-bezier(0.22, 1, 0.36, 1), color 200ms ease;
}
.modal-opt:hover .modal-opt-arrow{
	color:var(--surface-forest);
	transform:translateX(4px);
}


/* Body scroll lock when any modal is open — JS toggles this on <body> */
body.modal-open{overflow:hidden;}


/* ── MOBILE ───────────────────────────────────────────────────────────── */
@media(max-width:480px){
	.modal{padding:16px;align-items:flex-end;}
	.modal-card{
		padding:36px 24px 28px;
		max-height:calc(100vh - 32px);
	}
	.modal-h{font-size:22px;}
	.modal-options{gap:8px;}
	.modal-opt{
		padding:16px 14px;
		gap:14px;
	}
	.modal-opt-h{font-size:15px;}
	.modal-opt-p{font-size:13px;}
}


/* ── REDUCED MOTION ──────────────────────────────────────────────────── */
@media(prefers-reduced-motion:reduce){
	.modal-backdrop,
	.modal-card,
	.modal-opt,
	.modal-opt-arrow{
		transition:none;
	}
	.modal-card,
	.modal.is-open .modal-card{
		transform:none;
	}
	.modal.is-open .modal-options > *{
		animation:none;
	}
	.modal-options > *,
	.modal.is-open .modal-options > *{
		opacity:1;
	}
}
