/*
 * Atrophy Live — the Live page with its chat, and the header's LIVE badge. assets/live.js fills both in.
 */

/* --- Parts of the Live page that depend on who is looking --- */

body.al-can-watch-members #al-live-gate,
body.logged-in #al-live-gate-login {
	display: none !important;
}

.al-live-lede {
	margin: 0 0 28px !important;
	font-family: var(--font-body, Archivo), sans-serif;
	font-size: 14px;
	letter-spacing: 0.02em;
	color: color-mix(in srgb, var(--color-text, #eef3ef) 62%, transparent);
}

.al-live {
	margin: 0 0 32px;
	color: var(--color-text, #eef3ef);
	font-family: var(--font-body, Archivo), sans-serif;
}

.al-live__stage {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.al-live__message {
	margin: 0;
	font-size: 13px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: color-mix(in srgb, var(--color-text, #eef3ef) 55%, transparent);
}

/* Administrators only, before launch. */
.al-live__notice {
	margin: 0 0 16px;
	padding: 12px 16px;
	border: 1px solid var(--color-gold, #c8a97e);
	color: var(--color-gold, #c8a97e);
	font-size: 14px;
	line-height: 1.5;
}

.al-live__notice[hidden] {
	display: none;
}

/* --- Nothing on, coming up, or on air for someone who can't watch --- */

.al-live__card {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 10px;
	padding: 36px 36px 34px;
	border: 1px solid var(--color-divider, rgba(238, 243, 239, 0.14));
}

.al-live__kicker {
	margin: 0;
	font-size: 12px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--color-gold, #c8a97e);
}

.al-live__heading {
	margin: 0;
	font-family: var(--font-heading, Archivo), sans-serif;
	font-size: 28px;
	font-weight: 600;
	line-height: 1.2;
	overflow-wrap: anywhere;
}

.al-live__text {
	max-width: 620px;
	margin: 0;
	font-size: 15px;
	line-height: 1.6;
	color: rgba(238, 243, 239, 0.7);
}

.al-live__countdown {
	margin: 4px 0;
	font-family: var(--font-heading, Archivo), sans-serif;
	font-size: 20px;
	font-weight: 700;
	letter-spacing: 0.04em;
	font-variant-numeric: tabular-nums;
	color: var(--color-accent, #4fd1a1);
}

/* --- On air: the player, with the chat beside it on wide screens and under it on narrow ones --- */

.al-live__room {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.al-live__main {
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
}

@media (min-width: 1100px) {
	.al-live__room {
		flex-direction: row;
		align-items: stretch;
	}

	.al-live__main {
		flex: 1 1 auto;
		max-width: max(320px, calc((100vh - 200px) * 16 / 9));
	}

	/* As tall as the player beside it, however many messages there are. */
	.al-chat {
		flex: 0 0 340px;
		contain: size;
	}
}

.al-live__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px;
}

.al-live__pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 5px 12px;
	background: #e5384f;
	border-radius: 2px;
	color: #ffffff;
	font-family: var(--font-heading, Archivo), sans-serif;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.16em;
	line-height: 1.3;
	text-transform: uppercase;
}

.al-live__pill::before {
	content: '';
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #ffffff;
	animation: al-live-pulse 1.6s ease-in-out infinite;
}

.al-live__title {
	margin: 0;
	font-family: var(--font-heading, Archivo), sans-serif;
	font-size: 24px;
	font-weight: 600;
	line-height: 1.25;
	overflow-wrap: anywhere;
}

/* Wide as the page, but never taller than the window, so the whole picture fits on a laptop. */
.al-live__frame {
	position: relative;
	width: 100%;
	max-width: max(320px, calc((100vh - 200px) * 16 / 9));
	aspect-ratio: 16 / 9;
	background: #000;
	border: 1px solid var(--color-divider, rgba(238, 243, 239, 0.14));
}

.al-live__frame iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* The member's username, faint over the picture; it moves between corners every 45 seconds. */
.al-live__mark {
	position: absolute;
	z-index: 2;
	pointer-events: none;
	user-select: none;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 11px;
	letter-spacing: 0.08em;
	color: #ffffff;
	opacity: 0.16;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
	transition: opacity 0.6s ease, top 0.6s ease, left 0.6s ease, right 0.6s ease, bottom 0.6s ease;
}

/* The theme colours every button, focused ones included, so these hold their ground with !important. */
.al-live__like,
.al-live__like:focus {
	display: inline-flex !important;
	align-items: center !important;
	gap: 8px !important;
	margin-left: auto !important;
	padding: 8px 14px !important;
	background: transparent !important;
	border: 1px solid var(--color-divider, rgba(238, 243, 239, 0.14)) !important;
	border-radius: 2px !important;
	box-shadow: none !important;
	color: var(--color-text, #eef3ef) !important;
	font-family: var(--font-heading, Archivo), sans-serif !important;
	font-size: 14px !important;
	font-weight: 700 !important;
	letter-spacing: 0.04em !important;
	line-height: 1.2 !important;
	text-transform: none !important;
	cursor: pointer;
	transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.al-live__like:hover,
.al-live__like:focus-visible {
	background: rgba(238, 243, 239, 0.07) !important;
	border-color: color-mix(in srgb, var(--color-text, #eef3ef) 45%, transparent) !important;
}

.al-live__like svg path {
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
}

.al-live__like.is-liked,
.al-live__like.is-liked:focus {
	background: var(--color-accent-100, #16392c) !important;
	border-color: var(--color-accent, #4fd1a1) !important;
	color: var(--color-accent, #4fd1a1) !important;
}

.al-live__like.is-liked svg path {
	fill: currentColor;
}

.al-live__like-count {
	font-weight: 400;
	opacity: 0.8;
}

.al-live__like:disabled {
	opacity: 0.6;
	cursor: default;
}

/* --- The chat --- */

.al-chat {
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
	background: var(--color-surface, #14231d);
	border: 1px solid var(--color-divider, rgba(238, 243, 239, 0.14));
	color: var(--color-text, #eef3ef);
}

.al-chat__title {
	margin: 0 !important;
	padding: 12px 16px;
	border-bottom: 1px solid var(--color-divider, rgba(238, 243, 239, 0.14));
	font-family: var(--font-heading, Archivo), sans-serif;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--color-gold, #c8a97e);
}

.al-chat__body {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	min-height: 0;
}

.al-chat__list {
	flex: 1 1 auto;
	min-height: 0;
	margin: 0 !important;
	padding: 4px 16px !important;
	list-style: none !important;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.al-chat__empty {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 !important;
	padding: 16px;
	text-align: center;
	font-size: 14px;
	color: color-mix(in srgb, var(--color-text, #eef3ef) 62%, transparent);
	pointer-events: none;
}

.al-chat__empty[hidden] {
	display: none;
}

.al-chat__msg {
	position: relative;
	margin: 0 !important;
	padding: 9px 0 !important;
	border-bottom: 1px solid rgba(238, 243, 239, 0.07);
}

.al-chat__msg:last-child {
	border-bottom: 0;
}

.al-chat__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 8px;
	margin: 0 0 2px !important;
	padding-right: 26px;
	font-size: 13px;
	line-height: 1.3;
}

.al-chat__author {
	font-family: var(--font-heading, Archivo), sans-serif;
	font-weight: 700;
	overflow-wrap: anywhere;
}

.al-chat__msg.is-host .al-chat__author {
	color: var(--color-gold, #c8a97e);
}

.al-chat__badge {
	padding: 1px 6px;
	border: 1px solid var(--color-gold, #c8a97e);
	border-radius: 2px;
	color: var(--color-gold, #c8a97e);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.al-chat__time {
	font-size: 11px;
	color: color-mix(in srgb, var(--color-text, #eef3ef) 55%, transparent);
}

.al-chat__text {
	margin: 0 !important;
	font-size: 14px;
	line-height: 1.45;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	color: color-mix(in srgb, var(--color-text, #eef3ef) 88%, transparent);
}

.al-chat__remove,
.al-chat__remove:focus {
	position: absolute !important;
	top: 6px;
	right: 0;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 24px !important;
	height: 24px !important;
	padding: 0 !important;
	background: transparent !important;
	border: 0 !important;
	border-radius: 2px !important;
	box-shadow: none !important;
	color: color-mix(in srgb, var(--color-text, #eef3ef) 55%, transparent) !important;
	font-size: 17px !important;
	line-height: 1 !important;
	cursor: pointer;
}

.al-chat__remove:hover,
.al-chat__remove:focus-visible {
	background: rgba(255, 180, 168, 0.08) !important;
	color: #ffb4a8 !important;
}

.al-chat__form {
	display: flex;
	gap: 8px;
	margin: 0 !important;
	padding: 12px 16px;
	border-top: 1px solid var(--color-divider, rgba(238, 243, 239, 0.14));
}

.al-chat__input,
.al-chat__input:focus {
	flex: 1 1 auto;
	min-width: 0;
	width: auto !important;
	margin: 0 !important;
	padding: 9px 12px !important;
	background: var(--color-bg, #0b1411) !important;
	border: 1px solid var(--color-divider, rgba(238, 243, 239, 0.14)) !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	color: var(--color-text, #eef3ef) !important;
	caret-color: var(--color-accent, #4fd1a1);
	font-family: var(--font-body, Archivo), sans-serif !important;
	font-size: 15px !important;
	line-height: 1.4 !important;
}

.al-chat__input:focus {
	border-color: var(--color-accent, #4fd1a1) !important;
	outline: none;
}

.al-chat__input::placeholder {
	color: color-mix(in srgb, var(--color-text, #eef3ef) 50%, transparent);
	opacity: 1;
}

.al-chat__send,
.al-chat__send:focus {
	flex: 0 0 auto;
	padding: 9px 16px !important;
	background: var(--color-accent, #4fd1a1) !important;
	border: 1px solid var(--color-accent, #4fd1a1) !important;
	border-radius: 2px !important;
	box-shadow: none !important;
	color: var(--color-bg, #0b1411) !important;
	font-family: var(--font-heading, Archivo), sans-serif !important;
	font-size: 14px !important;
	font-weight: 700 !important;
	letter-spacing: 0.04em !important;
	line-height: 1.2 !important;
	text-transform: none !important;
	cursor: pointer;
}

.al-chat__send:hover,
.al-chat__send:focus-visible {
	background: var(--color-accent-600, #7fe0bb) !important;
	border-color: var(--color-accent-600, #7fe0bb) !important;
}

.al-chat__send:disabled {
	opacity: 0.6;
	cursor: default;
}

.al-chat__error {
	margin: 0 16px 12px !important;
	padding: 8px 12px;
	background: rgba(255, 180, 168, 0.08);
	border: 1px solid #ffb4a8;
	color: #ffb4a8;
	font-size: 13px;
	line-height: 1.4;
}

.al-chat__error[hidden] {
	display: none;
}

/* Under the player, the chat gets a height of its own. */
@media (max-width: 1099px) {
	.al-chat__body {
		flex: none;
		height: min(360px, 55vh);
	}
}

/* --- The header's Live link while a show is on air --- */

.al-live-link.al-live-link--on {
	display: inline-flex !important;
	align-items: center;
	gap: 7px;
	padding: 2px 10px !important;
	background: #e5384f !important;
	border-radius: 2px;
	color: #ffffff !important;
	font-weight: 700 !important;
	letter-spacing: 0.14em !important;
	text-transform: uppercase !important;
}

.al-live-link.al-live-link--on::before {
	content: '';
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #ffffff;
	animation: al-live-pulse 1.6s ease-in-out infinite;
}

@keyframes al-live-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
	.al-live__pill::before,
	.al-live-link.al-live-link--on::before {
		animation: none;
	}
}

@media (max-width: 767px) {
	.al-live__card {
		padding: 28px 22px 26px;
	}

	.al-live__heading {
		font-size: 22px;
	}

	.al-live__title {
		font-size: 20px;
	}
}
