/* Portail élève : « Rappels de cours du cycle 4 » */

@font-face {
	font-family: "Fredoka";
	src: url("polices/fredoka-latin.woff2") format("woff2");
	font-weight: 400 700;
	font-display: swap;
}

:root {
	--fond: #f5f3ff;
	--texte: #1e1b4b;
	--texte-doux: #5b5a78;
	--carte: #ffffff;
	--violet: #6366f1;
	--ombre: 0 6px 20px rgba(49, 46, 129, 0.12);
	--ombre-forte: 0 14px 34px rgba(49, 46, 129, 0.22);
	--rayon: 22px;
	--titre: "Fredoka", "Segoe UI Rounded", "Arial Rounded MT Bold", system-ui, sans-serif;
	--corps: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
	box-sizing: border-box;
}

[hidden] {
	display: none !important;
}

html {
	scroll-behavior: smooth;
	scroll-padding-top: 76px;
}

body {
	margin: 0;
	padding-inline: 16px;
	font-family: var(--corps);
	color: var(--texte);
	background:
		radial-gradient(circle at 10% 0%, #fde68a55 0, transparent 35%),
		radial-gradient(circle at 90% 10%, #a5f3fc66 0, transparent 35%),
		radial-gradient(circle at 50% 100%, #f9a8d455 0, transparent 40%),
		var(--fond);
	background-attachment: fixed;
	min-height: 100vh;
	overflow-x: hidden;
}

/* ===== Symboles flottants ===== */

.symboles span {
	position: fixed;
	z-index: -1;
	font-family: var(--titre);
	font-weight: 700;
	color: var(--violet);
	opacity: 0.09;
	animation: flotter 14s ease-in-out infinite;
	user-select: none;
}

.symboles span:nth-child(1) { top: 8%; left: 6%; font-size: 64px; }
.symboles span:nth-child(2) { top: 18%; right: 8%; font-size: 72px; animation-delay: -2s; }
.symboles span:nth-child(3) { top: 42%; left: 3%; font-size: 52px; animation-delay: -4s; }
.symboles span:nth-child(4) { top: 55%; right: 4%; font-size: 60px; animation-delay: -6s; }
.symboles span:nth-child(5) { top: 78%; left: 10%; font-size: 56px; animation-delay: -8s; }
.symboles span:nth-child(6) { top: 88%; right: 14%; font-size: 64px; animation-delay: -10s; }
.symboles span:nth-child(7) { top: 30%; left: 45%; font-size: 48px; animation-delay: -3s; }
.symboles span:nth-child(8) { top: 66%; left: 50%; font-size: 50px; animation-delay: -5s; }
.symboles span:nth-child(9) { top: 4%; left: 62%; font-size: 44px; animation-delay: -7s; }
.symboles span:nth-child(10) { top: 94%; left: 36%; font-size: 46px; animation-delay: -9s; }
.symboles span:nth-child(11) { top: 36%; right: 28%; font-size: 42px; animation-delay: -11s; }
.symboles span:nth-child(12) { top: 72%; left: 26%; font-size: 58px; animation-delay: -12s; }

@keyframes flotter {
	0%, 100% { transform: translateY(0) rotate(0deg); }
	50% { transform: translateY(-24px) rotate(12deg); }
}

/* ===== En-tête ===== */

.entete {
	max-width: 1100px;
	margin: 0 auto;
	padding-block: 28px 12px;
	text-align: center;
}

.tam {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
}

.tam img {
	width: 88px;
	height: 88px;
	animation: coucou 3s ease-in-out infinite;
}

@keyframes coucou {
	0%, 100% { transform: rotate(0deg); }
	10% { transform: rotate(-8deg); }
	20% { transform: rotate(6deg); }
	30% { transform: rotate(0deg); }
}

.bulle {
	position: relative;
	margin: 0;
	padding: 10px 16px;
	max-width: 290px;
	background: var(--carte);
	border-radius: 18px;
	box-shadow: var(--ombre);
	font-family: var(--titre);
	font-size: 17px;
	text-align: left;
}

.bulle::before {
	content: "";
	position: absolute;
	left: -9px;
	top: 50%;
	transform: translateY(-50%);
	border: 10px solid transparent;
	border-left: 0;
	border-right-color: var(--carte);
}

h1 {
	margin: 14px 0 18px;
	font-family: var(--titre);
	font-weight: 700;
	font-size: clamp(2rem, 6vw, 3.6rem);
	line-height: 1.05;
	background: linear-gradient(90deg, #f97316, #db2777 35%, #6366f1 70%, #0d9488);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

h1 .cycle {
	display: inline-block;
	background: linear-gradient(90deg, #6366f1, #0d9488);
	-webkit-background-clip: text;
	background-clip: text;
}

/* ===== Recherche et niveaux ===== */

.outils {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
	align-items: center;
}

.recherche {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1 1 280px;
	max-width: 460px;
	padding: 4px 16px;
	background: var(--carte);
	border: 2px solid transparent;
	border-radius: 999px;
	box-shadow: var(--ombre);
}

.recherche:focus-within {
	border-color: var(--violet);
}

.recherche input {
	flex: 1;
	min-width: 0;
	padding: 10px 0;
	border: 0;
	outline: 0;
	background: transparent;
	font: inherit;
	font-size: 16px;
	color: var(--texte);
}

.niveaux {
	display: flex;
	gap: 4px;
	padding: 4px;
	background: var(--carte);
	border-radius: 999px;
	box-shadow: var(--ombre);
}

.niveaux button {
	min-width: 44px;
	padding: 8px 12px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	font-family: var(--titre);
	font-size: 15px;
	color: var(--texte-doux);
	cursor: pointer;
}

.niveaux button[aria-pressed="true"] {
	background: var(--violet);
	color: #fff;
}

/* ===== Navigation par thèmes ===== */

.themes-nav {
	position: sticky;
	top: 0;
	z-index: 10;
	display: flex;
	gap: 8px;
	max-width: 1100px;
	width: fit-content;
	max-width: min(1100px, 100%);
	margin: 8px auto 0;
	padding: 8px;
	overflow-x: auto;
	scrollbar-width: none;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.55);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}

.themes-nav::-webkit-scrollbar {
	display: none;
}

.themes-nav a {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border-radius: 999px;
	background: var(--carte);
	border: 2px solid var(--c);
	box-shadow: var(--ombre);
	font-family: var(--titre);
	font-size: 15px;
	color: var(--texte);
	text-decoration: none;
	white-space: nowrap;
	transition: transform 0.15s, background 0.15s;
}

.themes-nav a:hover,
.themes-nav a:focus-visible {
	background: var(--c);
	color: #fff;
	transform: translateY(-2px);
}

.themes-nav .compte {
	min-width: 22px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--c);
	color: #fff;
	font-size: 13px;
	text-align: center;
}

.themes-nav a:hover .compte {
	background: #fff;
	color: var(--c);
}

/* ===== Sections de thème ===== */

main {
	max-width: 1100px;
	margin: 0 auto;
}

.theme {
	margin: 26px 0 40px;
}

.theme-titre {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-bottom: 16px;
}

.theme-icone {
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: 58px;
	height: 58px;
	border-radius: 18px;
	background: var(--c);
	box-shadow: 0 6px 16px color-mix(in srgb, var(--c) 45%, transparent);
	font-size: 30px;
	transform: rotate(-6deg);
}

.theme h2 {
	margin: 0;
	font-family: var(--titre);
	font-weight: 600;
	font-size: clamp(1.3rem, 3.5vw, 1.8rem);
	line-height: 1.15;
}

.theme .accroche {
	margin: 2px 0 0;
	color: var(--texte-doux);
	font-size: 14px;
}

.grille {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 20px;
}

/* ===== Dalles ===== */

.dalle {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--carte);
	border-radius: var(--rayon);
	box-shadow: var(--ombre);
	color: inherit;
	text-decoration: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	animation: apparaitre 0.5s ease both;
	animation-delay: calc(var(--i, 0) * 70ms);
}

.dalle:hover,
.dalle:focus-within {
	transform: translateY(-6px) rotate(-0.6deg);
	box-shadow: var(--ombre-forte);
}

.dalle-lien {
	display: flex;
	flex: 1;
	flex-direction: column;
	color: inherit;
	text-decoration: none;
	outline: none;
}

.dalle:has(.dalle-lien:focus-visible) {
	box-shadow: 0 0 0 4px var(--c), var(--ombre-forte);
}

@keyframes apparaitre {
	from { opacity: 0; transform: translateY(18px) scale(0.97); }
	to { opacity: 1; transform: none; }
}

.vignette {
	position: relative;
	aspect-ratio: 16 / 10;
	max-width: 100%;
	overflow: hidden;
	background: color-mix(in srgb, var(--c) 15%, #fff);
}

.vignette img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top left;
	transition: transform 0.4s ease;
}

.dalle:hover .vignette img {
	transform: scale(1.06);
}

.vignette::after {
	content: "";
	position: absolute;
	inset: 55% 0 0 0;
	background: linear-gradient(transparent, rgba(255, 255, 255, 0.95));
}

.niveau {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 1;
	padding: 4px 12px;
	border-radius: 999px;
	background: var(--c);
	color: #fff;
	font-family: var(--titre);
	font-weight: 600;
	font-size: 15px;
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.dalle-corps {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 6px;
	padding: 4px 18px 18px;
}

.dalle h3 {
	margin: 0;
	font-family: var(--titre);
	font-weight: 600;
	font-size: 1.3rem;
	line-height: 1.2;
}

.dalle p {
	flex: 1;
	margin: 0;
	color: var(--texte-doux);
	font-size: 14.5px;
	line-height: 1.4;
}

.dalle .action {
	align-self: flex-start;
	margin-top: 8px;
	padding: 8px 16px;
	border-radius: 999px;
	background: var(--c);
	color: #fff;
	font-family: var(--titre);
	font-weight: 500;
	font-size: 15px;
	transition: padding 0.2s;
}

.dalle-lien:hover .action {
	padding-right: 22px;
}

.dalle::before {
	content: "";
	position: absolute;
	inset: auto 0 0 0;
	height: 6px;
	background: var(--c);
}

/* Bouton et fenêtre du QR code */

.dalle-qr {
	padding: 0 18px 20px;
}

.bouton-qr,
.qr-fermer {
	padding: 7px 14px;
	border: 2px solid var(--c, var(--violet));
	border-radius: 999px;
	background: var(--carte);
	color: var(--texte);
	font-family: var(--titre);
	font-size: 14px;
	cursor: pointer;
}

.bouton-qr:hover,
.bouton-qr:focus-visible {
	background: var(--c);
	color: #fff;
}

.fenetre-qr {
	max-width: min(340px, calc(100vw - 32px));
	padding: 22px;
	border: 0;
	border-radius: var(--rayon);
	box-shadow: var(--ombre-forte);
	color: var(--texte);
	text-align: center;
}

.fenetre-qr::backdrop {
	background: rgba(30, 27, 75, 0.55);
}

.fenetre-qr h3 {
	margin: 0 0 14px;
	font-family: var(--titre);
	font-size: 1.3rem;
}

.qr-image {
	display: flex;
	justify-content: center;
	padding: 10px;
	background: #fff;
}

.qr-image img,
.qr-image canvas {
	max-width: 100%;
	height: auto;
}

.qr-adresse {
	margin: 12px 0;
	font-size: 12px;
	word-break: break-all;
	color: var(--texte-doux);
}

.qr-fermer {
	--c: var(--violet);
}

/* Dalle « bientôt » */

.dalle-bientot {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 180px;
	padding: 20px;
	border: 3px dashed color-mix(in srgb, var(--c) 55%, #fff);
	border-radius: var(--rayon);
	background: color-mix(in srgb, var(--c) 6%, transparent);
	color: var(--texte-doux);
	font-family: var(--titre);
	font-size: 17px;
	text-align: center;
}

.dalle-bientot span {
	font-size: 36px;
}

/* ===== Divers ===== */

.vide {
	margin: 40px auto;
	font-family: var(--titre);
	font-size: 20px;
	text-align: center;
	color: var(--texte-doux);
}

.pied {
	max-width: 1100px;
	margin: 20px auto 0;
	padding-block: 20px 28px;
	border-top: 2px dashed #c7d2fe;
	text-align: center;
	font-size: 13px;
	color: var(--texte-doux);
}

.pied a {
	color: var(--violet);
}

/* ===== Petits écrans ===== */

@media (max-width: 600px) {
	.entete {
		padding-top: 16px;
	}

	.tam img {
		width: 64px;
		height: 64px;
	}

	.bulle {
		font-size: 15px;
	}

	.symboles span {
		font-size: 36px !important;
	}

	.theme-icone {
		width: 48px;
		height: 48px;
		font-size: 24px;
	}

	.grille {
		grid-template-columns: 1fr;
		gap: 16px;
	}

	.niveaux {
		width: 100%;
		justify-content: space-between;
	}

	.niveaux button {
		flex: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
		scroll-behavior: auto !important;
	}
}

/* ===== Variante physique-chimie (body.physique-chimie) ===== */

.physique-chimie {
	--fond: #f0fdf4;
	--violet: #059669;
}

.physique-chimie h1 {
	background: linear-gradient(90deg, #059669, #0891b2 40%, #7c3aed 75%, #db2777);
	-webkit-background-clip: text;
	background-clip: text;
}

.physique-chimie h1 .cycle {
	display: block;
	margin-top: 0.25em;
	font-size: 0.55em;
	background: linear-gradient(90deg, #db2777, #ea580c);
	-webkit-background-clip: text;
	background-clip: text;
}

.physique-chimie .pied {
	border-top-color: #a7f3d0;
}

/* ===== Variante français (body.francais) ===== */

.francais {
	--fond: #faf5ff;
	--violet: #7c3aed;
}

.francais h1 {
	background: linear-gradient(90deg, #7c3aed, #a21caf 45%, #db2777);
	-webkit-background-clip: text;
	background-clip: text;
}

.francais h1 .cycle {
	display: block;
	margin-top: 0.25em;
	font-size: 0.55em;
	background: linear-gradient(90deg, #db2777, #ea580c);
	-webkit-background-clip: text;
	background-clip: text;
}

.francais .symboles span {
	font-family: Georgia, "Times New Roman", serif;
}

.francais .pied {
	border-top-color: #ddd6fe;
}
