/* ========================================
   BLT Events - Single Event (front end)

   BEM under the `blt-event` block. Every value resolves through the shared
   token layer in blt-events-tokens.css (spacing, type, neutrals, radii), so
   restyling happens there, in Settings > Appearance, or through Skeleton
   mode's mapping to your framework, rather than by overriding selectors.

   Layout:
   - Hero: the featured image at 16:9 with the "Back to events" button over
     its top-left corner.
   - Body: a 2fr / 1fr grid. The main column stacks the category chips,
     title, description, agenda, sponsors, location and registration, with a
     divider above each section. The event card sits in the narrow column,
     lifted over the bottom of the hero image, and sticks while scrolling.
   - Below 992px everything stacks, and the card moves up under the title.

   The block-local aliases below stay for backwards compatibility: sites
   already overriding --blt-event-accent keep working.
   ======================================== */

.blt-event {
	--blt-event-accent: var(--blt-e-fg-strong);
	--blt-event-link: var(--blt-e-link);
	--blt-event-border: var(--blt-e-divider);
	--blt-event-muted: var(--blt-e-fg-muted);
	--blt-event-radius: var(--blt-e-radius);
	/* Keeps the hero / body / card stacking local to the event. */
	isolation: isolate;
	color: var(--blt-e-fg);
	font-family: var(--blt-e-font);
	/* Size from the root, not the theme's (often large) body text, so the
	   card and accordion keep the design's proportions. 1.6rem rather than
	   1rem: rem is always relative to the page root, and ACSS's 62.5% root
	   makes 1rem = 10px, so this corrects back to a real 16px base. */
	font-size: 1.6rem;
	line-height: 1.5;
	/* Explicit width, not just max-width: some caching/speed plugins apply
	   content-visibility:auto (size containment) to below-the-fold
	   sections, and a width:auto box can't be sized without rendering it,
	   so the browser paints an estimate until it scrolls into view. An
	   explicit width sidesteps that; min(..., 100%) keeps it from
	   overflowing on viewports narrower than the content width. */
	width: min(var(--blt-e-content-width), 100%);
	max-width: var(--blt-e-content-width);
	margin: 0 auto;
	/* Left/right stay on .blt-event__layout so the hero can bleed full-width. */
	padding: var(--blt-e-space-m) 0 var(--blt-e-section-space-m);
}

.blt-event *,
.blt-event *::before,
.blt-event *::after {
	box-sizing: border-box;
}

.blt-event .blt-icon {
	width: 1em;
	height: 1em;
	flex-shrink: 0;
}

.blt-event__sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* --- Hero --- */
.blt-event__hero {
	position: relative;
	z-index: 1;
	margin-bottom: var(--blt-e-content-gap);
}

.blt-event__hero--plain {
	margin-bottom: var(--blt-e-space-s);
}

.blt-event__hero-media {
	margin: 0;
	overflow: hidden;
	aspect-ratio: 16 / 9;
	border-radius: var(--blt-e-radius);
	background: var(--blt-e-surface-sunken);
}

.blt-event__hero-media img,
.blt-event__featured-img {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	object-fit: cover;
	object-position: 50%;
}

/* --- Back to events --- */
.blt-event__back {
	position: absolute;
	top: var(--blt-e-space-s);
	left: var(--blt-e-space-s);
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.55rem 1rem;
	border-radius: var(--blt-e-radius);
	background: var(--blt-e-surface);
	color: var(--blt-e-neutral);
	box-shadow: var(--blt-e-shadow-sm);
	font-size: var(--blt-e-text-s);
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
}

.blt-event__back:hover,
.blt-event__back:focus-visible {
	background: var(--blt-e-surface-alt);
	color: var(--blt-event-accent);
}

.blt-event__hero--plain .blt-event__back {
	position: static;
	border: 1px solid var(--blt-e-border);
	box-shadow: none;
}

/* --- Layout --- */
.blt-event__layout {
	position: relative;
	z-index: 2;
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
	gap: var(--blt-e-grid-gap);
	/* Stretch, not start: the card column must be as tall as the main column
	   for the card to have room to stick. */
	align-items: stretch;
	padding: 0 var(--blt-e-space-m);
}

.blt-event__main {
	display: flex;
	flex-direction: column;
	row-gap: var(--blt-e-content-gap);
	min-width: 0;
}

.blt-event__main > * {
	margin-top: 0;
	margin-bottom: 0;
}

.blt-event__sidebar {
	position: relative;
	z-index: 3;
	min-width: 0;
}

/* The card overlaps the hero image only when there is one. */
.blt-event--has-image .blt-event__sidebar {
	margin-top: calc(-1 * var(--blt-e-section-space-m));
}

/* --- Category chips --- */
.blt-event__categories {
	display: flex;
	flex-wrap: wrap;
	gap: calc(var(--blt-e-space-xs) / 2);
	width: fit-content;
	margin: 0;
	padding: 0;
	list-style: none;
}

.blt-event__category-item {
	margin: 0;
}

.blt-event__category {
	display: inline-block;
	padding: calc(var(--blt-e-space-xs) / 2) calc(var(--blt-e-space-s) / 2);
	border-radius: var(--blt-e-chip-radius);
	background: var(--blt-e-chip-bg);
	color: var(--blt-e-neutral);
	font-size: var(--blt-e-text-xs);
	font-weight: 500;
	line-height: 1.5;
	text-decoration: none;
}

.blt-event__category:hover,
.blt-event__category:focus-visible {
	background: var(--blt-e-chip-bg-hover);
	color: var(--blt-e-neutral);
}

/* --- Title and description --- */
.blt-event__title {
	margin: 0;
	color: var(--blt-e-neutral);
	font-family: var(--blt-e-font-heading);
	font-size: var(--blt-e-text-xl);
	font-weight: 700;
	line-height: 1.15;
}

.blt-event__description {
	font-size: 1.6rem;
	line-height: 1.65;
}

.blt-event__description > :first-child {
	margin-top: 0;
}

.blt-event__description > :last-child {
	margin-bottom: 0;
}

/* Plain bold text reads as neutral/body-strength emphasis; a link kept
   its own color regardless, since color is inherited and a theme's direct
   `body a:where(...) { color: ... }` rule on the <a> itself always wins
   over an inherited value from this <strong>/<b> wrapper. */
.blt-event__description strong,
.blt-event__description b {
	color: var(--blt-e-neutral);
}

/* A theme's own `body a:where(...) { font-weight: ... }` sets font-weight
   directly on every link (not just inherited), which otherwise overrides
   the bold a <strong>/<b> wrapper would normally pass down to a link
   nested inside it. */
.blt-event__description strong a,
.blt-event__description b a {
	font-weight: inherit;
}

/* --- Sections (agenda, sponsors, location, registration) --- */
/* All four sides set as physical longhands (not just padding-top): these
   are <section> elements, and frameworks like ACSS style bare <section>
   tags directly (padding-block / padding-inline) at zero specificity,
   expecting a component's own class to override it. Only setting
   padding-top left padding-inline/-bottom unopposed and let it bleed in. */
.blt-event__section {
	display: flex;
	flex-direction: column;
	gap: var(--blt-e-space-s);
	padding: var(--blt-e-content-gap) 0 0;
	border-top: 1px solid var(--blt-event-border);
}

/* Agenda and Sponsors sit right under the title/description with no
   divider above them; Location and Registration keep it. */
.blt-event__agenda,
.blt-event__sponsors {
	padding-top: 0;
	border-top: 0;
}

.blt-event__section-title {
	margin: 0;
	color: var(--blt-e-neutral);
	font-family: var(--blt-e-font-heading);
	font-size: var(--blt-e-text-l);
	font-weight: 600;
	line-height: 1.25;
}

/* --- Agenda accordion --- */
.blt-event__agenda-list {
	display: flex;
	flex-direction: column;
}

.blt-event__agenda-item {
	margin: 0;
}

.blt-event__agenda-summary,
.blt-event__agenda-item--static {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--blt-e-space-xs);
	padding: var(--blt-e-space-xs) 0 var(--blt-e-space-s);
	border-bottom: 1px solid var(--blt-e-neutral-light);
}

.blt-event__agenda-summary {
	cursor: pointer;
	list-style: none;
}

.blt-event__agenda-summary::-webkit-details-marker {
	display: none;
}

.blt-event__agenda-summary::marker {
	content: "";
}

.blt-event__agenda-summary:focus-visible {
	outline: 2px solid var(--blt-e-focus-ring);
	outline-offset: 2px;
}

.blt-event__agenda-time {
	margin: 0;
	color: var(--blt-e-neutral);
	font-size: 1.4rem;
	font-weight: 600;
	line-height: 1.4;
	font-variant-numeric: tabular-nums;
}

/* Only the expandable (non-static) time, matching .blt-event__category's
   chip look. */
.blt-event__agenda-summary .blt-event__agenda-time {
	padding: calc(var(--blt-e-space-xs) / 2) calc(var(--blt-e-space-s) / 2);
	border-radius: var(--blt-e-chip-radius);
	background: var(--blt-e-chip-bg);
}

.blt-event__agenda-chevron {
	display: inline-flex;
	color: var(--blt-e-primary);
	font-size: 2rem;
	transition: transform 0.2s ease;
}

.blt-event__agenda-item[open] > .blt-event__agenda-summary .blt-event__agenda-chevron {
	transform: rotate(180deg);
}

.blt-event__agenda-content {
	padding: var(--blt-e-space-xs) 0;
}

.blt-event__agenda-label {
	margin: 0;
	color: var(--blt-e-fg);
	line-height: 1.55;
}

/* --- Sponsors --- */
.blt-event__sponsor-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--blt-e-space-m);
	margin: 0;
	padding: 0;
	list-style: none;
}

.blt-event__sponsor {
	margin: 0;
}

.blt-event__sponsor-link {
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	border: 1px solid var(--blt-e-border);
	border-radius: var(--blt-e-radius);
	background: var(--blt-e-surface);
	transition: border-color 0.15s ease;
}

.blt-event__sponsor-link:hover,
.blt-event__sponsor-link:focus-visible {
	border-color: var(--blt-e-primary);
}

.blt-event__sponsor-img {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	/* Logos are contained, not cropped; set the token to `cover` (and the
	   padding to 0) for photo tiles. */
	padding: var(--blt-e-sponsor-padding);
	object-fit: var(--blt-e-sponsor-fit);
}

/* --- Location --- */
.blt-event__address-text {
	margin: 0;
	color: var(--blt-e-fg-soft);
	line-height: 1.5;
}

.blt-event__map {
	overflow: hidden;
	border: 1px solid var(--blt-e-border);
	border-radius: var(--blt-e-radius);
}

.blt-event__map iframe {
	display: block;
	width: 100%;
	height: 280px;
	border: 0;
}

/* --- Registration --- */
.blt-event__registration {
	scroll-margin-top: 2rem;
}

.blt-event__registration .blt-registration-form,
.blt-event__registration .blt-registration-closed,
.blt-event__registration .blt-surecart-form,
.blt-event__registration .blt-fluentcart-form {
	margin: 0;
}

/* --- Event card --- */
.blt-event__card {
	padding: var(--blt-e-space-m);
	border: 1px solid var(--blt-event-border);
	border-radius: var(--blt-e-radius);
	background: var(--blt-e-surface);
}

.blt-event__summary {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: var(--blt-e-content-gap);
}

/* Only stick where the card fits comfortably on screen. */
@media (min-width: 992px) and (min-height: 720px) {
	.blt-event__summary {
		position: sticky;
		top: calc(var(--blt-e-space-m) + var(--wp-admin--admin-bar--height, 0px));
	}
}

/* Content other plugins add to the card with the sidebar actions: fold
   their own card chrome into this one. */
.blt-event__summary .blt-event__card {
	padding: 0;
	border: 0;
	background: none;
}

/* Date */
.blt-event__datebox {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: var(--blt-e-space-xs);
}

.blt-event__datebox-day {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 62px;
	aspect-ratio: 1;
	padding: calc(var(--blt-e-space-xs) / 2);
	border-radius: var(--blt-e-radius-sm);
	background: var(--blt-e-neutral-ultra-light);
}

.blt-event__datebox-day-inner {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 1;
	border-radius: var(--blt-e-radius-xs);
	background: var(--blt-e-surface);
	color: var(--blt-e-neutral);
	font-size: var(--blt-e-text-l);
	font-weight: 700;
	line-height: 1;
}

.blt-event__datebox-meta {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.blt-event__datebox-label {
	color: var(--blt-e-fg-muted);
	font-size: var(--blt-e-text-xs);
	font-weight: 500;
	line-height: 1.4;
}

.blt-event__datebox-value {
	color: var(--blt-e-neutral);
	font-size: var(--blt-e-text-s);
	font-weight: 700;
	line-height: 1.25;
}

/* Summary */
.blt-event__excerpt {
	margin: 0;
	color: var(--blt-e-fg-soft);
	line-height: 1.6;
}

/* Facts */
.blt-event__info {
	display: flex;
	flex-direction: column;
	gap: var(--blt-e-space-xs);
	margin: 0;
	padding: 0;
	list-style: none;
}

.blt-event__info-item {
	display: flex;
	flex-wrap: nowrap;
	align-items: flex-start;
	gap: var(--blt-e-space-xs);
	margin: 0;
	color: var(--blt-e-fg);
	font-size: 1.52rem;
	line-height: 1.45;
}

.blt-event__info-icon {
	display: inline-flex;
	flex-shrink: 0;
	color: var(--blt-e-neutral);
	font-size: var(--blt-e-text-m);
}

.blt-event__info-text {
	min-width: 0;
	overflow-wrap: anywhere;
}

.blt-event__price {
	color: var(--blt-e-neutral);
	font-weight: 700;
}

.blt-event__calendar-link,
.blt-event__virtual-link {
	color: var(--blt-event-link);
	font-weight: 500;
	text-decoration: none;
}

.blt-event__calendar-link:hover,
.blt-event__calendar-link:focus-visible,
.blt-event__virtual-link:hover,
.blt-event__virtual-link:focus-visible {
	text-decoration: underline;
}

.blt-event__virtual {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.blt-event__virtual-title {
	color: var(--blt-e-neutral);
	font-weight: 600;
}

.blt-event__virtual-text {
	color: var(--blt-event-muted);
	font-size: 1.36rem;
}

/* Speakers */
.blt-event__presenters {
	display: flex;
	flex-direction: column;
	gap: var(--blt-e-space-xs);
}

.blt-event__presenters-title {
	margin: 0;
	color: var(--blt-e-neutral);
	font-size: var(--blt-e-text-s);
	font-weight: 600;
	line-height: 1.4;
}

.blt-event__presenter-list {
	display: flex;
	flex-direction: column;
	gap: var(--blt-e-space-xs);
	margin: 0;
	padding: 0;
	list-style: none;
}

.blt-event__presenter {
	display: flex;
	align-items: center;
	gap: var(--blt-e-space-xs);
	margin: 0;
}

.blt-event__presenter-photo {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border: 3px solid var(--blt-e-surface);
	border-radius: 50%;
	background: var(--blt-e-neutral-ultra-light);
	/* The white ring from the design needs an edge to show on a white card. */
	box-shadow: 0 0 0 1px var(--blt-e-border);
	object-fit: cover;
}

.blt-event__presenter-photo--initial {
	color: var(--blt-e-neutral);
	font-size: var(--blt-e-text-m);
	font-weight: 700;
	text-transform: uppercase;
}

.blt-event__presenter-meta {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.blt-event__presenter-name {
	color: var(--blt-e-neutral);
	font-size: var(--blt-e-text-s);
	font-weight: 600;
	text-decoration: none;
}

a.blt-event__presenter-name:hover,
a.blt-event__presenter-name:focus-visible {
	color: var(--blt-event-link);
}

.blt-event__presenter-role {
	color: var(--blt-e-neutral-semi-dark);
	font-size: 1.4rem;
}

/* Register button */
.blt-event__cta {
	display: flex;
}

.blt-event__cta-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--blt-e-gap-sm);
	width: 100%;
	min-height: 46px;
	padding: 0.75rem 1.25rem;
	border-radius: var(--blt-e-radius-sm);
	background: var(--blt-e-primary);
	color: var(--blt-e-on-primary);
	font-size: 1.52rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color 0.15s ease;
}

.blt-event__cta-button:hover,
.blt-event__cta-button:focus-visible {
	background: var(--blt-e-primary-hover);
	color: var(--blt-e-on-primary);
}

.blt-event__cta-button:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px var(--blt-e-focus-ring);
}

.blt-event__cta-button.is-disabled,
.blt-event__cta-button.is-soldout,
.blt-event__cta-button.is-disabled:hover,
.blt-event__cta-button.is-soldout:hover {
	background: var(--blt-e-surface-sunken);
	color: var(--blt-e-fg-muted);
	cursor: default;
}

/* --- Parts from theme overrides of the pre-2.5 templates --- */
.blt-event__card-title {
	margin: 0 0 0.6rem;
	font-size: 1.68rem;
	font-weight: 700;
}

.blt-event__datebox-time,
.blt-event__presenter-bio {
	margin: 0;
	color: var(--blt-event-muted);
	font-size: 1.36rem;
}

.blt-event__cta-price {
	display: flex;
	align-items: baseline;
	gap: 0.35rem;
}

.blt-event__cta-from {
	color: var(--blt-event-muted);
	font-size: 1.12rem;
	letter-spacing: 0.05em;
}

.blt-event__cta-amount {
	font-weight: 700;
}

/* --- Tablet and below --- */
@media (max-width: 991px) {
	/* Stacked, there's no sticky sidebar pulling extra room below the
	   content, so all four sides match. The inset also moves up here from
	   .blt-event__layout, so the hero shares it instead of staying
	   full-bleed once everything's a single column. */
	.blt-event {
		padding: var(--blt-e-space-m);
	}

	/* Stack, with the card right under the title so the date, place and
	   register button come before the long content. */
	.blt-event__layout {
		padding: 0;
		display: flex;
		flex-direction: column;
		gap: var(--blt-e-content-gap);
	}

	.blt-event__main {
		display: contents;
	}

	.blt-event__main > * {
		order: 4;
	}

	.blt-event__main > .blt-event__categories {
		order: 1;
	}

	.blt-event__main > .blt-event__title {
		order: 2;
	}

	.blt-event__sidebar {
		order: 3;
	}

	.blt-event--has-image .blt-event__sidebar {
		margin-top: 0;
	}

	.blt-event__sponsor-grid {
		gap: var(--blt-e-space-s);
	}
}

@media (max-width: 600px) {
	.blt-event__back {
		top: 0.6rem;
		left: 0.6rem;
		padding: 0.45rem 0.8rem;
	}

	.blt-event__card {
		padding: var(--blt-e-space-s);
	}

	.blt-event__map iframe {
		height: 220px;
	}
}

@media (max-width: 478px) {
	.blt-event__sponsor-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.blt-event__presenters {
		gap: var(--blt-e-space-s);
	}
}

/* --- Sponsor lightbox (appended to <body>) --- */
.blt-lightbox {
	max-width: min(92vw, 1100px);
	max-height: 92vh;
	padding: 0;
	overflow: visible;
	border: 0;
	background: transparent;
}

.blt-lightbox::backdrop {
	background: rgba(0, 0, 0, 0.8);
}

.blt-lightbox[open] {
	animation: blt-lightbox-fade 0.2s ease;
}

@keyframes blt-lightbox-fade {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.blt-lightbox[open] {
		animation: none;
	}

	.blt-event__agenda-chevron {
		transition: none;
	}
}

.blt-lightbox__figure {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.6rem;
	margin: 0;
}

.blt-lightbox__img {
	display: block;
	width: auto;
	max-width: min(92vw, 1100px);
	height: auto;
	max-height: 82vh;
	border-radius: var(--blt-e-radius);
	background: #fff;
	object-fit: contain;
}

.blt-lightbox__caption {
	color: #fff;
	font-family: var(--blt-e-font);
	font-size: 1.44rem;
	text-align: center;
}

.blt-lightbox__btn {
	position: fixed;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: #111;
	font-size: 2.56rem;
	line-height: 1;
	cursor: pointer;
}

.blt-lightbox__btn:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

.blt-lightbox__btn[hidden] {
	display: none;
}

.blt-lightbox__close {
	top: 1rem;
	right: 1rem;
}

.blt-lightbox__prev,
.blt-lightbox__next {
	top: 50%;
	transform: translateY(-50%);
}

.blt-lightbox__prev {
	left: 1rem;
}

.blt-lightbox__next {
	right: 1rem;
}
