/*
 * Podcast index. Colour, spacing and radius come from AutomaticCSS custom
 * properties so the list tracks the site's design system; the fallbacks keep
 * the layout intact if the index is rendered where ACSS is not loaded.
 *
 * The list is a set of hairline-separated rows rather than filled cards. At
 * nineteen episodes, filled cards read as a stack of identical slabs and the
 * near-white card colour barely separates from the page; rows scan faster and
 * fit three episodes on screen where cards fit one and a half.
 */

.g2m-pi {
	--g2m-pi-rule: rgba(31, 41, 51, 0.1);
	--g2m-pi-accent: var(--primary, #2fa4b8);
	--g2m-pi-tint: var(--primary-ultra-light, #ebf8fa);
	--g2m-pi-text: var(--base, #1f2933);
	--g2m-pi-title: var(--secondary, #113157);
	display: flex;
	flex-direction: column;
	gap: var(--space-s, 0.75rem);
}

/*
 * Headings inherit a max-width and auto inline margins from the theme, which
 * centres them inside this flex column. Stretch it back to the list edge.
 */
.g2m-pi__heading {
	align-self: stretch;
	inline-size: 100%;
	max-inline-size: none;
	margin: 0;
	padding-block-end: var(--space-xs, 0.5rem);
	border-block-end: 1px solid rgba(31, 41, 51, 0.14);
	font-size: var(--text-m, 1rem);
	font-weight: 600;
	text-align: start;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--g2m-pi-text);
	opacity: 0.55;
}

.g2m-pi__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0;
}

.g2m-pi__item { margin: 0; }
.g2m-pi__item + .g2m-pi__item .g2m-pi__card { border-block-start: 1px solid var(--g2m-pi-rule); }

.g2m-pi__card {
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: start;
	gap: var(--space-m, 1.15rem);
	padding: var(--space-m, 1.15rem) var(--space-xs, 0.5rem);
	transition: background-color 120ms ease-in-out;
}

.g2m-pi__card:hover { background: var(--g2m-pi-tint); }

/* Play control: outlined at rest so it supports the title rather than competing with it. */
.g2m-pi__play {
	grid-column: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: 2.5rem;
	block-size: 2.5rem;
	flex: 0 0 auto;
	padding: 0;
	border: 1.5px solid var(--g2m-pi-accent);
	border-radius: 50%;
	background: transparent;
	color: var(--g2m-pi-accent);
	cursor: pointer;
	transition: background-color 120ms ease-in-out, color 120ms ease-in-out;
}

.g2m-pi__play:hover,
.g2m-pi__play[aria-pressed="true"] {
	background: var(--g2m-pi-accent);
	color: #fff;
}

.g2m-pi__play:focus-visible { outline: 2px solid var(--g2m-pi-title); outline-offset: 2px; }

/* Triangle by default, two bars while this episode is the one playing. */
.g2m-pi__play-icon {
	inline-size: 0;
	block-size: 0;
	margin-inline-start: 0.2em;
	border-block: 0.45em solid transparent;
	border-inline-start: 0.75em solid currentColor;
}

.g2m-pi__play[aria-pressed="true"] .g2m-pi__play-icon {
	inline-size: 0.75em;
	block-size: 0.8em;
	margin-inline-start: 0;
	border: 0;
	background: currentColor;
	-webkit-mask: linear-gradient(#000 0 0) left / 0.26em 100% no-repeat, linear-gradient(#000 0 0) right / 0.26em 100% no-repeat;
	mask: linear-gradient(#000 0 0) left / 0.26em 100% no-repeat, linear-gradient(#000 0 0) right / 0.26em 100% no-repeat;
}

.g2m-pi__body { grid-column: 2; min-inline-size: 0; }

.g2m-pi__title {
	font-size: var(--text-m, 1.0625rem);
	font-weight: 600;
	line-height: 1.35;
	margin: 0 0 0.35em;
}

.g2m-pi__title a { color: var(--g2m-pi-title); text-decoration: none; }
.g2m-pi__title a:hover { color: var(--g2m-pi-accent); text-decoration: underline; }

.g2m-pi__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
	margin: 0 0 0.5em;
	font-size: var(--text-xs, 0.75rem);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--g2m-pi-text);
	opacity: 0.55;
}

/*
 * Two lines. The summaries run to a full paragraph, which at nineteen episodes
 * buries the titles; the whole text stays in the DOM for search engines.
 */
.g2m-pi__excerpt {
	margin: 0;
	max-inline-size: 74ch;
	font-size: var(--text-s, 0.9rem);
	line-height: 1.5;
	color: var(--g2m-pi-text);
	opacity: 0.82;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/*
 * Docked player, pinned to the bottom of the viewport — not the end of the
 * list, where one shared audio element plays several thousand pixels below the
 * fold and reads as "nothing happened".
 *
 * Bottom rather than top: the site header is fixed and its own offset shifts
 * when the announcement bar above it is dismissed, so a top dock has to track a
 * moving target. There is nothing to collide with down here, and it is where
 * audio players conventionally live.
 */
.g2m-pi__dock {
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 997;
	display: flex;
	flex-direction: column;
	/*
	 * The theme sets align-items: flex-start on flex containers, which makes
	 * these children size to their content instead of the dock width — leaving
	 * the close button stranded mid-bar rather than at the right edge.
	 */
	align-items: stretch;
	gap: 0.3rem;
	padding: 0.6rem clamp(1rem, 4vw, 2.5rem) 0.7rem;
	padding-block-end: max(0.7rem, env(safe-area-inset-bottom));
	background: #fff;
	border-block-start: 1px solid var(--g2m-pi-rule, rgba(31, 41, 51, 0.1));
	box-shadow: 0 -6px 18px rgba(17, 49, 87, 0.1);
}

.g2m-pi__dock[hidden] { display: none; }

.g2m-pi__dock-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-s, 0.75rem);
}

.g2m-pi__close {
	flex: 0 0 auto;
	padding: 0.1em 0.35em;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: var(--g2m-pi-title, #113157);
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0.5;
	transition: opacity 120ms ease-in-out;
}

.g2m-pi__close:hover { opacity: 1; }
.g2m-pi__close:focus-visible { outline: 2px solid var(--g2m-pi-title, #113157); outline-offset: 2px; opacity: 1; }

/* Takes the free space and truncates, so a long title cannot push the close button off the edge. */
.g2m-pi__now {
	flex: 1 1 auto;
	min-inline-size: 0;
	margin: 0;
	font-size: var(--text-xs, 0.75rem);
	color: var(--g2m-pi-title, #113157);
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.g2m-pi__now-label {
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-weight: 600;
	opacity: 0.5;
	margin-inline-end: 0.5em;
}

.g2m-pi__audio { display: block; inline-size: 100%; block-size: 2.25rem; margin: 0; }

.g2m-pi__sr {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

@media (max-width: 600px) {
	.g2m-pi__card { gap: var(--space-s, 0.75rem); padding-inline: 0; }
	.g2m-pi__title { font-size: var(--text-s, 0.95rem); }
	.g2m-pi__play { inline-size: 2.25rem; block-size: 2.25rem; }
}

@media (prefers-reduced-motion: reduce) {
	.g2m-pi__card,
	.g2m-pi__play { transition: none; }
}
