/**
 * nc/video-gallery — front-end styles.
 *
 * Spotlight layout: a large main player on the left and a scrollable playlist of
 * community videos on the right (clicking a playlist tile loads it into the player).
 * Mirrors the legacy site's video module. Each tile is a lightweight YouTube facade
 * (poster + play button); view.js swaps in the iframe only on click.
 */
.nc-vgallery {
	padding: 48px 0;
}

.nc-vgallery__inner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 24px;
}

.nc-vgallery__title {
	margin: 0 0 28px;
	text-align: center;
	color: #062537;
	font-family: "Vollkorn", Georgia, serif;
	font-size: clamp( 26px, 3vw, 38px );
	font-weight: 600;
}

/* ---------------------------------------------------------------- layout --- */
.nc-vgallery__layout {
	display: grid;
	grid-template-columns: minmax( 0, 1fr ) clamp( 260px, 30%, 360px );
	gap: 16px;
	align-items: start;
}

@media ( max-width: 860px ) {
	.nc-vgallery__layout {
		grid-template-columns: 1fr;
	}
}

/* ----------------------------------------------------------------- stage --- */
.nc-vgallery__stage {
	position: relative;
	aspect-ratio: 16 / 9;
	background: #062537;
	overflow: hidden;
}

.nc-vgallery__stage-facade {
	display: block;
	position: relative;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.nc-vgallery__stage-poster {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.nc-vgallery__stage-facade:hover .nc-vgallery__stage-poster {
	transform: scale( 1.03 );
}

.nc-vgallery__iframe {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

/* Spotlight prev/next arrows (slider controls), overlaid on the stage like the legacy
   gallery: blue circular buttons with a white chevron, left + right, above the player.
   They fade in with the custom chrome on hover; touch devices keep them visible. */
.nc-vgallery__stage-nav {
	position: absolute;
	top: 50%;
	transform: translateY( -50% );
	z-index: 4;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba( 0, 103, 177, 0.82 );
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.2s ease, background-color 0.15s ease;
}

.nc-vgallery__stage.is-hover .nc-vgallery__stage-nav,
.nc-vgallery__stage:not( .is-live ) .nc-vgallery__stage-nav,
.nc-vgallery__stage-nav:focus-visible {
	opacity: 1;
}

@media ( hover: none ) {
	.nc-vgallery__stage-nav { opacity: 1; }
}

.nc-vgallery__stage-nav:hover,
.nc-vgallery__stage-nav:focus-visible {
	background: #ff6900;
	outline: none;
}

.nc-vgallery__stage-nav--prev { left: 14px; }
.nc-vgallery__stage-nav--next { right: 14px; }

.nc-vgallery__stage-nav::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 12px;
	height: 12px;
	border-top: 2px solid #fff;
	border-right: 2px solid #fff;
}

.nc-vgallery__stage-nav--prev::before { transform: translate( -30%, -50% ) rotate( -135deg ); }
.nc-vgallery__stage-nav--next::before { transform: translate( -70%, -50% ) rotate( 45deg ); }

/* --------------------------------------------------------------- playlist --- */
.nc-vgallery__playlist {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-y: auto;
	min-height: 0; /* JS caps max-height to the stage height; this lets it scroll */
}

/* Slim scrollbar so a long playlist doesn't shove the thumbnails around. */
.nc-vgallery__playlist {
	scrollbar-width: thin;
	scrollbar-color: #c3ccd4 transparent;
}
.nc-vgallery__playlist::-webkit-scrollbar { width: 6px; }
.nc-vgallery__playlist::-webkit-scrollbar-thumb { background: #c3ccd4; border-radius: 3px; }

.nc-vgallery__pl-item {
	margin: 0;
	flex: 0 0 auto;
}

.nc-vgallery__pl-btn {
	display: block;
	position: relative;
	width: 100%;
	padding: 0;
	border: 0;
	background: #062537;
	cursor: pointer;
	overflow: hidden;
}

.nc-vgallery__pl-thumb-wrap {
	display: block;
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
}

.nc-vgallery__pl-thumb {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.nc-vgallery__pl-btn:hover .nc-vgallery__pl-thumb {
	transform: scale( 1.04 );
}

/* Title bar across the bottom of each thumbnail. */
.nc-vgallery__pl-title {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	padding: 9px 12px;
	background: rgba( 6, 37, 55, 0.86 );
	color: #fff;
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.2;
	text-align: left;
}

/* ------------------------------------------------------------ play button --- */
.nc-vgallery__play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate( -50%, -50% );
	z-index: 1;
	border-radius: 50%;
	background: rgba( 0, 103, 177, 0.82 );
	transition: background-color 0.15s ease;
}

.nc-vgallery__stage-play { width: 84px; height: 84px; }
.nc-vgallery__pl-play { width: 48px; height: 48px; }

/* Centre the title-bar area: lift the playlist play button above the caption. */
.nc-vgallery__pl-thumb-wrap .nc-vgallery__pl-play { top: calc( 50% - 12px ); }

.nc-vgallery__play::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 54%;
	transform: translate( -50%, -50% );
	border-style: solid;
	border-color: transparent transparent transparent #fff;
}
.nc-vgallery__stage-play::before { border-width: 15px 0 15px 25px; }
.nc-vgallery__pl-play::before { border-width: 9px 0 9px 15px; }

.nc-vgallery__stage-facade:hover .nc-vgallery__play,
.nc-vgallery__stage-facade:focus-visible .nc-vgallery__play,
.nc-vgallery__pl-btn:hover .nc-vgallery__play,
.nc-vgallery__pl-btn:focus-visible .nc-vgallery__play {
	background: #ff6900;
}

.nc-vgallery__stage-facade:focus-visible,
.nc-vgallery__pl-btn:focus-visible {
	outline: 3px solid #0067b1;
	outline-offset: 2px;
}

/* ------------------------------------------------------------ active tile --- */
/* The currently-loaded playlist tile: an orange ring + check, and the play
   triangle becomes a pause (it is the one showing in the stage). */
.nc-vgallery__pl-item.is-active .nc-vgallery__pl-btn {
	outline: 3px solid #ff6900;
	outline-offset: -3px;
}

.nc-vgallery__pl-item.is-active .nc-vgallery__pl-play {
	background: rgba( 0, 103, 177, 0.92 );
}

/* play triangle -> pause (two bars) on the tile whose video is loaded in the stage.
   The pair is the 5px bar plus its box-shadow copy 8px to the right (13px wide total),
   so centre on the PAIR: shift left by half of 13px = 6.5px = -130% of the 5px bar. */
.nc-vgallery__pl-item.is-playing .nc-vgallery__pl-play::before {
	border: 0;
	top: 50%;
	left: 50%;
	width: 5px;
	height: 16px;
	background: #fff;
	box-shadow: 8px 0 0 #fff;
	transform: translate( -130%, -50% );
}

.nc-vgallery__pl-item.is-active .nc-vgallery__pl-btn::after {
	content: "";
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 3;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #ff6900 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E") center / 14px no-repeat;
}

/* ====================================================== custom player chrome === */
/* YouTube draws no controls of its own (controls:0); this overlay is our player.
   Idle, the only thing showing is a thin reel progress line at the very bottom; on
   hover (or when paused) the full control bar and centre button fade in. The iframe
   sits below; the surface above it swallows pointer events so YouTube's own hover
   chrome never appears. */
.nc-vplayer {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none; /* only the explicit children below capture clicks */
}

/* Full-area click/tap target -> play/pause, and the shield that hides YouTube chrome. */
.nc-vplayer__surface {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	pointer-events: auto;
}

/* A faint scrim along the bottom so white controls stay legible over bright footage. */
.nc-vplayer::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 88px;
	background: linear-gradient( to top, rgba( 6, 37, 55, 0.72 ), rgba( 6, 37, 55, 0 ) );
	opacity: 0;
	transition: opacity 0.2s ease;
	pointer-events: none;
}
.nc-vgallery__stage.is-hover .nc-vplayer::after,
.nc-vgallery__stage.is-paused .nc-vplayer::after {
	opacity: 1;
}

/* ---- centre play/pause ---- */
.nc-vplayer__big {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate( -50%, -50% ) scale( 0.9 );
	width: 84px;
	height: 84px;
	border-radius: 50%;
	background: rgba( 0, 103, 177, 0.82 );
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.15s ease;
	pointer-events: none;
}
.nc-vplayer__big svg { width: 40px; height: 40px; fill: #fff; }
.nc-vgallery__stage.is-hover .nc-vplayer__big,
.nc-vgallery__stage.is-paused .nc-vplayer__big {
	opacity: 1;
	transform: translate( -50%, -50% ) scale( 1 );
}
.nc-vgallery__stage.is-hover .nc-vplayer__surface:hover ~ .nc-vplayer__big {
	background: #ff6900;
}

/* ---- bottom control bar ---- */
.nc-vplayer__bar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px 12px;
	opacity: 0;
	transform: translateY( 6px );
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
}
.nc-vgallery__stage.is-hover .nc-vplayer__bar,
.nc-vgallery__stage.is-paused .nc-vplayer__bar {
	opacity: 1;
	transform: translateY( 0 );
	pointer-events: auto;
}

.nc-vplayer__btn {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: #fff;
	cursor: pointer;
	pointer-events: auto;
	transition: background-color 0.15s ease;
}
.nc-vplayer__btn svg { width: 22px; height: 22px; fill: #fff; }
.nc-vplayer__btn:hover,
.nc-vplayer__btn:focus-visible {
	background: rgba( 255, 255, 255, 0.16 );
	outline: none;
}

.nc-vplayer__time {
	flex: 0 0 auto;
	color: #fff;
	font-size: 0.8125rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	text-shadow: 0 1px 2px rgba( 0, 0, 0, 0.45 );
}

/* ---- scrubber (hover) ---- */
.nc-vplayer__scrub {
	position: relative;
	flex: 1 1 auto;
	height: 16px; /* generous hit area; the visible track is centred within */
	cursor: pointer;
	pointer-events: auto;
	touch-action: none;
}
.nc-vplayer__scrub::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: 4px;
	transform: translateY( -50% );
	background: rgba( 255, 255, 255, 0.3 );
	border-radius: 2px;
}
.nc-vplayer__buffered,
.nc-vplayer__played {
	position: absolute;
	left: 0;
	top: 50%;
	height: 4px;
	transform: translateY( -50% );
	border-radius: 2px;
}
.nc-vplayer__buffered { width: 0; background: rgba( 255, 255, 255, 0.5 ); }
.nc-vplayer__played { width: 0; background: #ff6900; }
.nc-vplayer__knob {
	position: absolute;
	right: 0;
	top: 50%;
	width: 12px;
	height: 12px;
	transform: translate( 50%, -50% ) scale( 0 );
	border-radius: 50%;
	background: #ff6900;
	transition: transform 0.12s ease;
}
.nc-vplayer__scrub:hover .nc-vplayer__knob,
.nc-vplayer__scrub:focus-visible .nc-vplayer__knob { transform: translate( 50%, -50% ) scale( 1 ); }
.nc-vplayer__scrub:focus-visible { outline: none; }
.nc-vplayer__scrub:focus-visible::before { box-shadow: 0 0 0 2px rgba( 255, 105, 0, 0.6 ); }

/* ---- the reel: idle bottom progress line ---- */
.nc-vplayer__reel {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1;
	height: 3px;
	background: rgba( 255, 255, 255, 0.25 );
	opacity: 1;
	transition: opacity 0.2s ease;
	pointer-events: none;
}
.nc-vplayer__reel-fill {
	width: 0;
	height: 100%;
	background: #ff6900;
}
/* When the bar is up, the reel gives way to the scrubber. */
.nc-vgallery__stage.is-hover .nc-vplayer__reel,
.nc-vgallery__stage.is-paused .nc-vplayer__reel {
	opacity: 0;
}

@media ( prefers-reduced-motion: reduce ) {
	.nc-vplayer__big,
	.nc-vplayer__bar,
	.nc-vplayer__reel,
	.nc-vplayer::after { transition: none; }
}

/* Mobile: the playlist drops below the stage as a horizontal scroller. */
@media ( max-width: 860px ) {
	.nc-vgallery__playlist {
		flex-direction: row;
		overflow-x: auto;
		max-height: none !important;
		padding-bottom: 6px;
	}
	.nc-vgallery__pl-item { flex: 0 0 60%; max-width: 280px; }
}
