/*
 * Episode screen — templates/single.html (prototype "05 Епизод").
 * Loaded on single posts only (inc/screens/episode.php) and in the editor.
 *
 * Markup contract (all core blocks, generated by scripts/gen-episode-news-templates.py):
 *   .hc-episode                 the band, 1200px
 *     .hc-crumbs                Начало › Предавания › [show button .hc-crumbs__show]
 *     .hc-player | figure.hc-episode__media   player, or the featured image when there is no video
 *     .hc-episode__cols
 *       .hc-episode__main       show button, H1, .hc-episode__byline (speakers + .hc-episode__meta), .hc-prose,
 *                               .hc-episode__topics (Post Terms: topic links)
 *       .hc-episode__side
 *         aside.hc-episode__aside .hc-episode__aside-head (H2 + .hc-autoplay), Query Loop, note
 *         .hc-sharebar          label + .hc-share (copy link, Facebook, Viber as icon buttons)
 *     .hc-episode__more         section head + rail
 */

/* Band: the old flex column of style.css §19 does not apply to block markup. */
.wp-block-group.hc-episode { padding-top: 0; }
.hc-episode > .wp-block-spacer + .wp-block-spacer { display: none; }

/* Breadcrumbs. */
.wp-block-group.hc-crumbs { gap: 8px; }
.hc-crumbs > * { margin: 0; }
.hc-crumbs p { font-size: 13px; font-weight: 600; line-height: 1.4; }
.hc-crumbs .wp-block-button .wp-block-button__link {
	min-height: 0;
	padding: 0;
	border-radius: 0;
	background: none;
	color: var(--hc-ink);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
}
.hc-crumbs .wp-block-button .wp-block-button__link:hover { background: none; color: var(--hc-accent-ink); }

/* Featured image in place of the player. */
figure.hc-episode__media {
	margin: 0;
	aspect-ratio: 16 / 9;
	border-radius: clamp(14px, 2vw, 22px);
	overflow: hidden;
	background: var(--hc-card);
}
figure.hc-episode__media img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Two columns that wrap. */
.wp-block-group.hc-episode__cols { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.hc-episode__cols > * { margin-block: 0; }
.hc-episode__main > *,
.hc-episode__aside > * { margin-block: 0; }

/* Show name above the title: a bound Button that reads as a label. */
.wp-block-button.hc-episode__show .wp-block-button__link {
	min-height: 0;
	padding: 0;
	border-radius: 0;
	background: none;
	color: var(--hc-accent-ink);
	font-size: 12px;
	font-weight: 800;
	letter-spacing: .08em;
	line-height: 1.3;
	text-transform: uppercase;
	text-align: left;
}
.wp-block-button.hc-episode__show .wp-block-button__link:hover { background: none; text-decoration: underline; }
/* No show: the bound button has no label. */
.wp-block-button:is(.hc-episode__show, .hc-crumbs__show) .wp-block-button__link:empty { display: none; }
.hc-crumbs:has(.wp-block-button__link:empty) > .hc-crumbs__sep:nth-last-child(2) { display: none; }

h1.hc-episode__title { text-transform: none; font-weight: 700; }

/* Date · duration. The dot belongs to the duration, so it goes when there is no video. */
.wp-block-group.hc-episode__meta { gap: 10px; }
.hc-episode__meta > p { margin: 0; }
.hc-episode__meta > p + p:not(:empty) { display: inline-flex; align-items: center; gap: 10px; }
.hc-episode__meta > p + p:not(:empty)::before {
	content: "";
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: currentColor;
}

/* Speaker + date between two lines (design "Speaker and Share" 3a). */
.wp-block-group.hc-episode__byline {
	gap: 16px;
	padding: 14px 0;
	border-top: 1px solid var(--hc-line);
	border-bottom: 1px solid var(--hc-line);
}
.hc-episode__byline > * { margin: 0; }
.hc-episode__byline .hc-episode__meta { font-size: 15px; }

/* Description. */
.hc-episode__main > .wp-block-post-content.hc-prose { margin-top: 6px; }

/* Topics under the description: the look of .hc-chip--tag, as links to /tema/<slug>/. */
.wp-block-post-terms.hc-episode__topics { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.hc-episode__topics a {
	padding: 5px 10px;
	border-radius: 8px;
	background: var(--hc-chip);
	color: var(--hc-ink);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: .08em;
	text-transform: uppercase;
	text-decoration: none;
	transition: background .15s;
}
.hc-episode__topics a:hover { background: var(--hc-chip2); }

/* Side column: "Следва" card, then the share bar (which stays when there is no next episode). */
.wp-block-group.hc-episode__side { flex: 1 1 300px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.hc-episode__side > * { margin-block: 0; }
.hc-episode__side > .hc-episode__aside { flex: none; }

/* "Следва". */
aside.hc-episode__aside.wp-block-group { display: flex; }
.hc-episode__aside:not(:has(.wp-block-post-template > li)) { display: none; }
.wp-block-group.hc-episode__aside-head { gap: 12px; }
.hc-episode__aside-head > * { margin: 0; }
h2.hc-episode__aside-title { font-size: 13px; letter-spacing: 0; line-height: 1.2; }

/* Autoplay switch: a Button block; the class sits on the <button> on the site, on the wrapper in the editor. */
.wp-block-button .wp-block-button__link.hc-autoplay,
.wp-block-button.hc-autoplay .wp-block-button__link {
	position: relative;
	min-height: 20px;
	padding: 0 44px 0 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: var(--hc-ink2);
	font-size: 12px;
	font-weight: 700;
	line-height: 20px;
	cursor: pointer;
}
.wp-block-button__link.hc-autoplay:hover,
.wp-block-button.hc-autoplay .wp-block-button__link:hover { background: none; color: var(--hc-ink); }
.wp-block-button__link.hc-autoplay::before,
.wp-block-button.hc-autoplay .wp-block-button__link::before {
	content: "";
	position: absolute;
	right: 0;
	top: 0;
	width: 36px;
	height: 20px;
	border-radius: 999px;
	background: var(--hc-line2);
	transition: background .15s;
}
.wp-block-button__link.hc-autoplay::after,
.wp-block-button.hc-autoplay .wp-block-button__link::after {
	content: "";
	position: absolute;
	right: 18px;
	top: 2px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
	transition: right .15s;
}
.wp-block-button__link.hc-autoplay[aria-pressed="true"]::before,
.wp-block-button.hc-autoplay .wp-block-button__link::before { background: var(--hc-yellow); }
.wp-block-button__link.hc-autoplay[aria-pressed="true"]::after,
.wp-block-button.hc-autoplay .wp-block-button__link::after { right: 2px; }
.wp-block-button__link.hc-autoplay[aria-pressed="false"]::before { background: var(--hc-line2); }
.wp-block-button__link.hc-autoplay[aria-pressed="false"]::after { right: 18px; }

/* Next episode card(s). */
.wp-block-post-template.hc-episode__nextlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.hc-episode__nextlist > li { margin: 0; min-width: 0; }
.wp-block-group.hc-episode__next { position: relative; }
.hc-episode__next > *,
.hc-episode__next-body > * { margin-block: 0; }
.hc-episode__next-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
h3.hc-episode__next-title { font-family: var(--hc-font-body); font-size: 14px; font-weight: 700; line-height: 1.3; letter-spacing: 0; text-transform: none; }
.hc-episode__next-title a { color: inherit; text-decoration: none; }
.hc-episode__next-title a::after { content: ""; position: absolute; inset: 0; z-index: 3; }
.hc-episode__next:hover .hc-episode__next-title a { color: var(--hc-accent-ink); }

/* Yellow play button over the thumbnail. */
.hc-thumb--play > a::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 48px;
	height: 48px;
	margin: -24px 0 0 -24px;
	border-radius: 50%;
	background: var(--hc-yellow);
	z-index: 1;
}
.hc-thumb--play > a::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	margin: -9px 0 0 -4px;
	border-left: 14px solid var(--hc-navy);
	border-top: 9px solid transparent;
	border-bottom: 9px solid transparent;
	z-index: 2;
}

/* The note is for autoplay on; hc.js writes the countdown into it. */
.hc-episode__aside:has(.hc-autoplay[aria-pressed="false"]) .hc-episode__next-note { display: none; }

/*
 * Share bar: label + three icon buttons in one segmented strip. The buttons keep their text
 * ("Копирай линк", "Facebook", "Viber") for screen readers; it is hidden and the icon drawn
 * with a mask. hc.js adds .is-copied to the copy button for 1.6 s.
 */
.wp-block-group.hc-sharebar {
	gap: 0;
	min-height: 52px;
	border-radius: 16px;
	background: var(--hc-card);
	overflow: hidden;
}
.hc-sharebar > * { margin: 0; }
p.hc-sharebar__label {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 18px;
	color: var(--hc-ink3);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
}
p.hc-sharebar__label::before {
	content: "";
	flex: none;
	width: 16px;
	height: 16px;
	background: currentColor;
	-webkit-mask: var(--hc-icon-share) center / contain no-repeat;
	mask: var(--hc-icon-share) center / contain no-repeat;
}
.wp-block-buttons.hc-share { gap: 0; flex-wrap: nowrap; align-items: stretch; }
.hc-share .wp-block-button.hc-share__btn { display: flex; margin: 0; }
.hc-share__btn .wp-block-button__link {
	position: relative;
	display: block;
	width: 60px;
	min-height: 52px;
	padding: 0;
	border: 0;
	border-left: 1px solid var(--hc-line);
	border-radius: 0;
	background: transparent;
	color: var(--hc-ink);
	font-size: 0;
	line-height: 0;
	cursor: pointer;
	transition: background .15s, color .15s;
}
.hc-share__btn .wp-block-button__link::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 18px;
	height: 18px;
	margin: -9px 0 0 -9px;
	background: currentColor;
	-webkit-mask: var(--hc-share-icon) center / contain no-repeat;
	mask: var(--hc-share-icon) center / contain no-repeat;
}
.hc-share--copy { --hc-share-icon: var(--hc-icon-link); }
.hc-share--facebook { --hc-share-icon: var(--hc-icon-facebook); }
.hc-share--viber { --hc-share-icon: var(--hc-icon-viber); }
.hc-share--copy .wp-block-button__link.is-copied { --hc-share-icon: var(--hc-icon-check); color: var(--hc-accent-ink); }
.hc-share--copy .wp-block-button__link:hover { background: var(--hc-card2); color: var(--hc-ink); }
.hc-share--facebook .wp-block-button__link:hover { background: #1877f2; color: #fff; }
.hc-share--viber .wp-block-button__link:hover { background: #7360f2; color: #fff; }
:root {
	--hc-icon-share: 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' stroke-linejoin='round'%3E%3Ccircle cx='18' cy='5' r='3'/%3E%3Ccircle cx='6' cy='12' r='3'/%3E%3Ccircle cx='18' cy='19' r='3'/%3E%3Cpath d='m8.6 13.5 6.8 4M15.4 6.5l-6.8 4'/%3E%3C/svg%3E");
	--hc-icon-link: 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' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E");
	--hc-icon-check: 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.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
	--hc-icon-facebook: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z'/%3E%3C/svg%3E");
	--hc-icon-viber: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11.4 0C9.473.028 5.333.344 3.02 2.467 1.302 4.187.696 6.7.633 9.817.57 12.933.488 18.776 6.12 20.36h.003l-.004 2.416s-.037.977.61 1.177c.777.242 1.234-.5 1.98-1.302.407-.44.972-1.084 1.397-1.58 3.85.326 6.812-.416 7.15-.525.776-.252 5.176-.816 5.892-6.657.74-6.02-.36-9.83-2.34-11.546-.596-.55-3.006-2.3-8.375-2.323 0 0-.395-.025-1.037-.017zm.058 1.693c.545-.004.88.017.88.017 4.542.02 6.717 1.388 7.222 1.846 1.675 1.435 2.53 4.868 1.906 9.897v.002c-.604 4.878-4.174 5.184-4.832 5.395-.28.09-2.882.737-6.153.524 0 0-2.436 2.94-3.197 3.704-.12.12-.26.167-.352.144-.13-.033-.166-.188-.165-.414l.02-4.018c-4.762-1.32-4.485-6.292-4.43-8.895.054-2.604.543-4.738 1.996-6.173 1.96-1.773 5.474-2.018 7.11-2.03zm.38 2.602c-.167 0-.303.135-.304.302 0 .167.133.303.3.305 1.624.01 2.946.537 4.028 1.592 1.073 1.046 1.62 2.468 1.633 4.334.002.167.14.3.307.3.166-.002.3-.138.3-.304-.014-1.984-.618-3.596-1.816-4.764-1.19-1.16-2.692-1.753-4.447-1.765zm-3.96.695c-.19-.032-.4.005-.616.117l-.01.002c-.43.247-.816.562-1.146.932-.002.004-.006.004-.008.008-.267.323-.42.638-.46.948-.008.046-.01.093-.007.14 0 .136.022.27.065.4l.013.01c.135.48.473 1.276 1.205 2.604.42.768.903 1.5 1.446 2.186.27.344.56.673.87.984l.132.132c.31.308.64.6.984.87.686.543 1.418 1.027 2.186 1.447 1.328.733 2.126 1.07 2.604 1.206l.01.014c.13.042.265.064.402.063.046.002.092 0 .138-.008.31-.036.627-.19.948-.46.004 0 .003-.002.008-.005.37-.33.683-.72.93-1.148l.003-.01c.225-.432.15-.842-.18-1.12-.004 0-.698-.58-1.037-.83-.36-.255-.73-.492-1.113-.71-.51-.285-1.032-.106-1.248.174l-.447.564c-.23.283-.657.246-.657.246-3.12-.796-3.955-3.955-3.955-3.955s-.037-.426.248-.656l.563-.448c.277-.215.456-.737.17-1.248-.217-.383-.454-.756-.71-1.115-.25-.34-.826-1.033-.83-1.035-.137-.165-.31-.265-.502-.297zm4.49.88c-.158.002-.29.124-.3.282-.01.167.115.312.282.324 1.16.085 2.017.466 2.645 1.15.63.688.93 1.524.906 2.57-.002.168.13.306.3.31.166.003.305-.13.31-.297.025-1.175-.334-2.193-1.067-2.994-.74-.81-1.777-1.253-3.05-1.346h-.024zm.463 1.63c-.16.002-.29.127-.3.287-.008.167.12.31.288.32.523.028.875.175 1.113.422.24.245.388.62.416 1.164.01.167.15.295.318.287.167-.008.295-.15.287-.317-.03-.644-.215-1.178-.58-1.557-.367-.378-.893-.574-1.52-.607h-.018z'/%3E%3C/svg%3E");
}

/* "Още от тази поредица". */
.hc-episode__more > * { margin-block: 0; }
.hc-episode__more > * + * { margin-top: 16px; }
.hc-episode__more:not(:has(.wp-block-post-template > li)) { display: none; }
.hc-episode > .wp-block-spacer:has(+ .hc-episode__more:not(:has(.wp-block-post-template > li))) { display: none; }

@media (max-width: 959px) {
	.hc-episode__cols > .hc-episode__main,
	.hc-episode__cols > .hc-episode__side { flex: 1 1 100%; }
}

/* Editor: loops have no current post there, keep everything visible. */
.editor-styles-wrapper .hc-episode__aside,
.editor-styles-wrapper .hc-episode__more { display: flex; }
.editor-styles-wrapper .hc-episode__more { display: block; }
.editor-styles-wrapper .hc-episode__next-title a::after { content: none; }
