/*
 * Κρήτη FM: the live player bar, fixed at the bottom of every page.
 * The page keeps the bar's height free at its end (and focus/anchors scroll clear of it).
 * Phones (< 600 px): 64 px, only play/pause, the show and the meter. Volume from 900 px.
 */

body { padding-bottom: calc(var(--player-h) + env(safe-area-inset-bottom, 0px)); }
html { scroll-padding-bottom: calc(var(--player-h) + 16px); }

.kfm-player {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
	padding-bottom: env(safe-area-inset-bottom, 0px);
	background: var(--deep);
	border-top: 1px solid var(--line);
	color: var(--ink);
}
.kfm-player__bar {
	display: flex; align-items: center; gap: 16px;
	height: calc(var(--player-h) - 1px); /* + the 1 px top border = exactly the space the body keeps free */
}

/* ---------- Play / pause: the one orange control in the bar ---------- */
.kfm-player__toggle {
	position: relative;
	display: inline-flex; align-items: center; justify-content: center; flex: none;
	width: 48px; height: 48px;
	padding: 0;
	border: 0; border-radius: 50%;
	background: var(--or); color: var(--on-or);
}
.kfm-player__toggle:hover { background: var(--or-hover); }
.kfm-player__toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 50%; }
.kfm-player__toggle .kfm-icon { width: 24px; height: 24px; }
.kfm-player__toggle .kfm-icon--pause,
.kfm-player__spinner { display: none; }
.kfm-player[data-state="playing"] .kfm-icon--play { display: none; }
.kfm-player[data-state="playing"] .kfm-icon--pause { display: block; }
.kfm-player[data-state="connecting"] .kfm-icon--play,
.kfm-player[data-state="retrying"] .kfm-icon--play { display: none; }
.kfm-player[data-state="connecting"] .kfm-player__spinner,
.kfm-player[data-state="retrying"] .kfm-player__spinner { display: block; }

/* A ring with a gap: still reads as «loading» when reduced motion stops the turn. */
.kfm-player__spinner {
	width: 22px; height: 22px;
	border: 3px solid var(--on-or); border-right-color: transparent;
	border-radius: 50%;
	animation: kfm-spin .8s linear infinite;
}
@keyframes kfm-spin { to { transform: rotate(360deg); } }

/* ---------- 87.5 and the small scale ---------- */
.kfm-player__station { display: flex; align-items: center; gap: 10px; flex: none; }
.kfm-player__freq { font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.kfm-player__station .kfm-dial { width: 92px; }

/* The level meter itself lives in layout.css (moves only under body.kfm-playing). */
.kfm-player__meter { height: 18px; opacity: .55; }
.kfm-playing .kfm-player__meter { opacity: 1; }

/* ---------- What is on air ---------- */
.kfm-player__info { flex: 1; min-width: 0; line-height: 1.3; }
.kfm-player__show,
.kfm-player__by,
.kfm-player__song,
.kfm-player__msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kfm-player__show { font-weight: 600; font-size: 16px; }
.kfm-player__by,
.kfm-player__song,
.kfm-player__msg { color: var(--mute); font-size: 14px; }
.kfm-player[data-state="error"] .kfm-player__msg,
.kfm-player[data-state="blocked"] .kfm-player__msg { color: var(--ink); white-space: normal; }
.kfm-player__msg a { color: var(--ink); }

.kfm-player__retry { flex: none; min-height: 40px; padding: 8px 18px; font-size: 15px; }

.kfm-player__listeners { flex: none; color: var(--mute); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Volume (desktop) ---------- */
.kfm-player__volume { display: none; flex: none; align-items: center; }
.kfm-player__volume input {
	width: 112px; height: 44px; margin: 0;
	background: transparent;
	accent-color: var(--ink);
	cursor: pointer;
}
@media (min-width: 900px) {
	.kfm-player__volume { display: flex; }
}

@media (max-width: 899px) {
	.kfm-player__bar { gap: 12px; }
	.kfm-player__listeners { display: none; }
}

/* ---------- Phones: play/pause, the show, the meter ---------- */
@media (max-width: 599px) {
	.kfm-player__toggle { width: 44px; height: 44px; }
	.kfm-player__station { display: none; }
	.kfm-player__meter { order: 2; }
	.kfm-player__show { font-size: 15px; }
	.kfm-player__by,
	.kfm-player__song,
	.kfm-player__msg { font-size: 13px; }

	/* Error / blocked: the message takes the show's place, up to three short lines, with the button beside it. */
	.kfm-player[data-state="error"] .kfm-player__show,
	.kfm-player[data-state="error"] .kfm-player__meter,
	.kfm-player[data-state="blocked"] .kfm-player__show,
	.kfm-player[data-state="blocked"] .kfm-player__meter { display: none; }
	.kfm-player[data-state="error"] .kfm-player__msg,
	.kfm-player[data-state="blocked"] .kfm-player__msg {
		display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3;
		line-height: 1.25;
	}
	.kfm-player__retry { min-height: 44px; padding: 8px 12px; font-size: 14px; }
}
