/* ==========================================================================
   Patient video library
   Built to sit inside the Joomla page's iframe: the page itself never grows,
   the library column scrolls inside itself. Palette from the practice header.
   ========================================================================== */

:root {
	--black: #272727;
	--black-2: #1f1f1f;
	--black-3: #323232;
	--gold: #d6ba8b;
	--gold-light: #ffdda7;
	--dot-1: #aacce5;
	--dot-2: #5c7b90;
	--dot-3: #e5c0ca;
	--dot-4: #afac7d;
	--dot-5: #8f8b65;
	--line: rgba(255, 255, 255, .12);
	--text: #e9e7e3;
	--muted: #a5a29b;
	--radius: 10px;
	--shell: 1400px;
	--lib-h: 31rem;			/* library height; the page never exceeds this */
}

*, *::before, *::after { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--black-2);
	color: var(--text);
	font: 400 16px/1.55 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
	-webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }

.visually-hidden {
	position: absolute;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

:where(a, button, summary, input):focus-visible {
	outline: 2px solid var(--gold-light);
	outline-offset: 2px;
	border-radius: 4px;
}

/* ---------- layout ---------- */

.layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 340px;
	gap: 24px;
	align-items: start;
	max-width: var(--shell);
	margin: 0 auto;
	padding: 20px 20px 16px;
}

/* ---------- player ---------- */

.player__frame {
	position: relative;
	aspect-ratio: 16 / 9;
	max-height: var(--lib-h);
	margin-inline: auto;
	background: #000;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
}

.player__frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.player__meta {
	display: flex;
	flex-direction: column-reverse;
	gap: 2px;
	padding: 12px 2px 0;
}

.player__cat {
	margin: 0;
	font-size: .7rem;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--gold);
}

.player__title {
	margin: 0;
	font-size: clamp(18px, 2vw, 22px);
	font-weight: 700;
	line-height: 1.25;
}

/* ---------- library ---------- */

.library {
	display: flex;
	flex-direction: column;
	max-height: calc(var(--lib-h) + 3.5rem);	/* matches the player column */
	background: var(--black);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
}

.library__search { padding: 12px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }

.library__search input {
	width: 100%;
	padding: 9px 13px;
	font: inherit;
	font-size: .88rem;
	color: var(--text);
	background: var(--black-3);
	border: 1px solid var(--line);
	border-radius: 6px;
}

.library__search input::placeholder { color: var(--muted); }
.library__search input:focus { border-color: var(--gold); outline: none; }

/* the only thing that scrolls */
.library__scroll {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: #4a4a4a transparent;
}

.library__scroll::-webkit-scrollbar { width: 9px; }
.library__scroll::-webkit-scrollbar-thumb {
	background: #4a4a4a;
	border-radius: 9px;
	border: 2px solid var(--black);
}

.library__empty {
	margin: 0;
	padding: 22px 16px;
	text-align: center;
	color: var(--muted);
	font-size: .86rem;
}

/* ---------- category ---------- */

.cat { border-bottom: 1px solid var(--line); }
.cat:last-of-type { border-bottom: 0; }

.cat__head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 11px 14px;
	cursor: pointer;
	list-style: none;
	font-weight: 600;
	font-size: .9rem;
	transition: background .18s;
}

.cat__head::-webkit-details-marker { display: none; }
.cat__head:hover { background: var(--black-3); }

.cat__head::after {
	content: '';
	width: 7px; height: 7px;
	margin-left: auto;
	border-right: 2px solid var(--muted);
	border-bottom: 2px solid var(--muted);
	transform: rotate(45deg) translate(-2px, -2px);
	transition: transform .2s;
}

.cat[open] > .cat__head::after {
	transform: rotate(-135deg) translate(-2px, -2px);
	border-color: var(--gold);
}

/* category colour bar — the five header dots, in order */
.cat__name { position: relative; padding-left: 14px; }

.cat__name::before {
	content: '';
	position: absolute;
	left: 0; top: 50%;
	width: 4px; height: 1em;
	transform: translateY(-50%);
	border-radius: 3px;
	background: var(--accent, var(--gold));
}

.cat[data-accent="1"] { --accent: var(--dot-1); }
.cat[data-accent="2"] { --accent: var(--dot-2); }
.cat[data-accent="3"] { --accent: var(--dot-3); }
.cat[data-accent="4"] { --accent: var(--dot-4); }
.cat[data-accent="5"] { --accent: var(--dot-5); }

.cat__count {
	padding: 2px 8px;
	font-size: .66rem;
	font-weight: 700;
	color: var(--muted);
	background: var(--black-3);
	border-radius: 20px;
}

.cat__list { margin: 0; padding: 0 0 6px; list-style: none; }

/* ---------- video row ---------- */

.vid {
	display: block;
	position: relative;
	padding: 7px 14px 7px 28px;
	font-size: .85rem;
	line-height: 1.4;
	color: var(--muted);
	transition: color .18s, background .18s;
}

.vid::before {
	content: '';
	position: absolute;
	left: 15px; top: .95em;
	width: 5px; height: 5px;
	border-radius: 50%;
	background: currentColor;
	opacity: .45;
	transition: opacity .18s, background .18s;
}

.vid:hover { color: #fff; background: var(--black-3); }
.vid:hover::before { opacity: 1; }

.vid.is-active {
	color: var(--black);
	background: var(--gold);
	font-weight: 600;
}

.vid.is-active::before { background: var(--black); opacity: 1; }

/* ---------- disclaimer ---------- */

.disclaimer {
	max-width: var(--shell);
	margin: 0 auto;
	padding: 0 20px 16px;
	color: var(--muted);
}

.disclaimer > summary {
	cursor: pointer;
	padding: 6px 0;
	font-size: .7rem;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--gold);
}

.disclaimer p {
	max-width: 95ch;
	margin: 6px 0 0;
	font-size: .76rem;
	line-height: 1.6;
}

/* ---------- responsive ---------- */

@media (max-width: 1150px) {
	.layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
	:root { --lib-h: 30rem; }
}

@media (max-width: 860px) {
	:root { --lib-h: none; }
	.layout {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
		padding: 14px 14px 12px;
	}
	.player__frame { max-height: none; }
	.library { max-height: 22rem; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; animation: none !important; }
}
