@font-face { font-family: "Playwrite FR Moderne"; src: url("fonts/PlaywriteFRModerne-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Andika"; src: url("fonts/Andika-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Andika"; src: url("fonts/Andika-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --papier: #fcfdff;
  --ligne: #e6ecf8;
  --ligne-forte: #bfcdea;
  --marge: #d9473f;
  --encre: #1f2c4a;
  --encre-douce: #4c5873;
  --bleu: #2e86de;
  --bleu-fonce: #1f6db8;
  --rouge: #c0392b;
  --scotch: rgba(246, 232, 170, 0.78);
  --u: 8px; /* interligne Seyès : 4 lignes fines par grand carreau */
  --marge-x: clamp(20px, 7vw, 96px);
  --barre: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--barre) + 16px); }
body {
  margin: 0;
  color: var(--encre);
  font: 19px/32px "Andika", "Atkinson Hyperlegible", system-ui, sans-serif;
  background-color: var(--papier);
  background-image:
    linear-gradient(to right, transparent calc(var(--marge-x) - 1px), var(--marge) calc(var(--marge-x) - 1px), var(--marge) calc(var(--marge-x) + 1px), transparent calc(var(--marge-x) + 1px)),
    linear-gradient(to bottom, var(--ligne-forte) 1px, transparent 1px),
    linear-gradient(to bottom, var(--ligne) 1px, transparent 1px),
    linear-gradient(to right, var(--ligne) 1px, transparent 1px);
  background-size: 100% 100%, 100% calc(4 * var(--u)), 100% var(--u), calc(4 * var(--u)) 100%;
  background-position: 0 0, 0 0, 0 0, var(--marge-x) 0;
}

a { color: var(--bleu-fonce); text-underline-offset: 3px; }
a:focus-visible, .bouton:focus-visible { outline: 3px solid var(--bleu); outline-offset: 3px; border-radius: 4px; }
img { max-width: 100%; height: auto; display: block; }

.cahier { padding: 0 20px 0 calc(var(--marge-x) + 28px); max-width: 1240px; overflow-x: clip; }
.texte { max-width: 62ch; }

/* Barre du haut : le nom, les sections, le code source, le téléchargement. */
.barre {
  position: sticky; top: 0; z-index: 10; height: var(--barre);
  display: flex; align-items: center; gap: 24px; padding: 0 clamp(16px, 3vw, 40px);
  background: rgba(252, 253, 255, 0.92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--ligne-forte); font-size: 17px;
}
.marque { display: flex; flex-shrink: 0; align-items: center; gap: 8px; font: 28px/1 "Playwrite FR Moderne", cursive; color: var(--rouge); text-decoration: none; }
.marque img { width: 40px; height: 40px; }
.barre .liens { display: flex; gap: 4px; list-style: none; margin: 0 auto 0 12px; padding: 0; }
.barre .liens a { display: block; white-space: nowrap; padding: 6px 12px; border-radius: 999px; color: var(--encre); text-decoration: none; }
.barre .liens a:hover { background: #eef3fb; }
.barre .liens a.ici { background: var(--encre); color: white; }
.barre .code { display: flex; align-items: center; gap: 6px; color: var(--encre); text-decoration: none; }
.barre .code:hover { color: var(--bleu-fonce); }
.bouton.petit { font-size: 16px; line-height: 24px; padding: 6px 18px; box-shadow: 0 2px 0 var(--bleu-fonce); }

/* La page d'accueil : tout est centré, les sections en cartes. */
.accueil, .page-accueil main section > h2, .intro { text-align: center; }
.cahier:has(.accueil) { margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px); max-width: 1240px; }
.accueil .titre { display: flex; align-items: center; margin-bottom: calc(3 * var(--u)); justify-content: center; gap: 20px; padding-top: calc(8 * var(--u)); }
.accueil .titre .logo { width: 150px; height: 150px; margin: 0; }
.accueil h1 { padding: 0; font-size: clamp(56px, 8vw, 104px); line-height: 1.2; max-width: none; }
.accroche { font: clamp(26px, 3.4vw, 40px)/1.4 "Playwrite FR Moderne", cursive; color: var(--encre); margin: calc(2 * var(--u)) auto 0; }
.accueil .chapo { max-width: 46ch; margin-left: auto; margin-right: auto; }
.intro { max-width: 62ch; margin: 0 auto calc(4 * var(--u)); }
.telecharger { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.telecharger .choix { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; font-size: 16px; color: var(--encre-douce); }
.telecharger label { display: flex; align-items: center; gap: 8px; }
.telecharger select { font: inherit; color: var(--encre); padding: 4px 8px; border: 1px solid var(--ligne-forte); border-radius: 8px; background: white; }
.accueil .colle { margin-left: auto; margin-right: auto; }

.cartes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; list-style: none; padding: 0; margin: calc(2 * var(--u)) 0 calc(4 * var(--u)); }
.cartes.deux-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cartes > li, .cartes > div { background: white; border: 1px solid var(--ligne-forte); border-radius: 16px; padding: 22px 24px; font-size: 17px; line-height: 28px; box-shadow: 0 4px 14px rgba(31, 44, 74, 0.06); }
.cartes h3 { margin: 6px 0 6px; line-height: 28px; }
.cartes p, .cartes ol { margin-bottom: 12px; }
.pastille { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: #eef3fb; font-size: 26px; }
.colle.petite { max-width: 820px; margin: calc(6 * var(--u)) auto; transform: rotate(1deg); }

header .logo { display: block; width: 160px; height: 160px; margin: calc(4 * var(--u)) 0 calc(-6 * var(--u)); }
h1, h2 { font-family: "Playwrite FR Moderne", cursive; font-weight: 400; color: var(--rouge); margin: 0; }
h1 { font-size: clamp(34px, 5.4vw, 64px); line-height: calc(12 * var(--u)); padding-top: calc(12 * var(--u)); max-width: 17ch; }
h2 { font-size: clamp(28px, 3.4vw, 40px); line-height: calc(8 * var(--u)); padding-top: calc(12 * var(--u)); margin-bottom: calc(2 * var(--u)); }
h3 { font-size: 21px; line-height: 32px; margin: calc(3 * var(--u)) 0 0; }
p, ul, ol { margin: 0 0 32px; }

header .chapo { font-size: 23px; line-height: 40px; margin: calc(3 * var(--u)) 0 calc(4 * var(--u)); color: var(--encre); }

.bouton {
  display: inline-block;
  background: var(--bleu);
  color: white;
  font-weight: 700;
  font-size: 21px;
  line-height: 32px;
  padding: 12px 28px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 3px 0 var(--bleu-fonce);
}
.bouton:hover { background: var(--bleu-fonce); }
.bouton:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--bleu-fonce); }
.sous-bouton { color: var(--encre-douce); font-size: 17px; margin: var(--u) 0 0; }
.store { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--u) calc(2 * var(--u)); margin: 0; color: var(--encre-douce); font-size: 17px; }
.store b { color: var(--encre); }
.telecharger .ou { margin: calc(2 * var(--u)) 0 0; color: var(--encre-douce); font-size: 16px; }
.store img { display: block; height: 52px; width: auto; }

/* La capture de l'application, scotchée sur la page du cahier. */
.colle { position: relative; margin: calc(8 * var(--u)) 0 calc(4 * var(--u)); max-width: 1080px; transform: rotate(-1.2deg); }
.colle img { border: 10px solid white; box-shadow: 0 10px 30px rgba(31, 44, 74, 0.18); }
.colle::before, .colle::after {
  content: ""; position: absolute; width: 130px; height: 34px; background: var(--scotch); top: -14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.colle::before { left: 8%; transform: rotate(-4deg); }
.colle::after { right: 8%; transform: rotate(5deg); }

.exemples { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 28px; margin: calc(2 * var(--u)) 0 calc(4 * var(--u)); padding: 0; list-style: none; }
.exemples li { margin: 0; }
.exemples img { border: 6px solid white; box-shadow: 0 6px 18px rgba(31, 44, 74, 0.16); }
.exemples li:nth-child(odd) img { transform: rotate(-1.5deg); }
.exemples li:nth-child(even) img { transform: rotate(1.2deg); }
.exemples b { display: block; margin-top: calc(2 * var(--u)); }
.exemples span { display: block; color: var(--encre-douce); font-size: 17px; line-height: 24px; }

.deux { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); gap: 48px; align-items: start; }
.deux .colle { margin-top: calc(3 * var(--u)); transform: rotate(1deg); }

.gommettes { list-style: none; padding: 0; }
.gommettes li { position: relative; padding-left: 44px; margin-bottom: calc(2 * var(--u)); }
.gommettes li::before {
  content: ""; position: absolute; left: 0; top: 4px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--g, var(--bleu)); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}
.gommettes li:nth-child(4n+1) { --g: #e74c3c; }
.gommettes li:nth-child(4n+2) { --g: #f1c40f; }
.gommettes li:nth-child(4n+3) { --g: #27ae60; }
.gommettes li:nth-child(4n+4) { --g: #2e86de; }
.gommettes h3 { margin: 0; }

ol.etapes { padding-left: 1.4em; }
ol.etapes li { padding-left: 6px; margin-bottom: var(--u); }
ol.etapes li::marker { font-weight: 700; color: var(--rouge); }
kbd, code { font-family: inherit; background: #eef3fb; border: 1px solid var(--ligne-forte); border-radius: 4px; padding: 0 6px; font-size: 0.92em; }

footer { margin-top: calc(12 * var(--u)); padding-bottom: calc(8 * var(--u)); color: var(--encre-douce); font-size: 16px; line-height: 24px; }
.cahier:has(.accueil) footer { text-align: center; max-width: 80ch; margin-left: auto; margin-right: auto; border-top: 1px solid var(--ligne-forte); padding-top: calc(4 * var(--u)); }
.liens-pied { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; font-size: 17px; }
footer p { margin-bottom: calc(2 * var(--u)); }

@media (max-width: 960px) {
  .cartes, .cartes.deux-col { grid-template-columns: 1fr; }
  .barre .code span { display: none; }
  .barre { gap: 12px; }
  .barre .liens { overflow-x: auto; margin-left: 0; }
  .barre .liens a { padding: 6px 8px; font-size: 15px; }
  .marque { font-size: 24px; }
  .exemples { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 62vw; overflow-x: auto; scroll-snap-type: x mandatory; padding: 12px 4px 16px; }
  .exemples li { scroll-snap-align: start; }
  .deux { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 600px) {
  .accueil .titre .logo { width: 96px; height: 96px; }
  .barre .liens, .barre .code { display: none; }
  .marque { margin-right: auto; }
  :root { --marge-x: 14px; }
  .cahier { padding-left: 34px; padding-right: 16px; }
  body { font-size: 18px; }
  header .chapo { font-size: 20px; line-height: 32px; }
  h1 { line-height: calc(7 * var(--u)); padding-top: calc(8 * var(--u)); }
  h2 { line-height: calc(6 * var(--u)); }
  .colle img { border-width: 6px; }
  .colle::before, .colle::after { width: 80px; height: 24px; }
}
@media (prefers-reduced-motion: reduce) { .bouton:active { transform: none; } }

/* Accueil : la page centrée garde le papier Seyès, sans la marge rouge du cahier. */
body.page-accueil {
  background-image:
    linear-gradient(to bottom, var(--ligne-forte) 1px, transparent 1px),
    linear-gradient(to bottom, var(--ligne) 1px, transparent 1px),
    linear-gradient(to right, var(--ligne) 1px, transparent 1px);
  background-size: 100% calc(4 * var(--u)), 100% var(--u), calc(4 * var(--u)) 100%;
  background-position: 0 0, 0 0, 0 0;
}
.page-accueil .exemples li { text-align: center; }
.colle figcaption { text-align: center; color: var(--encre-douce); font-size: 16px; margin-top: var(--u); transform: rotate(-1deg); }
