/**
 * Episode page (single-podcasts.php), loaded after css/kirjoitus.css: categories, "Tapaus lyhyesti", the script with
 * its contents (beside the text from 1280px, sticky), sources and interpretation, the prompt to suggest an episode
 * and the related episodes. The listening band and the previous and next episode are in css/kirjoitus.css.
 * The timeline, contents and sources have their own stylesheet in mu-plugins/pa-case-timeline.php (it follows the
 * tokens of css/runko.css). It comes later in <head>, so the rules here that change them have three classes.
 * The related episode cards have theirs in mu-plugins/pa-episode-groups.php.
 */

/* Categories: "Sisältää" and quiet chips like on the episode cards, links to the Rikosarkisto search. The label and
   the chips wrap as one line of text. */
.pa-jakso__aiheet {
	margin-top: 14px;
	font-size: 13px;
	line-height: 1.4;
	color: var(--pa-color-muted);
}
.pa-jakso__aiheet-nimio {
	margin-right: 4px;
}
.pa-jakso__aiheet-lista {
	display: inline;
	margin: 0;
	padding: 0;
	list-style: none;
}
.pa-jakso__aiheet-lista li {
	display: inline-block;
	margin: 6px 6px 0 0;
}
.pa-jakso__aiheet-lista a,
.pa-jakso__aiheet-lista span {
	display: inline-flex;
	align-items: center;
	height: 26px;
	padding: 0 10px;
	border: 1px solid #363636;
	border-radius: 4px;
	background: var(--pa-color-line);
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	color: #b0b0b0;
	transition: border-color .15s, color .15s;
}
.pa-jakso__aiheet-lista a:hover {
	border-color: #5a5a5a;
	color: #fff;
}
.pa-jakso__aiheet-lista a:focus-visible {
	outline: 2px solid var(--pa-color-accent);
	outline-offset: 2px;
}

/* Tapaus lyhyesti: a summary panel with the timeline as its last row (mu-plugins/pa-case-timeline.php) */
.pa-jakso__lyhyesti {
	margin-top: 48px;
	font-size: 16px;
}

/* The script and its contents: one column, the contents as a folded row above the text (right under the timeline
   row when there is one) */
.pa-jakso__runko {
	margin-top: 40px;
}
.pa-jakso__lyhyesti + .pa-jakso__runko {
	margin-top: 12px;
}
.pa-jakso__runko > .pa-kirjoitus__teksti {
	padding-top: 40px;
}

/* From 1280px the contents are open beside the text and stay in view; the chapter being read is highlighted */
@media (min-width: 1280px) {
	/* Wider than the page grid on purpose: the contents use the free space on the left */
	.pa-jakso__runko {
		display: grid;
		grid-template-columns: minmax(0, 1fr) var(--pa-width-read) minmax(0, 1fr);
		column-gap: clamp(48px, 5vw, 96px);
		margin: 48px 0 0;
		padding: 0 32px;
	}
	.pa-jakso__lyhyesti + .pa-jakso__runko {
		margin-top: 48px;
	}
	.pa-jakso__runko > .pa-palsta,
	.pa-jakso__runko > .pa-kirjoitus__teksti {
		grid-row: 1;
		max-width: none;
		margin: 0;
		padding: 0;
	}
	.pa-jakso__runko > .pa-kirjoitus__teksti {
		grid-column: 2;
	}
	.pa-jakso__runko > .pa-jakso__sisallys {
		justify-self: end;
		width: 100%;
		max-width: 320px;
	}
	/* The contents fill the left side, so the subscription cards widen to the right only */
	.pa-jakso .pa-sub-inline {
		margin-left: 0;
		margin-right: calc(-2 * var(--pa-bleed-x));
	}
	/* Beside the text the contents need no surface of their own, the narrow column keeps its width for the text */
	.pa-jakso .pa-jakso__sisallys .pa-toc {
		position: sticky;
		top: calc(104px + var(--wp-admin--admin-bar--height, 0px));
		/* Ends above the listening bar at the bottom of the screen */
		max-height: calc(100vh - 200px - var(--wp-admin--admin-bar--height, 0px));
		overflow-y: auto;
		border: 0;
		border-top: 1px solid var(--pa-color-line);
		border-radius: 0;
		background: none;
		scrollbar-width: thin;
		scrollbar-color: var(--pa-color-line) transparent;
	}
	.pa-jakso .pa-jakso__sisallys .pa-toc__summary {
		min-height: 0;
		padding: 12px 0;
	}
	.pa-jakso .pa-jakso__sisallys .pa-toc__icon {
		display: none;
	}
	.pa-jakso .pa-jakso__sisallys .pa-toc__head {
		gap: 0 8px;
	}
	.pa-jakso .pa-jakso__sisallys .pa-toc__title {
		font-size: 15px;
	}
	.pa-jakso .pa-jakso__sisallys .pa-toc__meta {
		font-size: 13px;
	}
	/* The narrow column has room for the chevron only */
	.pa-jakso .pa-jakso__sisallys .pa-toc .pa-toc__action > span {
		display: none;
	}
	.pa-jakso .pa-jakso__sisallys .pa-toc__list {
		display: block;
		padding: 8px 0 12px;
	}
	.pa-jakso .pa-jakso__sisallys .pa-toc__link {
		gap: 8px;
		min-height: 0;
		padding: 6px 0;
		font-size: 14px;
		line-height: 1.4;
		color: var(--pa-color-muted);
	}
	.pa-jakso .pa-jakso__sisallys .pa-toc__num {
		flex-basis: 20px;
		height: 20px;
		font-size: 10.5px;
		color: var(--pa-color-muted);
	}
	.pa-jakso .pa-jakso__sisallys .pa-toc__link:hover,
	.pa-jakso .pa-jakso__sisallys .pa-toc__link.is-current {
		color: #fff;
	}
	.pa-jakso .pa-jakso__sisallys .pa-toc__link.is-current .pa-toc__num {
		background: #fff;
		color: #000;
	}
	.pa-jakso .pa-jakso__sisallys .pa-toc__sources {
		padding: 12px 0;
		font-size: 13px;
	}
}

/* Sources and interpretation: the sources row (or a heading in the same look), the interpretation text, author */
.pa-jakso__lahteet {
	margin-top: 72px;
}
.pa-jakso .pa-jakso__lahteet-otsikko {
	margin: 0;
	padding: 18px 20px;
	border: 1px solid var(--pa-color-line);
	border-radius: 10px;
	background: var(--pa-color-surface);
	font-family: var(--pa-font-text);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--pa-color-ink);
}
/* The interpretation reads as a note on the script: an info icon with a thread down the left side */
.pa-jakso__tulkinta {
	position: relative;
	margin: 28px 0 0;
	padding-left: 36px;
	font-size: 14px;
	line-height: 1.65;
	color: var(--pa-color-muted);
}
.pa-jakso__tulkinta::before,
.pa-jakso__tulkinta::after {
	content: "";
	position: absolute;
	left: 0;
}
.pa-jakso__tulkinta::before {
	top: 1px;
	width: 21px;
	height: 21px;
	background: var(--pa-color-text);
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 11v6M12 7.5h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.pa-jakso__tulkinta::after {
	top: 30px;
	bottom: 4px;
	left: 10px;
	width: 1px;
	background: var(--pa-color-line);
}

/* Listener request: a block of its own on the lighter surface, apart from the episode links */
.pa-jakso__toive {
	margin-top: 56px;
}
.pa-jakso__toive-laatikko {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px 24px;
	padding: 22px 24px;
	border: 1px solid var(--pa-color-line);
	border-radius: 10px;
	background: var(--pa-color-surface);
}
.pa-jakso__toive p {
	flex: 1 1 320px;
	margin: 0;
	font-size: 16px;
	line-height: 1.6;
	color: var(--pa-color-text);
}
.pa-jakso__toive strong {
	color: var(--pa-color-ink);
}

/* Related episodes: the cards of the archive in the page width; fewer than three fill the reading column in two
   columns (the card styles are scoped to an ID, hence !important) */
.pa-jakso__samankaltaiset {
	margin-top: 80px;
}
@media (min-width: 1025px) {
	.pa-jakso__samankaltaiset.pa-palsta .pa-egp__results {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
}
.pa-jakso .pa-jakso__samankaltaiset-otsikko {
	margin: 0 0 24px;
	font-family: var(--pa-font-display);
	font-size: 32px;
	font-weight: var(--pa-weight-display);
	line-height: 1.1;
	color: var(--pa-color-ink);
}

@media (max-width: 600px) {
	.pa-jakso__toive-laatikko {
		padding: 18px 18px 20px;
	}
	.pa-jakso__samankaltaiset {
		margin-top: 64px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pa-jakso__aiheet-lista a {
		transition: none;
	}
}
