/* RwRadio web player
 * The dial is the one strong element: a dark tuning scale lit where audio
 * was recorded, with a red needle. Everything around it stays quiet. */

:root {
	--panel: #e6e9ed;
	--surface: #f5f6f8;
	--line: #c9cfd7;
	--ink: #1b2430;
	--ink-soft: #5a6573;
	--dial: #1d2937;
	--dial-ink: #9fb0c3;
	--lamp: #f0b43c;
	--lamp-glow: rgba(240, 180, 60, .45);
	--lamp-live: rgba(240, 180, 60, .55);
	--text-mark: #6cc4b7;
	--needle: #e5484d;
	--focus: #2f6fd6;
	--hl: rgba(240, 180, 60, .28);

	--ui: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
	--read: "Source Serif 4", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
	:root {
		--panel: #10151c;
		--surface: #171e27;
		--line: #2a3441;
		--ink: #e3e8ee;
		--ink-soft: #95a1b1;
		--dial: #0a1017;
		--dial-ink: #7d8ea2;
		--lamp-glow: rgba(240, 180, 60, .35);
		--focus: #7aa7f0;
		--hl: rgba(240, 180, 60, .18);
	}
}

* { box-sizing: border-box; }

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

body {
	margin: 0;
	background: var(--panel);
	color: var(--ink);
	font: 500 1.0625rem/1.4 var(--ui);
}

button, input, select { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

h2 {
	margin: 0 0 .75rem;
	font: 600 1.25rem/1.2 var(--ui);
}

/* Header: station selector */
.top {
	display: flex;
	align-items: center;
	gap: 1.25rem;
	padding: .75rem max(16px, 3vw);
	border-bottom: 1px solid var(--line);
	background: var(--surface);
}
.brand {
	font: 600 1.375rem/1 var(--ui);
	color: var(--ink);
	text-decoration: none;
	flex: none;
}
.stations {
	display: flex;
	gap: .25rem;
	overflow-x: auto;
	scrollbar-width: none;
	min-width: 0;
}
.stations button {
	flex: none;
	border: 0;
	background: none;
	padding: .35rem .7rem;
	border-radius: 999px;
	color: var(--ink-soft);
	cursor: pointer;
	white-space: nowrap;
}
.stations button:hover { color: var(--ink); }
.stations button[aria-pressed="true"] {
	background: var(--dial);
	color: var(--lamp);
}

main {
	max-width: 1180px;
	margin: 0 auto;
	padding: 1.5rem max(16px, 3vw) 3rem;
}

/* Clock readout */
.clock-line { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.clock {
	font: 600 clamp(3.25rem, 11vw, 6rem)/1 var(--ui);
	font-variant-numeric: tabular-nums;
	letter-spacing: .01em;
}
.clock-zone { color: var(--ink-soft); font-size: 1.25rem; }
.clock-meta {
	margin: .35rem 0 0;
	display: flex;
	flex-wrap: wrap;
	gap: .25rem 1.25rem;
	color: var(--ink-soft);
	font-size: 1.125rem;
}
#station-name { color: var(--ink); font-weight: 600; }

/* Day / time zone controls */
.controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .75rem 1.25rem;
	margin: 1.25rem 0 1rem;
}
.daynav { display: flex; align-items: center; gap: .25rem; }
.daynav input {
	border: 1px solid var(--line);
	background: var(--surface);
	border-radius: 6px;
	padding: .3rem .5rem;
	min-height: 2.5rem;
}
.btn {
	border: 1px solid var(--line);
	background: var(--surface);
	border-radius: 6px;
	padding: .35rem .85rem;
	min-height: 2.5rem;
	cursor: pointer;
}
.btn:hover { border-color: var(--ink-soft); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.icon { width: 2.5rem; padding: 0; display: grid; place-items: center; }
.btn svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 2.2; }

.tzswitch {
	display: inline-flex;
	border: 1px solid var(--line);
	border-radius: 6px;
	overflow: hidden;
}
.tzswitch button {
	border: 0;
	background: var(--surface);
	padding: .35rem .85rem;
	min-height: 2.5rem;
	cursor: pointer;
	color: var(--ink-soft);
}
.tzswitch button[aria-checked="true"] { background: var(--ink); color: var(--surface); }

/* The dial */
.dial-wrap { margin: 0 0 1rem; }
.dial {
	position: relative;
	height: 112px;
	background: var(--dial);
	border-radius: 10px;
	box-shadow: inset 0 2px 10px rgba(0, 0, 0, .45);
	cursor: crosshair;
	touch-action: none;
	user-select: none;
	overflow: hidden;
}
.dial-scale, .dial-bands { position: absolute; inset: 0 12px; }

.tick {
	position: absolute;
	bottom: 0;
	width: 1px;
	height: 10px;
	background: var(--dial-ink);
	opacity: .55;
}
.tick.hour { height: 22px; opacity: .9; }
.tick-label {
	position: absolute;
	top: 10px;
	transform: translateX(-50%);
	color: var(--dial-ink);
	font: 500 1.0625rem/1 var(--ui);
	font-variant-numeric: tabular-nums;
}

.band {
	position: absolute;
	top: 46px;
	height: 20px;
	background: var(--lamp);
	box-shadow: 0 0 14px var(--lamp-glow);
	border-radius: 2px;
}
.band.live {
	background: repeating-linear-gradient(90deg, var(--lamp) 0 4px, var(--lamp-live) 4px 8px);
}
.textmark {
	position: absolute;
	top: 70px;
	height: 3px;
	background: var(--text-mark);
	border-radius: 2px;
}
.dial-empty {
	position: absolute;
	left: 0; right: 0;
	top: 44px;
	text-align: center;
	color: var(--dial-ink);
}

.needle {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 2px;
	margin-left: -1px;
	background: var(--needle);
	box-shadow: 0 0 8px rgba(229, 72, 77, .7);
	pointer-events: none;
}
.needle.ghost { background: rgba(255, 255, 255, .55); box-shadow: none; }
.needle.ghost span {
	position: absolute;
	top: 4px;
	left: 6px;
	padding: 0 .3rem;
	border-radius: 3px;
	background: rgba(0, 0, 0, .55);
	color: #fff;
	font: 500 .9375rem/1.4 var(--ui);
	white-space: nowrap;
}
.needle.ghost.flip span { left: auto; right: 6px; }

.legend {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .25rem .5rem;
	margin: .5rem 0 0;
	color: var(--ink-soft);
	font-size: .9375rem;
}
.key { display: inline-block; width: 18px; height: 8px; border-radius: 2px; }
.key.rec { background: var(--lamp); }
.key.txt { background: var(--text-mark); height: 3px; margin-left: .75rem; }
.legend .hint { margin-left: auto; }

/* Transport */
.transport {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .5rem;
}
.btn.play {
	width: 3.5rem;
	height: 3.5rem;
	border-radius: 50%;
	padding: 0;
	display: grid;
	place-items: center;
	background: var(--ink);
	border-color: var(--ink);
	color: var(--surface);
}
.btn.play svg { width: 1.6rem; height: 1.6rem; fill: currentColor; stroke: none; }
.btn.play .i-pause, .btn.play.playing .i-play { display: none; }
.btn.play.playing .i-pause { display: block; }
.speed { display: flex; align-items: center; gap: .4rem; margin-left: .5rem; color: var(--ink-soft); }
.speed select, .search select {
	border: 1px solid var(--line);
	background: var(--surface);
	border-radius: 6px;
	padding: .3rem .4rem;
	min-height: 2.5rem;
}
.notice { margin: 0 0 0 .5rem; color: var(--ink-soft); flex: 1 1 16rem; }
.notice button {
	border: 0;
	background: none;
	padding: 0;
	color: var(--focus);
	text-decoration: underline;
	cursor: pointer;
}

/* Transcript and search */
.reading {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 20rem;
	gap: 2rem;
	margin-top: 2rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--line);
}
.tr-scroll {
	max-height: 60vh;
	overflow-y: auto;
	overscroll-behavior: contain;
	scroll-padding: 2rem 0;
}
.segments { list-style: none; margin: 0; padding: 0; max-width: 46rem; }
.segments li {
	display: grid;
	grid-template-columns: 4.75rem 1fr;
	gap: 1rem;
	padding: .45rem .5rem;
	border-radius: 6px;
	cursor: pointer;
}
.segments li:hover { background: var(--surface); }
.segments li.active { background: var(--hl); }
.segments time {
	color: var(--ink-soft);
	font-variant-numeric: tabular-nums;
	padding-top: .15rem;
}
.segments p {
	margin: 0;
	font: 400 1.125rem/1.6 var(--read);
}
.segments li.unsure p { color: var(--ink-soft); }
.empty { color: var(--ink-soft); margin: .5rem 0; }

.search form { display: grid; gap: .5rem; }
.search input[type="search"] {
	width: 100%;
	border: 1px solid var(--line);
	background: var(--surface);
	border-radius: 6px;
	padding: .45rem .65rem;
	min-height: 2.75rem;
}
.search-opts { display: flex; flex-wrap: wrap; gap: .5rem; }
.search-opts select { flex: 1 1 8rem; min-width: 0; }
.search-status { color: var(--ink-soft); margin: .75rem 0 .25rem; }
.hits { list-style: none; margin: 0; padding: 0; max-height: 55vh; overflow-y: auto; }
.hits button {
	display: block;
	width: 100%;
	text-align: left;
	border: 0;
	border-bottom: 1px solid var(--line);
	background: none;
	padding: .6rem .25rem;
	cursor: pointer;
}
.hits button:hover { background: var(--surface); }
.hit-when { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.hit-text { display: block; font: 400 1rem/1.5 var(--read); margin-top: .15rem; }
.hits mark { background: var(--hl); color: inherit; border-radius: 2px; }

@media (max-width: 860px) {
	.reading { grid-template-columns: 1fr; }
	.tr-scroll { max-height: 55vh; }
}

@media (max-width: 600px) {
	.top { gap: .75rem; }
	.dial { height: 100px; }
	.tick-label.minor { display: none; }
	.band { top: 42px; }
	.textmark { top: 66px; }
	.legend .hint { margin-left: 0; flex-basis: 100%; }
	.segments li { grid-template-columns: 4.25rem 1fr; gap: .6rem; }
	.notice { margin: .25rem 0 0; flex-basis: 100%; }
}

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