/* ────────────────────────────────────────────────────────────────────────
   mySKN TV — front-end styles.
   Dark theme matching the Android app's palette exactly:
     brand red    #C9102F   brand red pressed #A00D25
     background   #000000
     surface      #111111
     surface alt  #1A1A1A
     surface foc. #2A2A2A   (focused / hovered)
     border       #222222
     text         #E8E8E8
     muted        #A0A0A0
   ──────────────────────────────────────────────────────────────────────── */

:root {
	--mt-brand: #C9102F;
	--mt-brand-press: #A00D25;
	--mt-bg: #000000;
	--mt-surface: #111111;
	--mt-surface-alt: #1A1A1A;
	--mt-surface-focus: #2A2A2A;
	--mt-border: #222222;
	--mt-divider: #1C1C1C;
	--mt-text: #E8E8E8;
	--mt-muted: #A0A0A0;
	--mt-text-dim: #6E6E6E;
	--mt-radius: 10px;        /* matches channel_card_bg.xml corners 10dp */
	--mt-radius-sm: 8px;
	--mt-max: 1400px;
}

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

html, body {
	margin: 0;
	padding: 0;
	background: var(--mt-bg);
	color: var(--mt-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

a { color: var(--mt-text); text-decoration: none; }
a:hover { color: #fff; }

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

.mt-container { max-width: var(--mt-max); margin: 0 auto; padding: 0 24px; }

/* ── Page header ─────────────────────────────────────────────────────────────
   Mirrors activity_channels.xml: horizontal logo + big title + subtitle on a
   single dark row, with an optional back/crumb link on the right.
   ──────────────────────────────────────────────────────────────────────────── */
.mt-page-header {
	background: var(--mt-bg);
	border-bottom: 1px solid var(--mt-divider);
	padding: 20px 0;
}
.mt-page-header__inner {
	display: grid;
	grid-template-columns: auto 1fr auto;
	column-gap: 20px;
	align-items: center;
}
.mt-page-header__brand {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
}
.mt-page-header__logo {
	max-height: 57px;        /* matches the app's 57dp */
	width: auto;
	max-width: 220px;
	object-fit: contain;
}
.mt-page-header__mark {
	font-size: 26px;
	font-weight: 800;
	letter-spacing: 0.02em;
	color: #fff;
	line-height: 1;
}
.mt-page-header__mark span {
	color: var(--mt-brand);
	margin-left: 4px;
}
.mt-page-header__titles {
	min-width: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	line-height: 1.15;
}
.mt-page-header__title {
	margin: 0;
	font-size: 28px;
	font-weight: 800;          /* matches "TextAppearance.MySknTv.Display" bold */
	color: var(--mt-text);
	letter-spacing: -0.01em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.mt-page-header__subtitle {
	margin: 4px 0 0;
	font-size: 13px;
	color: var(--mt-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.mt-page-header__back {
	color: var(--mt-muted);
	font-size: 13px;
	padding: 8px 12px;
	border-radius: 6px;
	transition: background 0.15s, color 0.15s;
	flex-shrink: 0;
}
.mt-page-header__back:hover {
	background: var(--mt-surface);
	color: var(--mt-text);
}

@media (max-width: 720px) {
	.mt-page-header { padding: 16px 0; }
	.mt-page-header__inner {
		grid-template-columns: auto 1fr;
		grid-template-rows: auto auto;
		row-gap: 10px;
	}
	.mt-page-header__back { grid-column: 2; justify-self: end; grid-row: 1; }
	.mt-page-header__titles { grid-column: 1 / -1; grid-row: 2; }
	.mt-page-header__title { font-size: 22px; }
}

/* ── Main ────────────────────────────────────────────────────────────────── */
.mt-main { min-height: calc(100vh - 130px); }

/* ── Section ─────────────────────────────────────────────────────────────── */
.mt-section { padding: 24px 0 64px; }
.mt-section--center { text-align: center; padding: 80px 0; }
.mt-section__title { color: #fff; margin: 0 0 24px; font-size: 24px; }
.mt-section__lead { color: var(--mt-muted); font-size: 16px; max-width: 540px; margin: 0 auto 24px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.mt-btn {
	display: inline-block;
	padding: 12px 22px;
	background: var(--mt-surface);
	color: var(--mt-text);
	border: 1px solid var(--mt-border);
	border-radius: 8px;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.mt-btn:hover { background: var(--mt-surface-alt); border-color: #333; }
.mt-btn:active { transform: translateY(1px); }
.mt-btn--primary { background: var(--mt-brand); border-color: var(--mt-brand); color: #fff; }
.mt-btn--primary:hover { background: var(--mt-brand-press); border-color: var(--mt-brand-press); color: #fff; }

/* ── Channels grid ───────────────────────────────────────────────────────────
   Card matches channel_card_bg.xml — #111 surface, 1px #222 border, 10px
   radius, 14px inner padding. Hover/focus state uses a 3px brand-red border
   exactly like the app's focused state in the drawable selector.
   ──────────────────────────────────────────────────────────────────────────── */
.mt-channels-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 16px;
	grid-template-columns: repeat(1, 1fr);
}
@media (min-width: 540px)  { .mt-channels-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 880px)  { .mt-channels-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .mt-channels-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1600px) { .mt-channels-grid { grid-template-columns: repeat(5, 1fr); } }

.mt-channel-card {
	background: var(--mt-surface);
	border: 1px solid var(--mt-border);
	border-radius: var(--mt-radius);
	overflow: hidden;
	/* Reserve the focus-border thickness so the layout doesn't shift on hover. */
	box-shadow: inset 0 0 0 0 transparent;
	transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.mt-channel-card:hover,
.mt-channel-card:focus-within {
	background: var(--mt-surface-focus);
	border-color: var(--mt-brand);
	box-shadow: inset 0 0 0 2px var(--mt-brand);     /* 1px border + 2px inset ≈ 3px ring (matches app's 3dp brand-red focused stroke) */
}
.mt-channel-card__link { display: block; color: inherit; padding: 14px; }
.mt-channel-card__thumb {
	aspect-ratio: 16 / 9;
	background: var(--mt-surface-alt);
	overflow: hidden;
	position: relative;
	border-radius: 6px;
}
.mt-channel-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.mt-channel-card__placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
}
.mt-channel-card__placeholder span {
	font-size: 64px;
	font-weight: 800;
	color: var(--mt-brand);
	opacity: 0.55;
}
.mt-channel-card__body { padding-top: 10px; }
.mt-channel-card__title {
	margin: 0;
	font-size: 18px;            /* matches app's 18sp Title */
	font-weight: 700;
	color: var(--mt-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.mt-channel-card__meta {
	margin: 2px 0 0;
	color: var(--mt-muted);
	font-size: 13px;            /* matches app's 13sp body */
}

/* ── Subchannels grid ────────────────────────────────────────────────────────
   Same card chrome as channels. Logo uses `object-fit: contain` so it sits
   inside the square with padding/whitespace around it — matches the Android
   layout's `scaleType="fitCenter"`.
   ──────────────────────────────────────────────────────────────────────────── */
.mt-subchannels-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 14px;
	grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 540px)  { .mt-subchannels-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 880px)  { .mt-subchannels-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .mt-subchannels-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1500px) { .mt-subchannels-grid { grid-template-columns: repeat(6, 1fr); } }

.mt-subchannel-card {
	background: var(--mt-surface);
	border: 1px solid var(--mt-border);
	border-radius: var(--mt-radius);
	overflow: hidden;
	box-shadow: inset 0 0 0 0 transparent;
	transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.mt-subchannel-card:hover,
.mt-subchannel-card:focus-within {
	background: var(--mt-surface-focus);
	border-color: var(--mt-brand);
	box-shadow: inset 0 0 0 2px var(--mt-brand);
}
.mt-subchannel-card.is-disabled { opacity: 0.5; cursor: not-allowed; }
.mt-subchannel-card.is-disabled:hover,
.mt-subchannel-card.is-disabled:focus-within {
	background: var(--mt-surface);
	border-color: var(--mt-border);
	box-shadow: none;
}

.mt-subchannel-card__link { display: block; color: inherit; padding: 14px; }
.mt-subchannel-card__thumb {
	aspect-ratio: 1 / 1;
	background: var(--mt-surface-alt);
	border-radius: 6px;
	position: relative;
	padding: 10px;             /* breathing room around centered logos */
	display: flex;
	align-items: center;
	justify-content: center;
}
.mt-subchannel-card__thumb img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;       /* matches Android's fitCenter */
}
.mt-subchannel-card__placeholder {
	width: 100%; height: 100%;
	display: flex; align-items: center; justify-content: center;
	background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
	border-radius: 6px;
}
.mt-subchannel-card__placeholder span {
	font-size: 56px; font-weight: 800; color: var(--mt-brand); opacity: 0.6;
}
.mt-subchannel-card__badge {
	position: absolute;
	top: 8px; right: 8px;
	background: rgba(0,0,0,0.7);
	color: #fff;
	padding: 3px 8px;
	border-radius: 4px;
	font-size: 10px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}
.mt-subchannel-card__body { padding-top: 10px; }
.mt-subchannel-card__title {
	margin: 0;
	font-size: 18px;            /* matches app's 18sp Title */
	font-weight: 700;
	color: var(--mt-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ── Player ──────────────────────────────────────────────────────────────────
   The Android app's PlayerActivity is full-bleed black with an info overlay
   that auto-hides after 4 seconds and re-shows on tap / D-pad center. The
   web version mirrors this: video fills the stage, an absolute-positioned
   overlay band at the top (back + channel + stream title) and a chip rail
   at the bottom both fade out after 3 s of inactivity and fade back in on
   mouse move / click / keypress.
   ──────────────────────────────────────────────────────────────────────────── */
.mt-body--player {
	background: #000;
	overflow: hidden;          /* lock scroll — player view is fixed-viewport */
	height: 100vh;
}
.mt-body--player .mt-main { min-height: 100vh; }
.mt-body--player.mt-cursor-hidden,
.mt-body--player.mt-cursor-hidden * { cursor: none !important; }

/* Hide site chrome on the player view so the user can't scroll past the
   video — no footer, no margin below. The WP admin bar still shows for
   logged-in users; we don't touch it because it's already toggleable. */
.mt-body--player .mt-site-footer { display: none !important; }

.mt-player {
	display: block;
	min-height: 100vh;
}

.mt-player__stage {
	background: #000;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	overflow: hidden;
}
.mt-player__video {
	width: 100%;
	height: 100vh;
	object-fit: contain;
	background: #000;
}
.mt-player__embed {
	width: 100%;
	max-width: 1280px;
	aspect-ratio: 16 / 9;
	background: #000;
}
.mt-player__embed > * { width: 100%; height: 100%; }
.mt-player__embed iframe { border: 0; }

.mt-player__notice {
	background: var(--mt-surface);
	border: 1px solid var(--mt-border);
	border-radius: var(--mt-radius);
	padding: 32px 28px;
	max-width: 540px;
	text-align: center;
}
.mt-player__notice strong { color: var(--mt-brand); font-size: 16px; letter-spacing: 0.04em; text-transform: uppercase; }
.mt-player__notice p { color: var(--mt-muted); margin: 12px 0 0; }
.mt-player__notice-hint { font-size: 13px; }
.mt-player__notice-hint a { color: var(--mt-brand); text-decoration: underline; }

.mt-player__back {
	display: inline-flex !important;
	align-items: center;
	gap: 6px;
	color: #ffffff !important;
	font-size: 14px;
	font-weight: 600;
	padding: 8px 14px;
	border-radius: 8px;
	background: rgba(0,0,0,0.65);
	border: 1px solid rgba(255,255,255,0.15);
	transition: background 0.15s, border-color 0.15s;
	text-decoration: none !important;
}
.mt-player__back:hover {
	color: #fff !important;
	background: var(--mt-brand);
	border-color: var(--mt-brand);
}
.mt-player__live {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #fff;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.1em;
	padding: 6px 12px 6px 10px;
	background: rgba(0,0,0,0.6);
	border-radius: 999px;
	border: 1px solid rgba(255,255,255,0.12);
}
.mt-player__live-dot {
	width: 8px; height: 8px;
	background: var(--mt-brand);
	border-radius: 50%;
	box-shadow: 0 0 0 0 rgba(201, 16, 47, 0.7);
	animation: mt-live-pulse 1.6s ease-out infinite;
}
@keyframes mt-live-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(201, 16, 47, 0.75); }
	70%  { box-shadow: 0 0 0 8px rgba(201, 16, 47, 0); }
	100% { box-shadow: 0 0 0 0 rgba(201, 16, 47, 0); }
}
.mt-player__clock {
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.02em;
	opacity: 0.9;
}

/* ── Top info overlay (station-ident style) ──────────────────────────────────
   Inspired by PBS / BBC / cable on-screen idents — a logo card on the left,
   channel name in small eyebrow text, stream title in big bold, plus a
   compact meta row. Sits anchored to the top of the video stage. Back
   button is on the far left, LIVE badge + clock on the far right.
   ──────────────────────────────────────────────────────────────────────────── */
.mt-player__overlay {
	position: absolute;
	left: 0; right: 0; top: 0;
	z-index: 5;
	padding: 22px 24px 64px;
	background: linear-gradient(180deg,
		rgba(0,0,0,0.96) 0%,
		rgba(0,0,0,0.85) 55%,
		rgba(0,0,0,0.0) 100%);
	opacity: 0;
	transform: translateY(-8px);
	transition: opacity 0.25s ease, transform 0.25s ease;
	pointer-events: none;
}
.mt-player__overlay.is-visible {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}
.mt-player__overlay-row {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
}
.mt-player__overlay-right {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-left: auto;
}

.mt-player__card {
	display: flex;
	align-items: center;
	gap: 14px;
	flex: 1 1 280px;
	min-width: 0;
}
.mt-player__logo-cell {
	width: 64px;
	height: 64px;
	flex-shrink: 0;
	background: #fff;
	border-radius: 8px;
	padding: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}
.mt-player__logo-img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}
.mt-player__logo-mark {
	font-size: 11px;
	font-weight: 800;
	color: #111;
	letter-spacing: 0.02em;
	line-height: 1;
}
.mt-player__logo-mark span {
	color: var(--mt-brand);
	margin-left: 2px;
}

.mt-player__card-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.2;
}
.mt-player__eyebrow,
.mt-player__overlay .mt-player__eyebrow {
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #ffffff !important;
	opacity: 0.85;
	margin-bottom: 4px;
	text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.mt-player__heading,
.mt-player__overlay .mt-player__heading {
	font-size: 24px;
	font-weight: 800;
	color: #ffffff !important;
	margin: 0 0 4px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	letter-spacing: -0.01em;
	text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}
.mt-player__meta,
.mt-player__overlay .mt-player__meta {
	font-size: 13px;
	color: #ffffff !important;
	opacity: 0.85;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

@media (max-width: 720px) {
	.mt-player__overlay { padding: 16px 18px 48px; }
	.mt-player__overlay-right { margin-left: 0; }
	.mt-player__logo-cell { width: 52px; height: 52px; }
	.mt-player__heading { font-size: 20px; }
}

/* ── Loading overlay (matches Android scrim_75 + brand red spinner) ────── */
.mt-player__loading {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: rgba(0,0,0,0.75);
	gap: 18px;
	color: var(--mt-text);
	z-index: 6;
}
/* HTML's `hidden` attribute applies display:none at specificity (0,1,0).
   Our class rules above also live at (0,1,0), so without explicit
   reinforcement they override `hidden` and the element stays visible
   (this caused a stuck spinner during playback). */
.mt-player__loading[hidden] { display: none !important; }
.mt-spinner {
	width: 56px; height: 56px;
	border: 3px solid rgba(255,255,255,0.18);
	border-top-color: var(--mt-brand);
	border-radius: 50%;
	animation: mt-spin 0.9s linear infinite;
}
@keyframes mt-spin { to { transform: rotate(360deg); } }

/* ── Unmute + play CTAs ──────────────────────────────────────────────────── */
.mt-player__unmute {
	position: absolute;
	top: 24px;
	right: 24px;
	z-index: 7;
	background: var(--mt-brand);
	color: #fff;
	border: 0;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 700;
	padding: 10px 18px;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(201, 16, 47, 0.55);
	animation: mt-pulse 1.8s ease-in-out infinite;
}
.mt-player__unmute:hover { background: var(--mt-brand-press); }
.mt-player__unmute[hidden] { display: none !important; }
@keyframes mt-pulse {
	0%, 100% { transform: scale(1);   box-shadow: 0 8px 24px rgba(201, 16, 47, 0.55); }
	50%      { transform: scale(1.06);box-shadow: 0 10px 30px rgba(201, 16, 47, 0.75); }
}

.mt-player__play {
	position: absolute;
	inset: 0;
	margin: auto;
	width: 88px;
	height: 88px;
	background: transparent;
	border: 0;
	padding: 0;
	cursor: pointer;
	z-index: 7;
	display: flex;
	align-items: center;
	justify-content: center;
}
.mt-player__play svg { width: 88px; height: 88px; transition: transform 0.15s; }
.mt-player__play:hover svg { transform: scale(1.08); }
.mt-player__play[hidden] { display: none !important; }

/* (Stream-switching chip rail removed — use Back → grid to switch streams.) */

/* ── Empty state ─────────────────────────────────────────────────────────── */
.mt-empty {
	background: var(--mt-surface);
	border: 1px dashed var(--mt-border);
	border-radius: var(--mt-radius);
	padding: 48px 32px;
	text-align: center;
}
.mt-empty p { color: var(--mt-muted); margin: 0 0 12px; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.mt-site-footer {
	border-top: 1px solid var(--mt-divider);
	margin-top: 32px;
	padding: 18px 0;
	background: #050505;
}
.mt-site-footer__inner {
	max-width: var(--mt-max);
	margin: 0 auto;
	padding: 0 24px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	color: var(--mt-muted);
	font-size: 12px;
}
.mt-site-footer__muted { color: var(--mt-text-dim); }
