/**
 * Evidence Central Membership — front end.
 *
 * Text colour is never set here: headings, body copy and links all inherit
 * from the theme. The neutral tokens are mixed out of `currentColor`, so
 * panels, borders and secondary text follow the theme in both light and dark
 * without a single hard-coded grey.
 *
 * Point --ecm-accent at a theme variable to match your brand, e.g.
 *   .ecm { --ecm-accent: var(--wp--preset--color--primary); }
 */

.ecm {
	/* The only literal colours: the accent and the text that sits on it. */
	--ecm-accent: #0071e3;
	--ecm-accent-contrast: #ffffff;

	/* Derived from the inherited text colour, so they adapt to any theme. */
	--ecm-muted: color-mix(in oklab, currentColor 62%, transparent);
	--ecm-border: color-mix(in oklab, currentColor 14%, transparent);
	--ecm-surface: transparent;
	--ecm-surface-alt: color-mix(in oklab, currentColor 5%, transparent);

	--ecm-radius: 12px;
	--ecm-gap: 1.25rem;

	margin-block: var(--ecm-gap);
}

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

@media (prefers-color-scheme: dark) {
	.ecm {
		--ecm-accent: #0a84ff;
	}
}

/* -------------------------------------------------- Password gate */

.ecm-gate__panel {
	background: var(--ecm-surface-alt);
	border: 1px solid var(--ecm-border);
	border-radius: var(--ecm-radius);
	padding: clamp(1.25rem, 4vw, 2rem);
	max-width: 30rem;
}

.ecm-gate__thumb img {
	max-width: 100%;
	height: auto;
	border-radius: var(--ecm-radius);
}

.ecm-gate__lead {
	margin-top: 0;
	color: var(--ecm-muted);
}

.ecm-gate__icon {
	margin-right: 0.35em;
}

.ecm-gate__error {
	color: #c8322c;
	background: color-mix(in oklab, #c8322c 12%, transparent);
	border-left: 3px solid currentColor;
	padding: 0.6rem 0.8rem;
	border-radius: 6px;
	margin: 0 0 1rem;
}

.ecm-gate__label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.35rem;
}

.ecm-gate__input {
	width: 100%;
	padding: 0.6rem 0.7rem;
	font: inherit;
	color: inherit;
	background: var(--ecm-surface);
	border: 1px solid var(--ecm-border);
	border-radius: 8px;
}

.ecm-gate__submit,
.ecm-course__button {
	display: inline-block;
	margin-top: 1rem;
	padding: 0.6rem 1.2rem;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	color: var(--ecm-accent-contrast);
	background: var(--ecm-accent);
	border: 0;
	border-radius: 999px;
	cursor: pointer;
}

.ecm-gate__submit:hover,
.ecm-course__button:hover {
	filter: brightness(1.08);
	color: var(--ecm-accent-contrast);
}

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

/* -------------------------------------------------- Tabs */

.ecm-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	border-bottom: 1px solid var(--ecm-border);
	margin-bottom: var(--ecm-gap);
}

.ecm-tabs__tab {
	appearance: none;
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	color: var(--ecm-muted);
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	padding: 0.7rem 1rem;
	margin-bottom: -1px;
}

.ecm-tabs__tab:hover {
	color: inherit;
	background: none;
}

.ecm-tabs__tab.is-active {
	color: var(--ecm-accent);
	border-bottom-color: var(--ecm-accent);
	background: none;
}

.ecm-tabs__count {
	display: inline-block;
	margin-left: 0.4em;
	padding: 0.05em 0.5em;
	font-size: 0.75em;
	background: var(--ecm-surface-alt);
	border: 1px solid var(--ecm-border);
	border-radius: 999px;
}

.ecm-panel.is-hidden,
.ecm-panel[hidden] {
	display: none;
}

.ecm-panel__title {
	margin-top: 0;
}

/* -------------------------------------------------- Videos */

.ecm-videos {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
	gap: var(--ecm-gap);
	list-style: none;
	margin: 0;
	padding: 0;
}

/* The clickable poster tile that opens the lightbox. */
.ecm-video__trigger {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: var(--ecm-radius);
	background: #000;
	cursor: pointer;
	text-decoration: none;
	-webkit-tap-highlight-color: transparent;
}

.ecm-video__preview {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}

.ecm-video__play {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.ecm-video__play::before {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.18);
	transition: background 0.2s ease;
}

.ecm-video__play svg {
	position: relative;
	width: 3.5rem;
	height: 3.5rem;
	padding: 1rem 0.9rem 1rem 1.1rem;
	color: #fff;
	background: rgba(22, 22, 24, 0.55);
	border-radius: 50%;
	backdrop-filter: blur(12px) saturate(140%);
	-webkit-backdrop-filter: blur(12px) saturate(140%);
	box-shadow: 0 2px 14px rgba(0, 0, 0, 0.3);
	transition: transform 0.2s ease, background 0.2s ease;
}

.ecm-video__trigger:hover .ecm-video__play::before,
.ecm-video__trigger:focus-visible .ecm-video__play::before {
	background: rgba(0, 0, 0, 0.32);
}

.ecm-video__trigger:hover .ecm-video__play svg,
.ecm-video__trigger:focus-visible .ecm-video__play svg {
	transform: scale(1.08);
	background: rgba(22, 22, 24, 0.72);
}

.ecm-video__trigger:focus-visible {
	outline: 2px solid var(--ecm-accent);
	outline-offset: 3px;
}

.ecm-video__meta {
	padding: 0.75rem 0.15rem 0;
}

.ecm-video__title {
	margin: 0 0 0.35rem;
	font-size: 1.05rem;
}

.ecm-video__desc {
	margin: 0 0 0.35rem;
	color: var(--ecm-muted);
}

.ecm-video__file {
	margin: 0;
	font-size: 0.8rem;
	color: var(--ecm-muted);
}

/* -------------------------------------------------- Lightbox */

.ecm-lightbox {
	width: min(92vw, 68rem);
	max-width: none;
	max-height: 92vh;
	padding: 0;
	border: 0;
	background: transparent;
	color: #f5f6f8;
	overflow: visible;
}

.ecm-lightbox::backdrop {
	background: rgba(8, 9, 12, 0.72);
	backdrop-filter: blur(14px) saturate(120%);
	-webkit-backdrop-filter: blur(14px) saturate(120%);
}

.ecm-lightbox[open] {
	animation: ecm-lightbox-in 0.22s ease-out;
}

@keyframes ecm-lightbox-in {
	from {
		opacity: 0;
		transform: scale(0.97);
	}
}

.ecm-lightbox__inner {
	position: relative;
}

.ecm-lightbox__player {
	display: block;
	width: 100%;
	max-height: 80vh;
	aspect-ratio: 16 / 9;
	background: #000;
	border-radius: var(--ecm-radius);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.ecm-lightbox__caption {
	margin: 0.85rem 0 0;
	font-size: 0.95rem;
	text-align: center;
	color: rgba(245, 246, 248, 0.75);
}

.ecm-lightbox__caption:empty {
	display: none;
}

.ecm-lightbox__close {
	position: absolute;
	top: -0.9rem;
	right: -0.9rem;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	color: #f5f6f8;
	background: rgba(38, 39, 44, 0.9);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
	transition: transform 0.15s ease, background 0.15s ease;
}

.ecm-lightbox__close:hover,
.ecm-lightbox__close:focus-visible {
	background: rgba(58, 59, 66, 0.95);
	transform: scale(1.06);
}

@media (max-width: 40rem) {
	.ecm-lightbox__close {
		top: 0.5rem;
		right: 0.5rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ecm-lightbox[open] {
		animation: none;
	}

	.ecm-video__play svg,
	.ecm-video__play::before,
	.ecm-file__download,
	.ecm-lightbox__close {
		transition: none;
	}
}

/* -------------------------------------------------- Files */

.ecm-files {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.6rem;
}

.ecm-file {
	display: flex;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
	background: var(--ecm-surface);
	border: 1px solid var(--ecm-border);
	border-radius: var(--ecm-radius);
	padding: 0.85rem 1rem;
}

.ecm-file__ext {
	flex: 0 0 auto;
	min-width: 3.25rem;
	padding: 0.4rem 0.5rem;
	text-align: center;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	color: var(--ecm-accent);
	background: var(--ecm-surface-alt);
	border-radius: 6px;
}

.ecm-file__body {
	flex: 1 1 12rem;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	min-width: 0;
}

.ecm-file__title {
	font-weight: 600;
}

.ecm-file__desc,
.ecm-file__meta {
	color: var(--ecm-muted);
	font-size: 0.85rem;
	overflow-wrap: anywhere;
}

.ecm-file__download {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	color: var(--ecm-accent-contrast);
	background: var(--ecm-accent);
	border-radius: 50%;
	text-decoration: none;
	transition: transform 0.15s ease, filter 0.15s ease;
}

.ecm-file__download:hover,
.ecm-file__download:focus-visible {
	color: var(--ecm-accent-contrast);
	filter: brightness(1.08);
	transform: translateY(-1px);
}

.ecm-file__download:active {
	transform: scale(0.94);
}

.ecm-file__download:focus-visible {
	outline: 2px solid var(--ecm-accent);
	outline-offset: 3px;
}

/* -------------------------------------------------- News */

.ecm-news {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 1rem;
}

.ecm-news__item {
	border-bottom: 1px solid var(--ecm-border);
	padding-bottom: 1rem;
}

.ecm-news__item:last-child {
	border-bottom: 0;
	padding-bottom: 0;
}

.ecm-news__link {
	font-weight: 600;
	font-size: 1.05rem;
}

.ecm-news__date {
	display: block;
	font-size: 0.8rem;
	color: var(--ecm-muted);
	margin-top: 0.15rem;
}

.ecm-news__excerpt {
	margin: 0.4rem 0 0;
	color: var(--ecm-muted);
}

/* -------------------------------------------------- Course grid */

.ecm-courses {
	display: grid;
	gap: var(--ecm-gap);
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.ecm-courses--cols-1 {
	grid-template-columns: 1fr;
}

.ecm-course {
	display: flex;
	flex-direction: column;
	background: var(--ecm-surface);
	border: 1px solid var(--ecm-border);
	border-radius: var(--ecm-radius);
	overflow: hidden;
}

.ecm-course__thumb img {
	display: block;
	width: 100%;
	height: auto;
}

.ecm-course__body {
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.ecm-course__title {
	margin: 0;
	font-size: 1.1rem;
}

.ecm-course__excerpt {
	margin: 0;
	color: var(--ecm-muted);
}

.ecm-course__meta {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
	margin: 0;
	font-size: 0.8rem;
	color: var(--ecm-muted);
}

.ecm-badge {
	padding: 0.15em 0.55em;
	border: 1px solid var(--ecm-border);
	border-radius: 999px;
	background: var(--ecm-surface-alt);
}

.ecm-course__button {
	align-self: flex-start;
}

/* -------------------------------------------------- Misc */

.ecm-empty,
.ecm-resources__signout {
	color: var(--ecm-muted);
}

.ecm-resources__signout {
	margin-top: var(--ecm-gap);
	font-size: 0.85rem;
}

/* Editor-only diagnostic, never shown to members. */
.ecm-notice {
	color: #8a6d00;
	background: color-mix(in oklab, #d9a300 14%, transparent);
	border-left: 3px solid #d9a300;
	padding: 0.6rem 0.8rem;
	border-radius: 6px;
}