/**
 * Video / Celebs sections - one stylesheet for both.
 *
 * Template parts: parts/dd-parts/dd-video.php, parts/dd-parts/dd-celebs.php
 * Content:        ACF options page "Video / Celebs"
 *
 * 1. Shared layer: colour tokens and the base both sections inherit.
 *    Verlag (300 / 400 / 700) is loaded by the theme, not here; if the theme
 *    registers it under another family name, change --dd-vc-font-verlag.
 */

:root {
	--dd-vc-ink: #2d2c2c;
	--dd-vc-ink-line: rgba(45, 44, 44, 0.26);
	--dd-vc-cream: #f4f3ec;
	--dd-vc-white: #fff;
	--dd-vc-black: #000;
	--dd-vc-play-bg: rgba(255, 255, 255, 0.88);
	--dd-vc-font-verlag: "Verlag", Helvetica, Arial, sans-serif;
}

/*
 * The prototype set font, colour and line-height on <body>. Here they are
 * scoped to the sections, so the host theme's body styles stay untouched and
 * cannot leak in either.
 */
.dd-video,
.dd-celebs {
	font-family: var(--dd-vc-font-verlag);
	color: var(--dd-vc-ink);
	line-height: normal;
	background: var(--dd-vc-white);
}

/* Neutralise the host theme's button skin; each section sets its own. */
.dd-video button,
.dd-celebs button {
	-webkit-appearance: none;
	appearance: none;
	border-radius: 0;
	box-shadow: none;
	text-shadow: none;
}

/**
 * 2. Section: video (CNN feature) - parts/dd-parts/dd-video.php
 */

.dd-video {
	padding: 96px 0 0;
}

.dd-video__box {
	max-width: 1175px;
	margin: 0 auto;
	box-sizing: border-box;
	background: var(--dd-vc-cream);
	padding: 74px 66px;
	display: grid;
	grid-template-columns: 390px minmax(0, 1fr);
	gap: 52px;
	align-items: center;
}

.dd-video__copy {
	display: flex;
	flex-direction: column;
	gap: 32px;
}

.dd-video__title {
	margin: 0;
	font-size: 28px;
	line-height: 43px;
	font-weight: 700;
	letter-spacing: 3.5px;
	text-transform: uppercase;
	color: var(--dd-vc-ink);
	text-wrap: pretty;
}

.dd-video__text {
	margin: 0;
	font-size: 18px;
	line-height: 29px;
	font-weight: 300;
	letter-spacing: 1px;
	color: var(--dd-vc-ink);
	text-wrap: pretty;
}

.dd-video__player {
	position: relative;
	width: 100%;
	aspect-ratio: 600 / 339;
	background: var(--dd-vc-black);
	overflow: hidden;
}

.dd-video__player video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.dd-video__play {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.dd-video__play-icon {
	width: 74px;
	height: 74px;
	border-radius: 50%;
	background: var(--dd-vc-play-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.3s ease;
}

.dd-video__play .icon-play {
	margin-left: 4px;
}

.dd-video__play .icon-pause {
	display: none;
}

.dd-video__player.is-playing .icon-play {
	display: none;
}

.dd-video__player.is-playing .icon-pause {
	display: block;
}

.dd-video__player.is-playing .dd-video__play-icon {
	opacity: 0;
}

.dd-video__player.is-playing:hover .dd-video__play-icon,
.dd-video__play:focus-visible .dd-video__play-icon {
	opacity: 1;
}

/*
 * Tablet - not in the handoff, which only defines desktop and <=767px.
 * 1214px = box (1175) + 2 x 20px gutter: below it the box would touch the
 * screen edges. Below 992px the 390px copy column leaves the video too narrow.
 */
@media (max-width: 1214px) {
	.dd-video {
		padding-left: 20px;
		padding-right: 20px;
	}
}

@media (max-width: 991px) {
	.dd-video__box {
		grid-template-columns: 1fr;
		gap: 40px;
		padding: 56px 48px;
	}
}

/* Mobile */
@media (max-width: 767px) {
	.dd-video {
		padding: 40px 20px 0;
	}

	.dd-video__box {
		grid-template-columns: 1fr;
		gap: 28px;
		padding: 36px 20px;
	}

	.dd-video__copy {
		gap: 22px;
	}

	.dd-video__title {
		font-size: 22px;
		line-height: 34px;
		letter-spacing: 2.5px;
	}

	.dd-video__text {
		font-size: 16px;
		line-height: 27px;
	}

	.dd-video__play-icon {
		width: 60px;
		height: 60px;
	}
}

/**
 * 3. Section: celebrity gallery (tabs + infinite slider) - parts/dd-parts/dd-celebs.php
 *
 * --dd-vc-tab-count is set by the script in dd-celebs.php from the number of
 * tabs entered in ACF; 4 is the design's count and the no-JS fallback.
 */

.dd-celebs {
	--dd-vc-slide-w: 300px;
	--dd-vc-slide-h: 532px;
	--dd-vc-slide-gap: 30px;
	--dd-vc-arrow: 59px;
	padding: 96px 0 110px;
	overflow: hidden;
}

.dd-celebs__container {
	max-width: 1170px;
	margin: 0 auto;
	position: relative;
}

.dd-celebs__head {
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
}

.dd-celebs__eyebrow {
	margin: 0;
	font-size: 15px;
	font-weight: 400;
	letter-spacing: 7.1px;
	text-transform: uppercase;
}

.dd-celebs__title {
	margin: 0;
	font-size: 36px;
	font-weight: 700;
	line-height: normal;
	letter-spacing: 9px;
	text-transform: uppercase;
	color: var(--dd-vc-ink);
}

/* Tabs */
.dd-celebs__tabs {
	margin: 64px auto 0;
	width: 960px;
}

.dd-celebs__tabs-grid {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 1fr;
}

.dd-celebs__tab {
	background: none;
	border: 0;
	cursor: pointer;
	padding: 0 0 28px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
	font-family: inherit;
	color: var(--dd-vc-ink);
}

.dd-celebs__tab-img {
	display: block;
	width: 76px;
	height: 76px;
	max-width: none;
	border-radius: 50%;
	object-fit: cover;
	object-position: center;
	filter: grayscale(100%);
	transition: filter 0.4s ease;
}

.dd-celebs__tab-label {
	font-size: 12px;
	font-weight: 400;
	letter-spacing: 2.5px;
	line-height: 1.7;
	text-transform: uppercase;
	text-align: center;
	opacity: 0.6;
	transition: opacity 0.4s ease;
}

.dd-celebs__tab.is-active .dd-celebs__tab-img {
	filter: none;
}

.dd-celebs__tab.is-active .dd-celebs__tab-label {
	opacity: 1;
}

.dd-celebs__line {
	position: relative;
	height: 1px;
	background: var(--dd-vc-ink-line);
}

.dd-celebs__line-active {
	position: absolute;
	top: -1px;
	left: 0;
	width: calc(100% / var(--dd-vc-tab-count, 4));
	height: 2px;
	background: var(--dd-vc-ink);
	transform: translateX(0);
	transition: transform 0.45s ease;
}

/* Slider */
.dd-celebs__slider {
	margin-top: 72px;
	position: relative;
}

.dd-celebs__viewport {
	overflow: hidden;
	width: calc(var(--dd-vc-slide-w) * 3 + var(--dd-vc-slide-gap) * 2);
	margin: 0 auto;
}

.dd-celebs__track {
	display: flex;
	gap: var(--dd-vc-slide-gap);
	transition: transform 0.5s ease;
	will-change: transform;
}

.dd-celebs__track[hidden] {
	display: none;
}

.dd-celebs__track.no-anim {
	transition: none;
}

.dd-celebs__slide {
	flex: 0 0 var(--dd-vc-slide-w);
	width: var(--dd-vc-slide-w);
	height: var(--dd-vc-slide-h);
	border-radius: 14px;
	overflow: hidden;
}

.dd-celebs__slide-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center;
}

.dd-celebs__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: var(--dd-vc-arrow);
	height: var(--dd-vc-arrow);
	padding: 0;
	background: none;
	border: 0;
	cursor: pointer;
}

.dd-celebs__arrow img {
	width: 100%;
	height: 100%;
	max-width: none;
	display: block;
	padding: 1px;
	box-sizing: border-box;
}

.dd-celebs__arrow--prev {
	left: 0;
}

.dd-celebs__arrow--next {
	right: 0;
}

/*
 * Tablet - not in the handoff. Below 1100px the arrows no longer fit beside
 * the 960px viewport, so they move under the slides as on mobile, and the
 * three slides shrink with the screen (20px gutter each side, ratio kept).
 */
@media (max-width: 1099px) {
	.dd-celebs {
		--dd-vc-slide-w: min(300px, calc((100vw - 40px - 60px) / 3));
		--dd-vc-slide-h: calc(var(--dd-vc-slide-w) * 532 / 300);
	}

	.dd-celebs__tabs {
		width: min(960px, calc(100% - 40px));
	}

	.dd-celebs__arrows {
		display: flex;
		justify-content: center;
		gap: 24px;
		margin-top: 28px;
	}

	.dd-celebs__arrow {
		position: static;
		transform: none;
	}
}

/* Mobile */
@media (max-width: 767px) {
	.dd-celebs {
		--dd-vc-slide-w: min(calc(100vw - 40px), 420px);
		--dd-vc-slide-h: calc(var(--dd-vc-slide-w) * 532 / 300);
	}

	/* Not in the handoff: without a gutter the title touches the screen edges at 375px. */
	.dd-celebs__title {
		padding: 0 20px;
		font-size: 28px;
		line-height: 44px;
	}

	.dd-celebs__tabs {
		width: 100%;
		margin-top: 30px;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}

	.dd-celebs__tabs::-webkit-scrollbar {
		display: none;
	}

	.dd-celebs__tabs-inner {
		width: calc(var(--dd-vc-tab-count, 4) * 50%);
		padding: 0 20px;
		box-sizing: border-box;
	}

	.dd-celebs__tab-img {
		width: 65px;
		height: 65px;
	}

	.dd-celebs__tab-label {
		font-size: 10px;
		letter-spacing: 1.5px;
	}

	.dd-celebs__slider {
		margin-top: 40px;
	}

	.dd-celebs__viewport {
		width: var(--dd-vc-slide-w);
	}

	/* Arrows under the slides: inherited from the tablet block above. */
}
