/* Ressources Maths Seconde — feuille de style du site.
   Identité : cahier à petits carreaux (grille + marge rouge), bleu et vert des PDF. */
:root {
  --paper: #fbfcfe;
  --surface: #ffffff;
  --ink: #18233d;
  --muted: #5a6683;
  --line: #dde3ee;
  --grid: #e3eaf6;
  --accent: #005293;
  --accent-ink: #ffffff;
  --accent-soft: #e7f0f9;
  --answer: #00783c;
  --answer-soft: #e8f5ee;
  --margin: #d9534f;
  --teacher: #a35a00;
  --teacher-soft: #fbf0e2;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --shadow: 0 1px 2px rgba(24,35,61,.06), 0 8px 24px rgba(24,35,61,.06);
  --font-display: "Zilla Slab", "Rockwell", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --radius: 10px;
}
/* Thème clair uniquement (pas de mode sombre automatique). */
:root { color-scheme: light; }

* { box-sizing: border-box; }
html { scroll-padding-top: 80px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.55; }
a { color: var(--accent); }
img, canvas, iframe { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 16px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- Barre de navigation ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 8px 22px; padding-block: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.brand-mark { min-width: 34px; height: 30px; padding: 0 5px; white-space: nowrap; border: 1.5px solid var(--accent); border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--accent); font-size: 14px; font-weight: 700;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 6px 6px; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav a { text-decoration: none; color: var(--ink); padding: 6px 10px; border-radius: 7px; font-weight: 600; font-size: 15px; }
.nav a:hover { background: var(--accent-soft); color: var(--accent); }
.nav a.actif { color: var(--accent); background: var(--accent-soft); }
.role { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.role.prof { background: var(--teacher-soft); color: var(--teacher); }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px;
  padding: 7px 12px; font: inherit; font-size: 14.5px; font-weight: 600; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn.answer { color: var(--answer); }
.btn.answer:hover { border-color: var(--answer); }
.btn.small { padding: 5px 10px; font-size: 13.5px; }
.btn.link { border: 0; background: none; padding: 6px 4px; color: var(--accent); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.inline { display: inline; margin: 0; }

/* ---------- En-tête cahier ---------- */
.cahier { position: relative; border-bottom: 1px solid var(--line); background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 20px 20px; }
.cahier::before { content: ""; position: absolute; top: 0; bottom: 0; left: clamp(16px, 6vw, 72px); width: 2px; background: var(--margin); opacity: .7; }
.cahier .wrap { padding-block: 34px 28px; padding-left: clamp(32px, 8vw, 100px); display: grid; gap: 16px; }
.cahier h1 { font-size: clamp(32px, 5vw, 50px); margin: 4px 0 0; }
.cahier h1 em { font-style: normal; color: var(--accent); }
.lede { max-width: 62ch; margin: 0; color: var(--muted); font-size: 17px; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 22px; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.stats b { color: var(--ink); font-weight: 500; }

.search { display: flex; gap: 8px; max-width: 640px; }
.search input { flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 14px; }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }

/* ---------- Contenu ---------- */
main { padding-block: 28px 64px; }
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 34px 0 14px; flex-wrap: wrap; }
.section-title h2 { margin: 0; font-size: 26px; }

.parcours { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.carte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  display: grid; gap: 8px; align-content: start; min-width: 0; }
.carte h3 { margin: 0; font-size: 20px; }
.carte p { margin: 0; color: var(--muted); }
.carte .liens { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.chapitres { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.chap-carte { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.chap-carte:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.chap-carte h3 { margin: 0; font-size: 19px; }
.chap-carte p { margin: 0; grid-column: 2; color: var(--muted); font-size: 14.5px; }
.chap-carte .mono { grid-column: 2; font-size: 12.5px; color: var(--muted); }
.num { grid-row: span 3; width: 48px; height: 48px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700;
  font-size: 22px; color: var(--accent); border: 1.5px solid var(--accent); border-radius: 9px;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 8px 8px; }
.num.grand { width: 70px; height: 70px; font-size: 34px; border-radius: 12px; }

/* ---------- Matières et niveaux (accueil) ---------- */
.niveaux { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.niveau-carte { display: grid; gap: 4px; text-decoration: none; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 16px 18px; }
.niveau-carte:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.niveau-carte h3 { margin: 0; font-size: 21px; }
.niveau-carte .mono { font-size: 12.5px; color: var(--muted); }
.niveau-carte.vide { border-left-color: var(--line); background: transparent; border-style: dashed; }
.cahier .eyebrow a { color: inherit; }
.select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; max-width: 220px; }

/* ---------- Page chapitre ---------- */
.fil { font-size: 14px; color: var(--muted); }
.fil a { color: var(--muted); }
.chap-tete { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 20px; align-items: center; }
.chap-tete h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); }
.chap-tete .lede { grid-column: 2; }
.famille { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 20px 10px; margin-top: 18px; }
.famille h2 { font-family: var(--font-mono); font-weight: 500; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 14px 0 4px; }
.doc { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; padding: 12px 0; }
.doc + .doc { border-top: 1px solid var(--line); }
.doc-titre { font-weight: 700; font-size: 17px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.meta { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.tag { font-size: 12px; font-weight: 700; padding: 1px 9px; border-radius: 999px; }
.tag.prof { background: var(--teacher-soft); color: var(--teacher); }
.tag.vieux { background: var(--danger-soft); color: var(--danger); }
.corrige { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 14px;
  background: var(--answer-soft); border-radius: 8px; padding: 7px 10px; }
.corrige .label { color: var(--answer); font-weight: 700; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.voisins { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

/* ---------- Lecteur de document ---------- */
.lecteur-tete { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.lecteur-tete h1 { margin: 2px 0 0; font-size: clamp(24px, 3.5vw, 34px); }
.lecteur { width: 100%; height: calc(100vh - 210px); min-height: 480px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--grid); }

/* ---------- Recherche ---------- */
.resultat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 12px; }
.resultat h3 { margin: 0 0 2px; font-size: 18px; font-family: var(--font-body); }
.resultat h3 a { text-decoration: none; }
.extrait { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; padding: 6px 0; border-top: 1px dashed var(--line); font-size: 15px; }
.extrait:first-of-type { border-top: 0; }
.extrait a { font-family: var(--font-mono); font-size: 13px; text-decoration: none; }
.extrait mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }

/* ---------- Questions flash : liste ---------- */
.series { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.serie-carte { display: grid; gap: 2px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; }
.serie-carte:hover { border-color: var(--accent); }
.serie-carte b { font-family: var(--font-display); font-size: 20px; color: var(--accent); }
.serie-carte span { font-size: 14px; color: var(--muted); }

/* ---------- Formulaires, messages ---------- */
.panneau { max-width: 460px; margin: 40px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.panneau h1 { margin-top: 0; font-size: 28px; }
.champ { display: grid; gap: 4px; margin-bottom: 14px; }
.champ label { font-weight: 600; }
.champ input { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; }
.message { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.message.erreur { background: var(--danger-soft); color: var(--danger); }
.message.ok { background: var(--answer-soft); color: var(--answer); }

/* ---------- Tableau de bord ---------- */
.grille-prof { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.chiffres { display: flex; flex-wrap: wrap; gap: 8px 26px; }
.chiffres div { display: grid; }
.chiffres b { font-family: var(--font-display); font-size: 30px; line-height: 1; }
.chiffres span { color: var(--muted); font-size: 14px; }
.journal { background: #0f1524; color: #d6deee; font-family: var(--font-mono); font-size: 12.5px; border-radius: 8px; padding: 12px 14px;
  max-height: 340px; overflow: auto; white-space: pre-wrap; margin: 0; }
.tableau-etat { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tableau-etat th, .tableau-etat td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tableau-etat th { font-family: var(--font-mono); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.defile { overflow-x: auto; }
.pastille { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--answer); }
.pastille.non { background: var(--danger); }

footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
footer .wrap { padding-block: 18px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }

@media (max-width: 760px) {
  .chap-tete { grid-template-columns: auto minmax(0, 1fr); }
  .chap-tete .lede, .chap-tete .btn { grid-column: 1 / -1; }
  .chap-tete .btn { justify-self: start; }
  .doc { grid-template-columns: minmax(0, 1fr); }
  .actions { justify-content: flex-start; }
  .nav { margin-left: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .nav a, .chap-carte, .serie-carte { transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
}
