/* Hypno-CBT Explainers: the "What's this?" link and the video pop-up.
 * Colours follow the College palette. Fonts come from the theme.
 * Selectors are doubled (.a.a) so theme button styles do not leak in. */

.hcbt-explainer,
.hcbt-explainer-dialog {
	--hcbt-ink: #2e317d;          /* Purple Blue */
	--hcbt-ink-soft: rgba(46, 49, 125, .22);
	--hcbt-text: #343849;
	--hcbt-muted: #4c5164;
	--hcbt-heading: #1d1d1b;
	--hcbt-link: #0078c2;
	--hcbt-line: #e0e3ee;
	--hcbt-focus: rgba(0, 136, 219, .28);
}

/* ---------- the link (pill, inline, light) ---------- */

.hcbt-explainer.hcbt-explainer {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	box-sizing: border-box;
	width: auto;
	min-width: 0;
	height: 40px;
	min-height: 0;
	margin: 0;
	padding: 0 16px 0 6px;
	border: 1.5px solid var(--hcbt-ink-soft);
	border-radius: 999px;
	background: #fff;
	box-shadow: none;
	color: var(--hcbt-ink);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	white-space: nowrap;
	vertical-align: middle;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.hcbt-explainer.hcbt-explainer:hover {
	border-color: var(--hcbt-ink);
	background: rgba(46, 49, 125, .08);
	box-shadow: 0 2px 8px rgba(46, 49, 125, .10);
	color: var(--hcbt-ink);
}

.hcbt-explainer.hcbt-explainer:focus { outline: none; }
.hcbt-explainer.hcbt-explainer:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--hcbt-focus); }

.hcbt-explainer .hcbt-explainer__icon { flex: none; width: 28px; height: 28px; display: block; }
.hcbt-explainer .hcbt-explainer__icon-disc { fill: var(--hcbt-ink); }
.hcbt-explainer .hcbt-explainer__icon-play { fill: #fff; stroke: #fff; stroke-width: 1.5; stroke-linejoin: round; }
.hcbt-explainer .hcbt-explainer__time { color: var(--hcbt-muted); font-weight: 500; }

@media (max-width: 600px), (pointer: coarse) {
	.hcbt-explainer.hcbt-explainer:not(.hcbt-explainer--inline):not(.hcbt-explainer--card) { height: 44px; font-size: 15px; }
	.hcbt-explainer:not(.hcbt-explainer--inline) .hcbt-explainer__icon { width: 32px; height: 32px; }
}

/* In a sentence */
.hcbt-explainer.hcbt-explainer--inline {
	gap: 6px;
	height: auto;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: none;
	color: var(--hcbt-link);
	font-size: inherit;
	line-height: inherit;
}
.hcbt-explainer.hcbt-explainer--inline:hover { background: none; box-shadow: none; color: var(--hcbt-ink); }
.hcbt-explainer--inline .hcbt-explainer__icon { width: 1.15em; height: 1.15em; }
.hcbt-explainer--inline .hcbt-explainer__label { text-decoration: underline; text-underline-offset: 3px; }

/* On a dark or purple band */
.hcbt-explainer.hcbt-explainer--light {
	border-color: rgba(255, 255, 255, .6);
	background: rgba(255, 255, 255, .12);
	color: #fff;
}
.hcbt-explainer.hcbt-explainer--light:hover { border-color: #fff; background: rgba(255, 255, 255, .2); color: #fff; }
.hcbt-explainer--light .hcbt-explainer__icon-disc { fill: #fff; }
.hcbt-explainer--light .hcbt-explainer__icon-play { fill: var(--hcbt-ink); stroke: var(--hcbt-ink); }
.hcbt-explainer--light .hcbt-explainer__time { color: rgba(255, 255, 255, .85); }

/* Poster card */
.hcbt-explainer.hcbt-explainer--card {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 480px;
	height: auto;
	aspect-ratio: 16 / 9;
	padding: 0;
	border: 0;
	border-radius: 16px;
	overflow: hidden;
	background: linear-gradient(120deg, #2e317d 0%, #0088db 100%);
	color: #fff;
	white-space: normal;
}
.hcbt-explainer.hcbt-explainer--card:hover { background: linear-gradient(120deg, #2e317d 0%, #0088db 100%); box-shadow: 0 8px 24px rgba(46, 49, 125, .18); }
.hcbt-explainer--card .hcbt-explainer__poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; margin: 0; }
.hcbt-explainer--card .hcbt-explainer__card-title {
	position: absolute; top: 0; left: 0; right: 0;
	padding: 14px 16px 28px;
	background: linear-gradient(rgba(29, 29, 27, .55), rgba(29, 29, 27, 0));
	font-size: 17px; font-weight: 700; line-height: 1.3; text-align: left; color: #fff;
}
.hcbt-explainer--card .hcbt-explainer__card-play {
	position: relative;
	display: flex; align-items: center; justify-content: center;
	width: 56px; height: 56px; border-radius: 999px;
	background: #fff; box-shadow: 0 8px 24px rgba(29, 29, 27, .25);
}
.hcbt-explainer--card .hcbt-explainer__card-play svg { width: 22px; height: 22px; fill: var(--hcbt-ink); stroke: var(--hcbt-ink); stroke-width: 2; stroke-linejoin: round; }
.hcbt-explainer--card .hcbt-explainer__card-time {
	position: absolute; right: 12px; bottom: 12px;
	padding: 3px 8px; border-radius: 999px;
	background: rgba(29, 29, 27, .55);
	font-size: 12px; font-weight: 600; color: #fff;
}

/* Shown to editors only when a slot is missing */
.hcbt-explainer-missing {
	display: inline-block; padding: 2px 8px; border: 1px dashed #b32d2e; border-radius: 4px;
	color: #b32d2e; font-size: 13px;
}

/* ---------- the pop-up ---------- */

html.hcbt-explainer-lock { overflow: hidden; }

.hcbt-explainer-dialog.hcbt-explainer-dialog {
	box-sizing: border-box;
	width: min(760px, calc(100vw - 32px));
	max-width: none;
	max-height: calc(100vh - 32px);
	margin: auto;
	padding: 0;
	border: 0;
	border-radius: 24px;
	background: #fff;
	box-shadow: 0 18px 48px rgba(46, 49, 125, .14);
	color: var(--hcbt-text);
	overflow: auto;
}
.hcbt-explainer-dialog::backdrop { background: rgba(29, 29, 27, .55); }

.hcbt-explainer-dialog__panel { display: flex; flex-direction: column; gap: 18px; padding: 24px; }
.hcbt-explainer-dialog__handle { display: none; }

.hcbt-explainer-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hcbt-explainer-dialog .hcbt-explainer-dialog__kicker {
	margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--hcbt-link);
}
.hcbt-explainer-dialog .hcbt-explainer-dialog__close {
	display: flex; align-items: center; justify-content: center; flex: none;
	width: 44px; height: 44px; min-height: 0; margin: 0; padding: 0;
	border: 1px solid var(--hcbt-line); border-radius: 999px;
	background: #fff; box-shadow: none; cursor: pointer;
}
.hcbt-explainer-dialog .hcbt-explainer-dialog__close:hover { border-color: var(--hcbt-ink); background: #fff; }
.hcbt-explainer-dialog .hcbt-explainer-dialog__close:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--hcbt-focus); }
.hcbt-explainer-dialog__close svg { width: 18px; height: 18px; stroke: var(--hcbt-ink); stroke-width: 2; stroke-linecap: round; fill: none; }

.hcbt-explainer-dialog__player {
	position: relative; width: 100%; aspect-ratio: 16 / 9;
	border-radius: 16px; overflow: hidden; background: #1d1d1b;
}
.hcbt-explainer-dialog__player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.hcbt-explainer-dialog .hcbt-explainer-dialog__title {
	margin: 0; font-size: 24px; font-weight: 700; line-height: 1.2; letter-spacing: normal; color: var(--hcbt-heading);
}
.hcbt-explainer-dialog__body { display: flex; flex-direction: column; gap: 18px; }
.hcbt-explainer-dialog__body[hidden] { display: none; }
.hcbt-explainer-dialog__summary { font-size: 15px; line-height: 1.6; }
.hcbt-explainer-dialog__summary > :first-child { margin-top: 0; }
.hcbt-explainer-dialog__summary > :last-child { margin-bottom: 0; }

.hcbt-explainer-dialog__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.hcbt-explainer-dialog .hcbt-explainer-dialog__cta {
	display: inline-flex; align-items: center; height: 44px; padding: 0 22px;
	border-radius: 999px; background: var(--hcbt-ink); color: #fff;
	font-size: 15px; font-weight: 600; text-decoration: none;
}
.hcbt-explainer-dialog .hcbt-explainer-dialog__cta:hover { background: #24276a; color: #fff; }
.hcbt-explainer-dialog .hcbt-explainer-dialog__transcript { color: var(--hcbt-link); font-size: 15px; font-weight: 500; }
.hcbt-explainer-dialog .hcbt-explainer-dialog__transcript:hover { color: var(--hcbt-ink); }
.hcbt-explainer-dialog a:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--hcbt-focus); border-radius: 4px; }

/* Phone: a sheet from the bottom of the screen */
@media (max-width: 600px) {
	.hcbt-explainer-dialog.hcbt-explainer-dialog {
		width: 100%;
		max-height: 92vh;
		margin: auto 0 0;
		border-radius: 24px 24px 0 0;
		box-shadow: 0 -8px 24px rgba(46, 49, 125, .14);
	}
	.hcbt-explainer-dialog__panel { gap: 14px; padding: 10px 16px 28px; }
	.hcbt-explainer-dialog__handle {
		display: block; align-self: center; width: 40px; height: 5px; border-radius: 999px; background: #c7cbdb;
	}
	.hcbt-explainer-dialog .hcbt-explainer-dialog__title { font-size: 20px; line-height: 1.25; }
	.hcbt-explainer-dialog__summary { font-size: 14px; line-height: 1.55; }
	.hcbt-explainer-dialog__actions { flex-direction: column; align-items: stretch; }
	.hcbt-explainer-dialog .hcbt-explainer-dialog__cta { justify-content: center; height: 48px; font-size: 16px; }
	.hcbt-explainer-dialog .hcbt-explainer-dialog__transcript { align-self: center; padding: 10px 0; }
}

@media (prefers-reduced-motion: no-preference) {
	.hcbt-explainer-dialog[open] { animation: hcbt-explainer-in .18s ease-out; }
	@media (max-width: 600px) {
		.hcbt-explainer-dialog[open] { animation: hcbt-explainer-up .22s ease-out; }
	}
}
@keyframes hcbt-explainer-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes hcbt-explainer-up { from { transform: translateY(100%); } to { transform: none; } }
