/**
 * Lilian Saage Podcast — episode list.
 * Inherits the Extendable block theme's palette and type through the
 * theme's CSS custom properties, with safe fallbacks if a preset is renamed.
 */

.ls-podcast {
	--ls-fg: var(--wp--preset--color--foreground, #1a1a1a);
	--ls-muted: color-mix(in srgb, var(--ls-fg) 62%, transparent);
	--ls-line: color-mix(in srgb, var(--ls-fg) 14%, transparent);
	--ls-accent: var(--wp--preset--color--primary, #7a5c48);
	--ls-radius: 10px;

	max-width: 52rem;
	margin-inline: auto;

	/* Cards must react to the column they sit in, not the viewport — on the
	   homepage this block renders inside a half-width column. */
	container-type: inline-size;
}

.ls-podcast__note {
	margin: 0 0 1.75rem;
	padding: 0.7rem 1rem;
	border-left: 3px solid var(--ls-accent);
	background: color-mix(in srgb, var(--ls-accent) 7%, transparent);
	font-size: 0.9rem;
	color: var(--ls-muted);
}

.ls-podcast__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.ls-podcast__item {
	display: grid;
	grid-template-columns: 128px 1fr;
	gap: 1.25rem;
	align-items: start;
	padding: 1.25rem;
	border: 1px solid var(--ls-line);
	border-radius: var(--ls-radius);
}

.ls-podcast__art {
	width: 128px;
	height: 128px;
	border-radius: calc(var(--ls-radius) - 3px);
	object-fit: cover;
	display: block;
}

.ls-podcast__body {
	min-width: 0; /* lets long titles wrap instead of stretching the grid */
}

.ls-podcast__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 0.75rem;
	margin: 0 0 0.4rem;
	font-size: 0.82rem;
	color: var(--ls-muted);
}

.ls-podcast__badge {
	padding: 0.15em 0.6em;
	border-radius: 999px;
	background: color-mix(in srgb, var(--ls-accent) 12%, transparent);
	color: var(--ls-accent);
	font-weight: 600;
	letter-spacing: 0.02em;
}

.ls-podcast__dur::before {
	content: "·";
	margin-right: 0.75rem;
	color: var(--ls-line);
}

.ls-podcast__title {
	margin: 0 0 0.5rem;
	font-size: 1.12rem;
	line-height: 1.35;
	color: var(--ls-fg);
	text-wrap: balance;
}

.ls-podcast__desc {
	margin: 0 0 0.9rem;
	font-size: 0.94rem;
	line-height: 1.6;
	color: var(--ls-muted);
}

.ls-podcast__desc summary {
	cursor: pointer;
	list-style: none;
}

.ls-podcast__desc summary::-webkit-details-marker {
	display: none;
}

.ls-podcast__more {
	color: var(--ls-accent);
	font-weight: 600;
	white-space: nowrap;
}

.ls-podcast__desc summary:focus-visible {
	outline: 2px solid var(--ls-accent);
	outline-offset: 3px;
	border-radius: 3px;
}

.ls-podcast[open] .ls-podcast__more,
.ls-podcast__desc[open] .ls-podcast__more {
	display: none;
}

.ls-podcast__full {
	margin-top: 0.6rem;
}

.ls-podcast__full p {
	margin: 0 0 0.7rem;
}

.ls-podcast__audio {
	width: 100%;
	height: 40px;
	margin-top: 0.25rem;
}

.ls-podcast__all {
	margin: 2rem 0 0;
	text-align: center;
}

.ls-podcast__all a {
	color: var(--ls-accent);
	font-weight: 600;
}

.ls-podcast--error {
	padding: 1.25rem;
	border: 1px solid var(--ls-line);
	border-radius: var(--ls-radius);
	text-align: center;
}

/* Narrow container (a half-width column, or a phone) — stack the card. */
@container (max-width: 460px) {
	.ls-podcast__item {
		grid-template-columns: 1fr;
		gap: 0.9rem;
		padding: 1rem;
	}

	.ls-podcast__art {
		width: 84px;
		height: 84px;
	}

	.ls-podcast__title {
		font-size: 1.02rem;
	}
}

/* Fallback for engines without container query support. */
@supports not (container-type: inline-size) {
	@media (max-width: 600px) {
		.ls-podcast__item {
			grid-template-columns: 1fr;
			gap: 0.9rem;
			padding: 1rem;
		}

		.ls-podcast__art {
			width: 84px;
			height: 84px;
		}
	}
}

@media (prefers-reduced-motion: reduce) {
	.ls-podcast * {
		transition: none !important;
	}
}

/* --- Platform links (show-level) --- */

.ls-podcast__platforms {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem 0.9rem;
	margin: 0 0 1.75rem;
	padding-bottom: 1.35rem;
	border-bottom: 1px solid var(--ls-line);
}

.ls-podcast__platforms-label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--ls-muted);
	letter-spacing: 0.02em;
}

.ls-podcast__platforms ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

/* Brand colour per platform, consumed by the shared button rule below. */
.ls-podcast__platform--spotify { --brand: #1db954; }
.ls-podcast__platform--apple   { --brand: #9933cc; }
.ls-podcast__platform--youtube { --brand: #ff0000; }
.ls-podcast__platform--amazon  { --brand: #00a8e1; }

.ls-podcast__platform a {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.5em 1.05em;
	border: 1px solid var(--ls-line);
	border-radius: 999px;
	background: color-mix(in srgb, var(--ls-fg) 2%, transparent);
	font-size: 0.87rem;
	font-weight: 600;
	line-height: 1.4;
	color: var(--ls-fg);
	text-decoration: none;
	white-space: nowrap;
	transition: border-color 0.18s ease, background-color 0.18s ease,
		color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

/* The icon carries the brand colour at rest — the label stays theme-coloured
   so the row reads as one set of buttons rather than four clashing ones. */
.ls-podcast__icon {
	flex: 0 0 auto;
	color: var(--brand, var(--ls-accent));
	transition: color 0.18s ease, transform 0.18s ease;
}

.ls-podcast__platform a:hover,
.ls-podcast__platform a:focus-visible {
	border-color: var(--brand, var(--ls-accent));
	background: color-mix(in srgb, var(--brand, var(--ls-accent)) 10%, transparent);
	color: color-mix(in srgb, var(--brand, var(--ls-accent)) 72%, var(--ls-fg));
	transform: translateY(-1px);
	box-shadow: 0 4px 12px color-mix(in srgb, var(--brand, var(--ls-accent)) 22%, transparent);
}

.ls-podcast__platform a:hover .ls-podcast__icon,
.ls-podcast__platform a:focus-visible .ls-podcast__icon {
	transform: scale(1.08);
}

.ls-podcast__platform a:active {
	transform: translateY(0);
	box-shadow: none;
}

.ls-podcast__platform a:focus-visible {
	outline: 2px solid var(--brand, var(--ls-accent));
	outline-offset: 2px;
}

@media (max-width: 600px) {
	.ls-podcast__platforms {
		gap: 0.5rem;
	}

	.ls-podcast__platform a {
		padding: 0.45em 0.85em;
		font-size: 0.82rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ls-podcast__platform a,
	.ls-podcast__icon {
		transition: none;
	}

	.ls-podcast__platform a:hover,
	.ls-podcast__platform a:focus-visible {
		transform: none;
	}

	.ls-podcast__platform a:hover .ls-podcast__icon,
	.ls-podcast__platform a:focus-visible .ls-podcast__icon {
		transform: none;
	}
}

/* --- Articles from Edasi.org --- */

.ls-articles {
	--ls-fg: var(--wp--preset--color--foreground, #1a1a1a);
	--ls-muted: color-mix(in srgb, var(--ls-fg) 62%, transparent);
	--ls-line: color-mix(in srgb, var(--ls-fg) 14%, transparent);
	--ls-accent: var(--wp--preset--color--primary, #7a5c48);

	max-width: 52rem;
	margin-inline: auto;
	container-type: inline-size;
}

.ls-articles__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}

.ls-articles__item {
	padding: 1.4rem 0;
	border-bottom: 1px solid var(--ls-line);
}

.ls-articles__item:first-child {
	padding-top: 0;
}

.ls-articles__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 0.75rem;
	margin: 0 0 0.35rem;
	font-size: 0.82rem;
	color: var(--ls-muted);
}

.ls-articles__source {
	padding: 0.12em 0.6em;
	border-radius: 999px;
	background: color-mix(in srgb, var(--ls-accent) 12%, transparent);
	color: var(--ls-accent);
	font-weight: 600;
}

.ls-articles__title {
	margin: 0 0 0.45rem;
	font-size: 1.15rem;
	line-height: 1.35;
	text-wrap: balance;
}

.ls-articles__title a {
	color: var(--ls-fg);
	text-decoration: none;
	background-image: linear-gradient(var(--ls-accent), var(--ls-accent));
	background-size: 0 2px;
	background-repeat: no-repeat;
	background-position: 0 100%;
	transition: background-size 0.25s ease, color 0.2s ease;
}

.ls-articles__title a:hover,
.ls-articles__title a:focus-visible {
	color: var(--ls-accent);
	background-size: 100% 2px;
}

.ls-articles__excerpt {
	margin: 0 0 0.6rem;
	font-size: 0.94rem;
	line-height: 1.6;
	color: var(--ls-muted);
}

.ls-articles__cta {
	margin: 0;
}

.ls-articles__cta a {
	font-size: 0.87rem;
	font-weight: 600;
	color: var(--ls-accent);
	text-decoration: none;
}

.ls-articles__cta a:hover,
.ls-articles__cta a:focus-visible {
	text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
	.ls-articles__title a {
		transition: none;
	}
}

/* --- Split section: reading half on brand red ---
   Theme palette note: `foreground` IS the brand red (#af263b) and `primary` is
   navy (#070f79) — not the other way round. Values are hard-coded here rather
   than derived, because inside the red half we are inverting the scheme and the
   preset names would be misleading.

   No flex on .wp-block-column here: that combination with container-type
   collapsed the layout in v1.8.0. This only paints backgrounds and recolours. */

.ls-split {
	position: relative;
	isolation: isolate;
}

@media (min-width: 782px) {
	/* Full-bleed red across the right half of the viewport, so the section
	   reads as cut down the middle rather than as a card sitting on the page. */
	.ls-split::before {
		content: "";
		position: absolute;
		inset: 0 0 0 50%;
		background: #af263b;
		z-index: -1;
	}

	.ls-reading-col {
		padding-left: clamp(1.5rem, 3vw, 3rem);
	}
}

@media (max-width: 781px) {
	/* Stacked: a half-width split is meaningless, so the column carries its own
	   background instead. */
	.ls-reading-col {
		background: #af263b;
		padding: 2rem 1.5rem;
		border-radius: 0.9rem;
	}
}

/* Re-point the component tokens inside the red half. Because every rule in this
   stylesheet derives from these four, overriding them here recolours the whole
   list — meta, rules, badges and links included. */
.ls-reading-col .ls-articles {
	--ls-fg: #fff9ed;
	--ls-accent: #fff9ed;
	--ls-muted: color-mix(in srgb, #fff9ed 76%, transparent);
	--ls-line: color-mix(in srgb, #fff9ed 26%, transparent);
}

/* The heading and button are theme blocks, not ours, so they need saying explicitly. */
.ls-reading-col > .wp-block-heading {
	color: #fff9ed;
}

.ls-reading-col .ls-articles__source {
	background: color-mix(in srgb, #fff9ed 18%, transparent);
	color: #fff9ed;
}

.ls-reading-col .wp-block-button__link {
	background-color: #fff9ed;
	color: #af263b;
	border-color: #fff9ed;
}

.ls-reading-col .wp-block-button__link:hover,
.ls-reading-col .wp-block-button__link:focus-visible {
	background-color: #ffffff;
	color: #8f1c2f;
}

.ls-reading-col .ls-articles__title a:hover,
.ls-reading-col .ls-articles__title a:focus-visible {
	color: #ffffff;
}
