/**
 * Kennisbank overzicht (ticket #19)
 *
 * @package   ThinkYellow\Kennisbank
 * @author    Think Yellow
 * @copyright 2026 Think Yellow
 */

.kb-page {
	/* Design tokens (Figma variabelen) */
	--kb-blue-600: #002d35;
	--kb-blue-200: #8da3aa;
	--kb-blue-100: #ebf1f8;
	--kb-green-400: #a6c024;
	--kb-green-label: #8ea422;
	--kb-slate-400: #395b61;
	--kb-sky: #4db3eb;
	--kb-sky-bg: #eaf4fb;
	--kb-sky-active: rgba(77, 179, 235, .15);
	--kb-white: #fff;
	--kb-radius-xs: 6px;
	--kb-radius-s: 12px;
	--kb-font-title: "DM Sans", sans-serif;
	--kb-font-body: "Inter", sans-serif;

	background: var(--kb-blue-100);
	padding-top: 0 !important;
}

.kb-page,
.kb-page p,
.kb-page a,
.kb-page input {
	font-family: var(--kb-font-body);
}

/* Titelbalk ------------------------------------------------------------- */

.kb-hero {
	background: var(--kb-blue-600);
	padding-block: 40px;

	& .kb-hero__title {
		margin: 0;
		padding: 0;
		font-family: var(--kb-font-title);
		font-weight: 600;
		font-size: 45px;
		line-height: 50px;
		letter-spacing: 0;
		color: var(--kb-white);
	}
}

@media (max-width: 690px) {
	.kb-hero .kb-hero__title {
		font-size: 34px;
		line-height: 40px;
	}
}

/* Layout ---------------------------------------------------------------- */

.kb-page .main-content {
	padding-block: 40px 100px;
}

.kb {
	display: grid;
	grid-template-columns: 359px minmax(0, 1fr);
	gap: 30px;
	align-items: start;
	color: var(--kb-blue-600);
}

@media (max-width: 1199px) {
	.kb {
		grid-template-columns: minmax(240px, 30%) minmax(0, 1fr);
	}
}

@media (max-width: 999px) {
	.kb {
		grid-template-columns: minmax(0, 1fr);
		gap: 40px;
	}

	.kb-page .main-content {
		padding-block: 30px 60px;
	}
}

/* Sidebar --------------------------------------------------------------- */

.kb-sidebar {
	display: flex;
	flex-direction: column;
	gap: 30px;

	& > * {
		display: flex;
		flex-direction: column;
		gap: 10px;
	}
}

.kb-page .kb-sidebar__title {
	display: block;
	margin: 0;
	padding: 0;
	font-family: var(--kb-font-body);
	font-weight: 600;
	font-size: 20px;
	line-height: 30px;
	letter-spacing: 0;
	color: var(--kb-blue-600);
}

.kb-page .kb-search .kb-search__input {
	box-sizing: border-box;
	width: 100%;
	height: auto;
	margin: 0;
	padding: 6px 10px;
	font-size: 17px;
	line-height: 30px;
	color: var(--kb-blue-600);
	background: var(--kb-white);
	border: 1px solid var(--kb-blue-200);
	border-radius: var(--kb-radius-xs);
	box-shadow: none;

	&::placeholder {
		color: var(--kb-blue-200);
		opacity: 1;
	}

	&:focus {
		border-color: var(--kb-blue-600);
		outline: 2px solid var(--kb-sky);
		outline-offset: 1px;
	}
}

/* Lijst-reset tegen Salient; :where() houdt de specificiteit laag zodat
   de componentstijlen hieronder (padding van kaarten, chips) winnen. */
.kb-page :where(ul.kb-cats, ul.kb-tags, ul.kb-list, ul.kb-item__tags) {
	list-style: none;
	margin: 0;
	padding: 0;
}

.kb-page :where(ul.kb-cats, ul.kb-tags, ul.kb-list, ul.kb-item__tags) > :where(li) {
	list-style: none;
	margin: 0;
	padding: 0;
}

.kb-page .kb-list > .kb-item,
.kb-page .kb-item__tags > .kb-chip,
.kb-page .kb-cats > .kb-cats__item {
	margin: 0;
	list-style: none;
}

/* Thema's & onderwerpen (Figma "Categorie": wit blok 7px, link 3px 8px) */
.kb-cats {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.kb-page .kb-cats > .kb-cats__item {
	padding: 7px;
	background: var(--kb-white);
	border-radius: var(--kb-radius-xs);
}

/* Rij: link + (bij subcategorieën) pijltje; actief = groen */
.kb-page .kb-cats__row {
	display: flex;
	align-items: center;
	border-radius: 5px;
	transition: background-color .15s;

	&:hover {
		background: var(--kb-blue-100);
	}

	&.is-active {
		background: var(--kb-green-400);

		& .kb-cats__link {
			color: var(--kb-white);
		}
	}
}

.kb-page .kb-cats__link {
	flex: 1;
	min-width: 0;
	padding: 3px 8px;
	font-size: 17px;
	line-height: 30px;
	color: var(--kb-blue-600);
	border-radius: 5px;
	text-decoration: none;

	&:focus-visible {
		outline: 2px solid var(--kb-sky);
		outline-offset: 1px;
	}
}

.kb-page .kb-cats__toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 5px;
	cursor: pointer;

	&:focus-visible {
		outline: 2px solid var(--kb-sky);
		outline-offset: -2px;
	}
}

.kb-page .kb-cats__chevron {
	display: block;
	width: 14.585px;
	height: 14.585px;
	margin: 0;
	transition: transform .15s;
}

.kb-page .kb-cats__chevron--light,
.kb-page .kb-cats__row.is-active .kb-cats__chevron:not(.kb-cats__chevron--light) {
	display: none;
}

.kb-page .kb-cats__row.is-active .kb-cats__chevron--light {
	display: block;
}

.kb-page .kb-cats__item.is-open .kb-cats__chevron {
	transform: rotate(180deg);
}

/* Subcategorieën (Figma: 14px, 30px regel, 14px inspringing; actief groen onderstreept) */
.kb-page .kb-cats__sub {
	margin: 0;
	padding: 0 14px;
	list-style: none;

	& .kb-cats__sub {
		padding-right: 0;
	}

	& > li {
		margin: 0;
		padding: 0;
		list-style: none;
	}
}

.kb-page .kb-cats__sublink {
	display: inline-block;
	font-size: 14px;
	line-height: 30px;
	color: var(--kb-blue-600);
	text-decoration: none;

	&:hover,
	&:focus-visible {
		color: var(--kb-green-label);
		text-decoration: underline;
	}

	&.is-current {
		color: var(--kb-green-label);
		text-decoration: underline;
	}
}

/* Dichtgeklapt (alleen met JS; zonder JS blijft alles zichtbaar) */
.kb:not(.kb-ready) .kb-cats__toggle {
	display: none;
}

.kb.kb-ready .kb-cats__item.has-children:not(.is-open) > .kb-cats__sub {
	display: none;
}

/* Type */
.kb-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 11px;
}

.kb-page .kb-tag {
	display: inline-flex;
	align-items: flex-start;
	gap: 3px;
	padding: 6px 10px;
	font-size: 14px;
	line-height: normal;
	white-space: nowrap;
	color: var(--kb-blue-600);
	background: var(--kb-white);
	border: 1px solid var(--kb-blue-200);
	border-radius: var(--kb-radius-xs);
	text-decoration: none;
	transition: background-color .15s, border-color .15s;

	& .kb-count {
		color: var(--kb-blue-200);
	}

	&:hover,
	&:focus-visible {
		border-color: var(--kb-sky);
	}

	&:focus-visible {
		outline: 2px solid var(--kb-sky);
		outline-offset: 1px;
	}

	&.is-active {
		background: var(--kb-sky-active);
		border-color: var(--kb-sky);

		& .kb-count {
			color: var(--kb-blue-600);
		}
	}
}

/* Resultaten ------------------------------------------------------------ */

.kb-results {
	display: flex;
	flex-direction: column;
	gap: 20px;
	min-width: 0;
}

.kb-results__header {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
}

.kb-page .kb-results__title {
	margin: 0;
	padding: 0;
	font-family: var(--kb-font-title);
	font-weight: 600;
	font-size: 27px;
	line-height: 34px;
	letter-spacing: 0;
	color: var(--kb-blue-600);
}

.kb-page .kb-results__count {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 0;
	font-weight: 600;
	font-size: 17px;
	line-height: 30px;
	color: var(--kb-blue-600);
}

.kb-results__badge {
	padding: 2px 12px;
	background: var(--kb-white);
	border-radius: 999px;
	white-space: nowrap;
}

.kb-page .kb-results__reset {
	margin: -10px 0 0;
	padding: 0;
	font-size: 14px;
	line-height: normal;

	& a {
		color: var(--kb-blue-600);
		text-decoration: underline;
	}
}

.kb-results[aria-busy="true"] .kb-list {
	opacity: .5;
	transition: opacity .15s;
}

.kb-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* Kennisartikel */
.kb-item {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 16px 17px;
	background: var(--kb-white);
	border-radius: var(--kb-radius-s);
	transition: box-shadow .15s;

	&:hover,
	&:focus-within {
		box-shadow: 0 4px 16px rgba(0, 45, 53, .1);
	}
}

.kb-item__media {
	flex: 0 0 110px;
}

.kb-page .kb-item__img {
	display: block;
	width: 110px;
	height: 110px;
	margin: 0;
	object-fit: cover;
	border-radius: var(--kb-radius-s);
}

.kb-item__img--placeholder {
	background: var(--kb-blue-100);
}

.kb-item__body {
	flex: 1;
	min-width: 0;
	align-self: stretch;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 10px;
}

.kb-item__meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	line-height: normal;
}

.kb-item__cat {
	font-family: var(--kb-font-body);
	font-weight: 600;
	font-size: 15px;
	color: var(--kb-green-label);
}

.kb-item__date {
	font-family: var(--kb-font-title);
	font-weight: 400;
	font-size: 14px;
	color: var(--kb-slate-400);
	white-space: nowrap;
}

.kb-page .kb-item__title {
	margin: 0;
	padding: 0;
	font-family: var(--kb-font-title);
	font-weight: 500;
	font-size: 18px;
	line-height: normal;
	letter-spacing: 0;
	color: var(--kb-blue-600);
}

.kb-page .kb-item__link {
	font-family: inherit;
	color: inherit;
	text-decoration: none;

	/* Hele kaart klikbaar */
	&::after {
		content: "";
		position: absolute;
		inset: 0;
		border-radius: var(--kb-radius-s);
	}

	&:focus-visible {
		outline: none;

		&::after {
			outline: 2px solid var(--kb-sky);
			outline-offset: 2px;
		}
	}
}

.kb-item__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.kb-page .kb-chip {
	padding: 3px 9px 5px;
	font-size: 14px;
	line-height: normal;
	white-space: nowrap;
	color: var(--kb-blue-600);
	background: var(--kb-sky-bg);
	border: 1px solid var(--kb-sky);
	border-radius: var(--kb-radius-xs);
}

@media (max-width: 690px) {
	.kb-item__media {
		flex-basis: 72px;
	}

	.kb-page .kb-item__img {
		width: 72px;
		height: 72px;
	}

	.kb-item__meta {
		flex-wrap: wrap;
	}
}

/* Beschrijving van het gekozen onderwerp */
.kb-intro {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 20px;
}

.kb-page .kb-intro__title {
	margin: 0;
	padding: 0;
	font-family: var(--kb-font-title);
	font-weight: 600;
	font-size: 27px;
	line-height: 34px;
	letter-spacing: 0;
	color: var(--kb-blue-600);
}

.kb-page .kb-intro__text,
.kb-page .kb-intro__text p {
	margin: 0;
	padding: 0;
	font-size: 17px;
	line-height: 30px;
	color: #585858;
}

.kb-page .kb-intro__text p + p {
	margin-top: 1em;
}

.kb-page .kb-empty {
	margin: 0;
	padding: 16px 17px;
	background: var(--kb-white);
	border-radius: var(--kb-radius-s);
}
