/*
Theme Name: Undernet Radio
Theme URI: https://www.radio-undernet.org
Author: Radio Undernet
Description: Lightweight dark theme for #Radio Undernet: player, web chat and a live users panel. No page builder required.
Version: 1.3.0
Requires at least: 6.0
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: undernet-radio
*/

:root {
	--bg: #0b1020;
	--surface: #121a2e;
	--surface-deep: #090d1a;
	--line: #232f4b;
	--text: #e8ecf6;
	--muted: #8f9cba;
	--accent: #4da3ff;
	--wave: #2dd4bf;
	--op: #4ade80;
	--voice: #fbbf24;
	--header-h: 4.25rem;

	--font-body: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
	--font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;

	color-scheme: dark;
}

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

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

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

img, svg, video, canvas { max-width: 100%; height: auto; }
audio { width: 100%; }
iframe { max-width: 100%; }

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: #fff; }

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
	border-radius: 4px;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0; border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
.skip-link:focus {
	position: fixed !important;
	top: 0.75rem; left: 0.75rem;
	width: auto; height: auto; margin: 0; clip: auto;
	padding: 0.6rem 1rem;
	background: var(--accent); color: #06101f;
	z-index: 1000; border-radius: 8px;
}

/* ---------- Header ---------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: rgba(11, 16, 32, 0.88);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--line);
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }

.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	max-width: 1440px;
	min-height: var(--header-h);
	margin: 0 auto;
	padding: 0.5rem 1.5rem;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	color: var(--text);
	text-decoration: none;
	font-weight: 700;
	font-size: 1.125rem;
	letter-spacing: -0.01em;
}
.brand:hover { color: var(--text); }
.brand__logo { width: 2.75rem; height: 2.75rem; object-fit: contain; }

.site-nav { display: flex; align-items: center; gap: 1.5rem; }

.nav-menu {
	display: flex;
	gap: 0.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}
.nav-menu a {
	display: block;
	padding: 0.5rem 0.85rem;
	border-radius: 8px;
	color: var(--muted);
	font-weight: 500;
	text-decoration: none;
}
.nav-menu a:hover,
.nav-menu .current-menu-item > a,
.nav-menu .current_page_item > a { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.btn {
	display: inline-block;
	padding: 0.5rem 1.1rem;
	border: 1px solid var(--accent);
	border-radius: 999px;
	color: var(--accent);
	font-weight: 600;
	text-decoration: none;
	transition: background-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--accent); color: #06101f; }

.nav-toggle {
	display: none;
	width: 2.75rem; height: 2.75rem;
	padding: 0;
	background: transparent;
	border: 1px solid var(--line);
	border-radius: 10px;
	cursor: pointer;
}
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
	display: block;
	width: 1.15rem; height: 2px;
	margin: 0 auto;
	background: var(--text);
	border-radius: 2px;
	content: "";
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before { position: absolute; top: -6px; left: 0; }
.nav-toggle__bars::after { position: absolute; top: 6px; left: 0; }

@media (max-width: 760px) {
	.nav-toggle { display: inline-block; }
	.site-nav {
		display: none;
		position: absolute;
		top: 100%; left: 0; right: 0;
		flex-direction: column;
		align-items: stretch;
		gap: 0.75rem;
		padding: 1rem 1.5rem 1.25rem;
		background: var(--bg);
		border-bottom: 1px solid var(--line);
	}
	.site-nav.is-open { display: flex; }
	.nav-menu { flex-direction: column; }
	.btn { text-align: center; }
}

/* ---------- Front page layout ---------- */

.layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 20rem;
	gap: 1.5rem;
	align-items: start;
	max-width: 1440px;
	margin: 0 auto;
	padding: 1.5rem;
}
.layout__main { display: grid; gap: 1.5rem; min-width: 0; }

@media (max-width: 980px) {
	.layout { grid-template-columns: minmax(0, 1fr); padding: 1rem; }
}

/* Cards */

.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 14px;
	overflow: hidden;
}
.card__title {
	margin: 0;
	padding: 0.85rem 1.5rem;
	border-bottom: 1px solid var(--line);
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--muted);
}
.card__body { padding: 1.5rem; }
.card__body--flush { padding: 0; }

.player { border-top: 2px solid var(--wave); }
.player .card__body { padding: 1rem; }

.widget + .widget { margin-top: 1.5rem; }
.widget__title { margin: 0 0 0.75rem; font-size: 1rem; }

.chat__frame {
	display: block;
	width: 100%;
	height: min(72vh, 640px);
	min-height: 420px;
	border: 0;
	background: #fff;
}

.hint {
	margin: 0;
	padding: 0.75rem 1rem;
	border: 1px dashed var(--line);
	border-radius: 8px;
	color: var(--muted);
	font-size: 0.9rem;
}

/* Users panel: styled like an IRC channel window */

.layout__side { position: sticky; top: calc(var(--header-h) + 1rem); }
.admin-bar .layout__side { top: calc(var(--header-h) + 3rem); }
@media (max-width: 980px) { .layout__side { position: static; } }

.console {
	background: var(--surface-deep);
	border: 1px solid var(--line);
	border-radius: 10px;
	font-family: var(--font-mono);
}
.console__title {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.75rem;
	margin: 0;
	padding: 0.9rem 1.1rem;
	border-bottom: 1px solid var(--line);
	font-size: 1.05rem;
	font-weight: 700;
	letter-spacing: 0;
	color: var(--text);
}
.console__body {
	max-height: calc(100vh - var(--header-h) - 8rem);
	padding: 0.75rem 1.1rem 1rem;
	overflow-y: auto;
	font-size: 0.875rem;
	line-height: 1.55;
	scrollbar-width: thin;
	scrollbar-color: var(--line) transparent;
}
@media (max-width: 980px) { .console__body { max-height: 24rem; } }

.console__body ul { margin: 0; padding: 0; list-style: none; }
.console__body li { padding: 0.05rem 0; overflow-wrap: anywhere; }
.console__body .widget__title { display: none; }

.console__count {
	flex: none;
	font-size: 0.8rem;
	font-weight: 400;
	color: var(--muted);
}

/* Users: op (@) green, voice (+) amber, regular (-) muted */
.user { display: flex; gap: 0.6rem; }
.user__mode { flex: none; width: 0.9rem; text-align: center; }
.user--op .user__mode { color: var(--op); }
.user--voice .user__mode { color: var(--voice); }
.user--none .user__mode { color: var(--muted); }
.user--none .user__nick { color: #b8c2da; }

/* ---------- Posts and pages ---------- */

.content {
	max-width: 46rem;
	margin: 0 auto;
	padding: 3rem 1.5rem 4rem;
}
.entry + .entry { margin-top: 3rem; }
.entry__title {
	margin: 0 0 1rem;
	font-size: clamp(1.75rem, 3vw + 1rem, 2.5rem);
	line-height: 1.15;
	letter-spacing: -0.02em;
}
.entry__title a { color: inherit; text-decoration: none; }
.entry-content > * + * { margin-top: 1em; }
.entry-content { overflow-wrap: break-word; }

.pagination .nav-links { display: flex; gap: 0.5rem; margin-top: 2rem; }
.pagination a, .pagination span {
	padding: 0.4rem 0.8rem;
	border: 1px solid var(--line);
	border-radius: 8px;
	text-decoration: none;
}
.pagination .current { background: var(--accent); border-color: var(--accent); color: #06101f; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--line); margin-top: 2rem; }
.site-footer__inner {
	max-width: 1440px;
	margin: 0 auto;
	padding: 1.5rem;
	color: var(--muted);
	font-size: 0.9rem;
}
.site-footer p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	* { transition: none !important; }
}
