/* Category-first accordion view on the document archive.
 *
 * Every selector is scoped under `.ova-doc-archive` so the styles win against
 * aggressive theme defaults (e.g. theme-wide `button` resets or `ul li` rules).
 *
 * Markup (rendered by ova_doc_render_categories_accordion()):
 *   <ul class="ova-doc-categories-accordion">
 *     <li class="ova-doc-cat-item [.is-open]" data-slug="...">
 *       <button class="ova-doc-cat-toggle" aria-expanded="true|false">
 *         <span class="ova-doc-cat-chevron"></span>
 *         <span class="ova-doc-cat-name">...</span>
 *         <span class="ova-doc-cat-count">N</span>
 *       </button>
 *       <ul class="ova-doc-cat-posts" [hidden]>
 *         <li class="ova-doc-cat-post"><a>...</a></li>
 *       </ul>
 *     </li>
 *   </ul>
 */

.ova-doc-archive .ova-doc-categories-accordion {
	list-style: none;
	margin: 0;
	padding: 0;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	font-size: 1rem;
	line-height: 1.5;
}

.ova-doc-archive .ova-doc-cat-item {
	list-style: none;
	margin: 0;
	padding: 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.ova-doc-archive .ova-doc-cat-item::before,
.ova-doc-archive .ova-doc-cat-post::before,
.ova-doc-archive .ova-doc-cat-empty::before {
	/* defeat themes that inject custom bullets via ::before */
	content: none;
}

.ova-doc-archive .ova-doc-cat-toggle {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 0.75em;
	margin: 0;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	padding: 0.9em 1em;
	font: inherit;
	color: inherit;
	text-align: left;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 120ms ease;
}

.ova-doc-archive .ova-doc-cat-toggle:hover,
.ova-doc-archive .ova-doc-cat-toggle:focus-visible {
	background-color: rgba(0, 0, 0, 0.04);
	outline: none;
}

.ova-doc-archive .ova-doc-cat-toggle:focus-visible {
	box-shadow: inset 0 0 0 2px currentColor;
}

/* Inner spans never receive pointer events: every click lands on the
 * <button> itself, which keeps the JS handler simple and avoids the
 * Firefox/Safari quirk where the click target can be a child element
 * rather than the button. */
.ova-doc-archive .ova-doc-cat-toggle > * {
	pointer-events: none;
}

.ova-doc-archive .ova-doc-cat-chevron {
	width: 0.9em;
	height: 0.9em;
	flex: 0 0 auto;
	display: inline-block;
	position: relative;
	transition: transform 180ms ease;
}

.ova-doc-archive .ova-doc-cat-chevron::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0.55em;
	height: 0.55em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translate(-50%, -65%) rotate(-45deg);
}

.ova-doc-archive .ova-doc-cat-item.is-open > .ova-doc-cat-toggle .ova-doc-cat-chevron {
	transform: rotate(90deg);
}

.ova-doc-archive .ova-doc-cat-name {
	flex: 1 1 auto;
	font-weight: 600;
	font-size: 1.05em;
	line-height: 1.3;
	word-break: break-word;
}

.ova-doc-archive .ova-doc-cat-count {
	flex: 0 0 auto;
	min-width: 1.8em;
	padding: 0.15em 0.55em;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.07);
	font-size: 0.85em;
	font-weight: 600;
	text-align: center;
	color: inherit;
}

.ova-doc-archive .ova-doc-cat-posts {
	list-style: none;
	margin: 0;
	padding: 0 1em 0.5em 2.6em;
}

.ova-doc-archive .ova-doc-cat-posts[hidden] {
	display: none;
}

.ova-doc-archive .ova-doc-cat-post {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ova-doc-archive .ova-doc-cat-post + .ova-doc-cat-post {
	border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

.ova-doc-archive .ova-doc-cat-post a {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1em;
	padding: 0.55em 0;
	color: inherit;
	text-decoration: none;
	border: 0;
	background: transparent;
	box-shadow: none;
}

.ova-doc-archive .ova-doc-cat-post a:hover .ova-doc-cat-post-title,
.ova-doc-archive .ova-doc-cat-post a:focus-visible .ova-doc-cat-post-title {
	text-decoration: underline;
}

.ova-doc-archive .ova-doc-cat-post-title {
	flex: 1 1 auto;
	line-height: 1.4;
	word-break: break-word;
}

.ova-doc-archive .ova-doc-cat-post-date {
	flex: 0 0 auto;
	font-size: 0.85em;
	opacity: 0.7;
	white-space: nowrap;
}

.ova-doc-archive .ova-doc-cat-empty {
	list-style: none;
	font-style: italic;
	opacity: 0.7;
	padding: 0.4em 0;
}

.ova-doc-archive .ova-doc-empty {
	padding: 1em 0;
	font-style: italic;
	opacity: 0.7;
}

@media (max-width: 600px) {
	.ova-doc-archive .ova-doc-cat-posts {
		padding-left: 1.6em;
	}

	.ova-doc-archive .ova-doc-cat-post a {
		flex-direction: column;
		align-items: stretch;
		gap: 0.15em;
	}

	.ova-doc-archive .ova-doc-cat-post-date {
		font-size: 0.8em;
	}
}
