/* ============================================================
   MathsLink Ressources — charte graphique
   Navy #1A2844 · Crème #FAF7F2 · Doré #C9A961
   Titres : Cormorant Garamond · Corps : Inter
   ============================================================ */

:root {
  --navy: #1A2844;
  --navy-soft: #243456;
  --creme: #FAF7F2;
  --dore: #C9A961;
  --dore-clair: #E4CD94;
  --encre: #1A2844;
  --gris-doux: #6B7280;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

body {
  font-family: var(--sans);
  background: var(--creme);
  color: var(--encre);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- En-tête ---------- */
.site-header {
  background: var(--navy);
  color: var(--creme);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 64px);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(201, 169, 97, 0.35);
}

.brand { text-decoration: none; display: flex; align-items: baseline; gap: 10px; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.55rem; color: var(--dore); }
.brand-sub {
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--creme); opacity: 0.85;
}

.site-nav { display: flex; align-items: center; gap: clamp(14px, 3vw, 28px); }
.site-nav a {
  text-decoration: none; font-size: 0.88rem; font-weight: 500;
  color: var(--creme); opacity: 0.9; transition: opacity 0.2s;
}
.site-nav a:hover { opacity: 1; }
.nav-cta {
  border: 1px solid var(--dore); border-radius: 3px;
  padding: 7px 14px; color: var(--dore) !important;
}

/* ---------- Héro ---------- */
.hero {
  background: var(--navy);
  color: var(--creme);
  text-align: center;
  padding: clamp(70px, 11vw, 130px) 24px clamp(80px, 12vw, 140px);
}

.hero-rule {
  width: 64px; height: 2px; background: var(--dore);
  margin: 0 auto 36px;
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.6rem, 6.5vw, 4.4rem);
  line-height: 1.12;
  letter-spacing: 0.01em;
}

.hero-sub {
  margin: 26px auto 0;
  max-width: 560px;
  font-size: clamp(0.98rem, 2vw, 1.08rem);
  color: var(--dore-clair);
}

.hero-actions {
  margin-top: 42px;
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-block;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 13px 28px;
  border-radius: 3px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--dore); outline-offset: 3px; }

.btn-gold { background: var(--dore); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--creme); border-color: rgba(250, 247, 242, 0.45); }
.btn-navy { background: var(--navy); color: var(--creme); }
.btn-ghost-navy { background: transparent; color: var(--navy); border-color: var(--navy); }

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 9vw, 110px) clamp(20px, 5vw, 64px); }
.section-creme { background: var(--creme); color: var(--encre); }
.section-navy { background: var(--navy); color: var(--creme); }

.section-head { max-width: 680px; margin: 0 auto 48px; text-align: center; }
.section-head h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.2;
  margin-bottom: 16px;
}
.section-head p { color: var(--gris-doux); font-size: 0.98rem; }
.section-navy .section-head p { color: var(--dore-clair); }

.eyebrow {
  display: inline-block;
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--dore);
  margin-bottom: 14px;
}

/* ---------- Filtres ---------- */
.filtres {
  max-width: 980px; margin: 0 auto 36px;
  display: flex; flex-wrap: wrap; gap: 14px;
  align-items: center; justify-content: center;
}

.filtres-niveaux { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.chip {
  font-family: var(--sans);
  font-size: 0.84rem; font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(26, 40, 68, 0.25);
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.chip:hover { background: rgba(201, 169, 97, 0.15); }
.chip.actif { background: var(--navy); color: var(--creme); border-color: var(--navy); }

.filtre-theme {
  font-family: var(--sans);
  font-size: 0.88rem;
  padding: 9px 14px;
  border-radius: 3px;
  border: 1px solid rgba(26, 40, 68, 0.3);
  background: #fff;
  color: var(--navy);
}

/* ---------- Grille exercices ---------- */
.grille-exercices {
  max-width: 980px; margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}

.chargement, .vide { grid-column: 1 / -1; text-align: center; color: var(--gris-doux); }

.carte-exo {
  display: block;
  text-decoration: none;
  background: #fff;
  border: 1px solid rgba(26, 40, 68, 0.1);
  border-top: 3px solid var(--dore);
  border-radius: 4px;
  padding: 24px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.carte-exo:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(26, 40, 68, 0.1);
}

.carte-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

.badge-niveau {
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--navy); color: var(--creme);
  padding: 4px 10px; border-radius: 3px;
}

.carte-theme, .exo-theme {
  font-size: 0.78rem; font-weight: 600;
  color: var(--dore); text-transform: uppercase; letter-spacing: 0.06em;
}

.carte-exo h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1.25;
  color: var(--navy);
}

.points-difficulte { display: inline-flex; gap: 4px; margin-left: auto; }
.points-difficulte span {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(26, 40, 68, 0.15);
}
.points-difficulte span.plein { background: var(--dore); }

/* ---------- Grille outils ---------- */
.grille-outils {
  max-width: 980px; margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}

.carte-outil {
  display: block;
  text-decoration: none;
  background: var(--navy-soft);
  border: 1px solid rgba(201, 169, 97, 0.4);
  border-radius: 4px;
  padding: 28px 24px;
  color: var(--creme);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.carte-outil:hover { transform: translateY(-3px); border-color: var(--dore); }

.carte-outil h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--dore-clair);
  margin-bottom: 10px;
}
.carte-outil p { font-size: 0.9rem; opacity: 0.85; }
.carte-outil .ouvrir {
  display: inline-block; margin-top: 16px;
  font-size: 0.82rem; font-weight: 600; color: var(--dore);
}

/* ---------- Section accompagnement ---------- */
.section-accomp { text-align: center; }
.accomp-inner { max-width: 640px; margin: 0 auto; }
.accomp-inner h2 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.9rem, 4.5vw, 2.8rem);
  margin-bottom: 18px;
}
.accomp-inner > p { color: var(--gris-doux); }

.accomp-points {
  list-style: none;
  margin: 28px 0 10px;
  display: inline-flex; flex-direction: column; gap: 10px;
  text-align: left;
}
.accomp-points li { padding-left: 26px; position: relative; font-size: 0.95rem; }
.accomp-points li::before {
  content: "—";
  position: absolute; left: 0;
  color: var(--dore); font-weight: 700;
}

/* ---------- Détail exercice ---------- */
.exo-detail {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(48px, 7vw, 80px) 24px 100px;
}

.lien-retour {
  display: inline-block;
  text-decoration: none;
  font-size: 0.88rem; font-weight: 600;
  color: var(--dore);
  margin-bottom: 32px;
}
.lien-retour:hover { text-decoration: underline; }

.exo-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

.exo-detail h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  line-height: 1.18;
  margin-bottom: 32px;
}

.exo-corps { font-size: 1rem; }
.exo-corps h2 {
  font-family: var(--serif); font-weight: 600;
  font-size: 1.5rem; margin: 32px 0 14px;
}
.exo-corps p { margin-bottom: 14px; }
.exo-corps ol, .exo-corps ul { margin: 0 0 14px 22px; }
.exo-corps li { margin-bottom: 6px; }
.exo-corps .katex-display { margin: 22px 0; overflow-x: auto; padding: 4px 0; }
.exo-corps strong { color: var(--navy); }

.correction-bloc { margin-top: 44px; }

.correction {
  margin-top: 28px;
  background: #fff;
  border: 1px solid rgba(201, 169, 97, 0.5);
  border-left: 3px solid var(--dore);
  border-radius: 4px;
  padding: 28px 30px;
}

/* ---------- Pied de page ---------- */
.site-footer {
  background: var(--navy);
  color: var(--creme);
  text-align: center;
  padding: 56px 24px 48px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.footer-rule { width: 64px; height: 2px; background: var(--dore); margin-bottom: 18px; }
.footer-logo { font-family: var(--serif); font-weight: 700; font-size: 1.8rem; color: var(--dore); }
.footer-tagline { font-size: 0.82rem; opacity: 0.85; }
.site-footer a { font-size: 0.82rem; color: var(--dore-clair); margin-top: 6px; }

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
  .site-nav a:not(.nav-cta) { display: none; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .btn { text-align: center; }
}
