/* Fichier généré par assets/css/build.mjs — ne pas modifier : éditer assets/css/src/. */

/* ---- blocs/page-categorie.css ---- */
/*
 * Page catégorie produit (maquettes/gabarits/page-categorie.php, préfixe cat). La liste de
 * produits et la carte catégorie sont dans page-catalogue.css (préfixe cl).
 */

/* Premier bloc collé au header. */
.kdo-bloc--cat-entete {
	padding-top: 0.9rem;
}

/* ---------- En-tête : disposition A (texte | miniature), familles en pied ---------- */
.kdo-cat-entete .kdo-panneau__grille {
	@media (min-width: 1024px) {
		grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
		row-gap: 1.25rem;
		padding-block: 1.75rem 1.6rem;
	}
}

.kdo-cat-entete .kdo-panneau__texte .kdo-ariane {
	margin-bottom: 0.85rem;
}

.kdo-cat-entete .kdo-surtitre {
	margin-bottom: 0.75rem;
}

.kdo-cat-entete .kdo-hero__titre {
	margin-bottom: 0.9rem;
	font-size: clamp(1.9rem, 1.2rem + 2.4vw, 2.6rem);
}

.kdo-cat-page {
	font-size: 0.6em;
}

/* texte_1 : trois lignes, « Lire plus » déplie, sans JS.
 * Gabarit réel (woocommerce/taxonomy-product_cat.php) : un <details>. Fermé, son contenu reste
 * affiché, coupé et fondu (::details-content) ; le résumé « Lire plus » passe sous le texte
 * (flex, order). Navigateur sans ::details-content : seul « Lire plus » est visible, le texte
 * s'ouvre au clic. Texte court : un simple <div> (--court).
 * Maquette (maquettes/gabarits/page-categorie.php) : case à cocher et <label>, règles :has()
 * plus bas. */
.kdo-cat-texte {
	max-width: 40rem;
	margin-bottom: 1.15rem;
	font-size: 0.9rem;
	line-height: 1.6;
}

details.kdo-cat-texte {
	display: flex;
	flex-direction: column;

	&::details-content {
		content-visibility: visible;
		max-height: calc(3 * 1.6em);
		overflow: hidden;
		mask-image: linear-gradient(180deg, var(--wp--preset--color--navy) 55%, transparent);
	}

	&[open]::details-content {
		max-height: none;
		mask-image: none;
	}

	& > summary {
		order: 1;
		align-self: flex-start;
		list-style: none;

		&::-webkit-details-marker {
			display: none;
		}

		&:focus-visible {
			outline: 2px solid var(--wp--preset--color--marque);
			outline-offset: 3px;
		}
	}

	&[open] > summary {
		&::after {
			margin-top: 0.2rem;
			rotate: -135deg;
		}

		& span:first-child {
			display: none;
		}

		& span + span {
			display: inline;
		}
	}

	& .kdo-cat-texte__contenu {
		max-height: none;
		overflow: visible;
		mask-image: none;
	}
}

.kdo-cat-texte--court,
details.kdo-cat-texte .kdo-cat-texte__contenu {
	& p {
		margin: 0 0 0.75rem;

		&:last-child {
			margin-bottom: 0;
		}
	}

	/* Intertitres saisis dans texte_1 (sous le H1) : à la taille du texte, en gras. */
	& :is(h2, h3, h4) {
		margin: 0 0 0.35rem;
		color: var(--wp--preset--color--navy);
		font-family: inherit;
		font-size: 1em;
		font-weight: 700;
		line-height: inherit;
		text-transform: none;
	}

	& a {
		color: var(--wp--preset--color--marque);
		font-weight: 600;
	}
}

.kdo-cat-texte__contenu {
	max-height: calc(3 * 1.6em);
	overflow: hidden;
	mask-image: linear-gradient(180deg, var(--wp--preset--color--navy) 55%, transparent);

	& p {
		margin: 0 0 0.75rem;
	}

	& a {
		color: var(--wp--preset--color--marque);
		font-weight: 600;
	}
}

.kdo-cat-texte:has(.kdo-cat-texte__bascule:checked) .kdo-cat-texte__contenu {
	max-height: none;
	mask-image: none;
}

.kdo-cat-texte__lire {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	margin-top: 0.2rem;
	color: var(--wp--preset--color--marque);
	font-family: var(--wp--preset--font-family--titre);
	font-size: 0.78rem;
	font-weight: 800;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	cursor: pointer;

	&::after {
		content: "";
		width: 0.45rem;
		height: 0.45rem;
		margin-top: -0.2rem;
		border: solid currentColor;
		border-width: 0 2px 2px 0;
		rotate: 45deg;
	}

	& span + span {
		display: none;
	}

	&:hover {
		text-decoration: underline;
		text-underline-offset: 0.2em;
	}
}

.kdo-cat-texte:has(.kdo-cat-texte__bascule:checked) .kdo-cat-texte__lire {
	&::after {
		margin-top: 0.2rem;
		rotate: -135deg;
	}

	& span:first-child {
		display: none;
	}

	& span + span {
		display: inline;
	}
}

.kdo-cat-texte:has(.kdo-cat-texte__bascule:focus-visible) .kdo-cat-texte__lire {
	outline: 2px solid var(--wp--preset--color--marque);
	outline-offset: 3px;
}

/* Chiffres réels de la catégorie : gros chiffre vert, libellé sur deux lignes. */
.kdo-cat-chiffres {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 0;
	margin: 0 0 1.15rem;
	padding: 0;
	list-style: none;

	& li {
		display: flex;
		align-items: center;
		gap: 0.5rem;
		padding-inline: clamp(0.7rem, 0.2rem + 0.8vw, 1.1rem);

		&:first-child {
			padding-left: 0;
		}

		& + li {
			border-left: 1px solid color-mix(in srgb, var(--wp--preset--color--marque) 35%, var(--wp--preset--color--filet));
		}
	}

	& strong {
		color: var(--wp--preset--color--marque);
		font-family: var(--wp--preset--font-family--titre);
		font-size: clamp(1.3rem, 0.95rem + 0.75vw, 1.75rem);
		font-weight: 800;
		line-height: 1;
		white-space: nowrap;
	}

	& span {
		color: var(--wp--preset--color--navy);
		font-family: var(--wp--preset--font-family--titre);
		font-size: 0.64rem;
		font-weight: 700;
		line-height: 1.25;
		text-transform: uppercase;
	}

	& abbr {
		text-decoration: none;
	}

	@media (max-width: 479px) {
		& li {
			padding-inline: 0.7rem;
		}
	}
}

/* Visuel : la miniature de la catégorie (ACF), détourée, posée sur les bandes. Conteneur : la
 * pastille ronde se dimensionne sur sa largeur. */
.kdo-cat-entete .kdo-panneau__visuel {
	min-height: 16.5rem;
	container-type: inline-size;

	@media (min-width: 640px) and (max-width: 1023px) {
		min-height: 22rem;
	}

	@media (min-width: 1024px) {
		min-height: 20rem;
		margin-bottom: 0;
	}
}

/* Image posée en bas du visuel, jamais plus haute que lui (photos de produits en portrait ou
 * grandes : elle se réduit au lieu d'être coupée par le panneau). */
.kdo-cat-entete__miniature {
	top: 0.75rem;
	left: 50%;
	bottom: 0;
	display: flex;
	align-items: flex-end;
	width: min(68%, 16rem);
	translate: -50% 0;

	& img {
		max-height: 100%;
		object-fit: contain;
		object-position: 50% 100%;
	}

	@media (min-width: 640px) {
		width: min(100%, 22rem);
	}

	@media (min-width: 1024px) {
		bottom: -0.25rem;
		width: min(88%, 27rem);
	}
}

.kdo-cat-entete__pastille {
	top: 4%;
	right: 4%;
	width: max(22%, 5.5rem);

	@media (min-width: 1024px) {
		top: 12%;
		right: 3%;
		width: max(21%, 6.5rem);
	}
}

/* ---------- Guide (texte_2) : sommaire collant à gauche, texte à droite ---------- */
.kdo-cat-guide {
	@media (min-width: 1024px) {
		display: grid;
		grid-template-columns: minmax(0, 21rem) minmax(0, 1fr);
		gap: 4rem;
		align-items: start;
	}
}

.kdo-cat-guide__aside {
	@media (min-width: 1024px) {
		position: sticky;
		top: 1.5rem;
	}

	& .kdo-en-tete-section {
		margin-bottom: 1.25rem;
	}

	& .kdo-titre-section {
		font-size: clamp(1.6rem, 1.1rem + 1.5vw, 2.1rem);
	}
}

.kdo-cat-sommaire {
	margin-bottom: 2rem;
	padding: 1rem 1.15rem;
	border-radius: var(--wp--custom--rayon--carte);
	background: var(--kdo-panneau-gris);

	& summary {
		display: flex;
		align-items: center;
		gap: 0.6rem;
		color: var(--wp--preset--color--navy);
		font-family: var(--wp--preset--font-family--titre);
		font-size: 0.8rem;
		font-weight: 800;
		text-transform: uppercase;
		cursor: pointer;
		list-style: none;

		&::-webkit-details-marker {
			display: none;
		}

		& .kdo-icone {
			width: 1.5rem;
			height: 1.5rem;
		}

		& span {
			margin-left: auto;
			color: var(--wp--preset--color--texte);
			font-size: 0.7rem;
			font-weight: 600;
			text-transform: none;
		}
	}

	& ol {
		display: grid;
		gap: 0.1rem;
		margin: 0.8rem 0 0;
		padding: 0;
		list-style: none;
		counter-reset: guide;
		font-size: 0.8rem;
		line-height: 1.35;
	}

	& li {
		counter-increment: guide;
	}

	& a {
		display: grid;
		grid-template-columns: 1.6rem minmax(0, 1fr);
		padding: 0.3rem 0;
		color: var(--wp--preset--color--texte);
		text-decoration: none;

		&::before {
			content: counter(guide, decimal-leading-zero);
			color: var(--wp--preset--color--marque);
			font-family: var(--wp--preset--font-family--titre);
			font-weight: 800;
		}

		&:hover,
		&:focus-visible {
			color: var(--wp--preset--color--marque);
		}
	}
}

.kdo-cat-guide__corps {
	max-width: 46rem;
	font-size: 0.95rem;
	line-height: 1.7;

	& h2 {
		margin: 2rem 0 0.6rem;
		color: var(--wp--preset--color--navy);
		font-family: var(--wp--preset--font-family--titre);
		font-size: clamp(1.1rem, 0.95rem + 0.5vw, 1.3rem);
		font-weight: 800;
		line-height: 1.25;
		scroll-margin-top: 2rem;

		&:first-child {
			margin-top: 0;
		}
	}

	& h3 {
		margin: 1.5rem 0 0.5rem;
		color: var(--wp--preset--color--navy);
		font-size: 1rem;
	}

	& p {
		margin: 0 0 0.9rem;
	}

	& a {
		color: var(--wp--preset--color--marque);
		font-weight: 600;
	}
}

.kdo-cat-guide__suite {
	& > summary {
		display: inline-flex;
		align-items: center;
		gap: 0.5rem;
		margin: 0.5rem 0 1.5rem;
		padding: 0.6rem 1.2rem;
		border: 1.5px solid var(--wp--preset--color--action);
		border-radius: var(--wp--custom--rayon--bouton);
		color: var(--wp--preset--color--action);
		font-family: var(--wp--preset--font-family--titre);
		font-size: 0.8rem;
		font-weight: 700;
		text-transform: uppercase;
		cursor: pointer;
		list-style: none;

		&::-webkit-details-marker {
			display: none;
		}

		&::after {
			content: "+";
			font-size: 1.1rem;
			line-height: 1;
		}

		& span + span {
			display: none;
		}

		&:hover {
			background: var(--wp--preset--color--action);
			color: var(--wp--preset--color--surface);
		}
	}

	&[open] > summary {
		&::after {
			content: "−";
		}

		& span:first-child {
			display: none;
		}

		& span + span {
			display: inline;
		}
	}
}

/* texte_local_reference : note discrète, picto de lieu. */
.kdo-cat-local {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 0.85rem;
	max-width: 46rem;
	margin-top: 1.5rem;
	padding: 1rem 1.15rem;
	border-left: 3px solid var(--wp--preset--color--accent);
	border-radius: 0 var(--wp--custom--rayon--carte) var(--wp--custom--rayon--carte) 0;
	background: var(--kdo-panneau-gris);
	font-size: 0.82rem;
	line-height: 1.55;

	& > .kdo-icone {
		width: 1.75rem;
		height: 1.75rem;
	}

	& p {
		margin: 0;
	}

	& a {
		color: var(--wp--preset--color--marque);
		font-weight: 600;
	}
}

/* ---------- FAQ : en-tête à gauche, questions à droite (comme sur l'accueil) ---------- */
.kdo-cat-faq {
	@media (min-width: 1024px) {
		display: grid;
		grid-template-columns: minmax(0, 21rem) minmax(0, 1fr);
		gap: 4rem;
		align-items: start;
	}

	& .kdo-en-tete-section {
		@media (min-width: 1024px) {
			position: sticky;
			top: 1.5rem;
			margin-bottom: 0;
		}
	}

	& .kdo-faq {
		max-width: none;
		margin-inline: 0;

		& details:first-child summary {
			padding-top: 0.2rem;
		}

		& [itemprop="text"] {
			font-size: 0.92rem;
			line-height: 1.65;

			& p {
				margin: 0 0 0.75rem;
			}
		}

		& a {
			color: var(--wp--preset--color--marque);
		}
	}
}
