/* PollyVox v0.13 — pill header, mobile article meta, TOC and plugin bridge. */

/* --------------------------------------------------------------------------
   Beebom-inspired pill header, using PollyVox branding and tokens
   -------------------------------------------------------------------------- */
.pv-masthead {
	border: 0;
	background: transparent;
	color: var(--pv-header-ink);
	isolation: isolate;
}

.pv-masthead__frame {
	padding-block: var(--pv-header-outer-gap);
	background: var(--pv-surface);
}

.pv-masthead__container {
	position: relative;
}

.pv-header-shell-wide .pv-masthead__container {
	width: calc(100% - max(24px, var(--pv-header-outer-gap) * 2));
	max-width: 1560px;
}

.pv-header-shell-full .pv-masthead__container {
	width: 100%;
	max-width: none;
	padding-inline: var(--pv-header-outer-gap);
}

.pv-masthead__shell {
	position: relative;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: clamp(14px, 2vw, 30px);
	min-height: var(--pv-header-height);
	padding: 7px var(--pv-header-inner-padding);
	border: var(--pv-header-shell-border-width) solid var(--pv-header-shell-border);
	border-radius: var(--pv-header-shell-radius);
	background: var(--pv-header-bg);
	color: var(--pv-header-ink);
}

.pv-header-shadow .pv-masthead__shell {
	box-shadow: 0 10px 30px color-mix(in srgb, var(--pv-ink) 9%, transparent);
}

.pv-masthead--sticky {
	background: color-mix(in srgb, var(--pv-surface) 88%, transparent);
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
}

.pv-brand,
.pv-masthead__actions {
	position: relative;
	z-index: 3;
}

.pv-brand .custom-logo {
	max-height: min(var(--pv-logo-height), calc(var(--pv-header-height) - 18px));
}

.pv-nav {
	min-width: 0;
	margin: 0;
	justify-self: center;
}

.pv-nav__list {
	justify-content: center;
	align-items: center;
	gap: var(--pv-header-nav-gap);
}

.pv-header-pill .pv-nav__list > li > a {
	min-height: 38px;
	padding: var(--pv-header-item-y) var(--pv-header-item-x);
	border-width: 1px;
	border-style: solid;
	border-color: color-mix(in srgb, var(--pv-header-ink) 20%, transparent);
	border-radius: 999px;
	font-size: clamp(.78rem, .72rem + .18vw, .9rem);
	font-weight: 700;
	letter-spacing: -.01em;
	white-space: nowrap;
}

.pv-header-item-flat.pv-header-pill .pv-nav__list > li > a {
	border-color: transparent;
}

.pv-header-pill .pv-nav__list > li.current-menu-ancestor > a,
.pv-header-pill .pv-nav__list > li.current-post-ancestor > a {
	border-color: color-mix(in srgb, var(--pv-accent) 55%, transparent);
	color: var(--pv-accent);
}

.pv-masthead__actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 7px;
}

.pv-search-toggle,
.pv-menu-toggle,
.pv-theme-toggle {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid color-mix(in srgb, var(--pv-header-ink) 20%, transparent);
	border-radius: 50%;
	background: color-mix(in srgb, var(--pv-header-bg) 92%, var(--pv-header-ink) 8%);
	color: var(--pv-header-ink);
}

.pv-search-toggle svg,
.pv-menu-toggle svg,
.pv-theme-toggle svg {
	width: 19px;
	height: 19px;
}

.pv-menu-toggle__close,
.pv-menu-toggle[aria-expanded="true"] .pv-menu-toggle__open {
	display: none;
}

.pv-menu-toggle[aria-expanded="true"] .pv-menu-toggle__close {
	display: block;
}

.pv-search-toggle:hover,
.pv-menu-toggle:hover,
.pv-theme-toggle:hover,
.pv-search-toggle:focus-visible,
.pv-menu-toggle:focus-visible,
.pv-theme-toggle:focus-visible {
	border-color: var(--pv-accent);
	background: color-mix(in srgb, var(--pv-accent) 11%, var(--pv-header-bg));
	color: var(--pv-accent);
}

.pv-searchbar {
	padding: 0 0 var(--pv-header-outer-gap);
	border: 0;
	background: var(--pv-surface);
}

.pv-searchbar__shell {
	padding: 10px;
	border: 1px solid var(--pv-card-border);
	border-radius: 999px;
	background: var(--pv-header-bg);
	box-shadow: 0 12px 28px color-mix(in srgb, var(--pv-ink) 9%, transparent);
}

.pv-searchbar .search-form {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 8px;
}

.pv-searchbar input[type="search"] {
	min-height: 44px;
	padding-inline: 18px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--pv-ink);
}

.pv-searchbar input[type="submit"],
.pv-searchbar button[type="submit"] {
	min-height: 44px;
	padding-inline: 20px;
	border-radius: 999px;
}

.pv-topicbar {
	padding: 0 0 var(--pv-header-outer-gap);
	border: 0;
	background: var(--pv-surface);
}

.pv-topicbar__list {
	gap: 8px;
}

.pv-header-pill .pv-topicbar__list > li > a {
	background: var(--pv-topic-bg);
}

[data-pv-theme="dark"] .pv-masthead__shell,
[data-pv-theme="dark"] .pv-searchbar__shell,
[data-pv-theme="dark"] .pv-nav__list .sub-menu {
	border-color: var(--pv-card-border);
}

/* --------------------------------------------------------------------------
   Configurable article metadata
   -------------------------------------------------------------------------- */
.pv-byline--article {
	position: relative;
	gap: var(--pv-meta-gap);
}

.pv-byline--article.pv-byline--outlined {
	margin-top: 1rem;
	padding: var(--pv-meta-padding);
	border: 1px solid var(--pv-card-border);
	border-radius: var(--pv-meta-radius);
	background: var(--pv-panel-soft, color-mix(in srgb, var(--pv-surface) 96%, var(--pv-ink) 4%));
}

.pv-byline--article.pv-byline--no-avatar {
	grid-template-columns: minmax(0, 1fr);
}

.pv-meta-spectrum .pv-byline--article::after {
	content: "";
	position: absolute;
	inset: -1px;
	z-index: -1;
	padding: 1px;
	border-radius: inherit;
	background: linear-gradient(90deg, #0879ed, #a83ee8 38%, #ec3b8f 65%, #f28a00 84%, #f33a22);
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	opacity: 0;
	pointer-events: none;
	transition: opacity .18s ease;
}

.pv-meta-spectrum .pv-byline--article:hover::after,
.pv-meta-spectrum .pv-byline--article:focus-within::after {
	opacity: 1;
}

.pv-byline__role {
	font-weight: 650;
}

.pv-byline__role-separator {
	color: color-mix(in srgb, var(--pv-ink) 36%, transparent);
}

/* --------------------------------------------------------------------------
   Reading progress and generated table of contents
   -------------------------------------------------------------------------- */
.pv-reading-progress {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100000;
	height: 3px;
	pointer-events: none;
}

.admin-bar .pv-reading-progress {
	top: 32px;
}

.pv-reading-progress span {
	display: block;
	width: 100%;
	height: 100%;
	transform: scaleX(0);
	transform-origin: left center;
	background: linear-gradient(90deg, #0879ed, #a83ee8 38%, #ec3b8f 65%, #f28a00 84%, #f33a22);
}

.pv-toc {
	margin-block: 1.6rem;
	padding: 14px 16px;
	border: 1px solid var(--pv-card-border);
	border-radius: 10px;
	background: var(--pv-panel-soft, color-mix(in srgb, var(--pv-surface) 96%, var(--pv-ink) 4%));
}

.pv-toc__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	width: 100%;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--pv-ink);
	font: inherit;
	font-weight: 800;
	text-align: left;
	cursor: pointer;
}

.pv-toc__toggle svg {
	width: 20px;
	height: 20px;
	transition: transform .18s ease;
}

.pv-toc__list {
	display: grid;
	gap: 7px;
	margin: 13px 0 0;
	padding: 13px 0 0 1.25rem;
	border-top: 1px solid var(--pv-card-border);
}

.pv-toc__item--h3 {
	margin-inline-start: 1rem;
	font-size: .92em;
}

.pv-toc a {
	color: var(--pv-ink);
	text-decoration: none;
}

.pv-toc a:hover,
.pv-toc a:focus-visible {
	color: var(--pv-accent);
}

.pv-toc.is-collapsed .pv-toc__list {
	display: none;
}

.pv-toc.is-collapsed .pv-toc__toggle svg {
	transform: rotate(-90deg);
}

.pv-article__body :is(h2, h3)[id] {
	scroll-margin-top: calc(var(--pv-header-height) + 28px);
}

/* Pvox Admin theme bridge uses the plugin's native card system. */
.pvox-action-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 14px;
}

/* --------------------------------------------------------------------------
   Responsive header and metadata
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
	.pv-masthead__shell {
		gap: 12px;
	}

	.pv-header-pill .pv-nav__list > li > a {
		padding-inline: max(9px, calc(var(--pv-header-item-x) - 4px));
		font-size: .78rem;
	}
}

@media (max-width: 1024px) {
	.pv-masthead__shell {
		grid-template-columns: minmax(0, 1fr) auto;
		min-height: max(58px, var(--pv-header-height));
	}

	.pv-brand .custom-logo {
		width: var(--pv-logo-width-mobile);
		max-height: var(--pv-logo-height-mobile);
	}

	.pv-menu-toggle {
		display: inline-flex;
	}

	.pv-nav {
		position: absolute;
		top: calc(100% + 10px);
		left: 0;
		right: 0;
		z-index: 20;
		display: none;
		max-height: min(72vh, 620px);
		margin: 0;
		padding: 12px;
		overflow: auto;
		border: 1px solid var(--pv-card-border);
		border-radius: var(--pv-header-mobile-radius);
		background: var(--pv-header-bg);
		box-shadow: 0 20px 45px color-mix(in srgb, var(--pv-ink) 18%, transparent);
	}

	.pv-nav.is-open {
		display: block;
	}

	.pv-nav__list {
		align-items: stretch;
		flex-direction: column;
		gap: 5px;
	}

	.pv-header-pill .pv-nav__list > li > a {
		display: flex;
		justify-content: space-between;
		width: 100%;
		min-height: 44px;
		padding: 11px 14px;
		font-size: .92rem;
	}

	.pv-nav__list .sub-menu,
	.pv-header-pill .pv-nav__list .sub-menu {
		position: static;
		display: grid;
		gap: 3px;
		min-width: 0;
		margin: 5px 0 0 14px;
		padding: 4px 0 4px 12px;
		border: 0;
		border-left: 1px solid var(--pv-card-border);
		border-radius: 0;
		background: transparent;
		box-shadow: none;
	}

	.pv-nav__list .sub-menu a {
		padding: 8px 10px;
		border: 0;
	}
}

@media (max-width: 782px) {
	.admin-bar .pv-reading-progress {
		top: 46px;
	}
}

@media (max-width: 680px) {
	.pv-masthead__frame {
		padding-block: max(6px, calc(var(--pv-header-outer-gap) * .7));
	}

	.pv-masthead__container,
	.pv-header-shell-wide .pv-masthead__container {
		width: 100%;
		padding-inline: 10px;
	}

	.pv-masthead__shell {
		padding: 6px 8px 6px 12px;
		border-radius: min(var(--pv-header-shell-radius), 24px);
	}

	.pv-masthead__actions {
		gap: 5px;
	}

	.pv-search-toggle,
	.pv-menu-toggle,
	.pv-theme-toggle {
		width: 38px;
		height: 38px;
	}

	.pv-cta--header {
		display: none;
	}

	.pv-byline--article {
		grid-template-columns: var(--pv-meta-mobile-avatar) minmax(0, 1fr);
		gap: var(--pv-meta-gap);
		padding-block: 10px;
	}

	.pv-byline--article .pv-byline__avatar {
		width: var(--pv-meta-mobile-avatar);
		height: var(--pv-meta-mobile-avatar);
	}

	.pv-byline--article.pv-byline--no-avatar {
		grid-template-columns: minmax(0, 1fr);
	}

	.pv-byline__content {
		gap: 5px;
	}

	.pv-byline__identity {
		column-gap: 5px;
		row-gap: 1px;
		font-size: .82rem;
	}

	.pv-byline--article .pv-byline__role {
		width: auto;
		padding: 0;
		border: 0;
		font-size: inherit;
	}

	.pv-byline__details {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, auto));
		justify-content: start;
		column-gap: 10px;
		row-gap: 2px;
		font-size: .68rem;
	}

	.pv-byline__details > * + *::before {
		display: none;
	}

	.pv-meta-mobile-card .pv-byline--article,
	.pv-meta-mobile-stacked .pv-byline--article {
		padding: var(--pv-meta-padding);
		border: 1px solid var(--pv-card-border);
		border-radius: var(--pv-meta-radius);
		background: var(--pv-panel-soft, color-mix(in srgb, var(--pv-surface) 96%, var(--pv-ink) 4%));
	}

	.pv-meta-mobile-stacked .pv-byline--article {
		grid-template-columns: minmax(0, 1fr);
		justify-items: center;
		text-align: center;
	}

	.pv-meta-mobile-stacked .pv-byline__identity,
	.pv-meta-mobile-stacked .pv-byline__details {
		justify-content: center;
	}

	.pv-meta-mobile-stacked .pv-byline__details {
		grid-template-columns: minmax(0, 1fr);
	}

	.pv-toc {
		margin-block: 1.25rem;
		padding: 13px 14px;
	}

	.pv-toc__item--h3 {
		margin-inline-start: .5rem;
	}

	.pvox-action-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (prefers-reduced-motion: reduce) {
	.pv-toc__toggle svg,
	.pv-meta-spectrum .pv-byline--article::after {
		transition: none;
	}
}

/* Compatibility with earlier mobile byline ordering rules. */
.pv-byline--article > * {
	position: relative;
	z-index: 1;
}

.pv-meta-spectrum .pv-byline--article::after {
	z-index: 0;
}

@media (max-width: 680px) {
	.pv-byline__identity > * {
		order: initial;
	}
	.pv-byline__prefix {
		display: inline;
	}
}
