/*
 * The "Watch the video" card on an article page (Bjkb_Video::card_html()),
 * and the "Editors only" note shown to editors when an article's video
 * isn't shown yet. Loaded only on an article that has one or the other.
 *
 * Only the theme tokens from bjkb-theme-*.css, so it works unchanged in App
 * Light, App Dark and Account. The label mirrors the guided summary card's
 * title (.bjkb-summary-title) and the panel mirrors "On this page" (.bjkb-toc),
 * so the card sits between the two looking like part of the same page.
 *
 * Positioned children use top/right/bottom/left rather than inset: the
 * padding-box fallback below is for old Safari (14.0 and earlier), which
 * doesn't know inset either.
 */

.bjkb-video {
	margin: 0 0 24px;
	padding: 16px 18px 14px;
	background: var(--bjkb-bg-panel);
	border: 1px solid var(--bjkb-border);
	border-radius: var(--bjkb-radius-card);
}

.bjkb-video-label {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 12px;
	color: var(--bjkb-accent);
	font-size: 0.8125em;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.bjkb-video-label .bjkb-icon {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
}

.bjkb-video-duration {
	margin-left: auto;
	color: var(--bjkb-text-muted);
	font-weight: 600;
	letter-spacing: 0;
	text-transform: none;
	font-variant-numeric: tabular-nums;
}

.bjkb-video-frame {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #000;
	border-radius: var(--bjkb-radius-card);
}

/* Older Safari: the padding-top ratio box. */
@supports not (aspect-ratio: 16 / 9) {
	.bjkb-video-frame {
		height: 0;
		padding-top: 56.25%;
	}
}

/* No picture on disk yet: a tinted 16:9 panel with the play button - still nothing from YouTube. */
.bjkb-video-frame.is-placeholder {
	background: #1b1e22;
	background: color-mix(in srgb, var(--bjkb-accent) 35%, #000);
}

.bjkb-video-thumb,
.bjkb-video-player {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	border: 0;
}

.bjkb-video-thumb {
	object-fit: cover;
}

.bjkb-video-play {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	text-decoration: none;
}

.bjkb-video-play-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.62);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

/*
 * White whatever the theme says. Its a:hover/a:focus colour (#2a6496 and
 * #23527c, specificity 0-1-1, loaded after this file) would otherwise turn
 * the triangle dark blue on the teal hover circle - and near-black on a
 * link-only card, whose link keeps focus after opening YouTube in a new tab.
 * Same fix as .bjkb-btn:hover in bjkb-base.css: out-rank it, no !important.
 */
.bjkb-video .bjkb-video-play,
.bjkb-video .bjkb-video-play:hover,
.bjkb-video .bjkb-video-play:focus {
	color: #fff;
}

.bjkb-video-play-icon svg {
	width: 30px;
	height: 30px;
	margin-left: 4px; /* optical centring of the triangle */
	fill: #fff;
}

.bjkb-video-play:hover .bjkb-video-play-icon,
.bjkb-video-play:focus-visible .bjkb-video-play-icon {
	background: var(--bjkb-accent);
}

.bjkb-video-play:focus-visible {
	outline: 3px solid var(--bjkb-accent);
	outline-offset: -3px;
}

@media (prefers-reduced-motion: no-preference) {
	.bjkb-video-play-icon {
		transition: background-color 0.15s ease, transform 0.15s ease;
	}

	.bjkb-video-play:hover .bjkb-video-play-icon {
		transform: scale(1.06);
	}
}

.bjkb-video-caption {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 16px;
	margin: 10px 0 0;
	font-size: 0.9em;
}

.bjkb-video-name {
	min-width: 0;
	color: var(--bjkb-text);
	font-weight: 600;
}

.bjkb-video-note {
	color: var(--bjkb-text-muted);
}

.bjkb-video-youtube {
	margin-left: auto;
	color: var(--bjkb-accent);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.bjkb-video-youtube:hover {
	text-decoration: underline;
}

/* The theme's a:hover/a:focus blue would otherwise replace the accent (about
   2:1 against App Dark's panel). */
.bjkb-video .bjkb-video-youtube:hover,
.bjkb-video .bjkb-video-youtube:focus,
.bjkb-video-editor-note a:hover,
.bjkb-video-editor-note a:focus {
	color: var(--bjkb-accent);
}

.bjkb-video-youtube:focus-visible {
	outline: 2px solid var(--bjkb-accent);
	outline-offset: 2px;
}

/* Own copy of a visually-hidden rule: .bjkb-sr-only lives in bjkb-guided.css,
   which only loads on guided articles. */
.bjkb-video-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.bjkb-video-editor-note {
	margin: 0 0 20px;
	padding: 10px 14px;
	border: 1px dashed var(--bjkb-border);
	border-radius: var(--bjkb-radius-card);
	color: var(--bjkb-text-muted);
	font-size: 0.85em;
}

.bjkb-video-editor-note a {
	color: var(--bjkb-accent);
}

@media (max-width: 480px) {
	.bjkb-video {
		padding: 12px 12px 10px;
	}

	.bjkb-video-play-icon {
		width: 60px;
		height: 60px;
	}
}

@media print {
	.bjkb-video {
		break-inside: avoid;
	}

	.bjkb-video-play,
	.bjkb-video-editor-note {
		display: none !important;
	}

	.bjkb-video-youtube::after {
		content: " (" attr(href) ")";
		font-weight: 400;
	}
}
