/* =========================================================
   Entangle Events — upcoming events list
   BEM: entangle-events-upcoming__{rows,row,date,body,title,meta,category,cta,more,empty}

   Same token bridging as calendar-dropdown.css: Entangle Base theme tokens
   first, legacy Tailwind theme tokens second, neutral fallbacks last.
   Fonts inherit from the theme (serif display via --font-serif when present).
   ========================================================= */

.entangle-events-upcoming {
	--ee-ink: var(--color-ink, var(--color-base, #222));
	--ee-muted: var(--color-ink-soft, var(--color-neutral-500, #6b6b6b));
	--ee-accent: var(--color-brand, var(--color-primary, #1a1a1a));
	--ee-accent-deep: var(--color-brand-deep, var(--ee-accent));
	--ee-on-accent: var(--color-on-brand, #fff);
	--ee-rule: var(--color-rule, rgba(0, 0, 0, 0.14));
	--ee-surface: var(--color-bg, var(--color-contrast, #fff));
	/* Card tile sits ON the page background, so it needs the theme's raised surface. */
	--ee-surface-card: var(--color-bg-alt, var(--wp--preset--color--surface, #fff));
	--ee-radius: var(--radius-media, var(--radius, 14px));
	--ee-serif: var(--font-serif, inherit);

	margin-top: clamp(24px, 3vw, 36px);
}

.entangle-events-upcoming__heading {
	font-family: var(--ee-serif);
	font-weight: 400;
	font-size: clamp(28px, 3vw, 40px);
	line-height: 1.1;
	margin: 0 0 clamp(8px, 1.4vw, 18px);
	color: var(--ee-ink);
}

.entangle-events-upcoming__rows {
	border-bottom: 1px solid var(--ee-rule);
}

.entangle-events-upcoming__row {
	position: relative;
	display: grid;
	grid-template-columns: 120px 1fr auto;
	gap: 14px 28px;
	align-items: center;
	padding: clamp(28px, 3vw, 40px) 0;
	border-top: 1px solid var(--ee-rule);
}

/* Whole row is one link: the title link is stretched over the entire row. */
.entangle-events-upcoming__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}
.entangle-events-upcoming__row:hover .entangle-events-upcoming__title a,
.entangle-events-upcoming__row:focus-within .entangle-events-upcoming__title a {
	color: var(--ee-accent);
}

/* ---- Date badge ---- */
.entangle-events-upcoming__date b {
	display: block;
	font-family: var(--ee-serif);
	font-weight: 400;
	font-size: 2.6rem;
	line-height: 1;
	color: var(--ee-ink);
}

.entangle-events-upcoming__date span {
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ee-muted);
}

/* ---- Title + meta ---- */
.entangle-events-upcoming__title {
	font-family: var(--ee-serif);
	font-weight: 400;
	font-size: clamp(22px, 2.4vw, 30px);
	line-height: 1.12;
	margin: 0 0 10px;
}

.entangle-events-upcoming__title a {
	color: inherit;
	text-decoration: none;
}

.entangle-events-upcoming__title a:hover,
.entangle-events-upcoming__title a:focus-visible {
	color: var(--ee-accent);
}

.entangle-events-upcoming__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
	color: var(--ee-muted);
	font-size: 0.9rem;
}

.entangle-events-upcoming__category {
	font-style: normal;
	font-weight: 600;
	color: var(--ee-accent-deep);
}

/* ---- "More" affordance (ghost pill, visual only — the whole row is the link) ---- */
.entangle-events-upcoming__cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4em;
	padding: 0.6em 1.1em;
	font-size: 0.86rem;
	font-weight: 600;
	border: 1.5px solid var(--ee-ink);
	border-radius: 999px;
	background: transparent;
	color: var(--ee-ink);
	pointer-events: none; /* the stretched row link handles the click */
	transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}
.entangle-events-upcoming__cta::after {
	content: "→";
}

.entangle-events-upcoming__row:hover .entangle-events-upcoming__cta,
.entangle-events-upcoming__row:focus-within .entangle-events-upcoming__cta {
	background: var(--ee-ink);
	color: var(--ee-surface);
	transform: translateY(-2px);
}

/* =========================================================
   Cards layout (default for upcoming events)

   The row list is great for scanning dates, but nothing in it invites a click.
   Cards lead with the event's own photo, keep the date as a badge on it and
   reuse the row's building blocks (__date, __category, __title, __meta, __cta)
   so both layouts stay one component.
   ========================================================= */

.entangle-events-upcoming__cards {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: clamp(20px, 2.2vw, 30px);
}

/* Cards are heavier than rows (a row opens with a hairline right under the
   heading), so the heading needs a little more air above the grid. */
.entangle-events-upcoming--cards .entangle-events-upcoming__heading {
	margin-bottom: clamp(16px, 2.2vw, 28px);
}

.entangle-events-upcoming__card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--ee-surface-card);
	border: 1px solid var(--ee-rule);
	border-radius: var(--ee-radius);
	overflow: hidden;
	transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

/* Lift + accent border, no shadow — the same hover the theme's own cards use. */
.entangle-events-upcoming__card:hover,
.entangle-events-upcoming__card:focus-within {
	transform: translateY(-3px);
	border-color: var(--ee-accent);
}

/* ---- Image + date badge ---- */
.entangle-events-upcoming__thumb {
	position: relative;
	display: block;
	aspect-ratio: 3 / 2;
	overflow: hidden;
	background: var(--ee-rule);
}

.entangle-events-upcoming__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* Event that opted out of cropping: whole image, letterboxed on the tile. */
.entangle-events-upcoming__thumb--uncropped .entangle-events-upcoming__img {
	object-fit: contain;
	background: var(--ee-surface-card);
}

.entangle-events-upcoming__card:hover .entangle-events-upcoming__img {
	transform: scale(1.04);
}

.entangle-events-upcoming--cards .entangle-events-upcoming__date {
	position: absolute;
	left: 12px;
	bottom: 12px;
	z-index: 1; /* above the tint a past event's photo gets */
	display: inline-flex;
	align-items: baseline;
	gap: 0.4em;
	/* Optically centred: a serif numeral leaves ~5px of unused line box under the
	   baseline and none above the cap, so the top padding carries the difference.
	   Measured against the theme's display serif; re-check when the badge resizes. */
	padding: 10px 12px 5px;
	border-radius: 999px;
	/* Same surface as the card body it belongs to, not the page background. */
	background: var(--ee-surface-card);
}

.entangle-events-upcoming--cards .entangle-events-upcoming__date b {
	font-size: 1.3rem;
}

.entangle-events-upcoming--cards .entangle-events-upcoming__date span {
	font-size: 0.66rem;
	letter-spacing: 0.12em;
}

/* ---- Card body ---- */
.entangle-events-upcoming--cards .entangle-events-upcoming__body {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 9px;
	padding: 18px 20px 20px;
}

.entangle-events-upcoming--cards .entangle-events-upcoming__category {
	margin: 0;
	font-size: 0.7rem;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ee-accent);
}

.entangle-events-upcoming--cards .entangle-events-upcoming__title {
	margin: 0;
	font-size: clamp(20px, 1.45vw, 23px);
	line-height: 1.16;
}

/* Time, venue and city are the footnote of the card: pinned to the bottom (so the
   hairline lines up across a row of cards) and set off by a rule. */
.entangle-events-upcoming--cards .entangle-events-upcoming__meta {
	margin: auto 0 0;
	padding-top: 13px;
	border-top: 1px solid var(--ee-rule);
	gap: 2px 14px;
	font-size: 0.86rem;
}

/* Dot separators, same rhythm as the event hero meta. */
.entangle-events-upcoming--cards .entangle-events-upcoming__meta span {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
}

.entangle-events-upcoming--cards .entangle-events-upcoming__meta span::before {
	content: "";
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: currentColor;
	opacity: 0.5;
}

.entangle-events-upcoming--cards .entangle-events-upcoming__meta span:first-child::before {
	display: none;
}

/* A card carries no "More" pill: the whole tile is the link, the title turns
   accent on hover and the lift says the rest. */

/* ---- Past events: same card, photo a step back ----
   Desaturated and pulled towards the accent colour, so an archive reads as an
   archive at a glance and the colour photos above stay the ones that matter. */
.entangle-events-upcoming--past .entangle-events-upcoming__thumb {
	isolation: isolate; /* keep the blend inside the tile */
}

.entangle-events-upcoming--past .entangle-events-upcoming__img {
	filter: grayscale(1);
}

.entangle-events-upcoming--past .entangle-events-upcoming__thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--ee-accent);
	mix-blend-mode: color;
	opacity: 0.32;
	pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
	.entangle-events-upcoming__card,
	.entangle-events-upcoming__img {
		transition: none;
	}

	.entangle-events-upcoming__card:hover,
	.entangle-events-upcoming__card:focus-within,
	.entangle-events-upcoming__card:hover .entangle-events-upcoming__img {
		transform: none;
	}
}

/* ---- Archive link ---- */
.entangle-events-upcoming__more {
	margin: 30px 0 0;
	font-size: 1.02rem;
}

.entangle-events-upcoming__more a {
	font-weight: 600;
	color: var(--ee-accent-deep);
	text-decoration: none;
	border-bottom: 1px solid var(--ee-accent-deep);
	transition: 0.15s;
	padding: 0.06em 0.14em;
	margin: -0.06em -0.14em;
	border-radius: 3px;
}

.entangle-events-upcoming__more a::after {
	content: "→";
	display: inline-block;
	margin-left: 0.45em;
	transition: transform 0.2s ease;
}

.entangle-events-upcoming__more a:hover,
.entangle-events-upcoming__more a:focus-visible {
	background: var(--ee-accent);
	color: var(--ee-on-accent);
	border-color: var(--ee-accent);
}

.entangle-events-upcoming__more a:hover::after {
	transform: translateX(5px);
}

.entangle-events-upcoming__empty {
	color: var(--ee-muted);
}

/* ---- Responsive ---- */
@media (max-width: 1000px) {
	.entangle-events-upcoming__cards {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 640px) {
	.entangle-events-upcoming__row {
		grid-template-columns: 1fr;
	}

	.entangle-events-upcoming__cta {
		justify-self: start;
	}

	.entangle-events-upcoming__cards {
		grid-template-columns: 1fr;
	}
}
