/* ==========================================================================
   Trailer section  (#trailer)
   Markup: partials/trailer.php   |   Behaviour: assets/js/bdsh-trailer.js
   Quick tweaks: change the variables in the first block.
   ========================================================================== */

/* 1. Variables ------------------------------------------------------------ */
.bd-trailer {
	--bdt-bg: #0b0807;
	--bdt-ink: #efe7da;
	--bdt-muted: #a1968b;
	--bdt-accent: #e8705c;
	--bdt-line: rgba(239, 231, 218, .12);
	--bdt-radius: clamp(12px, 1.6vw, 22px);
	--bdt-ease: cubic-bezier(.16, 1, .3, 1);
}

/* 2. Section wrapper -------------------------------------------------------- */
.bd-trailer {
	position: relative;
	z-index: 2;
	overflow: hidden;
	padding: clamp(90px, 14vh, 160px) clamp(20px, 4vw, 56px);
	background: var(--bdt-bg);
	color: var(--bdt-ink);
	font-family: 'Inter', system-ui, sans-serif;
	line-height: 1.6;
}
.bd-trailer__glow {
	position: absolute;
	left: 50%;
	top: 62%;
	width: min(1100px, 120vw);
	height: min(620px, 70vw);
	transform: translate(-50%, -50%);
	background: radial-gradient(ellipse at center, rgba(226, 99, 79, .2), rgba(11, 8, 7, 0) 68%);
	pointer-events: none;
}
.bd-trailer__inner {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: clamp(40px, 6vw, 80px);
	max-width: 1320px;
	margin: 0 auto;
}

/* 3. Heading block ---------------------------------------------------------- */
.bd-trailer__head {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
	gap: clamp(24px, 5vw, 80px);
	align-items: end;
}
.bd-trailer__head-main { display: flex; flex-direction: column; gap: clamp(24px, 3vw, 40px); }
.bd-trailer__eyebrow {
	display: flex;
	align-items: center;
	gap: 18px;
	margin: 0;
	font-size: 11px;
	letter-spacing: .3em;
	text-transform: uppercase;
	color: var(--bdt-muted);
}
.bd-trailer__num { color: var(--bdt-accent); }
.bd-trailer__rule { display: block; width: 48px; height: 1px; background: var(--bdt-accent); }
.bd-trailer__title {
	margin: 0;
	font-family: 'Inter Tight', system-ui, sans-serif;
	font-weight: 500;
	font-size: clamp(2.6rem, 6vw, 5.8rem);
	line-height: .92;
	letter-spacing: -.045em;
}
.bd-trailer__mask { display: block; overflow: hidden; padding-bottom: .08em; }
.bd-trailer__accent { font-style: italic; color: var(--bdt-accent); }
.bd-trailer__lead {
	margin: 0;
	max-width: 440px;
	font-size: clamp(15px, 1.2vw, 17px);
	line-height: 1.75;
	color: #cfc5b8;
	text-wrap: pretty;
}

/* 4. Player frame ----------------------------------------------------------- */
.bd-trailer__player { margin: 0; }
.bd-trailer__frame {
	position: relative;
	aspect-ratio: 20 / 9;               /* trailer has baked-in black bars: this crops them */
	overflow: hidden;
	isolation: isolate;
	border: 1px solid var(--bdt-line);
	border-radius: var(--bdt-radius);
	background: #000;
	box-shadow: 0 50px 120px -40px rgba(232, 112, 92, .32), 0 30px 80px -20px rgba(0, 0, 0, .85);
}
.bd-trailer__frame:focus-visible { outline: 1px solid var(--bdt-accent); outline-offset: 6px; }
.bd-trailer__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: #000;
}

/* 5. Start screen (poster + big play button) -------------------------------- */
.bd-trailer__start {
	position: absolute;
	inset: 0;
	z-index: 3;
	display: grid;
	place-items: center;
	padding: 0;
	border: 0;
	background: #000;
	color: var(--bdt-ink);
	font: inherit;
	cursor: pointer;
	transition: opacity .6s var(--bdt-ease), visibility .6s;
}
.bd-trailer__poster {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 1.4s var(--bdt-ease);
}
.bd-trailer__shade {
	position: absolute;
	inset: 0;
	background:
		radial-gradient(ellipse at center, rgba(11, 8, 7, .05) 30%, rgba(11, 8, 7, .55) 100%),
		linear-gradient(180deg, rgba(11, 8, 7, 0) 55%, rgba(11, 8, 7, .75) 100%);
}
.bd-trailer__start:hover .bd-trailer__poster { transform: scale(1.04); }

.bd-trailer__play {
	position: relative;
	display: grid;
	place-items: center;
	width: clamp(72px, 9vw, 112px);
	aspect-ratio: 1;
	border-radius: 50%;
	background: var(--bdt-accent);
	color: #0b0807;
	transition: transform .5s var(--bdt-ease), background-color .3s;
}
.bd-trailer__play svg { margin-left: 4px; }              /* optical centering of the triangle */
.bd-trailer__play::before,
.bd-trailer__play::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 1px solid var(--bdt-accent);
	animation: bd-trailer-pulse 2.6s ease-out infinite;
}
.bd-trailer__play::after { animation-delay: 1.3s; }
.bd-trailer__start:hover .bd-trailer__play,
.bd-trailer__start:focus-visible .bd-trailer__play { transform: scale(1.1); background: var(--bdt-ink); }
.bd-trailer__start:focus-visible { outline: 1px solid var(--bdt-accent); outline-offset: -6px; }
@keyframes bd-trailer-pulse {
	0%   { transform: scale(1);   opacity: .7; }
	100% { transform: scale(1.8); opacity: 0; }
}

.bd-trailer__meta {
	position: absolute;
	left: clamp(16px, 2.4vw, 32px);
	right: clamp(16px, 2.4vw, 32px);
	bottom: clamp(14px, 2vw, 26px);
	display: flex;
	justify-content: space-between;
	gap: 16px;
	font-size: 10px;
	letter-spacing: .28em;
	text-transform: uppercase;
	color: var(--bdt-ink);
	font-variant-numeric: tabular-nums;
}
.bd-trailer__txt-replay { display: none; }

/* start screen hides once the video plays */
.bd-trailer__frame.is-started .bd-trailer__start { opacity: 0; visibility: hidden; pointer-events: none; }
/* after the video ends: bring the start screen back with "Watch again" */
.bd-trailer__frame.is-ended .bd-trailer__txt-play   { display: none; }
.bd-trailer__frame.is-ended .bd-trailer__txt-replay { display: inline; }

/* 6. Control bar ------------------------------------------------------------ */
.bd-trailer__controls {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 4;
	display: flex;
	align-items: center;
	gap: clamp(8px, 1.4vw, 18px);
	padding: 40px clamp(12px, 2vw, 24px) clamp(10px, 1.4vw, 18px);
	background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .78));
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity .35s, transform .35s var(--bdt-ease), visibility .35s;
}
.bd-trailer__frame.is-started .bd-trailer__controls { opacity: 1; visibility: visible; transform: none; }
.bd-trailer__frame.is-started.is-playing.is-idle .bd-trailer__controls { opacity: 0; transform: translateY(6px); pointer-events: none; }
.bd-trailer__frame.is-started.is-playing.is-idle { cursor: none; }

.bd-trailer__btn {
	display: grid;
	place-items: center;
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--bdt-ink);
	cursor: pointer;
	transition: background-color .25s, color .25s;
}
.bd-trailer__btn:hover { background: rgba(239, 231, 218, .14); color: #fff; }
.bd-trailer__btn:focus-visible { outline: 1px solid var(--bdt-accent); outline-offset: 2px; }

/* icon swaps driven by state classes on the frame */
.bd-trailer__btn .i-pause, .bd-trailer__btn .i-muted { display: none; }
.bd-trailer__frame.is-playing .bd-trailer__btn .i-play  { display: none; }
.bd-trailer__frame.is-playing .bd-trailer__btn .i-pause { display: block; }
.bd-trailer__frame.is-muted .bd-trailer__btn .i-sound { display: none; }
.bd-trailer__frame.is-muted .bd-trailer__btn .i-muted { display: block; }

.bd-trailer__time {
	flex: 0 0 auto;
	display: flex;
	gap: 6px;
	font-size: 11px;
	letter-spacing: .14em;
	color: var(--bdt-ink);
	font-variant-numeric: tabular-nums;
}
.bd-trailer__time-sep { opacity: .45; }

/* Seek bar (native range input, styled; --p is set by JS = % played) */
.bd-trailer__seek {
	--p: 0%;
	flex: 1 1 auto;
	min-width: 0;
	height: 22px;
	margin: 0;
	background: transparent;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}
.bd-trailer__seek:focus { outline: none; }
.bd-trailer__seek::-webkit-slider-runnable-track {
	height: 3px;
	border-radius: 3px;
	background: linear-gradient(90deg, var(--bdt-accent) var(--p), rgba(239, 231, 218, .25) var(--p));
}
.bd-trailer__seek::-moz-range-track { height: 3px; border-radius: 3px; background: rgba(239, 231, 218, .25); }
.bd-trailer__seek::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--bdt-accent); }
.bd-trailer__seek::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 12px;
	height: 12px;
	margin-top: -4.5px;
	border: 0;
	border-radius: 50%;
	background: var(--bdt-ink);
	box-shadow: 0 0 0 3px rgba(232, 112, 92, .35);
	transform: scale(0);
	transition: transform .2s;
}
.bd-trailer__seek::-moz-range-thumb {
	width: 12px;
	height: 12px;
	border: 0;
	border-radius: 50%;
	background: var(--bdt-ink);
	box-shadow: 0 0 0 3px rgba(232, 112, 92, .35);
	transform: scale(0);
	transition: transform .2s;
}
.bd-trailer__seek:hover::-webkit-slider-thumb,
.bd-trailer__seek:focus-visible::-webkit-slider-thumb { transform: scale(1); }
.bd-trailer__seek:hover::-moz-range-thumb,
.bd-trailer__seek:focus-visible::-moz-range-thumb { transform: scale(1); }

/* 7. Caption row under the player ------------------------------------------ */
.bd-trailer__caption {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 14px 24px;
	margin-top: 22px;
	padding-top: 20px;
	border-top: 1px solid var(--bdt-line);
	font-size: 10px;
	letter-spacing: .26em;
	text-transform: uppercase;
	color: var(--bdt-muted);
}
.bd-trailer__caption-book { color: var(--bdt-ink); }
.bd-shell .bd-trailer__cta {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	padding: 0 22px;
	border: 1px solid rgba(239, 231, 218, .3);
	color: var(--bdt-ink);
	transition: background-color .3s, color .3s, border-color .3s;
}
.bd-shell .bd-trailer__cta:hover { background: var(--bdt-ink); border-color: var(--bdt-ink); color: #0b0807; }

/* 8. Fullscreen -------------------------------------------------------------- */
/* The site hides the system cursor (custom cursor lives below the fullscreen layer), so restore it here. */
.bd-trailer__frame:fullscreen,
.bd-trailer__frame:fullscreen *,
.bd-trailer__frame:-webkit-full-screen,
.bd-trailer__frame:-webkit-full-screen * { cursor: auto !important; }
.bd-trailer__frame:fullscreen button,
.bd-trailer__frame:fullscreen input,
.bd-trailer__frame:-webkit-full-screen button,
.bd-trailer__frame:-webkit-full-screen input { cursor: pointer !important; }
.bd-trailer__frame.is-started.is-playing.is-idle:fullscreen,
.bd-trailer__frame.is-started.is-playing.is-idle:fullscreen * { cursor: none !important; }

.bd-trailer__frame:fullscreen,
.bd-trailer__frame:-webkit-full-screen {
	aspect-ratio: auto;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}
.bd-trailer__frame:fullscreen .bd-trailer__video,
.bd-trailer__frame:-webkit-full-screen .bd-trailer__video { object-fit: contain; }

/* 9. Responsive ---------------------------------------------------------------- */
@media (min-width: 861px) {
	.bd-trailer__mask { white-space: nowrap; }
}
@media (max-width: 860px) {
	.bd-trailer__head { grid-template-columns: 1fr; align-items: start; }
	.bd-trailer__lead { max-width: 540px; }
}
@media (max-width: 560px) {
	.bd-trailer__time { display: none; }
	.bd-trailer__btn { width: 36px; height: 36px; }
	.bd-trailer__caption-book { display: none; }
	.bd-trailer__caption { justify-content: space-between; }
}

/* 10. Reduced motion ----------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.bd-trailer__play::before,
	.bd-trailer__play::after { animation: none; opacity: 0; }
	.bd-trailer__poster,
	.bd-trailer__play,
	.bd-trailer__controls { transition: none; }
}
