/*
 * Knowledge base — layout only. Every colour comes from the global host.yt
 * design tokens, so this file needs no dark/light branches.
 */

.hy-kb { display: grid; gap: var(--hy-space-10); }

.hy-kb__search { max-width: 640px; margin-inline: auto; width: 100%; }

.hy-kb__cat { display: grid; gap: var(--hy-space-3); align-content: start; }
.hy-kb__cat .hy-card__title a { color: inherit; text-decoration: none; }
.hy-kb__cat .hy-card__title a:hover { color: var(--hy-brand-500); }

.hy-kb__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--hy-space-2); }
.hy-kb__list a {
	display: block;
	padding: 2px 0;
	font-size: .9375rem;
	color: var(--hy-text-secondary);
	text-decoration: none;
	transition: color var(--hy-dur-fast) var(--hy-ease);
}
.hy-kb__list a:hover { color: var(--hy-text-primary); }

.hy-kb__more {
	font: var(--hy-text-body-sm);
	font-weight: 600;
	color: var(--hy-brand-500);
	text-decoration: none;
}
.hy-kb__more:hover { color: var(--hy-brand-600); }

/* ---------------------------------------------------------- article --- */

.hy-kb-article { max-width: 76ch; margin-inline: auto; }
.hy-kb-article :is(h2, h3, h4) { margin-top: var(--hy-space-10); }
.hy-kb-article p, .hy-kb-article li { color: var(--hy-text-secondary); }
.hy-kb-article a { color: var(--hy-brand-500); text-underline-offset: 3px; }

.hy-kb-article :is(pre, code) { font-family: var(--hy-font-mono); font-size: .875rem; }
.hy-kb-article code {
	padding: 2px 6px;
	border: 1px solid var(--hy-border-subtle);
	border-radius: var(--hy-radius-xs);
	background: var(--hy-surface-2);
	color: var(--hy-text-primary);
}
.hy-kb-article pre {
	overflow-x: auto;
	padding: var(--hy-space-5);
	border: 1px solid var(--hy-border-subtle);
	border-radius: var(--hy-radius-md);
	background: var(--hy-surface-2);
}
.hy-kb-article pre code { padding: 0; border: 0; background: none; }

.hy-kb-article blockquote {
	margin: var(--hy-space-6) 0;
	padding: var(--hy-space-4) var(--hy-space-5);
	border-left: 2px solid var(--hy-brand-500);
	background: var(--hy-brand-tint);
	border-radius: 0 var(--hy-radius-sm) var(--hy-radius-sm) 0;
}
.hy-kb-article blockquote p:last-child { margin-bottom: 0; }

.hy-kb-article img { max-width: 100%; height: auto; border-radius: var(--hy-radius-md); }

.hy-kb-article table {
	width: 100%;
	border-collapse: collapse;
	font-size: .9375rem;
}
.hy-kb-article th, .hy-kb-article td {
	padding: var(--hy-space-3) var(--hy-space-4);
	border-bottom: 1px solid var(--hy-border-subtle);
	text-align: left;
}
.hy-kb-article th { color: var(--hy-text-primary); }

/* ------------------------------------------------------- kb templates --- */

.hy-kb-shell { padding-block: var(--hy-space-10) var(--hy-space-20); }
/* Docs need more room than a marketing page: widen only inside the KB. */
.hy-kb-shell .hy-container { max-width: 1400px; }

/* Breadcrumbs */
.hy-kb-crumbs ol {
	display: flex; flex-wrap: wrap; align-items: center;
	gap: var(--hy-space-2);
	margin: 0 0 var(--hy-space-8); padding: 0; list-style: none;
	font-size: .8125rem; color: var(--hy-text-muted);
}
.hy-kb-crumbs li + li::before { content: "/"; margin-right: var(--hy-space-2); color: var(--hy-border-strong); }
.hy-kb-crumbs a { color: var(--hy-text-secondary); text-decoration: none; }
.hy-kb-crumbs a:hover { color: var(--hy-text-primary); }
.hy-kb-crumbs [aria-current] { color: var(--hy-text-primary); }

/* Hero + search */
.hy-kb-hero { display: grid; gap: var(--hy-space-4); margin-bottom: var(--hy-space-12); }
.hy-kb-hero__title { font: var(--hy-text-h1); margin: 0; color: var(--hy-text-primary); }
.hy-kb-hero__lede { font: var(--hy-text-body-lg); margin: 0; max-width: 62ch; color: var(--hy-text-secondary); }

.hy-kb-search { position: relative; max-width: 560px; width: 100%; margin-top: var(--hy-space-2); }

/*
 * The FORM carries the box, not the input. Themes routinely restyle
 * `input[type=search]` padding, which used to slide the text under an
 * absolutely positioned icon. As flex siblings they cannot collide.
 */
.hy-kb-search__form {
	display: flex; align-items: center; gap: var(--hy-space-3);
	min-height: var(--hy-control-h);
	padding-inline: var(--hy-space-4);
	background: var(--hy-surface-1);
	border: 1px solid var(--hy-border-default);
	border-radius: var(--hy-radius-md);
	transition: border-color var(--hy-dur-fast) var(--hy-ease);
}
.hy-kb-search__form:focus-within {
	border-color: var(--hy-brand-500);
	outline: 2px solid var(--hy-brand-500); outline-offset: 2px;
}
.hy-kb-search__icon {
	flex: 0 0 auto;
	width: 18px; height: 18px;
	color: var(--hy-text-muted);
	pointer-events: none;
}
.hy-kb-search__input {
	flex: 1 1 auto; min-width: 0;
	/* Beat the theme's own input rules without an !important. */
	height: auto; margin: 0; padding: var(--hy-space-3) 0;
	font: var(--hy-text-body); line-height: 1.4;
	color: var(--hy-text-primary);
	background: none; border: 0; border-radius: 0; box-shadow: none;
	-webkit-appearance: none; appearance: none;
}
.hy-kb-search__input::placeholder { color: var(--hy-text-muted); opacity: 1; }
.hy-kb-search__input:focus, .hy-kb-search__input:focus-visible { outline: none; box-shadow: none; }
.hy-kb-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Three-column shell: nav | article | on-this-page */
.hy-kb-layout { display: grid; gap: var(--hy-space-10); align-items: start; }
/* Without this a long sidebar title widens its track and overlaps the body. */
.hy-kb-layout > * { min-width: 0; }
@media (min-width: 900px) {
	.hy-kb-layout { grid-template-columns: 260px minmax(0, 1fr); }
}
@media (min-width: 1200px) {
	.hy-kb-shell--article .hy-kb-layout { grid-template-columns: 260px minmax(0, 1fr) 240px; }
}
.hy-kb-layout__side, .hy-kb-layout__toc { position: sticky; top: var(--hy-space-24); align-self: start; }
@media (max-width: 899px) {
	.hy-kb-layout__side { position: static; }
	.hy-kb-layout__toc { display: none; }
}
@media (min-width: 900px) and (max-width: 1199px) {
	.hy-kb-layout__toc { display: none; }
}

/* Category nav */
.hy-kb-nav { font-size: .875rem; }
.hy-kb-nav__home {
	display: inline-block; margin-bottom: var(--hy-space-6);
	color: var(--hy-text-secondary); text-decoration: none;
}
.hy-kb-nav__home:hover { color: var(--hy-text-primary); }
.hy-kb-nav__label {
	margin: 0 0 var(--hy-space-3);
	font-size: .6875rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
	color: var(--hy-text-muted);
}
.hy-kb-nav__cats, .hy-kb-nav__articles { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--hy-space-1); }
.hy-kb-nav__cats > li > a {
	display: block; padding: var(--hy-space-2) var(--hy-space-3);
	border-radius: var(--hy-radius-sm);
	color: var(--hy-text-secondary); text-decoration: none;
	transition: background var(--hy-dur-fast) var(--hy-ease), color var(--hy-dur-fast) var(--hy-ease);
}
.hy-kb-nav__cats > li > a:hover { background: var(--hy-surface-2); color: var(--hy-text-primary); }
.hy-kb-nav__cat.is-current > a { color: var(--hy-brand-500); font-weight: 600; }
.hy-kb-nav__articles {
	margin: var(--hy-space-2) 0 var(--hy-space-4);
	padding-inline-start: var(--hy-space-3);
	border-inline-start: 1px solid var(--hy-border-subtle);
}
.hy-kb-nav__articles a {
	display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
	padding: var(--hy-space-2) var(--hy-space-3);
	color: var(--hy-text-secondary); text-decoration: none;
	line-height: 1.35;
	overflow: hidden; overflow-wrap: anywhere;
}
.hy-kb-nav__articles a:hover { color: var(--hy-text-primary); }
.hy-kb-nav__articles .is-current a { color: var(--hy-brand-500); font-weight: 600; }

/* Article head */
.hy-kb-head { margin-bottom: var(--hy-space-8); }
.hy-kb-head__row {
	display: flex; align-items: flex-start; justify-content: space-between;
	gap: var(--hy-space-4); flex-wrap: wrap;
}
.hy-kb-head__row .hy-kb-head__title { flex: 1 1 20ch; }
.hy-kb-head__title { font: var(--hy-text-h1); margin: 0 0 var(--hy-space-3); color: var(--hy-text-primary); }
.hy-kb-head__meta { margin: 0; font-size: .8125rem; color: var(--hy-text-muted); }
.hy-kb-article { max-width: 78ch; margin-inline: 0; }

/* On this page */
.hy-kb-toc { font-size: .8125rem; }
.hy-kb-toc__label {
	margin: 0 0 var(--hy-space-3);
	font-size: .6875rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
	color: var(--hy-text-muted);
}
.hy-kb-toc ul { list-style: none; margin: 0; padding: 0; border-inline-start: 1px solid var(--hy-border-subtle); }
.hy-kb-toc a {
	display: block; padding: var(--hy-space-2) var(--hy-space-4);
	margin-inline-start: -1px;
	border-inline-start: 2px solid transparent;
	color: var(--hy-text-secondary); text-decoration: none;
}
.hy-kb-toc a:hover { color: var(--hy-text-primary); }
.hy-kb-toc__l3 a { padding-inline-start: var(--hy-space-7); }

/* Prev / next */
.hy-kb-adjacent {
	display: grid; gap: var(--hy-space-4);
	margin-top: var(--hy-space-16); padding-top: var(--hy-space-8);
	border-top: 1px solid var(--hy-border-subtle);
}
@media (min-width: 640px) { .hy-kb-adjacent { grid-template-columns: 1fr 1fr; } }
.hy-kb-adjacent__link {
	display: grid; gap: var(--hy-space-1);
	padding: var(--hy-space-4) var(--hy-space-5);
	border: 1px solid var(--hy-border-subtle); border-radius: var(--hy-radius-md);
	text-decoration: none;
	transition: border-color var(--hy-dur-fast) var(--hy-ease);
}
.hy-kb-adjacent__link:hover { border-color: var(--hy-border-strong); }
.hy-kb-adjacent__link--next { text-align: end; grid-column: -2; }
.hy-kb-adjacent__dir { font-size: .75rem; color: var(--hy-text-muted); }
.hy-kb-adjacent__title { font-weight: 600; color: var(--hy-text-primary); }

.hy-kb-back { margin-top: var(--hy-space-8); font-size: .875rem; }
.hy-kb-back a { color: var(--hy-text-secondary); text-decoration: none; }
.hy-kb-back a:hover { color: var(--hy-text-primary); }

/* Listing / search results */
.hy-kb-results { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--hy-space-2); }
.hy-kb-results__link {
	display: grid; gap: var(--hy-space-2);
	padding: var(--hy-space-5);
	border: 1px solid var(--hy-border-subtle); border-radius: var(--hy-radius-md);
	text-decoration: none;
	transition: border-color var(--hy-dur-fast) var(--hy-ease), background var(--hy-dur-fast) var(--hy-ease);
}
.hy-kb-results__link:hover { border-color: var(--hy-border-strong); background: var(--hy-surface-2); }
.hy-kb-results__title { font-weight: 600; color: var(--hy-text-primary); }
.hy-kb-results__text { font-size: .875rem; color: var(--hy-text-secondary); }
.hy-kb-empty { color: var(--hy-text-secondary); }

/* Long titles wrap instead of forcing the grid wider. */
.hy-kb-head__title, .hy-kb-results__title, .hy-kb-adjacent__title { overflow-wrap: anywhere; }

/* ---------------------------------------------------------- open in ----- */

.hy-kb-openin { position: relative; flex: 0 0 auto; }
.hy-kb-openin > summary {
	display: inline-flex; align-items: center; gap: var(--hy-space-2);
	padding: var(--hy-space-2) var(--hy-space-3);
	font-size: .8125rem; font-weight: 500;
	color: var(--hy-text-secondary);
	background: var(--hy-surface-1);
	border: 1px solid var(--hy-border-default);
	border-radius: var(--hy-radius-sm);
	cursor: pointer; list-style: none;
	transition: color var(--hy-dur-fast) var(--hy-ease), background var(--hy-dur-fast) var(--hy-ease);
}
.hy-kb-openin > summary::-webkit-details-marker { display: none; }
.hy-kb-openin > summary:hover { color: var(--hy-text-primary); background: var(--hy-surface-2); }
.hy-kb-openin > summary:focus-visible { outline: 2px solid var(--hy-brand-500); outline-offset: 2px; }
.hy-kb-openin > summary svg { width: 12px; height: 12px; opacity: .6; transition: transform var(--hy-dur-fast) var(--hy-ease); }
.hy-kb-openin[open] > summary { color: var(--hy-text-primary); background: var(--hy-surface-2); }
.hy-kb-openin[open] > summary svg { transform: rotate(180deg); }

.hy-kb-openin__menu {
	position: absolute; inset-inline-end: 0; top: calc(100% + var(--hy-space-2));
	z-index: 30; min-width: 240px; padding: var(--hy-space-1);
	background: var(--hy-surface-1);
	border: 1px solid var(--hy-border-default);
	border-radius: var(--hy-radius-md);
	box-shadow: 0 12px 32px rgb(0 0 0 / .18);
}
.hy-kb-openin__menu hr { height: 1px; margin: var(--hy-space-1) 0; border: 0; background: var(--hy-border-subtle); }
.hy-kb-openin__menu a {
	display: flex; align-items: center; gap: var(--hy-space-3);
	padding: var(--hy-space-2) var(--hy-space-3);
	font-size: .875rem; color: var(--hy-text-primary); text-decoration: none;
	border-radius: var(--hy-radius-sm);
}
.hy-kb-openin__menu a:hover { background: var(--hy-surface-2); }
.hy-kb-openin__menu a span { flex: 1; }
.hy-kb-openin__menu a svg { width: 14px; height: 14px; color: var(--hy-text-muted); }

.hy-kb-toc a.is-active {
	color: var(--hy-brand-500);
	border-inline-start-color: var(--hy-brand-500);
	font-weight: 600;
}
/* Anchor jumps must clear the sticky header. */
.hy-kb-article :is(h2, h3) { scroll-margin-top: var(--hy-space-24); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* Date and the Open in menu share one line under the title. */
.hy-kb-head__row {
	display: flex; align-items: center; justify-content: space-between;
	gap: var(--hy-space-4); flex-wrap: wrap;
	margin-top: var(--hy-space-3);
}
.hy-kb-head__row .hy-kb-head__meta { margin: 0; }

/* ------------------------------------------------------ instant search --- */

.hy-kb-search__kbd {
	flex: 0 0 auto;
	display: none;
	min-width: 20px; padding: 2px 6px;
	font: 500 .6875rem/1.4 var(--hy-font-mono, monospace);
	color: var(--hy-text-muted);
	background: var(--hy-surface-2);
	border: 1px solid var(--hy-border-subtle);
	border-radius: var(--hy-radius-xs);
	pointer-events: none;
}
@media (min-width: 900px) { .hy-kb-search__kbd { display: block; } }
.hy-kb-search__form:focus-within .hy-kb-search__kbd { opacity: 0; }

.hy-kb-search__results {
	position: absolute; inset-inline: 0; top: calc(100% + var(--hy-space-2));
	z-index: 40; padding: var(--hy-space-1);
	max-height: min(60vh, 460px); overflow-y: auto;
	background: var(--hy-surface-1);
	border: 1px solid var(--hy-border-default);
	border-radius: var(--hy-radius-md);
	box-shadow: 0 16px 40px rgb(0 0 0 / .22);
}
.hy-kb-search__hit {
	display: flex; align-items: baseline; justify-content: space-between;
	gap: var(--hy-space-4);
	padding: var(--hy-space-3);
	border-radius: var(--hy-radius-sm);
	text-decoration: none;
}
.hy-kb-search__hit:hover, .hy-kb-search__hit.is-active { background: var(--hy-surface-2); }
.hy-kb-search__hit-title { color: var(--hy-text-primary); font-size: .9375rem; }
.hy-kb-search__hit-cat {
	flex: 0 0 auto;
	font-size: .6875rem; letter-spacing: .06em; text-transform: uppercase;
	color: var(--hy-text-muted);
}
.hy-kb-search__empty { margin: 0; padding: var(--hy-space-4); font-size: .875rem; color: var(--hy-text-secondary); }
.hy-kb-search__all {
	display: block; width: 100%;
	margin-top: var(--hy-space-1); padding: var(--hy-space-3);
	font: inherit; font-size: .8125rem; text-align: start;
	color: var(--hy-brand-500);
	background: none; border: 0; border-top: 1px solid var(--hy-border-subtle);
	cursor: pointer;
}
.hy-kb-search__all:hover { color: var(--hy-brand-600); }

/* Article images arrive from Chatwoot at arbitrary sizes. */
.hy-kb-article img {
	display: block;
	height: auto; max-width: 100%;
	margin-block: var(--hy-space-6);
	border: 1px solid var(--hy-border-subtle);
	border-radius: var(--hy-radius-md);
}
.hy-kb-article figure { margin: var(--hy-space-6) 0; }
.hy-kb-article figcaption {
	margin-top: var(--hy-space-2);
	font-size: .8125rem; color: var(--hy-text-muted); text-align: center;
}

/*
 * Themes style `input[type="search"]` directly, which outranks a class and
 * left a second border drawn inside the form's box. Matching the attribute
 * here — not !important — is what actually wins the cascade.
 */
.hy-kb-search__form input[type="search"].hy-kb-search__input {
	height: auto; min-height: 0;
	margin: 0; padding: var(--hy-space-3) 0;
	background: none;
	border: 0; border-radius: 0;
	box-shadow: none; outline: none;
}
.hy-kb-search__form input[type="search"].hy-kb-search__input:focus {
	background: none; border: 0; box-shadow: none; outline: none;
}

/* A result carries title, category and a snippet, so it stacks. */
.hy-kb-search__hit {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 2px var(--hy-space-4);
	align-items: baseline;
}
.hy-kb-search__hit-text {
	grid-column: 1 / -1;
	font-size: .8125rem; line-height: 1.45;
	color: var(--hy-text-secondary);
	display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
	overflow: hidden;
}

/* ------------------------------------------------------- pagination ----- */

.hy-kb-layout__main .navigation.pagination { margin-top: var(--hy-space-10); }
.hy-kb-layout__main .nav-links {
	display: flex; flex-wrap: wrap; align-items: center; gap: var(--hy-space-2);
}
.hy-kb-layout__main .page-numbers {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: var(--hy-control-h-sm); height: var(--hy-control-h-sm);
	padding-inline: var(--hy-space-3);
	font-size: .875rem; font-variant-numeric: tabular-nums;
	color: var(--hy-text-secondary); text-decoration: none;
	background: var(--hy-surface-1);
	border: 1px solid var(--hy-border-subtle);
	border-radius: var(--hy-radius-sm);
	transition: color var(--hy-dur-fast) var(--hy-ease), border-color var(--hy-dur-fast) var(--hy-ease);
}
.hy-kb-layout__main a.page-numbers:hover {
	color: var(--hy-text-primary);
	border-color: var(--hy-border-strong);
}
.hy-kb-layout__main .page-numbers.current {
	color: var(--hy-brand-contrast);
	background: var(--hy-brand-500);
	border-color: var(--hy-brand-500);
	font-weight: 600;
}
.hy-kb-layout__main .page-numbers.dots {
	background: none; border-color: transparent; color: var(--hy-text-muted);
}
.hy-kb-layout__main .screen-reader-text {
	position: absolute; width: 1px; height: 1px;
	margin: -1px; padding: 0; overflow: hidden;
	clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
