/* ==========================================================================
   Podcast Portal styles
   All colors/spacing are CSS variables — override these in your theme to
   rebrand without touching the rest of the file.
   ========================================================================== */

:root {
	--pp-bg: #ffffff;
	--pp-surface: #f4f6f5;
	--pp-surface-2: #e9edeb;
	--pp-text: #15201b;
	--pp-text-dim: #5d6b64;
	--pp-accent: #1f6f54;        /* primary action color */
	--pp-accent-contrast: #ffffff;
	--pp-border: #dfe4e1;
	--pp-sidebar-bg: #d6dad8;   /* left column: medium gray */
	--pp-main-bg: #c4c9c7;      /* right column: darker gray */
	--pp-radius: 5px;
	--pp-radius-sm: 8px;
	--pp-shadow: 0 6px 24px rgba(21, 32, 27, 0.10);
	--pp-player-h: 96px;
	--pp-page-bg: #eef1f0;
	--pp-base-font-size: 16px;
	--pp-content-width: 1120px;
	--pp-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.pp-portal {
	font-family: var(--pp-font);
	font-size: var(--pp-base-font-size);
	color: var(--pp-text);
	max-width: var(--pp-content-width);
	margin: 0 auto;
	padding: 32px 20px calc(var(--pp-player-h) + 40px); /* leave room for the footer player */
	box-sizing: border-box;
}

/* ---- Full-bleed layout: columns cover the entire background ------------- */
/* In full mode the centered .pp-portal wrapper expands edge-to-edge and the
   page background takes the column colors so the grays fill the viewport. */
body.pp-layout-full { background: var(--pp-page-bg); }
body.pp-page-landing { background: var(--pp-list-bg); }

body.pp-layout-full .pp-portal {
	max-width: none;
	padding: 0 0 calc(var(--pp-player-h) + 40px);
}

body.pp-layout-full .pp-landing__inner {
	border-radius: 0;
	box-shadow: none;
	min-height: calc(100vh - var(--pp-player-h));
}

/* Full-bleed single show: the darker-gray panel fills the width. */
body.pp-layout-full .pp-show__inner {
	border-radius: 0;
	box-shadow: none;
	min-height: calc(100vh - var(--pp-player-h));
	padding-left: max(28px, calc((100vw - var(--pp-content-width)) / 2));
	padding-right: max(28px, calc((100vw - var(--pp-content-width)) / 2));
}

/* In full mode, keep a uniform 30px gutter so the grid fills the column
   edge-to-edge with even padding (matches boxed mode). */
body.pp-layout-full .pp-landing__main {
	padding: 30px;
}

/* Boxed mode keeps the page background visible around the centered box. */
body.pp-layout-boxed { background: var(--pp-page-bg); }
body.pp-page-landing { background: var(--pp-list-bg); }

.pp-portal * {
	box-sizing: border-box;
}

.pp-portal * {
	box-sizing: border-box;
}

/* Landing page heading (optional, color-controlled) */
.pp-landing__heading {
	color: var(--pp-list-heading);
	font-size: clamp(1.6rem, 3.5vw, 2.4rem);
	letter-spacing: -0.02em;
	margin: 0 0 20px;
	padding: 0 4px;
}
body.pp-layout-full .pp-landing__heading { padding: 24px 28px 0; margin-bottom: 12px; }

/* ---- Landing: two-column boxed layout ---------------------------------- */
.pp-landing__inner {
	display: grid;
	grid-template-columns: 264px 1fr;
	align-items: stretch;          /* equal-height columns */
	border-radius: var(--pp-radius);
	box-shadow: var(--pp-shadow);
}

/* Round the columns themselves instead of clipping the box with overflow,
   because overflow:hidden on an ancestor disables position: sticky. */
.pp-landing__sidebar {
	border-radius: var(--pp-radius) 0 0 var(--pp-radius);
}
.pp-landing__main {
	border-radius: 0 var(--pp-radius) var(--pp-radius) 0;
}
body.pp-layout-full .pp-landing__sidebar,
body.pp-layout-full .pp-landing__main {
	border-radius: 0;
}

/* Left column: medium gray, categories. The cell stays full height (covers the
   background); an inner wrapper sticks to the top as the grid scrolls. */
.pp-landing__sidebar {
	background: var(--pp-sidebar-bg);
}

.pp-sidebar__inner {
	position: sticky;
	top: 0;
	padding: 24px 22px;
	/* Keep the menu within the viewport and let it scroll on its own when the
	   category list is long, with a slim scrollbar. */
	max-height: 100vh;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: color-mix(in srgb, var(--pp-menu-text) 28%, transparent) transparent;
}

/* Slim WebKit scrollbar for the menu */
.pp-sidebar__inner::-webkit-scrollbar {
	width: 6px;
}
.pp-sidebar__inner::-webkit-scrollbar-track {
	background: transparent;
}
.pp-sidebar__inner::-webkit-scrollbar-thumb {
	background: color-mix(in srgb, var(--pp-menu-text) 28%, transparent);
	border-radius: 3px;
}
.pp-sidebar__inner::-webkit-scrollbar-thumb:hover {
	background: color-mix(in srgb, var(--pp-menu-text) 42%, transparent);
}

.pp-sidebar__heading {
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--pp-text-dim);
	margin: 0 0 14px;
}

.pp-cats {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.pp-cats__item {
	display: block;
	width: 100%;
	text-align: left;
	box-sizing: border-box;
	padding: 9px 12px;
	border-radius: var(--pp-radius-sm);
	color: var(--pp-menu-text);
	background: none;
	border: none;
	font: inherit;
	font-size: 0.92rem;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.pp-cats__item:hover {
	color: var(--pp-menu-hover);
	background: color-mix(in srgb, var(--pp-menu-hover) 12%, transparent);
}

.pp-cats__item.is-active {
	background: var(--pp-accent);
	color: var(--pp-accent-contrast);
	font-weight: 600;
}

/* Right column: darker gray, podcast grid */
.pp-landing__main {
	background: var(--pp-main-bg);
	padding: 30px;
}

.pp-grid {
	display: grid;
	/* auto-fit (not auto-fill) collapses empty tracks so the real cards stretch
	   to fill the column width edge-to-edge. ~180px min keeps a sensible count. */
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 26px 22px;
}

/* Card: thumbnail on top, title below, host below */
.pp-show-card {
	text-decoration: none;
	color: inherit;
	display: block;
}

.pp-show-card__art {
	aspect-ratio: 1 / 1;
	border-radius: var(--pp-radius-sm);
	overflow: hidden;
	background: rgba(21, 32, 27, 0.06);
	box-shadow: var(--pp-shadow);
	transition: transform 0.18s ease;
}

.pp-show-card:hover .pp-show-card__art {
	transform: translateY(-3px);
}

.pp-show-card__art img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.pp-show-card__title {
	font-size: var(--pp-title-size);
	color: var(--pp-title-color);
	margin: 11px 0 2px;
	line-height: 1.3;
}

.pp-show-card__host {
	font-size: var(--pp-host-size);
	color: var(--pp-host-color);
	margin: 0;
}

/* Stack the columns on narrow screens */
@media (max-width: 768px) {
	.pp-landing__inner {
		grid-template-columns: 1fr;
	}
	.pp-sidebar__inner {
		position: static;   /* no sticky when the menu is stacked on top */
	}
	.pp-cats {
		flex-direction: row;
		flex-wrap: wrap;
		gap: 8px;
	}
	.pp-cats__item {
		width: auto;
		background: color-mix(in srgb, var(--pp-menu-text) 5%, transparent);
	}
	.pp-sidebar__bar {
		margin-bottom: 12px;
		padding-bottom: 12px;
	}
}

/* ---- Single show: header ----------------------------------------------- */
/* Boxed panel to match the landing layout (same darker-gray content surface). */
.pp-show__inner {
	background: var(--pp-main-bg);
	border-radius: var(--pp-radius);
	box-shadow: var(--pp-shadow);
	padding: 32px;
}

@media (max-width: 600px) {
	.pp-show__inner {
		padding: 20px;
	}
}

.pp-show__header {
	display: flex;
	gap: 28px;
	align-items: flex-start;
	margin-bottom: 36px;
}

.pp-show__art {
	flex: 0 0 var(--pp-show-art-size, 200px);
	width: var(--pp-show-art-size, 200px);
	aspect-ratio: 1 / 1;
	border-radius: var(--pp-radius);
	overflow: hidden;
	box-shadow: var(--pp-shadow);
}

.pp-show__art img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.pp-show__back {
	color: var(--pp-text-dim);
	text-decoration: none;
	font-size: 0.9rem;
}

.pp-show__back:hover {
	color: var(--pp-text);
}

.pp-show__title {
	font-size: var(--pp-show-title-size);
	color: var(--pp-show-title-color);
	letter-spacing: -0.02em;
	margin: 8px 0 12px;
	line-height: 1.15;
}

.pp-show__desc {
	color: var(--pp-text-dim);
	line-height: 1.6;
	max-width: 60ch;
}

.pp-show__more {
	margin-top: 8px;
	padding: 4px 0;
	background: none;
	border: none;
	color: var(--pp-accent);
	font: inherit;
	font-weight: 600;
	font-size: 0.9rem;
	cursor: pointer;
}

.pp-show__more:hover {
	text-decoration: underline;
}

@media (max-width: 600px) {
	.pp-show__header {
		flex-direction: column;
		gap: 18px;
	}
	.pp-show__art {
		flex-basis: auto;
		width: 140px;
	}
}

/* ---- Single show: episode cards ---------------------------------------- */
.pp-episodes {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.pp-episode {
	display: flex;
	gap: 18px;
	padding: 18px;
	border: 1px solid var(--pp-border);
	border-radius: var(--pp-episode-radius);
	background: var(--pp-bg);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pp-episode:hover {
	box-shadow: var(--pp-shadow);
}

.pp-episode.is-active {
	border-color: var(--pp-accent);
	box-shadow: 0 0 0 1px var(--pp-accent);
}

.pp-episode__art {
	position: relative;
	flex: 0 0 110px;
	width: 110px;
	aspect-ratio: 1 / 1;
	border-radius: var(--pp-radius-sm);
	overflow: hidden;
	background: var(--pp-surface);
}

.pp-episode__art img {
	width: 100%;
	height: 100%;
	object-fit: contain;   /* show the whole artwork, never crop */
	object-position: center;
	display: block;
}

.pp-play-btn {
	position: absolute;
	inset: 0;
	margin: auto;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	background: rgba(21, 32, 27, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease, transform 0.15s ease;
}

.pp-play-btn:hover {
	background: var(--pp-accent);
	transform: scale(1.06);
}

.pp-play-btn svg {
	width: 22px;
	height: 22px;
	fill: #fff;
	margin-left: 2px;
}

.pp-episode__body {
	flex: 1;
	min-width: 0;
}

.pp-episode__title {
	font-size: var(--pp-episode-title-size);
	color: var(--pp-episode-title-color);
	margin: 0 0 6px;
	line-height: 1.35;
}

.pp-episode__meta {
	display: flex;
	gap: 14px;
	font-size: 0.82rem;
	color: var(--pp-text-dim);
	margin: 0 0 10px;
}

.pp-episode__notes {
	font-size: 0.92rem;
	color: var(--pp-text-dim);
	line-height: 1.55;
	margin: 0;
}

@media (max-width: 600px) {
	.pp-episode__art {
		flex-basis: 84px;
		width: 84px;
	}
}

/* Phones and tablet-portrait: top-align the thumbnail with the title/meta and
   drop the description so each row stays compact. Covers small widths outright,
   plus portrait orientation up to typical tablet width (e.g. iPad portrait). */
@media (max-width: 600px), (max-width: 1024px) and (orientation: portrait) {
	.pp-episode {
		align-items: flex-start;   /* top-align art with the title/meta block */
	}
	.pp-episode__notes {
		display: none;             /* remove the show description on these views */
	}
}

/* ---- Pagination -------------------------------------------------------- */
.pp-pagination {
	display: flex;
	gap: 6px;
	margin-top: 28px;
	flex-wrap: wrap;
}

.pp-pagination__page {
	min-width: 38px;
	height: 38px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--pp-radius-sm);
	background: var(--pp-surface);
	color: var(--pp-text);
	text-decoration: none;
	font-size: 0.9rem;
}

.pp-pagination__page:hover {
	background: var(--pp-surface-2);
}

.pp-pagination__page.is-current {
	background: var(--pp-accent);
	color: var(--pp-accent-contrast);
}

.pp-empty {
	color: var(--pp-text-dim);
	padding: 40px 0;
}

/* ==========================================================================
   Sticky footer player
   ========================================================================== */
.pp-player {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	height: var(--pp-player-h);
	z-index: 9999;
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 0 18px;
	background: var(--pp-player-bg);
	color: var(--pp-player-text);
	box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
	font-family: var(--pp-player-font);
}

.pp-player.is-empty {
	display: none; /* hide until something is played */
}

.pp-player__art {
	flex: 0 0 60px;
	width: 60px;
	height: 60px;
	border-radius: var(--pp-radius-sm);
	overflow: hidden;
	background: color-mix(in srgb, var(--pp-player-text) 10%, transparent);
}

.pp-player__art img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.pp-player__main {
	flex: 1;
	min-width: 0;
	display: grid;
	grid-template-columns: 1fr auto;
	grid-template-rows: auto auto;
	column-gap: 18px;
	row-gap: 6px;
	align-items: center;
}

.pp-player__info {
	display: flex;
	flex-direction: column;
	min-width: 0;
	grid-row: 1;
	grid-column: 1;
}

.pp-player__title {
	font-weight: 600;
	font-size: 0.95rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.pp-player__show {
	font-size: 0.8rem;
	color: color-mix(in srgb, var(--pp-player-text) 60%, transparent);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.pp-player__controls {
	display: flex;
	align-items: center;
	gap: 8px;
	grid-row: 1;
	grid-column: 2;
}

.pp-ctrl {
	position: relative;
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px 6px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1px;
	line-height: 1;
}

.pp-ctrl svg {
	width: 24px;
	height: 24px;
	fill: color-mix(in srgb, var(--pp-player-text) 85%, transparent);
}

.pp-ctrl:hover svg {
	fill: var(--pp-player-text);
}

/* Skip-seconds label sits BELOW the icon (not over it) so it stays readable. */
.pp-ctrl__label {
	font-size: 0.62rem;
	font-weight: 700;
	line-height: 1;
	color: color-mix(in srgb, var(--pp-player-text) 90%, transparent);
	pointer-events: none;
}

.pp-ctrl--play {
	background: var(--pp-player-accent);
	border-radius: 50%;
	width: 44px;
	height: 44px;
	padding: 0;
}

.pp-ctrl--play svg {
	fill: var(--pp-player-text);
}

/* Toggle play/pause icon visibility from the player state class. */
.pp-icon-pause { display: none; }
.pp-player.is-playing .pp-icon-play { display: none; }
.pp-player.is-playing .pp-icon-pause { display: block; }

.pp-player__progress {
	grid-row: 2;
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	gap: 10px;
}

.pp-time {
	font-size: 0.72rem;
	color: color-mix(in srgb, var(--pp-player-text) 60%, transparent);
	font-variant-numeric: tabular-nums;
	min-width: 38px;
	text-align: center;
}

.pp-seek {
	flex: 1;
	-webkit-appearance: none;
	appearance: none;
	height: 4px;
	border-radius: 4px;
	background: color-mix(in srgb, var(--pp-player-text) 25%, transparent);
	cursor: pointer;
}

.pp-seek::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	background: var(--pp-player-text);
}

.pp-seek::-moz-range-thumb {
	width: 13px;
	height: 13px;
	border: none;
	border-radius: 50%;
	background: var(--pp-player-text);
}

.pp-player__extra {
	flex: 0 0 auto;
}

.pp-speed {
	background: color-mix(in srgb, var(--pp-player-text) 12%, transparent);
	color: var(--pp-player-text);
	border: none;
	border-radius: 999px;
	padding: 6px 12px;
	font-size: 0.8rem;
	font-weight: 600;
	cursor: pointer;
}

.pp-speed:hover {
	background: color-mix(in srgb, var(--pp-player-text) 22%, transparent);
}

@media (max-width: 600px) {
	.pp-player__art { display: none; }
	.pp-player__extra { display: none; }
	.pp-player { gap: 12px; padding: 0 12px; }
}

/* ==========================================================================
   Theme toggle (light/dark) + theme-aware tweaks
   ========================================================================== */
.pp-sidebar__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 14px;
}
.pp-sidebar__top .pp-sidebar__heading {
	margin: 0;
}

/* Toggle bar above the category menu */
.pp-sidebar__bar {
	margin-bottom: 16px;
	padding-bottom: 16px;
	border-bottom: 1px solid color-mix(in srgb, var(--pp-menu-text) 14%, transparent);
	display: flex;
	align-items: center;
}

.pp-show__topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.pp-theme-toggle {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border-radius: 999px;
	border: 1px solid color-mix(in srgb, var(--pp-text) 18%, transparent);
	background: color-mix(in srgb, var(--pp-text) 5%, transparent);
	color: var(--pp-text);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.15s ease, border-color 0.15s ease;
}
.pp-theme-toggle:hover {
	background: color-mix(in srgb, var(--pp-text) 12%, transparent);
}
.pp-theme-toggle svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}
/* Moon stroke is fine, but the moon path reads better filled. */
.pp-icon-moon {
	fill: currentColor;
	stroke: none;
}
/* Show sun in dark mode (tap to go light); moon in light mode (tap to go dark). */
.pp-icon-sun { display: none; }
.pp-icon-moon { display: block; }
[data-pp-theme="dark"] .pp-icon-sun { display: block; }
[data-pp-theme="dark"] .pp-icon-moon { display: none; }

/* In dark mode the episode cards use a surface tint and the play-button scrim
   stays legible. */
[data-pp-theme="dark"] .pp-episode {
	background: color-mix(in srgb, var(--pp-text) 5%, transparent);
}

/* ==========================================================================
   Category-filter entry animation (fade + slide up, slight stagger)
   ========================================================================== */
@keyframes pp-card-in {
	from { opacity: 0; transform: translateY(10px); }
	to   { opacity: 1; transform: none; }
}

.pp-show-card.pp-animate-in {
	animation: pp-card-in 0.35s ease both;
	animation-delay: var(--pp-stagger, 0ms);
}

@media (prefers-reduced-motion: reduce) {
	.pp-show-card.pp-animate-in {
		animation: none;
	}
}
