/* LGN Player — fullscreen layout
 *
 * Reproduces the normal page layout at full-screen size:
 *
 *     video  →  chapter strip  →  practice controls
 *
 * ...or, with .lgn-fs-bare, a plain full-screen video. A toggle in the
 * top-right switches between the two and the choice is remembered.
 *
 * The chapter list is moved between the video and the controls by
 * lgn-player-fullscreen.js (it lives after .lgn-pc-outer on the page,
 * so CSS alone can't reorder it). Its own styling is left untouched —
 * it should look exactly as it does on the page.
 *
 * Applies to both real fullscreen and the iPhone pseudo-fullscreen
 * fallback; the .lgn-fs class is added in both cases.
 */

/* Stop the page scrolling behind pseudo-fullscreen. */
html.lgn-fs-lock,
html.lgn-fs-lock body {
	overflow: hidden;
}

/* ---- Pseudo-fullscreen box (iPhone) ---- */
.lgn-video-wrapper.lgn-fs-pseudo {
	position: fixed;
	inset: 0;
	z-index: 999999;
	width: 100vw;
	height: 100dvh;
	margin: 0;
	max-width: none;
}

/* ---- Fullscreen column ---- */
.lgn-video-wrapper.lgn-fs {
	display: flex;
	flex-direction: column;
	background: #000;
	padding: 0;
	gap: 0;
}

.lgn-video-wrapper:fullscreen {
	width: 100vw;
	height: 100vh;
	max-width: none;
	margin: 0;
}

/* The video column takes whatever the chapters and controls don't. */
.lgn-video-wrapper.lgn-fs .lgn-pc-outer {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
	min-width: 0;
}

.lgn-video-wrapper.lgn-fs video-player {
	flex: 1 1 auto;
	min-height: 0;
	display: block;
}

/* The page sets aspect-ratio: 16/9 on video-skin, which would overflow
   a height-constrained box. In fullscreen, fill the space instead and
   let the video letterbox itself. */
.lgn-video-wrapper.lgn-fs video-skin {
	aspect-ratio: auto;
	width: 100%;
	height: 100%;
	min-height: 0;
}

/* Chapters and controls keep their natural height at the bottom. */
.lgn-video-wrapper.lgn-fs .lgn-chapters,
.lgn-video-wrapper.lgn-fs .lgn-pc-wrapper {
	flex: 0 0 auto;
	position: relative;
	margin: 0;
}

/* If a lesson has enough chapters to wrap onto several rows, cap the
   strip so it scrolls rather than squeezing the video. */
.lgn-video-wrapper.lgn-fs .lgn-chapters {
	max-height: 22vh;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

/* The bookmark button's original container, if it's still around
   (logged out, or the controls JS hasn't adopted it). */
.lgn-video-wrapper.lgn-fs .lgn-video-meta {
	flex: 0 0 auto;
}

/* ---- Bare mode: video only ---- */
.lgn-video-wrapper.lgn-fs.lgn-fs-bare .lgn-chapters,
.lgn-video-wrapper.lgn-fs.lgn-fs-bare .lgn-pc-wrapper,
.lgn-video-wrapper.lgn-fs.lgn-fs-bare .lgn-video-meta {
	display: none;
}

/* ---- The toggle ---- */
/* Hidden outside fullscreen; the button exists on the page but has no
   job there. */
.lgn-fs-toggle {
	display: none;
}

/* A labelled button, not an icon. It says what pressing it does, it's
   always fully visible, and it's big enough to hit without aiming —
   this gets pressed once and then remembered forever, so the cost of
   it being slightly prominent is one click in a member's lifetime. */
.lgn-video-wrapper.lgn-fs > .lgn-fs-toggle {
	display: block;
	position: absolute;
	top: 1rem;
	right: 1rem;
	z-index: 10;

	min-height: 2.75rem;
	padding: 0.5rem 1rem;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 0;

	background: rgba(0, 0, 0, 0.7);
	color: #fff;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.4;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.lgn-video-wrapper.lgn-fs > .lgn-fs-toggle:hover,
.lgn-video-wrapper.lgn-fs > .lgn-fs-toggle:focus-visible {
	background: rgba(0, 0, 0, 0.9);
	border-color: rgba(255, 255, 255, 0.7);
}

/* Touch: a bit more room, and clear of the notch / status bar. */
@media (pointer: coarse) {
	.lgn-video-wrapper.lgn-fs > .lgn-fs-toggle {
		top: max(1rem, env(safe-area-inset-top));
		right: max(1rem, env(safe-area-inset-right));
		min-height: 3rem;
		padding: 0.6rem 1.1rem;
	}
}
