/**
 * Single event (events CPT).
 * Figma desktop: file wxwuK7BpekIvd9pKAYnPC4, node-id=21363-3018
 * Figma mobile:  file wxwuK7BpekIvd9pKAYnPC4, node-id=21363-9072
 *
 * Mobile first (Figma mobile 375); 768+ uses desktop fonts/spacing
 * (1040 content column, as Figma 1440 with 200 side padding).
 */

/* ==========================================================================
   Header — date + title (Figma 21363:3024 / 21363:9292)
   ========================================================================== */

.event-hero {
	width: 100%;
	background-color: #f7f3e3;
}

.event-hero__inner {
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 100%;
	padding: 40px 20px 32px;
	box-sizing: border-box;
	text-align: center;
}

/* Figma Label 16/20, 8%, uppercase (site label font, see global .label) */
.event-hero__date {
	margin: 0;
	color: #537b50;
	font-family: var(--font-label);
	font-size: var(--font-label-size);
	font-style: normal;
	font-weight: var(--font-label-weight);
	letter-spacing: var(--font-label-tracking);
	line-height: var(--font-label-line);
	text-transform: uppercase;
}

/* Figma H1 (Mobile 44/54, Desktop 64/74); set here because style.css normalizes h1 to 2em. */
.event-hero__title {
	margin: 0;
	color: #000000;
	font-family: var(--font-h1-family);
	font-size: var(--font-h1-size);
	font-style: var(--font-h1-style);
	font-weight: var(--font-h1-weight);
	letter-spacing: var(--font-h1-tracking);
	line-height: var(--font-h1-line);
	text-transform: capitalize;
}

/* ==========================================================================
   Gallery — main slider + dots (Figma 21363:3028 / 21363:9296)
   ========================================================================== */

.event-gallery {
	width: 100%;
}

/* Top half cream, bottom half white (Figma gradient stops 51.5% / 51.51%) */
.event-gallery__stage {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20px;
	width: 100%;
	padding: 0 20px;
	box-sizing: border-box;
	background: linear-gradient(180deg, #f7f3e3 51.5%, #ffffff 51.51%);
}

.event-gallery__main {
	width: 100%;
	container-type: inline-size; /* slide heights below follow the slider's own width (cqw) */
}

/* Before Slick runs, show only the first slide (no stacked images / shift). */
.event-gallery__main:not(.slick-initialized) .event-gallery__slide:not(:first-child) {
	display: none;
}

/* Mobile: Figma 335 × 193 box across the full slider width, capped at 60vh
   (developer: photo + strip must fit the viewport together). Explicit width + height, not
   aspect-ratio + max-height: that pair shrinks the box's width whenever the cap applies. */
.event-gallery__slide {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: min(calc(100cqw * 193 / 335), 60vh);
}

/* The image always fills the slide box; object-fit (below) keeps the whole photo visible. */
.event-gallery__image {
	display: block;
	width: 100%;
	height: 100%;
	object-position: center;
}

.event-gallery__main .slick-slide {
	cursor: grab;
}

/* Centre the photo in its slide (slick.css sets .slick-initialized .slick-slide { display: block }). */
.event-gallery__main.slick-initialized .event-gallery__slide {
	display: flex;
}

.event-gallery__main .slick-slide:active {
	cursor: grabbing;
}

/* Every width (developer 2026-10-07): the whole photo shows inside the slide box (contain),
   portrait or landscape — rule #7 satisfied again on mobile. */
.event-gallery__image {
	object-fit: contain;
}

/* Figma carousel dots: 15px, 10px apart, active #537B50, others #7A7A7A @ 40% */
.event-gallery__dots {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.event-gallery__dots li {
	display: block;
	margin: 0;
	padding: 0;
}

.event-gallery__dot {
	display: block;
	width: 15px;
	height: 15px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background-color: #7a7a7a;
	opacity: 0.4;
	cursor: pointer;
	transition: opacity 0.2s ease, background-color 0.2s ease;
}

.event-gallery__dot:hover,
.event-gallery__dot:focus-visible {
	opacity: 0.7;
}

.event-gallery__dot.is-current {
	background-color: #537b50;
	opacity: 1;
}

.event-gallery__dot:focus-visible,
.event-gallery__thumb:focus-visible,
.event-gallery__arrow:focus-visible {
	outline: 2px solid var(--color-bright-green);
	outline-offset: 2px;
}

/* One image (single posts / one-photo events): no dots or strip, so close the stage. */
.event-gallery--single .event-gallery__stage {
	padding-bottom: 40px;
}

/* ==========================================================================
   Post content (single posts only) — Paragraph 16/24 in the 1040 column
   ========================================================================== */

.event-content {
	width: 100%;
	background-color: var(--color-white);
}

.event-content__inner {
	width: 100%;
	padding: 0 20px 40px;
	box-sizing: border-box;
	color: var(--color-grey-800);
	font-size: var(--font-paragraph-size);
	line-height: var(--font-paragraph-line);
}

.event-content__inner > :first-child {
	margin-top: 0;
}

.event-content__inner > :last-child {
	margin-bottom: 0;
}

/* ==========================================================================
   Thumbnails — mobile grid (Figma 21363:9302 / 21363:9288): 4 squares per row across the full
   width (80 each at 375), 5 gap, last row centred, pt 32 pb 40
   ========================================================================== */

.event-gallery__strip {
	position: relative;
	width: 100%;
	padding: 32px 20px 40px;
	box-sizing: border-box;
	background-color: var(--color-white);
}

.event-gallery__thumbs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 5px;
}

.event-gallery__thumb-slide {
	width: calc((100% - 15px) / 4); /* 4 columns, 3 × 5px gaps */
	aspect-ratio: 1;
}

.event-gallery__thumb {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	opacity: 0.75;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.event-gallery__thumb:hover,
.event-gallery__thumb.is-current {
	opacity: 1;
}

.event-gallery__thumb-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	pointer-events: none; /* drag the slider, not the image */
}

.event-gallery__arrows {
	display: none;
}

/* ==========================================================================
   768+ — desktop fonts/spacing; thumbnail strip slider (Figma 21363:3034)
   ========================================================================== */

@media (min-width: 768px) {
	.event-hero__inner {
		gap: 12px;
		max-width: 1120px; /* 1040 + 2 × 40 */
		margin: 0 auto;
		padding: 80px 40px 50px;
	}

	.event-gallery__stage {
		gap: 40px;
		padding: 0 40px;
	}

	.event-gallery__main {
		max-width: 1040px;
	}

	.event-gallery--single .event-gallery__stage {
		padding-bottom: 60px;
	}

	.event-content__inner {
		max-width: 1120px; /* 1040 + 2 × 40 */
		margin: 0 auto;
		padding: 0 40px 80px;
	}

	/*
	 * Figma 1040 × 600 box. Developer: max 60vh so the photo and the thumbnail strip
	 * fit the viewport together (click thumbnails without scrolling up and down).
	 * Also ≤ 100svh − 360px: 92 sticky nav + 40 gap + 15 dots + 60 strip padding + 140 thumbs (347) + 13 breathing room (+ the WP admin bar when logged in).
	 * The box always spans the full column width; every photo is contained (never cropped).
	 */
	.event-gallery__slide {
		height: min(
			calc(100cqw * 600 / 1040),
			600px,
			60vh,
			calc(100svh - 360px - var(--wp-admin--admin-bar--height, 0px))
		);
	}

	/* Strip: 260 tall, 140 thumbs 12 apart, bleeding to both edges.
	   overflow hidden: the arrows' 158px shadow image must not widen the page near the edges. */
	.event-gallery__strip {
		padding: 60px 0;
		overflow: hidden;
	}

	.event-gallery__thumbs {
		display: block;
		height: 140px;
		overflow: hidden;
		white-space: nowrap;
	}

	/* Hidden until Slick positions it (space stays reserved, nothing jumps). */
	.event-gallery__thumbs:not(.slick-initialized) {
		visibility: hidden;
	}

	.event-gallery__thumb-slide {
		display: inline-block;
		width: 140px;
		height: 140px;
		margin: 0 6px;
	}

	.event-gallery__thumbs .slick-slide {
		cursor: grab;
	}

	/* Arrows sit on the 1040 column edges, vertically centred on the strip */
	.event-gallery__arrows {
		position: absolute;
		top: 50%;
		left: 50%;
		display: flex;
		justify-content: space-between;
		width: min(1040px, calc(100% - 80px));
		transform: translate(-50%, -50%);
		pointer-events: none;
	}

	.event-gallery__arrow {
		position: relative;
		width: 60px;
		height: 60px;
		margin: 0;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: none;
		cursor: pointer;
		pointer-events: auto;
	}

	/* Figma Frame 1139: 49px white circle + shadow, centred in the 60 box */
	.event-gallery__arrow img {
		position: absolute;
		top: -40.91px;
		left: -49.09px;
		display: block;
		width: 158.18px;
		max-width: none;
		height: 158.18px;
		transition: opacity 0.2s ease;
	}

	.event-gallery__arrow--prev {
		transform: scaleX(-1);
	}

	.event-gallery__arrow:hover img,
	.event-gallery__arrow:focus-visible img {
		opacity: 0.8;
	}
}
