/*
 * Events page only. Enqueued in functions.php whenever the page slug is
 * "events" (see sjc_page_assets()).
 *
 * The flyer is the unit here: cards are sized to portrait artwork and the grid
 * is built around it. Events posted without a flyer get a drawn accent plate in
 * the same slot rather than a pale text panel, so they read as cards against
 * the page's tinted wash instead of dissolving into it.
 */

.page--events {
	padding-bottom: clamp(3rem, 6vw, 5rem);
}

/* ---- Sections ---- */

.events-section {
	margin-bottom: clamp(2.5rem, 5vw, 3.75rem);
}

.events-section__title {
	margin: 0 0 0.4rem;
	font-size: clamp(1.35rem, 2.4vw, 1.75rem);
	font-weight: 600;
	letter-spacing: -0.02em;
}

.events-section__lead {
	margin: 0 0 1.75rem;
	max-width: 60ch;
	color: var(--muted);
}

.events-section__title + .event-grid,
.events-section__title + .weekly-list,
.events-section__title + .events-month {
	margin-top: 1.25rem;
}

.events-section__empty {
	margin: 0;
	padding: 1.5rem;
	border: 1px dashed var(--line);
	border-radius: var(--radius-sm);
	background: var(--bg);
	color: var(--muted);
	text-align: center;
}

.events-section__more {
	margin-top: 2rem;
	text-align: center;
}

/* ---- Month headings ---- */

.events-month + .events-month {
	margin-top: clamp(1.75rem, 3.5vw, 2.5rem);
}

/* A quiet label with a rule running off it, rather than a second heavy
   heading competing with the section title above. */
.events-month__title {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin: 0 0 0.9rem;
	font-size: 0.75rem;
	font-weight: 700;
	color: var(--accent);
	text-transform: uppercase;
	letter-spacing: 0.12em;
	white-space: nowrap;
}

.events-month__title::after {
	content: "";
	flex: 1;
	height: 1px;
	min-width: 1.5rem;
	background: linear-gradient(90deg, var(--line), transparent);
}

.events-month__sub {
	color: var(--muted);
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: none;
	letter-spacing: 0.02em;
}

/* ---- Flyer grid ---- */

.event-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: clamp(0.9rem, 1.8vw, 1.35rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

.event-grid__item {
	display: flex;
}

.event-card {
	display: flex;
	flex-direction: column;
	width: 100%;
	padding: 0;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--bg);
	color: inherit;
	font: inherit;
	text-align: left;
	text-decoration: none;
	overflow: hidden;
	cursor: pointer;
	/* The page sits on a tint wash, so cards carry a resting shadow — without
	   one a white card on tint reads as a flat patch, not an object. */
	box-shadow: 0 1px 2px rgb(11 20 32 / 6%), 0 6px 16px rgb(11 20 32 / 6%);
	transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
}

.event-card:hover,
.event-card:focus-visible {
	transform: translateY(-3px);
	box-shadow: 0 2px 4px rgb(11 20 32 / 8%), 0 16px 32px rgb(11 20 32 / 16%);
}

/* An event set to do nothing on click still reads as a card, but must not
   invite the click it will not answer. */
.event-card--static {
	cursor: default;
}

.event-card--static:hover,
.event-card--static:focus-visible {
	transform: none;
	box-shadow: 0 1px 2px rgb(11 20 32 / 6%), 0 6px 16px rgb(11 20 32 / 6%);
}

/* Flyers are portrait; the fixed ratio keeps every card in a row the same
   height whatever the artwork's own proportions are. */
.event-card__media {
	position: relative;
	display: block;
	aspect-ratio: 4 / 5;
	background: var(--sand);
	overflow: hidden;
}

.event-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Date chip over the flyer's top-left corner. */
.event-card__date {
	position: absolute;
	top: 0.65rem;
	left: 0.65rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 3rem;
	padding: 0.35rem 0.5rem;
	border-radius: 10px;
	background: rgb(255 255 255 / 94%);
	box-shadow: 0 4px 12px rgb(11 20 32 / 20%);
	line-height: 1.1;
}

.event-card__date-month {
	color: var(--accent);
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.event-card__date-day {
	font-size: 1.25rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.event-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.25rem;
	padding: 0.8rem 0.9rem 0.95rem;
}

.event-card__when {
	color: var(--accent);
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.07em;
}

/* Titles are clamped so one long name can't make its card tower over the rest
   of the row — the whole point of the fixed-ratio media above. */
.event-card__name {
	font-size: 0.98rem;
	font-weight: 600;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
}

.event-card__subtitle,
.event-card__details {
	color: var(--muted);
	font-size: 0.8rem;
	line-height: 1.4;
}

.event-card__subtitle {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
}

.event-card__details {
	margin-top: auto;
	padding-top: 0.35rem;
	font-size: 0.76rem;
}

/* ---- Drawn plate (events with no flyer) ---- */

/* Fills the media slot an event without artwork would otherwise leave empty.
   Setting the date large gives the card a subject of its own, and the accent
   surface separates it from the page wash the way a flyer would. */
.event-card__plate {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.1rem;
	padding: 1rem;
	background: linear-gradient(155deg, var(--accent), var(--accent-dark));
	color: #fff;
	text-align: center;
	overflow: hidden;
}

/* Faint concentric rings, so the panel has some surface rather than reading as
   a solid colour swatch. */
.event-card__plate::before {
	content: "";
	position: absolute;
	inset: -30%;
	background:
		repeating-radial-gradient(
			circle at 50% 45%,
			rgb(255 255 255 / 7%) 0 1px,
			transparent 1px 22px
		);
	pointer-events: none;
}

.event-card__plate > * {
	position: relative;
}

.event-card__plate-month {
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.18em;
	opacity: 0.85;
}

.event-card__plate-day {
	font-family: var(--display);
	font-size: clamp(2.75rem, 8vw, 3.5rem);
	font-weight: 700;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.event-card__plate-weekday {
	margin-top: 0.45rem;
	padding-top: 0.45rem;
	border-top: 1px solid rgb(255 255 255 / 30%);
	font-size: 0.68rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	opacity: 0.8;
}

/* Undated events have no numeral to set, so the type word carries the plate. */
.event-card__plate-label {
	font-family: var(--display);
	font-size: clamp(1.1rem, 3.5vw, 1.4rem);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	text-wrap: balance;
}

/* ---- Status flags ---- */

.event-card__flag {
	align-self: flex-start;
	margin-top: 0.5rem;
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.event-card__flag--cancelled {
	background: #fdecea;
	color: #b3261e;
}

.event-card__flag--tentative {
	background: var(--sand);
	color: var(--muted);
}

/* Cancelled is struck through, not hidden — the same call the homepage week
   list and the printed sheets make. */
.event-card--cancelled .event-card__name {
	text-decoration: line-through;
	text-decoration-thickness: 1px;
}

.event-card--cancelled .event-card__media img,
.event-card--cancelled .event-card__plate {
	filter: grayscale(1);
	opacity: 0.65;
}

/* ---- Past events ---- */

.event-grid--past {
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.event-card--past .event-card__media img,
.event-card--past .event-card__plate {
	opacity: 0.82;
}

.event-card--past:hover .event-card__media img,
.event-card--past:hover .event-card__plate {
	opacity: 1;
}

/* Past plates step back to a neutral surface — the archive shouldn't be the
   loudest colour on the page. */
.event-card--past .event-card__plate {
	background: linear-gradient(155deg, #6b8698, #55707f);
}

.event-card--past .event-card__when {
	color: var(--muted);
}

/* ---- Weekly list ---- */

.weekly-list {
	margin: 0;
	padding: 0;
	list-style: none;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--bg);
	overflow: hidden;
}

.weekly-item {
	display: flex;
	align-items: flex-start;
	gap: 1.25rem;
	padding: 1rem 1.35rem;
}

.weekly-item + .weekly-item {
	border-top: 1px solid var(--line);
}

.weekly-item__when {
	flex: 0 0 8.5rem;
	display: flex;
	flex-direction: column;
}

.weekly-item__day {
	font-weight: 600;
}

.weekly-item__time {
	color: var(--accent);
	font-size: 0.9rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.weekly-item__body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.weekly-item__name {
	font-weight: 600;
}

.weekly-item__subtitle,
.weekly-item__details {
	color: var(--muted);
	font-size: 0.88rem;
	line-height: 1.45;
}

.weekly-item--cancelled .weekly-item__name {
	text-decoration: line-through;
	text-decoration-thickness: 1px;
}

@media (max-width: 560px) {
	.weekly-item {
		flex-wrap: wrap;
		gap: 0.35rem;
	}

	.weekly-item__when {
		flex: 0 0 100%;
		flex-direction: row;
		gap: 0.5rem;
		align-items: baseline;
	}
}

/* ---- Lightbox ---- */

/* Lives in main.css now — it is shared with the homepage carousel and single
   event pages. See template-parts/global/lightbox.php. */
