/**
 * Media page (page-templates/template-media.php).
 *
 * Loaded only on that page, after theme.css, so it reuses the --tv-* tokens and
 * the shared .page-hero rules. Everything here sits under md-* classes.
 *
 * Each story is a copy column beside two 9:16 videos, the side alternating
 * down the page. On mobile the copy stacks on top and the videos stay as a
 * two-column grid, never a swipe row.
 *
 * Contents
 *   1. Hero
 *   2. Stories
 *   3. Video cards
 *   4. Follow band
 *   5. Responsive
 */

/* ============================================================ 1. HERO */

.md-hero {
	padding: 64px 0 56px;
}

.md-hero + .md-story {
	padding-top: 24px;
}

/* ============================================================ 2. STORIES */

.md-story {
	padding: 72px 0;
	background: var(--tv-white);
}

.md-story--flip {
	background: var(--tv-mint);
}

.md-story__inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 700px);
	gap: 64px;
	align-items: start;
}

/* Copy rides alongside the tall videos instead of floating mid-height. */
.md-story__copy {
	position: sticky;
	top: calc(var(--tv-header-h) + 40px);
	padding-top: 24px;
}

.md-story--flip .md-story__inner {
	grid-template-columns: minmax(0, 700px) minmax(0, 1fr);
}

.md-story--flip .md-story__copy {
	order: 2;
}

.md-story__title {
	margin-bottom: 18px;
	font-weight: 600;
	font-size: clamp(2rem, 3.4vw, 44px);
	line-height: 1.1;
	letter-spacing: -0.01em;
	color: var(--tv-green);
}

.md-story__copy p {
	max-width: 46ch;
	font-size: 17px;
	line-height: 1.7;
	color: var(--tv-ink);
}

/* ============================================================ 3. VIDEO CARDS */

.md-reels {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 28px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.md-reel {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--tv-line);
	border-radius: var(--tv-radius-card);
	background: var(--tv-white);
	box-shadow: 0 4px 18px rgba(26, 42, 34, 0.08);
}

.md-reel__media {
	position: relative;
	aspect-ratio: 9 / 16;
	background: var(--tv-ink);
}

.md-reel__video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.md-reel__play {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	width: 100%;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}

.md-reel__play[hidden] {
	display: none;
}

.md-reel__play img {
	width: 64px;
	height: 64px;
	transition: transform 0.2s ease;
}

.md-reel__play:hover img,
.md-reel__play:focus-visible img {
	transform: scale(1.08);
}

.md-reel__play:focus-visible {
	outline: 3px solid var(--tv-lime);
	outline-offset: -3px;
}

/* While playing, the frame stays a tap target but the icon gets out of the way. */
.md-reel__play img {
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.is-playing .md-reel__play img {
	opacity: 0;
}

.md-reel__progress {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	height: 4px;
	background: rgba(255, 255, 255, 0.25);
	pointer-events: none;
}

.md-reel__bar {
	display: block;
	width: 0;
	height: 100%;
	background: var(--tv-lime);
}

.md-reel__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 8px;
	padding: 18px 20px 20px;
}

.md-reel__title {
	font-weight: 700;
	font-size: 18px;
	line-height: 1.3;
	color: var(--tv-green);
}

.md-reel__quote,
.md-reel__note {
	font-size: 15px;
	line-height: 1.6;
	color: var(--tv-ink);
}

.md-reel__quote {
	font-style: italic;
}

.md-reel__handle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: auto;
	padding-top: 6px;
	align-self: flex-start;
	font-weight: 600;
	font-size: 14px;
	color: var(--tv-brown);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color 0.2s ease;
}

.md-reel__handle:hover,
.md-reel__handle:focus-visible {
	border-bottom-color: currentColor;
}

/* ============================================================ 4. FOLLOW */

.md-follow {
	padding: 72px 0;
	background: var(--tv-white);
}

.md-follow__inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 28px;
	align-items: center;
	max-width: 1040px;
	padding: 34px 40px;
	border: 1px solid var(--tv-green);
	border-radius: 22px;
}

.md-follow__title {
	margin-bottom: 6px;
	font-weight: 700;
	font-size: 26px;
}

.md-follow p {
	font-size: 16px;
	line-height: 1.65;
	color: var(--tv-ink);
}

.md-follow__btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 14px 26px;
	border-radius: 999px;
	background: var(--tv-green);
	color: var(--tv-white);
	font-weight: 600;
	font-size: 15px;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.2s ease;
}

.md-follow__btn:hover,
.md-follow__btn:focus-visible {
	background: var(--tv-ink);
}

/* ============================================================ 5. RESPONSIVE */

@media (max-width: 1080px) {
	.md-story__inner,
	.md-story--flip .md-story__inner {
		grid-template-columns: minmax(0, 1fr);
		gap: 32px;
	}

	.md-story--flip .md-story__copy {
		order: 0;
	}

	.md-story__copy {
		position: static;
		padding-top: 0;
		max-width: 700px;
		margin-inline: auto;
		text-align: center;
	}

	.md-reels {
		width: 100%;
		max-width: 700px;
		margin-inline: auto;
	}
}

@media (max-width: 900px) {
	.md-follow__inner {
		grid-template-columns: minmax(0, 1fr);
		justify-items: start;
		gap: 18px;
		width: auto;
		margin-inline: var(--tv-gutter);
		padding: 28px 24px;
	}
}

@media (max-width: 600px) {
	.md-hero {
		padding: 48px 0 40px;
	}

	.md-hero .page-hero__title {
		font-size: min(36px, 9.4vw);
	}

	.md-story,
	.md-follow {
		padding: 48px 0;
	}

	.md-story__inner {
		gap: 24px;
	}

	.md-story__copy p {
		font-size: 16px;
	}

	/* One video per row, full width: at ~170px side by side the reels were
	   too small to watch. Still a vertical stack, never a swipe row. */
	.md-reels {
		grid-template-columns: minmax(0, 1fr);
		gap: 24px;
		max-width: 400px;
	}

	.md-reel__body {
		padding: 16px 18px 18px;
	}

	.md-follow__btn {
		width: 100%;
		justify-content: center;
	}
}
