/*
 * Pages de classe (Sixième à Troisième) : liste des chapitres sous forme de cartes.
 * Même palette que le reste du site : vert #16855a, vert clair #5cc79a, gris #878787, filets #e5e5e5.
 */

.chap-section {
	text-align: center;
	padding: 3em 0 5em 0;
}

.chap-section > .container > header {
	margin: 0 0 1.5em 0;
}

.chap-intro {
	max-width: 40em;
	margin: 0 auto 2.5em auto;
	color: #666;
	line-height: 1.7em;
}

.chap-intro strong {
	color: #16855a;
}

/* ---------- Recherche et filtres ---------- */

.chap-recherche {
	max-width: 36em;
	margin: 0 auto 1.75em auto;
	text-align: left;
}

.chap-recherche label {
	display: block;
	margin: 0 0 0.7em 0;
	font-size: 0.85em;
	letter-spacing: 2px;
	text-transform: uppercase;
	color: #878787;
}

#chap-recherche {
	display: block;
	width: 100%;
	box-sizing: border-box;
	background: #f7f7f7;
	border: solid 2px #e5e5e5;
	border-radius: 4px;
	padding: 0.85em 1em;
	font-size: 1em;
	color: #555;
	transition: background-color 0.25s ease-in-out, border-color 0.25s ease-in-out;
}

#chap-recherche:focus {
	background: #fff;
	border-color: #5cc79a;
	outline: 0;
}

.chap-filtres {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75em;
	margin: 0 0 1.25em 0;
}

button.chap-filtre {
	display: inline-block;
	width: auto;
	background: #fff;
	color: #878787 !important;
	border: solid 2px #e5e5e5;
	border-radius: 4px;
	box-shadow: none;
	text-shadow: none;
	padding: 0.8em 1.3em;
	font-size: 0.9em;
	line-height: 1;
	letter-spacing: 1px;
	cursor: pointer;
}

button.chap-filtre:hover {
	background: #fff;
	color: #16855a !important;
	border-color: #16855a;
}

button.chap-filtre[aria-pressed="true"] {
	background: #16855a;
	color: #fff !important;
	border-color: #16855a;
	box-shadow: 0.125em 0.175em 0 0 rgba(0, 0, 0, 0.125);
}

.chap-info {
	min-height: 1.6em;
	margin: 0 0 2em 0;
	font-size: 0.85em;
	letter-spacing: 2px;
	text-transform: uppercase;
	color: #878787;
}

.chap-vide {
	margin: 2em 0 0 0;
	color: #878787;
}

/* ---------- Grille de cartes ---------- */

.chap-grille {
	container-type: inline-size;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	column-gap: 1.75em;
	row-gap: 0;
	text-align: left;
}

.chap-carte {
	position: relative;
	display: grid;
	grid-row: span 4;
	grid-template-rows: subgrid;      /* thème / titre / description / accès : alignés d'une carte à l'autre */
	row-gap: 0;
	margin: 0 0 1.75em 0;
	text-align: left;
	background: #fff;
	border: solid 2px #e5e5e5;
	border-radius: 4px;
	padding: 1.75em 1.5em 1.25em 1.5em;
	transition: transform 0.25s ease-in-out, border-color 0.25s ease-in-out, box-shadow 0.25s ease-in-out;
}

.chap-carte[hidden] {
	display: none;
}

.chap-carte:not(.chap-bientot):hover,
.chap-carte:not(.chap-bientot):focus-within {
	transform: translateY(-4px);
	border-color: #16855a;
	box-shadow: 0.125em 0.175em 0 0 rgba(0, 0, 0, 0.125);
}

.chap-num {
	position: absolute;
	top: 1.1rem;
	right: 1.25rem;
	font-family: 'Fredoka', 'Nunito', 'Segoe UI', Arial, sans-serif;
	font-weight: 700;
	font-size: 2.6rem;
	line-height: 1;
	color: #e5e5e5;
	text-shadow: none;
}

.chap-carte:not(.chap-bientot):hover .chap-num {
	color: #5cc79a;
}

.chap-theme {
	margin: 0 0 0.9em 0;
	padding-right: 3.5rem;
	font-size: 0.72rem;
	letter-spacing: 2px;
	text-transform: uppercase;
	line-height: 1.5;
	color: #16855a;
}

#features .chap-carte h3,
#features .chap-carte p {
	text-align: left;
}

.chap-carte h3 {
	margin: 0 0 0.6em 0;
	font-size: 1.05rem;
	line-height: 1.45;
	letter-spacing: 1px;
	color: #555;
}

.chap-desc {
	margin: 0 0 1.25em 0;
	font-size: 0.95em;
	line-height: 1.65em;
	color: #878787;
}

.chap-acces {
	position: relative;
	z-index: 2;       /* au-dessus de la zone cliquable de la carte */
	display: grid;
	grid-template-columns: repeat(4, auto);
	justify-content: space-between;
	gap: 0.3em;
	margin: 0;
	padding: 1em 0 0 0;
	list-style: none;
	border-top: solid 2px #f0f0f0;
}

.chap-acces li {
	margin: 0;
	padding: 0;
	text-align: center;
	white-space: nowrap;
}

.chap-acces a {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.35em;
	padding: 0.55em 0.35em;
	border: 0;
	border-radius: 4px;
	font-size: clamp(6.5px, 0.9cqw, 0.7rem);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-decoration: none;
	color: #878787;
	transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.chap-acces a:before {
	font-size: 1.35rem;
	color: #16855a;
	transition: color 0.2s ease-in-out;
}

.chap-acces a:hover,
.chap-acces a:focus-visible {
	background: #16855a;
	color: #fff;
}

.chap-acces a:hover:before,
.chap-acces a:focus-visible:before {
	color: #fff;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
	outline: 3px solid #5cc79a;
	outline-offset: 3px;
}

/* Chapitres pas encore en ligne */
.chap-bientot {
	background: #f7f7f7;
	border-style: dashed;
}

.chap-bientot h3,
.chap-bientot .chap-theme {
	color: #a0a0a0;
}

.chap-bientot .chap-desc {
	color: #b0b0b0;
}

.chap-etat {
	margin: 0;
	padding-top: 1em;
	border-top: solid 2px #ececec;
	font-size: 0.72rem;
	letter-spacing: 2px;
	text-transform: uppercase;
	color: #a0a0a0;
}

/* ---------- Tablette et mobile ---------- */

@media screen and (max-width: 980px) {
	.chap-grille {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media screen and (max-width: 640px) {
	.chap-section {
		padding: 2em 0 3.5em 0;
	}
	.chap-grille {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (prefers-reduced-motion: reduce) {
	.chap-carte,
	#chap-recherche,
	.chap-acces a {
		transition: none;
	}
}

/* ---------- Bandeau « annales de brevet » (3ème) ---------- */

.chap-annales {
	display: flex;
	align-items: center;
	gap: 1.5em;
	max-width: 52em;
	margin: 0 auto 2.5em auto;
	padding: 1.25em 1.75em;
	box-sizing: border-box;
	text-align: left;
	text-decoration: none;
	color: #555;
	background: #f1faf6;
	border: solid 2px #bfe8d6;
	border-left: solid 6px #16855a;
	border-radius: 4px;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
	transition: transform 0.25s ease-in-out, box-shadow 0.25s ease-in-out, background-color 0.25s ease-in-out;
}

.chap-annales:hover {
	transform: translateY(-3px);
	box-shadow: 0 8px 20px rgba(22, 133, 90, 0.18);
	background: #e8f7f0;
	color: #555;
}

.chap-annales-icone {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 3.2em;
	height: 3.2em;
	border-radius: 50%;
	background: #16855a;
	color: #fff;
	font-size: 1.1em;
}

.chap-annales-icone:before {
	line-height: 1;
}

.chap-annales-texte {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.25em;
	line-height: 1.5em;
}

.chap-annales-etiquette {
	font-size: 0.75em;
	letter-spacing: 2px;
	text-transform: uppercase;
	color: #16855a;
}

.chap-annales-texte strong {
	font-size: 1.25em;
	color: #444;
}

.chap-annales-bouton {
	flex-shrink: 0;
	white-space: nowrap;
	padding: 0.7em 1.4em;
	border-radius: 4px;
	background: #16855a;
	color: #fff;
	font-size: 0.9em;
	letter-spacing: 1px;
	text-transform: uppercase;
	transition: background-color 0.25s ease-in-out;
}

.chap-annales-bouton:before {
	margin-right: 0.7em;
}

.chap-annales:hover .chap-annales-bouton {
	background: #45c48f;
}

@media screen and (max-width: 640px) {
	.chap-annales {
		flex-direction: column;
		align-items: stretch;
		text-align: center;
		gap: 1em;
		padding: 1.25em;
	}
	.chap-annales-icone {
		align-self: center;
	}
	.chap-annales-bouton {
		text-align: center;
	}
}

/* 3ème : bandeau annales placé avant le titre des chapitres */
.chap-annales + header {
	margin-top: 3.5em;
}

/* ---------- Titre de page (vert) et animation des cartes ---------- */

#logo.logo-classe {
	font-size: 2.4em;
	line-height: 1.2em;
}

@media screen and (max-width: 640px) {
	#logo.logo-classe {
		font-size: 1.7em;
	}
}

.chap-section {
	padding-top: 2em;
}

@keyframes chapEntre {
	from { opacity: 0; transform: translateY(14px) scale(0.97); }
	to   { opacity: 1; transform: none; }
}

@keyframes chapSort {
	from { opacity: 1; transform: none; }
	to   { opacity: 0; transform: scale(0.94); }
}

.chap-carte.chap-entre {
	animation: chapEntre 0.35s ease-out both;
}

.chap-carte.chap-sort {
	animation: chapSort 0.2s ease-in both;
	pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
	.chap-carte.chap-entre,
	.chap-carte.chap-sort {
		animation: none;
	}
}

/* ---------- Recherche remontée et thèmes sur une seule ligne ---------- */

#header > .container:has(.logo-classe) {
	padding: 8em 0 2em 0;
}

.chap-section {
	padding-top: 0.5em;
}

.chap-recherche {
	margin-bottom: 1.25em;
}

.chap-recherche label {
	margin-bottom: 0.5em;
}

.chap-filtres {
	flex-wrap: nowrap;
	justify-content: center;
	gap: 0.5em;
	overflow: visible;
	padding: 0.2em 0 0.6em 0;
	container-type: inline-size;
}

button.chap-filtre {
	flex: 0 0 auto;
	white-space: nowrap;
	padding: 0.8em 1em;
	font-size: min(0.85rem, 1.15cqw);
	letter-spacing: 0.04em;
}

.chap-filtre .l-court { display: none; }

/* Tablette et mobile : libellés courts, texte réduit pour tout garder sur une ligne */
@media screen and (max-width: 900px) {
	.chap-filtre .l-long { display: none; }
	.chap-filtre .l-court { display: inline; }
	.chap-filtres { gap: 0.3em; }
	button.chap-filtre {
		font-size: min(0.85rem, 1.9cqw);
		padding: 0.75em 0.6em;
		letter-spacing: 0;
	}
}

@media screen and (max-width: 520px) {
	button.chap-filtre {
		font-size: max(8px, 2.4cqw);
		padding: 0.7em 0.32em;
		border-width: 1px;
		text-transform: none;
		font-weight: 600;
	}
	.chap-filtres { gap: 0.18em; }
}

#header > .container:has(.logo-classe) {
	padding-top: 8.5em;
}

/* Espace sous l'en-tête réduit (pages de classe) */
#features.chap-section {
	padding-top: 1.1em;
}

/* Taille des mots sous les icônes : adaptée au nombre de colonnes pour que « Cartes mentales » reste sur une ligne */
@media screen and (max-width: 980px) {
	.chap-acces a { font-size: clamp(6.5px, 1.45cqw, 0.7rem); }
}
@media screen and (max-width: 640px) {
	.chap-acces a { font-size: clamp(6.5px, 2.9cqw, 0.7rem); }
}

/* Étiquette de thème : une seule ligne, taille adaptée à la largeur des cartes */
.chap-theme {
	white-space: nowrap;
	padding-right: 2.6rem;
	letter-spacing: 0.1em;
	font-size: clamp(6.5px, 0.95cqw, 0.72rem);
}
@media screen and (max-width: 980px) {
	.chap-theme { font-size: clamp(6.5px, 1.55cqw, 0.72rem); }
}
@media screen and (max-width: 640px) {
	.chap-theme { font-size: clamp(6.5px, 3cqw, 0.72rem); }
}

/* Leçon pas encore en ligne : bouton grisé, carte non cliquable */
.chap-acces .chap-indispo {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.35em;
	padding: 0.55em 0.35em;
	font-size: clamp(6.5px, 0.9cqw, 0.7rem);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #c4c4c4;
	cursor: not-allowed;
}
.chap-acces .chap-indispo:before {
	font-size: 1.35rem;
	color: #d6d6d6;
}
@media screen and (max-width: 980px) {
	.chap-acces .chap-indispo { font-size: clamp(6.5px, 1.45cqw, 0.7rem); }
}
@media screen and (max-width: 640px) {
	.chap-acces .chap-indispo { font-size: clamp(6.5px, 2.9cqw, 0.7rem); }
}
.chap-sanslecon:hover {
	transform: none;
	box-shadow: none;
	border-color: #e5e5e5;
}
