/*
Theme Name: TSO Livestream
Theme URI: https://www.livestreaming.co.uk/
Author: TSO Livestreaming
Author URI: https://www.livestreaming.co.uk/
Description: Reusable livestream event theme. Each service or event is a "Livestream" entry with its own date, stream link, poster and order of service. The front page automatically shows a countdown, then the live player, then the replay. Copy an event to next year with one click.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: tso-livestream
*/

:root {
	--tso-bg: #15110f;
	--tso-surface: #1f1916;
	--tso-text: #f2ece3;
	--tso-muted: #b3a89b;
	--tso-accent: #c8102e;
	--tso-accent-text: #ffffff;
	--tso-line: rgba(242, 236, 227, 0.14);
	--tso-radius: 10px;
	--tso-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
	--tso-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--tso-max: 1080px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--tso-bg);
	color: var(--tso-text);
	font-family: var(--tso-sans);
	font-size: 1.0625rem;
	line-height: 1.6;
}

[hidden] { display: none !important; }

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration-color: var(--tso-accent); text-underline-offset: 3px; }
a:hover { color: var(--tso-accent); }

:focus-visible { outline: 3px solid var(--tso-accent); outline-offset: 3px; }

.screen-reader-text, .skip-link:not(:focus) {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link:focus {
	position: fixed; top: 8px; left: 8px; z-index: 100; padding: 10px 16px;
	background: var(--tso-accent); color: var(--tso-accent-text); border-radius: 6px;
}

.wrap { width: 100%; max-width: var(--tso-max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

/* ---------- Site header ---------- */
.site-header {
	border-bottom: 1px solid var(--tso-line);
}
.site-header .wrap {
	display: flex; align-items: center; justify-content: space-between; gap: 16px;
	min-height: 64px;
}
.site-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.site-brand img { width: auto; max-height: 40px; }
.site-brand__name {
	font-family: var(--tso-serif); font-size: 1.125rem; letter-spacing: 0.02em;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 20px; }
.site-nav a { text-decoration: none; color: var(--tso-muted); font-size: 0.9375rem; }
.site-nav a:hover { color: var(--tso-text); }

/* ---------- Event hero ---------- */
.event-hero {
	position: relative;
	padding: 48px 0 32px;
	text-align: center;
	overflow: hidden;
}
.event-hero__bg {
	position: absolute; inset: 0; z-index: 0;
	background-size: cover; background-position: center;
	opacity: 0.22;
}
.event-hero__bg::after {
	content: ""; position: absolute; inset: 0;
	background: linear-gradient(to bottom, transparent 0%, var(--tso-bg) 92%);
}
.event-hero .wrap { position: relative; z-index: 1; }

.event-status {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 6px 14px; border-radius: 999px;
	border: 1px solid var(--tso-line);
	font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase;
	color: var(--tso-muted);
}
.event-status__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
[data-state="live"] .event-status { color: var(--tso-accent-text); background: var(--tso-accent); border-color: var(--tso-accent); }
[data-state="live"] .event-status__dot { animation: tso-pulse 1.6s ease-in-out infinite; }
@keyframes tso-pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { [data-state="live"] .event-status__dot { animation: none; } }

.event-title {
	font-family: var(--tso-serif);
	font-weight: 400;
	font-size: clamp(2rem, 5.5vw, 3.5rem);
	line-height: 1.1;
	margin: 20px auto 12px;
	max-width: 18ch;
	text-wrap: balance;
}
.event-strapline { color: var(--tso-muted); margin: 0 auto; max-width: 52ch; font-size: 1.125rem; }

.event-meta {
	display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px;
	margin: 20px 0 0; padding: 0; list-style: none;
	color: var(--tso-muted); font-size: 0.9375rem;
}
.event-meta strong { color: var(--tso-text); font-weight: 600; }

/* ---------- Countdown ---------- */
.countdown {
	display: flex; justify-content: center; gap: 10px;
	margin: 28px 0 0;
	font-variant-numeric: tabular-nums;
}
.countdown[hidden] { display: none; }
.countdown__unit {
	min-width: 72px; padding: 12px 8px 10px;
	border: 1px solid var(--tso-line); border-radius: var(--tso-radius);
	background: var(--tso-surface);
}
.countdown__num { display: block; font-family: var(--tso-serif); font-size: 2rem; line-height: 1; }
.countdown__label { display: block; margin-top: 6px; font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tso-muted); }
@media (max-width: 420px) { .countdown__unit { min-width: 0; flex: 1; } .countdown__num { font-size: 1.5rem; } }

/* ---------- Player ---------- */
.event-player { padding: 8px 0 40px; }
.player {
	position: relative;
	aspect-ratio: 16 / 9;
	width: 100%;
	border-radius: var(--tso-radius);
	overflow: hidden;
	background: #000;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.player iframe, .player video, .player__embed > * {
	position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
.player__embed { position: absolute; inset: 0; }
/* Embed codes such as Dacast's wrap the player in a div with its own sizing; make it fill our frame on any screen. */
.player__embed > * { min-width: 0 !important; min-height: 0 !important; aspect-ratio: auto !important; }

.player__facade {
	position: absolute; inset: 0; width: 100%; height: 100%;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
	padding: 24px;
	border: 0; margin: 0; cursor: pointer;
	color: #fff; font: inherit; text-align: center;
	background-color: #000;
	background-size: cover; background-position: center;
}
.player__facade::before {
	content: ""; position: absolute; inset: 0;
	background: radial-gradient(ellipse at center, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.6) 100%);
}
.player__facade > * { position: relative; }
.player__facade[disabled] { cursor: default; }
.player__play {
	width: 84px; height: 84px; border-radius: 50%;
	display: grid; place-items: center;
	background: var(--tso-accent); color: var(--tso-accent-text);
	box-shadow: 0 6px 24px rgba(0,0,0,0.4);
	transition: transform 0.15s ease;
}
.player__facade:not([disabled]):hover .player__play { transform: scale(1.06); }
.player__facade[disabled] .player__play { display: none; }
.player__play svg { width: 34px; height: 34px; margin-left: 5px; }
.player__label {
	font-size: 1.0625rem; font-weight: 600;
	text-shadow: 0 1px 8px rgba(0,0,0,0.8);
}
@media (max-width: 480px) { .player__note { display: none; } .player__label { font-size: 0.9375rem; } }
.player__note { font-size: 0.8125rem; opacity: 0.85; max-width: 46ch; text-shadow: 0 1px 6px rgba(0,0,0,0.8); }

.player-ended {
	position: absolute; inset: 0; display: grid; place-items: center; padding: 24px;
	text-align: center; background: var(--tso-surface);
}
.player-ended[hidden] { display: none; }
.player-ended p { max-width: 46ch; margin: 0; font-family: var(--tso-serif); font-size: 1.25rem; }

.player-actions {
	display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
	margin-top: 20px;
}

/* ---------- Buttons ---------- */
.button {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 10px 18px; border-radius: 999px;
	border: 1px solid var(--tso-line); background: transparent;
	color: var(--tso-text); font: inherit; font-size: 0.9375rem;
	text-decoration: none; cursor: pointer;
}
.button:hover { border-color: var(--tso-text); color: var(--tso-text); }
.button--primary { background: var(--tso-accent); border-color: var(--tso-accent); color: var(--tso-accent-text); }
.button--primary:hover { filter: brightness(1.1); color: var(--tso-accent-text); border-color: var(--tso-accent); }
.button svg { width: 16px; height: 16px; flex: none; }

/* ---------- Content ---------- */
.event-body { padding: 8px 0 56px; }
.event-grid { display: grid; gap: 40px; }
@media (min-width: 860px) { .event-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 56px; } }
.event-grid--single { grid-template-columns: minmax(0, 720px); justify-content: center; }

.entry-content { max-width: 68ch; }
.entry-content h2, .entry-content h3 { font-family: var(--tso-serif); font-weight: 400; line-height: 1.2; }
.entry-content h2 { font-size: 1.75rem; }
.entry-content blockquote {
	margin: 1.5em 0; padding: 0 0 0 20px; border-left: 3px solid var(--tso-accent);
	font-family: var(--tso-serif); font-size: 1.25rem; font-style: italic;
}
.entry-content .alignwide, .entry-content .alignfull { max-width: none; }

.panel {
	border: 1px solid var(--tso-line); border-radius: var(--tso-radius);
	background: var(--tso-surface); padding: 20px;
}
.panel + .panel { margin-top: 20px; }
.panel h2 {
	margin: 0 0 12px; font-size: 0.8125rem; font-weight: 600;
	letter-spacing: 0.1em; text-transform: uppercase; color: var(--tso-muted);
}

.schedule { list-style: none; margin: 0; padding: 0; }
.schedule li { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid var(--tso-line); }
.schedule li:first-child { border-top: 0; padding-top: 0; }
.schedule time { font-variant-numeric: tabular-nums; color: var(--tso-muted); }

/* ---------- Notice banner ---------- */
.site-notice {
	background: var(--tso-accent); color: var(--tso-accent-text);
	text-align: center; padding: 10px 16px; font-size: 0.9375rem;
}
.site-notice a { color: inherit; }

/* ---------- Archive ---------- */
.archive-header { padding: 48px 0 24px; text-align: center; }
.archive-header h1 { font-family: var(--tso-serif); font-weight: 400; font-size: clamp(2rem, 5vw, 3rem); margin: 0; }
.stream-list { display: grid; gap: 20px; padding: 0 0 56px; margin: 0; list-style: none; }
@media (min-width: 640px) { .stream-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .stream-list { grid-template-columns: repeat(3, 1fr); } }
.stream-card { display: block; text-decoration: none; border: 1px solid var(--tso-line); border-radius: var(--tso-radius); overflow: hidden; background: var(--tso-surface); height: 100%; }
.stream-card:hover { border-color: var(--tso-accent); color: inherit; }
.stream-card__img { aspect-ratio: 16 / 9; background: #000 center / cover no-repeat; }
.stream-card__body { padding: 16px; }
.stream-card__title { font-family: var(--tso-serif); font-size: 1.25rem; margin: 0 0 4px; }
.stream-card__date { color: var(--tso-muted); font-size: 0.875rem; }

/* ---------- Generic page ---------- */
.page-content { padding: 48px 0 56px; }
.page-content h1 { font-family: var(--tso-serif); font-weight: 400; font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 24px; }

/* ---------- Footer ---------- */
.site-footer {
	border-top: 1px solid var(--tso-line);
	padding: 28px 0 36px; color: var(--tso-muted); font-size: 0.875rem; text-align: center;
}
.site-footer p { margin: 4px 0; }
.site-footer a { color: var(--tso-text); }
