/* ==========================================================================
   Watch Khaliah — the media collection. Scoped to this page.
   --------------------------------------------------------------------------
   One object repeats down the whole page: a 16:9 still, a play target or an
   outbound link, then title and copy beneath. Every section uses the same
   grid, so a section with one item gets one card the same size as the others
   rather than a player stretched across the page.

   Columns: 1 on phones, 2 from 620, 3 from 940, 4 from 1440 — where the rail
   also widens, because four cards in a 1180 rail are too small to read a
   still in.

   Colour and type are the child theme's: forest, gold, Black Mango headings
   (the `playfair` slug, which the child remaps) and Futura body (`dm-sans`).
   ========================================================================== */

.kv-page {
	--kv-green: var(--wp--preset--color--forest, #122c21);
	--kv-gold: var(--wp--preset--color--gold, #eeba2b);
	--kv-ink: #122c21;
	--kv-muted: #4a514a;
	color: var(--kv-ink);
	background: #fff;
	margin-block-start: 0 !important;
	font-family: var(--wp--preset--font-family--dm-sans);
}

.kv-page * { box-sizing: border-box; }

.kv-page .kv-wrap { width: min(1180px, calc(100% - 80px)); margin-inline: auto; }
.kv-page .kv-section { padding: 88px 0; margin: 0; scroll-margin-top: 100px; }

.kv-page h1, .kv-page h2, .kv-page h3 {
	font-family: var(--wp--preset--font-family--playfair);
	font-weight: 700;
	letter-spacing: -.025em;
	color: inherit;
	margin: 0;
	text-wrap: balance;
}
.kv-page h1 { font-size: clamp(40px, 5.6vw, 78px); line-height: 1.12; max-width: 1000px; }
.kv-page h2 { font-size: clamp(32px, 3.5vw, 50px); line-height: 1.16; }
.kv-page p { font-size: 19px; line-height: 1.65; margin: 16px 0 0; }

.kv-page .kv-eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .15em; line-height: 1.4; margin: 0 0 22px; }
.kv-page .kv-lead { font-size: 21px; line-height: 1.6; max-width: 760px; }

.kv-page a { color: inherit; text-underline-offset: 5px; }
.kv-page a:focus-visible,
.kv-page button:focus-visible { outline: 3px solid #b37b00; outline-offset: 4px; }

/* ---- Hero ------------------------------------------------------------- */
.kv-page .kv-hero { background: var(--kv-green); color: #fff; padding: 160px 0 60px; margin: 0; }
.kv-hero .kv-eyebrow { color: var(--kv-gold); }
.kv-hero .kv-lead { margin-top: 28px; color: #eef0e9; }
.kv-jump { display: flex; flex-wrap: wrap; gap: 12px 32px; margin-top: 42px; padding-top: 26px; border-top: 1px solid #ffffff40; }
.kv-jump a { font-size: 17px; text-decoration: none; padding: 5px 0; }
.kv-jump a:hover { color: var(--kv-gold); }

.kv-section-heading { margin-bottom: 36px; }
.kv-section-heading .kv-eyebrow { margin-bottom: 16px; }
.kv-section-heading .kv-lead { margin-top: 18px; }

/* ---- The grid ---------------------------------------------------------- */
.kv-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 44px 28px;
}
@media (min-width: 620px)  { .kv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 940px)  { .kv-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* 1600, not 1440: a 1440 desktop is where three columns read best, and the
   stage section has five items — four-up there leaves a single card stranded
   on its own row. Four only once the rail is genuinely wide. */
@media (min-width: 1600px) {
	.kv-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.kv-page .kv-wrap { width: min(1520px, calc(100% - 96px)); }
}

/* A section with one item puts its heading inside the grid, filling the rest
   of the row. That is how a single card stays exactly the width it has in the
   five-card sections without leaving two empty columns beside it — the brief
   asks for both, and this is the only arrangement that gives both. */
.kv-grid__intro { grid-column: 1 / -1; margin-bottom: 0; align-self: center; }
@media (min-width: 620px) { .kv-grid__intro { grid-column: 1 / -2; } }
.kv-grid__intro .kv-lead { font-size: 18px; }

/* ---- The card ---------------------------------------------------------- */
.kv-card { display: flex; flex-direction: column; min-width: 0; }

/* The thumbnail. A button for video, a link for an article — same box either
   way, so the grid stays even. */
.kv-page .kv-card__frame {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: #0b1b14;
	cursor: pointer;
	text-decoration: none;
}
.kv-card__frame img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .35s ease;
}
.kv-card__frame::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(transparent 52%, rgba(6, 18, 12, .55));
	pointer-events: none;
}
.kv-card__frame:hover img,
.kv-card__frame:focus-visible img { transform: scale(1.04); }

/* Centred play target. Sits above the gradient, hence the z-index. */
.kv-card__play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 1;
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	padding-left: 4px;
	border-radius: 50%;
	background: var(--kv-gold);
	color: #122c21;
	box-shadow: 0 6px 22px rgba(6, 18, 12, .35);
	transition: transform .25s ease, background .25s ease;
}
.kv-card__frame:hover .kv-card__play,
.kv-card__frame:focus-visible .kv-card__play { transform: translate(-50%, -50%) scale(1.09); }

.kv-card__body { padding-top: 18px; }
.kv-page .kv-card__eyebrow { font-size: 11px; letter-spacing: .14em; margin: 0 0 8px; color: #7a6a33; }
.kv-page .kv-card__title { font-size: clamp(20px, 1.5vw, 24px); line-height: 1.22; margin: 0; }
.kv-page .kv-card__desc { font-size: 16px; line-height: 1.6; margin: 10px 0 0; color: var(--kv-muted); }
.kv-page .kv-card__links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0; }
.kv-page .kv-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; letter-spacing: .02em; text-decoration: none; border-bottom: 1px solid var(--wp--preset--color--gold-border, #c4973a4d); padding-bottom: 2px; }
.kv-page .kv-link:hover { border-bottom-color: var(--kv-gold); }
.kv-arrow { flex: none; }

/* ---- Section skins ------------------------------------------------------ */
.kv-page .kv-music { background: var(--kv-gold); color: #122c21; }
.kv-music .kv-card__eyebrow { color: #5d4f1c; }
.kv-music .kv-card__desc { color: #3c3a22; }
.kv-page .kv-media { background: #f4f1e7; }
.kv-page .kv-rest { background: #fff; }

/* ---- Buttons + final CTA ------------------------------------------------ */
.kv-page .kv-button {
	display: inline-flex; justify-content: center; align-items: center;
	background: #122c21; color: #fff; text-decoration: none;
	font-size: 14px; font-weight: 700; letter-spacing: .035em;
	padding: 18px 25px; min-height: 52px;
}
.kv-page .kv-button:hover { background: #244c39; }
.kv-page .kv-cta { background: var(--kv-green); color: #fff; text-align: center; padding-block: 100px; }
.kv-cta .kv-eyebrow { color: var(--kv-gold); }
.kv-cta h2 { max-width: 800px; margin: auto; font-size: clamp(38px, 4.5vw, 64px); }
.kv-cta .kv-lead { margin: 24px auto 34px; }
.kv-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.kv-cta .kv-button { background: var(--kv-gold); color: #122c21; }
.kv-cta .kv-button-outline { border: 1px solid #fff; background: transparent; color: #fff; }
.kv-cta .kv-button:hover { background: #fff; color: #122c21; }

/* ==========================================================================
   Modal player
   Sizing: the panel is capped by BOTH the viewport width and height, and the
   stage carries the clip's own aspect ratio, so a 1:1 clip (ABC) stays square
   and a 16:9 one stays wide. `min()` against vh is what stops a tall ratio
   from running off the bottom of the screen.
   ========================================================================== */
/* `margin: 0` is load-bearing. Core's `:where(.is-layout-flow) > *` puts a
   1.5rem top margin on every flow child, the modal included, and on a fixed box
   with both top and bottom pinned that margin offsets the box AND shrinks its
   resolved height — the backdrop was covering 699px of a 723px viewport,
   leaving a live strip of page at the top. */
.kv-modal { position: fixed; inset: 0; margin: 0; z-index: 9999; display: grid; place-items: center; }
.kv-modal[hidden] { display: none; }
.kv-modal__backdrop { position: absolute; inset: 0; background: rgba(6, 14, 10, .93); border: 0; }

.kv-modal__panel {
	position: relative;
	width: min(1100px, calc(100vw - 48px));
	max-height: calc(100vh - 48px);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.kv-modal__bar { display: flex; align-items: center; gap: 16px; justify-content: space-between; }
.kv-page .kv-modal__title,
.kv-modal__title { font-family: var(--wp--preset--font-family--playfair); font-size: clamp(18px, 2vw, 24px); line-height: 1.2; color: #fff; margin: 0; }

.kv-modal__close {
	flex: none;
	display: grid; place-items: center;
	width: 44px; height: 44px;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, .35);
	background: transparent;
	color: #fff;
	cursor: pointer;
	transition: background .2s ease, border-color .2s ease;
}
.kv-modal__close:hover { background: var(--kv-gold); border-color: var(--kv-gold); color: #122c21; }

/* `--kv-ar` is a NUMBER (1.778, 1), not "16 / 9", because the width has to be
   computed from it. Capping height with max-height alone leaves the box its
   full width, so a square clip sat letterboxed inside a 1100px-wide stage —
   the width has to come down too, which is what the min() does. */
.kv-modal__stage {
	position: relative;
	--kv-ar: 1.7778;
	--kv-budget: calc(100vh - 190px);
	width: min(100%, calc(var(--kv-budget) * var(--kv-ar)));
	aspect-ratio: var(--kv-ar);
	max-height: var(--kv-budget);
	margin-inline: auto;
	background: #000;
	border-radius: 10px;
	overflow: hidden;
}
.kv-modal__stage iframe,
.kv-modal__stage video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}
.kv-modal__stage video { object-fit: contain; background: #000; }

.kv-modal__foot { margin: 0; text-align: center; }
.kv-modal__foot .kv-link { color: #fff; border-bottom-color: rgba(255, 255, 255, .45); }
.kv-modal__foot .kv-link:hover { border-bottom-color: var(--kv-gold); color: var(--kv-gold); }

/* The page behind the modal must not scroll under it. */
body.kv-modal-open { overflow: hidden; }

/* ---- Narrow -------------------------------------------------------------- */
@media (min-width: 1500px) { .kv-page .kv-hero { padding-top: 190px; } }

@media (max-width: 900px) {
	.kv-page .kv-wrap { width: calc(100% - 48px); }
	.kv-page .kv-section { padding-block: 64px; }
}

@media (max-width: 760px) {
	.kv-page .kv-wrap { width: calc(100% - 40px); }
	.kv-page .kv-hero { padding: 130px 0 36px; }
	.kv-page h1 { font-size: 39px; }
	.kv-page .kv-lead { font-size: 19px; }
	.kv-page .kv-eyebrow { font-size: 12px; }
	.kv-jump { gap: 8px 22px; margin-top: 30px; }
	.kv-jump a { font-size: 16px; }
	.kv-page .kv-section { padding-block: 48px; }
	.kv-section-heading { margin-bottom: 26px; }
	.kv-grid { gap: 36px; }
	.kv-card__play { width: 56px; height: 56px; }
	.kv-actions { flex-direction: column; }
	.kv-modal__panel { width: calc(100vw - 24px); }
	.kv-modal__stage { --kv-budget: calc(100vh - 170px); }
}

@media (prefers-reduced-motion: reduce) {
	.kv-card__frame img,
	.kv-card__play { transition: none; }
	.kv-card__frame:hover img,
	.kv-card__frame:focus-visible img { transform: none; }
}
