/**
 * Gate 52 — Hero Patterns
 *
 * Shared styles for hero-internal and hero-homepage patterns.
 * Uses design tokens from theme.json via CSS custom properties.
 */

/* ----------------------------------------------------------------
   Internal Hero (hero-internal pattern)
   ---------------------------------------------------------------- */

.g52-hero-internal {
	position: relative;
	height: 60vh;
	min-height: 480px;
	box-sizing: border-box;
	padding-top: 5rem;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--g52--font--body, Inter, sans-serif);
	margin-bottom: 5rem !important;
}

.g52-hero-internal__bg {
	position: absolute;
	inset: 0;
}

.g52-hero-internal__bg img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	filter: grayscale(1);
	opacity: 0.5;
}

/* Background Treatment toggles (grayscale/dimImage) — modifier classes on
   .g52-hero-internal remove the corresponding effect from the bg img. The
   showOverlay toggle needs no CSS: the __overlay div is simply omitted when off. */
.g52-hero-internal.no-grayscale .g52-hero-internal__bg img {
	filter: none;
}

.g52-hero-internal.no-dim .g52-hero-internal__bg img {
	opacity: 1;
}

.g52-hero-internal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 10, 0.8);
	mix-blend-mode: multiply;
}

.g52-hero-internal__gradient {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(10, 10, 10, 1) 0%, transparent 60%);
}

.g52-hero-internal__content {
	position: relative;
	z-index: 1;
	text-align: center;
	max-width: var(--wp--style--global--wide-size, 1536px);
	width: 100%;
	height: 100%;
	margin: 0 auto;
	padding: 0 1rem;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	transform: translateY(-1.25rem);
}

.g52-hero-internal__badge {
	display: inline-block;
	padding: 0.375rem 0.75rem;
	background: var(--g52--color--primary, #D90429);
	color: #fff;
	font-size: 11px;
	line-height: 1;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	margin: 0 0 1.5rem;
	border-radius: 2px;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.g52-hero-internal__heading {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	line-height: 0.9;
	margin: 0 0 1.5rem;
}

.g52-hero-internal__heading-solid,
.g52-hero-internal__heading-ghost {
	font-family: var(--g52--font--display, Anton, sans-serif);
	text-transform: uppercase;
	letter-spacing: 0.025em;
	display: block;
	margin: 0;
	font-weight: 400;
}

.g52-hero-internal__heading-solid {
	color: #fff;
	font-size: clamp(3.75rem, 10vw, 8rem);
	line-height: 0.9;
	text-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 8px 40px rgba(0, 0, 0, 0.25), 0 16px 80px rgba(0, 0, 0, 0.15);
}

.g52-hero-internal__heading-ghost {
	color: rgba(255, 255, 255, 0.08);
	font-family: var(--g52--font--display, Anton, sans-serif);
	font-size: clamp(3.75rem, 10vw, 8rem);
	font-weight: 400;
	letter-spacing: 3.2px;
	line-height: 0.9;
	text-align: center;
	-webkit-font-smoothing: antialiased;
	-webkit-text-stroke: 1px rgba(255, 255, 255, 0.08);
	text-shadow: none;
	margin-top: 0.35rem;
}

.g52-hero-internal__subtitle {
	max-width: 42rem;
	font-family: var(--g52--font--condensed, Oswald, sans-serif);
	font-size: 1.25rem;
	line-height: 1.4;
	color: rgba(209, 213, 219, 0.9);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	border-top: 1px solid color-mix(in srgb, var(--g52--color--primary, #D90429) 50%, transparent);
	margin: 0;
	padding-top: 1.5rem;
	/* Always-on legibility floor (not toggle-gated): the __gradient is a
	   bottom-edge vignette only and the content stack is vertically
	   centered, so neither protects this text when all three
	   background-treatment toggles are off. Matches the shadow already
	   applied to .g52-hero-internal__heading-solid above. */
	text-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 8px 40px rgba(0, 0, 0, 0.25), 0 16px 80px rgba(0, 0, 0, 0.15);
}

.g52-hero-internal__cta {
	display: inline-block;
	margin-top: 2.5rem;
	background: var(--g52--color--primary, #D90429);
	color: #fff;
	font-family: var(--g52--font--body, Inter, sans-serif);
	font-weight: 700;
	font-size: 0.875rem;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	padding: 1rem 2.5rem;
	text-decoration: none;
	border: none;
	transition: background-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}

.g52-hero-internal__cta:hover {
	background: var(--g52--color--primary-dark, #b00220);
	color: #fff;
	transform: translateY(-2px);
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

@media (min-width: 640px) {
	.g52-hero-internal__content {
		padding: 0 1.5rem;
	}
}

@media (min-width: 1024px) {
	.g52-hero-internal__content {
		padding: 0 2rem;
	}
}

@media (max-width: 767px) {
	.g52-hero-internal {
		min-height: 400px;
		height: 50vh;
		padding-top: 3.5rem;
		margin-bottom: 3rem !important;
	}

	.g52-hero-internal__subtitle {
		font-size: 1rem;
	}

	.g52-hero-internal__cta {
		display: inline-block;
		text-align: center;
	}
}

.g52-nav-shrink-sentinel {
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	height: 0;
	pointer-events: none;
}

/* ----------------------------------------------------------------
   Homepage Hero (hero-homepage pattern)
   ---------------------------------------------------------------- */

.wp-block-g52-hero-homepage {
	margin: 0;
	max-width: none;
	padding: 0;
}

@media (max-width: 767px) {
	.entry-content iframe {
		display: block;
		max-width: 100%;
	}
}

.g52-hero-homepage,
.g52-hero-homepage *,
.g52-hero-homepage *::before,
.g52-hero-homepage *::after {
	box-sizing: border-box;
}

.g52-hero-homepage h1,
.g52-hero-homepage h2,
.g52-hero-homepage h3,
.g52-hero-homepage h4 {
	margin-top: 0;
	padding: 0;
	font-weight: 400;
}

.g52-hero-homepage {
	position: relative;
	width: 100%;
	/* Use dvh so the hero doesn't ignore Safari's collapsing URL bar.
	 * Fallback for browsers without dvh: vh. */
	height: 85vh;
	height: 85dvh;
	overflow: hidden;
	padding-top: 5rem;
	font-family: var(--g52--font--body, Inter, sans-serif);
	background: #0a0a0a;
}

/* Ambient blur layer: picks up the hero image's color palette.
   Stacks behind child elements via natural DOM order (::before precedes children). */
.g52-hero-homepage::before {
	content: '';
	position: absolute;
	inset: -20px;
	background: var(--hero-img, none) center / cover no-repeat;
	filter: blur(30px) brightness(0.3);
}

.g52-hero-homepage__bg {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 100%;
}

@media (min-width: 768px) {
	.g52-hero-homepage__bg {
		width: 65%;
	}
}

@media (min-width: 1024px) {
	.g52-hero-homepage__bg {
		width: 55%;
	}
}

.g52-hero-homepage__bg img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center 20%;
}

/* Feather left edge of the portrait into the ambient blur */
.g52-hero-homepage__bg::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(to right, rgba(10, 10, 10, 1) 0%, transparent 40%);
	pointer-events: none;
}

/* Stacked bg layers — one per event, crossfade via opacity.
   Centered horizontally so the poster subject stays visible
   even when the sidebar overlaps the right edge. */
.g52-hero-homepage__bg-layer {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 100%;
	opacity: 0;
	transition: opacity 300ms ease;
	pointer-events: none;
}

.g52-hero-homepage__bg-layer.is-active {
	opacity: 1;
}

@media (min-width: 768px) {
	.g52-hero-homepage__bg-layer {
		width: 75%;
	}
}

@media (min-width: 1024px) {
	.g52-hero-homepage__bg-layer {
		width: 66%;
	}
}

.g52-hero-homepage__bg-layer img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center 20%;
}

/* Feather both edges of the portrait into the ambient blur */
.g52-hero-homepage__bg-layer::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to right,
		rgba(10, 10, 10, 1) 0%,
		transparent 35%,
		transparent 65%,
		rgba(10, 10, 10, 0.75) 100%
	);
	pointer-events: none;
}

/* Featured Image: full-width layer, no side gradients */
.g52-hero-homepage__bg-layer--full-width {
	left: 0;
	transform: none;
	width: 100%;
}

@media (min-width: 768px) {
	.g52-hero-homepage__bg-layer--full-width {
		width: 100%;
	}
}

@media (min-width: 1024px) {
	.g52-hero-homepage__bg-layer--full-width {
		width: 100%;
	}
}

.g52-hero-homepage__bg-layer--full-width::after {
	background: transparent;
}

.g52-hero-homepage__gradient-bt {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(10, 10, 10, 1) 0%, transparent 50%);
}

.g52-hero-homepage__overlay {
	position: absolute;
	inset: 0;
}

.g52-hero-homepage__overlay--0  { background: transparent; }
.g52-hero-homepage__overlay--20 { background: rgba(10, 10, 10, 0.2); }
.g52-hero-homepage__overlay--40 { background: rgba(10, 10, 10, 0.4); }
.g52-hero-homepage__overlay--60 { background: rgba(10, 10, 10, 0.6); }
.g52-hero-homepage__overlay--80 { background: rgba(10, 10, 10, 0.8); }

/* Layout: main content + sidebar */
.g52-hero-homepage__inner {
	position: relative;
	z-index: 1;
	width: 100%;
	height: 100%;
	max-width: var(--wp--style--global--wide-size, 1536px);
	margin: 0 auto;
	padding: 0 1rem 3rem;
	display: flex;
	flex-direction: column;
}

@media (min-width: 640px) {
	.g52-hero-homepage__inner {
		padding: 0 1.5rem 3rem;
	}
}

@media (min-width: 768px) {
	.g52-hero-homepage__inner {
		flex-direction: row;
		align-items: center;
		padding: 0 1.5rem 0;
	}
}

@media (min-width: 1024px) {
	.g52-hero-homepage__inner {
		padding: 0 2rem 0;
	}
}

/* Main content area */
.g52-hero-homepage__main {
	width: 100%;
	z-index: 1;
	padding-top: 3rem;
}

@media (min-width: 768px) {
	.g52-hero-homepage__main {
		width: 66.666%;
		padding-top: 0;
	}
}

@media (min-width: 1024px) {
	.g52-hero-homepage__main {
		width: 50%;
	}
}

/* Badge */
.g52-hero-homepage__badge {
	display: inline-block;
	padding: 0.375rem 0.75rem;
	background: var(--g52--color--primary, #D90429);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	margin-bottom: 1.5rem;
	border-radius: 2px;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Event title heading */
.g52-hero-homepage__title {
	font-family: var(--g52--font--display, Anton, sans-serif);
	color: #fff;
	text-transform: uppercase;
	line-height: 0.9;
	margin-bottom: 1.5rem;
	text-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 8px 40px rgba(0, 0, 0, 0.25), 0 16px 80px rgba(0, 0, 0, 0.15);
	font-size: 3rem;
}

/* Length-aware title sizing.
 *
 * The render exposes the title's character count as --title-len; the
 * curve below shrinks long titles so a tall headline can't overflow the
 * fixed-height hero and clip the CTAs. Short titles (<= threshold chars)
 * stay at the full display size (MAX cap); longer ones ride down toward
 * the MIN cap. Single source of truth — no length thresholds in PHP/JS.
 */
@media (min-width: 768px) {
	.g52-hero-homepage__title {
		font-size: clamp(
			2.5rem,
			calc(4.5rem - max(0, var(--title-len, 0) - 20) * 0.08rem),
			4.5rem
		);
	}
}

@media (min-width: 1024px) {
	.g52-hero-homepage__title {
		font-size: clamp(
			3rem,
			calc(8rem - max(0, var(--title-len, 0) - 20) * 0.2rem),
			8rem
		);
	}
}

/* Event metadata (date, doors, support) */
.g52-hero-homepage__meta {
	font-family: var(--g52--font--condensed, Oswald, sans-serif);
	font-size: 1.25rem;
	color: #d1d5db;
	text-transform: uppercase;
	letter-spacing: 0.025em;
	margin-bottom: 2rem;
	border-left: 4px solid var(--g52--color--primary, #D90429);
	padding-left: 1.5rem;
	padding-top: 0.25rem;
	padding-bottom: 0.25rem;
}

@media (min-width: 768px) {
	.g52-hero-homepage__meta {
		font-size: 1.5rem;
	}
}

.g52-hero-homepage__meta-artist {
	color: #fff;
	font-weight: 700;
}

.g52-hero-homepage__meta-date {
	color: var(--g52--color--primary, #D90429);
	font-weight: 700;
}

.g52-hero-homepage__meta-sep {
	color: rgba(107, 114, 128, 1);
	margin: 0 0.5rem;
}

.g52-hero-homepage__meta-doors {
	font-size: 0.875rem;
	letter-spacing: 0.05em;
	vertical-align: middle;
}

/* CTA buttons */
.g52-hero-homepage__ctas {
	display: flex;
	gap: 1rem;
	flex-wrap: wrap;
}

.g52-hero-homepage__cta-primary {
	display: inline-block;
	background: var(--g52--color--primary, #D90429);
	color: #fff;
	font-weight: 700;
	padding: 1rem 2.5rem;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	font-size: 0.875rem;
	text-decoration: none;
	border: none;
	cursor: pointer;
	transition: background-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}

.g52-hero-homepage__cta-primary:hover {
	background: var(--g52--color--primary-dark, #b00220);
	transform: translateY(-2px);
	box-shadow: 0 10px 15px -3px rgba(19, 78, 74, 0.3), 0 4px 6px -4px rgba(19, 78, 74, 0.3);
}

.g52-hero-homepage__cta-secondary {
	display: inline-block;
	background: transparent;
	color: #fff;
	font-weight: 700;
	padding: 1rem 2.5rem;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	font-size: 0.875rem;
	text-decoration: none;
	border: 1px solid rgba(255, 255, 255, 0.8);
	cursor: pointer;
	transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}

.g52-hero-homepage__cta-secondary:hover,
.g52-hero-homepage__cta-secondary:focus-visible {
	background: #fff;
	color: #000;
	border-color: #fff;
}

/* "Don't Miss Out" sidebar */
.g52-hero-homepage__sidebar {
	display: none;
}

@media (min-width: 768px) {
	.g52-hero-homepage__sidebar {
		display: flex;
		flex-direction: column;
		justify-content: center;
		height: 100%;
		width: 33.333%;
		margin-left: auto;
		border-left: 1px solid rgba(255, 255, 255, 0.1);
		background: rgba(0, 0, 0, 0.55); /* solid fallback */
		padding: 2.5rem;
	}

	@supports ((backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px))) {
		.g52-hero-homepage__sidebar {
			background: rgba(0, 0, 0, 0.4);
			backdrop-filter: blur(12px);
			-webkit-backdrop-filter: blur(12px);
		}
	}
}

@media (min-width: 1024px) {
	.g52-hero-homepage__sidebar {
		width: 25%;
	}
}

.g52-hero-homepage__sidebar-heading {
	font-family: var(--g52--font--condensed, Oswald, sans-serif);
	color: #fff;
	text-transform: uppercase;
	letter-spacing: 0.2em;
	font-size: 0.75rem;
	margin-bottom: 2rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.2);
	text-align: center;
	width: 100%;
}

.g52-hero-homepage__sidebar-events {
	display: flex;
	flex-direction: column;
	gap: 2.5rem;
}

.g52-hero-homepage__sidebar-event {
	display: block;
	text-decoration: none;
	border-left: 3px solid transparent;
	padding-left: 0.75rem;
	transition: transform 300ms ease, border-color 200ms ease, background 200ms ease;
}

.g52-hero-homepage__sidebar-event:hover,
.g52-hero-homepage__sidebar-event:focus-visible,
.g52-hero-homepage__sidebar-event.is-active {
	transform: translateX(4px);
	border-left-color: var(--g52--color--primary, #D90429);
	background: rgba(255, 255, 255, 0.04);
}

.g52-hero-homepage__sidebar-date {
	display: block;
	color: var(--g52--color--primary, #D90429);
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	margin-bottom: 0.25rem;
}

.g52-hero-homepage__sidebar-title {
	font-family: var(--g52--font--display, Anton, sans-serif);
	color: #fff;
	font-size: 1.875rem;
	text-transform: uppercase;
	letter-spacing: 0.025em;
	line-height: 1;
	margin-bottom: 0;
	padding-top: 10px;
	padding-bottom: 10px;
	transition: color 200ms ease;
}

.g52-hero-homepage__sidebar-event:hover .g52-hero-homepage__sidebar-title,
.g52-hero-homepage__sidebar-event:focus-visible .g52-hero-homepage__sidebar-title,
.g52-hero-homepage__sidebar-event.is-active .g52-hero-homepage__sidebar-title {
	color: var(--g52--color--primary, #D90429);
}

.g52-hero-homepage__sidebar-support {
	display: block;
	color: rgba(156, 163, 175, 1);
	font-family: var(--g52--font--condensed, Oswald, sans-serif);
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	margin-top: 0;
}

/* ----------------------------------------------------------------
   Homepage Hero — Mobile (< 768px)
   Push content into the darker lower zone and use a vertical
   gradient stack so text remains readable over full-width artwork.
   ---------------------------------------------------------------- */
@media (max-width: 767px) {
	.g52-hero-homepage {
		height: clamp(520px, 78dvh, 720px);
		padding-top: 4rem;
	}

	.g52-hero-homepage__inner {
		justify-content: flex-end;
		padding-bottom: 1rem;
	}

	.g52-hero-homepage__main {
		padding-top: 0;
	}

	.g52-hero-homepage__bg::after {
		background: linear-gradient(
			to top,
			rgba(10, 10, 10, 0.95) 0%,
			rgba(10, 10, 10, 0.6) 40%,
			transparent 65%
		);
	}

	.g52-hero-homepage__gradient-bt {
		background: linear-gradient(
			to top,
			rgba(10, 10, 10, 1) 0%,
			rgba(10, 10, 10, 0.7) 30%,
			transparent 55%
		);
	}

	.g52-hero-homepage__badge {
		margin-bottom: 1rem;
	}

	.g52-hero-homepage__title {
		font-size: clamp(2.5rem, 12vw, 4.5rem);
		margin-bottom: 1rem;
	}

	.g52-hero-homepage__meta {
		font-size: 1.125rem;
		margin-bottom: 1.5rem;
		padding-left: 1rem;
	}

	.g52-hero-homepage__ctas {
		width: 100%;
	}

	.g52-hero-homepage__cta-primary,
	.g52-hero-homepage__cta-secondary {
		flex: 1;
		text-align: center;
		padding: 0.875rem 1.5rem;
	}

	/* Show secondary featured events as a compact swipe row on mobile. */
	.g52-hero-homepage__sidebar {
		display: block;
		width: 100%;
		margin-top: 0.5rem;
		padding-top: 0.5rem;
		border-top: 1px solid rgba(255, 255, 255, 0.15);
	}

	.g52-hero-homepage__sidebar-heading {
		font-size: 0.625rem;
		letter-spacing: 0.16em;
		margin-bottom: 0.4rem;
		padding-bottom: 0;
		border-bottom: 0;
		text-align: left;
	}

	.g52-hero-homepage__sidebar-events {
		flex-direction: row;
		gap: 0.5rem;
		overflow-x: auto;
		overflow-y: hidden;
		padding-bottom: 0;
		padding-right: 1.5rem; /* peek of next card hints swipe */
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
	}

	.g52-hero-homepage__sidebar-event {
		flex: 0 0 72%;
		scroll-snap-align: start;
		padding: 0.5rem 0.625rem;
		background: rgba(0, 0, 0, 0.45);
		border: 1px solid rgba(255, 255, 255, 0.12);
		border-radius: 2px;
	}

	.g52-hero-homepage__sidebar-date {
		font-size: 0.6875rem;
		margin-bottom: 0.125rem;
	}

	.g52-hero-homepage__sidebar-title {
		font-size: 1.125rem;
		padding-top: 0.125rem;
		padding-bottom: 0;
		line-height: 0.92;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.g52-hero-homepage__sidebar-support {
		display: none;
	}
}

/* Reactive visibility toggle for Interactivity API bound elements */
.g52-hero-homepage .is-hidden {
	display: none !important;
}

/* Ambient blur crossfade follows the --hero-img custom property */
.g52-hero-homepage::before {
	transition: background-image 300ms ease;
}

/* Brand hero: keep full-width image (admin-controlled) */
.g52-hero-homepage--brand .g52-hero-homepage__bg {
	width: 100%;
}

.g52-hero-homepage--brand .g52-hero-homepage__bg::after {
	display: none;
}

/* Brand hero centered layout */
.g52-hero-homepage--brand .g52-hero-homepage__main {
	width: 100%;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
}

@media (min-width: 768px) {
	.g52-hero-homepage--brand .g52-hero-homepage__main {
		width: 100%;
	}
}

.g52-hero-homepage--brand .g52-hero-homepage__meta {
	border-left: none;
	padding-left: 0;
	max-width: 40rem;
}

.g52-hero-homepage--brand .g52-hero-homepage__ctas {
	justify-content: center;
}

/* Empty / fallback state */
.g52-hero-homepage__empty {
	position: relative;
	z-index: 1;
	width: 100%;
	text-align: center;
	padding: 4rem 1rem;
}

.g52-hero-homepage__empty p {
	font-family: var(--g52--font--condensed, Oswald, sans-serif);
	color: rgba(156, 163, 175, 1);
	font-size: 1.25rem;
	text-transform: uppercase;
	letter-spacing: 0.1em;
}
