/* Groupe Scolaire Saphine : prototype de la page d'accueil */
:root {
  /* Couleurs du logo */
  --indigo: #302684;      /* anneau */
  --bleu: #0e4483;        /* lettres */
  --jaune: #fbc421;       /* escalier */
  --violet: #60338e;      /* élève */
  --magenta: #a01481;     /* arc */
  /* Versions claires */
  --bleu-p: #e3edf8;
  --jaune-p: #fff3cc;
  --violet-p: #f1eafa;
  --magenta-p: #fbe6f5;
  /* Neutres */
  --blanc: #fff;
  --encre: #17143a;
  --encre-2: #47446a;
  --trait: #c9cde4;
  --carreau: 48,38,132;

  --titre: "Bricolage Grotesque", "Avenir Next", Arial, sans-serif;
  --texte: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --main: "Playwrite FR Moderne", "Bradley Hand", "Segoe Script", cursive;

  --gouttiere: clamp(18px, 4vw, 48px);
  --section: clamp(76px, 9vw, 136px);
  --ombre: 4px 5px 0 rgba(48,38,132,.16);
  --croquis: 255px 14px 225px 16px / 16px 225px 14px 255px;
  --croquis-grand: 255px 7px 225px 9px / 9px 225px 7px 255px;
  --croquis-grand-2: 9px 225px 7px 255px / 255px 7px 225px 9px;
  --croquis-2: 16px 225px 14px 255px / 255px 14px 225px 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--blanc); color: var(--encre); font: 400 17px/1.6 var(--texte); overflow-x: clip; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ul, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
.cadre { width: 100%; max-width: 1280px; margin: 0 auto; padding-inline: var(--gouttiere); }
:focus-visible { outline: 3px solid var(--magenta); outline-offset: 4px; border-radius: 4px; }
.evitement { position: absolute; left: 12px; top: -80px; z-index: 60; background: var(--jaune); padding: 10px 16px; }
.evitement:focus { top: 12px; }

/* ---------- Titres ---------- */
h1, h2 { font-family: var(--titre); font-weight: 800; font-stretch: 88%; letter-spacing: -.02em; text-wrap: balance; }
h1 { font-size: clamp(44px, 5.5vw, 80px); line-height: 1.02; }
h2 { font-size: clamp(36px, 4.3vw, 62px); line-height: 1.05; }
h3 { font-family: var(--titre); font-weight: 700; font-size: 24px; line-height: 1.15; }
.titre-section { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 18px 48px; margin-bottom: clamp(44px, 5vw, 72px); }
.titre-section p { max-width: 38ch; color: var(--encre-2); font-size: 18px; }
.intro { font-size: clamp(18px, 1.45vw, 20px); color: var(--encre-2); max-width: 46ch; }

/* Soulignement au feutre */
.feutre { position: relative; display: inline-block; white-space: nowrap; }
.feutre > svg:first-of-type { position: absolute; z-index: -1; left: -2%; bottom: -.2em; width: 104%; height: .34em; overflow: visible; }
.feutre path[pathLength] { fill: none; stroke: var(--jaune); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 1; }
.feutre.violet path[pathLength] { stroke: #b794dc; }
.feutre .crayon { position: absolute; left: 98%; bottom: -.16em; width: .95em; height: .95em; transform-origin: 14% 87%; }
.heros .feutre { margin-right: .9em; }
/* Surligneur */
.surligne { padding: 0 .12em; margin: 0 -.12em; background: linear-gradient(174deg, transparent 51%, rgba(251,196,33,.78) 52% 82%, transparent 83%); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.points .surligne { background: linear-gradient(176deg, transparent 51%, #f0bfe4 52% 84%, transparent 85%); }

/* ---------- Petits éléments ---------- */
.etiquette { display: inline-block; font: 700 16px/1 var(--titre); padding: 10px 16px 11px; border: 2px solid var(--encre); border-radius: var(--croquis); transform: rotate(-2deg); }
.etiquette.jaune { background: var(--jaune); }

.bouton {
  display: inline-flex; align-items: center; justify-content: center; min-height: 54px; padding: 12px 28px; position: relative;
  font: 700 18px/1.1 var(--titre); text-decoration: none; color: var(--blanc); background: var(--bleu);
  border: 2.5px solid var(--encre); border-radius: var(--croquis); box-shadow: 3px 4px 0 var(--jaune);
  transition: transform .18s, box-shadow .18s, border-radius .18s;
}
.bouton:hover { transform: rotate(-1deg) translateY(-2px); border-radius: var(--croquis-2); box-shadow: 5px 7px 0 var(--jaune); }
.bouton:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--jaune); }
.bouton.clair { background: var(--blanc); color: var(--bleu); }
.bouton.petit { min-height: 46px; padding: 8px 20px; font-size: 16px; }
.lien-feutre { font: 700 18px/1 var(--titre); text-decoration: underline; text-decoration-style: wavy; text-decoration-color: var(--magenta); text-decoration-thickness: 2px; text-underline-offset: 7px; padding: 12px 0; transition: color .18s; }
.lien-feutre:hover { color: var(--magenta); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; margin-top: 34px; }

/* Tirage façon Polaroid, avec ruban */
.tirage { --ruban: 251,196,33; position: relative; background: var(--blanc); padding: 11px; border: 1.5px solid var(--trait); box-shadow: var(--ombre); transform: rotate(var(--r, 0deg)); transition: transform .25s, box-shadow .25s; }
.tirage::before { content: ""; position: absolute; z-index: 2; left: var(--ruban-x, 50%); top: -15px; width: 92px; height: 27px; transform: translateX(-50%) rotate(var(--rr, -3deg));
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.32) 0 5px, transparent 5px 11px), rgba(var(--ruban), .84);
  clip-path: polygon(0 0, 3% 18%, 0 34%, 3% 50%, 0 68%, 3% 84%, 0 100%, 100% 100%, 97% 84%, 100% 68%, 97% 50%, 100% 34%, 97% 18%, 100% 0); }
.tirage img { width: 100%; object-fit: cover; }
.tirage figcaption { font: 400 16px/1.5 var(--main); color: var(--indigo); padding: 11px 4px 4px; }
.tirage:hover { transform: rotate(0deg) translateY(-4px); box-shadow: 7px 9px 0 rgba(48,38,132,.18); }

/* ---------- En-tête : papier blanc colorié au crayon ---------- */
.entete { position: sticky; top: 0; z-index: 50; background-color: var(--blanc);
  background-image:
    /* grain du papier */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 2.4 0 0 0 -.95'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23g)' opacity='.5'/%3E%3C/svg%3E"),
    /* coups de crayon de couleur */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1800' height='150'%3E%3Cfilter id='b' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.006 .16' numOctaves='3' seed='5'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .67 0 0 0 0 .93 3 0 0 0 -1.3'/%3E%3C/filter%3E%3Crect x='-300' y='-1100' width='2500' height='2300' transform='rotate(-24 900 75)' filter='url(%23b)' opacity='.34'/%3E%3C/svg%3E");
  box-shadow: 0 3px 14px rgba(48,38,132,.13); }
.entete-ligne { display: flex; align-items: center; gap: 24px; min-height: 92px; }
.logo { flex: none; margin-right: auto; padding: 8px 0; transition: transform .2s; transform: rotate(-2deg); filter: drop-shadow(2px 3px 0 rgba(14,68,131,.28)); }
.logo:hover { transform: rotate(0deg) scale(1.03); }
.logo img { width: auto; height: 70px; }

/* Menu : texte sombre, trait jaune au survol */
.menu { display: flex; gap: clamp(2px, 1vw, 14px); }
.menu a { position: relative; color: var(--encre); font: 600 18px/1 var(--titre); text-decoration: none; padding: 15px 12px; white-space: nowrap; }
.menu a::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 5px; height: 5px; border-radius: 60% 40% 50% 50%; background: var(--jaune); transform: scaleX(0) rotate(-1deg); transform-origin: left; transition: transform .22s; }
.menu a:hover::after, .menu a:focus-visible::after { transform: scaleX(1) rotate(-1deg); }
.entete .bouton { white-space: nowrap; background: var(--jaune); color: var(--encre); box-shadow: 3px 4px 0 rgba(23,20,58,.28); }
.entete .bouton:hover { box-shadow: 5px 7px 0 rgba(23,20,58,.28); }

/* ---------- Héros : page de cahier Seyès ---------- */
.heros { --m: max(16px, calc((100vw - 1280px) / 2 + 4px)); position: relative; isolation: isolate; overflow: clip;
  background:
    linear-gradient(90deg, transparent var(--m), rgba(160,20,129,.42) var(--m) calc(var(--m) + 2px), transparent calc(var(--m) + 2px)),
    repeating-linear-gradient(0deg, rgba(var(--carreau),.13) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(90deg, rgba(var(--carreau),.1) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(0deg, rgba(var(--carreau),.045) 0 1px, transparent 1px 8px),
    var(--blanc);
  border-bottom: 2px solid var(--indigo); }
.heros-grille { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(36px, 5vw, 80px); align-items: center; padding-block: clamp(56px, 6vw, 92px) clamp(72px, 8vw, 120px); }
.heros-texte { position: relative; z-index: 1; }
.heros h1 { margin: 26px 0 34px; }
.heros-photos { width: 100%; max-width: 580px; justify-self: end; }
.heros .grand { --r: 0deg; }
.heros .grand img { aspect-ratio: 1; }
/* Tampon de l'école, posé à cheval sur la photo et le cahier */
.heros .tampon { position: absolute; z-index: 3; top: -34px; right: calc(10px - var(--gouttiere)); width: clamp(112px, 11.25vw, 155px); transform: rotate(13deg); mix-blend-mode: multiply; pointer-events: none; }

/* ---------- Niveaux : deux cahiers ---------- */
section { position: relative; }
.niveaux, .vie, .points, .contact { padding-block: var(--section); }
.cahiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(22px, 2.2vw, 32px); }
.cahier { position: relative; padding: 28px 24px 34px 46px; border: 2px solid var(--encre); border-radius: 5px 16px 16px 5px; box-shadow: 5px 6px 0 rgba(48,38,132,.16); }
/* Dos du cahier et agrafes */
.cahier::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 20px; border-right: 2px solid var(--encre); border-radius: 3px 0 0 3px; background: var(--c); }
.c-violet { --c: var(--violet); background: var(--violet-p); }
.c-violet .tirage { --r: 1.2deg; --ruban: 160,20,129; }
.c-bleu { --c: var(--bleu); background: var(--bleu-p); }
.c-jaune { --c: var(--jaune); background: var(--jaune-p); }
.vignette { position: relative; background: var(--blanc); border: 2px solid var(--encre); border-radius: 10px; padding: 20px 24px 18px; margin-bottom: 44px; outline: 1.5px solid var(--c); outline-offset: -7px; }
.vignette h3 { font-size: clamp(28px, 2.5vw, 34px); font-weight: 800; font-stretch: 88%; letter-spacing: -.015em; }
.vignette small { font: 600 .5em/1 var(--titre); color: var(--encre-2); letter-spacing: 0; }
.vignette dl { display: grid; gap: 2px; margin-top: 10px; }
.vignette dl div { display: flex; align-items: baseline; gap: 12px; border-bottom: 1.5px dotted var(--encre-2); }
.vignette dt { font-weight: 600; font-size: 16px; min-width: 68px; }
.vignette dd { font: 400 17px/2.1 var(--main); color: var(--indigo); }
.cahier .tirage { --r: -1.4deg; }
.cahier .tirage img { aspect-ratio: 3 / 2; object-position: 50% 40%; }
.c-jaune .tirage { --r: 1.3deg; --ruban: 96,51,142; --rr: 3deg; }
.cahier-texte { margin-top: 34px; }
.cahier-texte > p { font-size: 18px; }
.coches { display: grid; gap: 10px; margin-top: 20px; }
.coches li { position: relative; padding-left: 36px; font-weight: 500; }
.coches li::before { content: ""; position: absolute; left: 0; top: 0; width: 26px; height: 26px; background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26' fill='none' stroke='%23a01481' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 14c3 2 4 4 6 7C13 14 17 8 23 4'/%3E%3C/svg%3E"); }

/* ---------- Vie à l'école ---------- */
.vie { background:
    repeating-linear-gradient(0deg, rgba(var(--carreau),.07) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, rgba(var(--carreau),.07) 0 1px, transparent 1px 24px), var(--blanc);
  border-block: 2px solid var(--indigo); isolation: isolate; }
.planche { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(30px, 3.2vw, 48px) clamp(16px, 2.2vw, 32px); align-items: start; }
.planche .tirage { display: flex; flex-direction: column; height: 100%; }
.planche .tirage img { flex: 1; min-height: 0; }
.p1 { grid-column: span 8; --r: -.8deg; }
.p1 img { aspect-ratio: 16 / 10; }
.p2 { grid-column: span 4; --r: 1.6deg; --ruban: 160,20,129; --rr: 4deg; }
.p2 img { height: 0; }
.p3, .p4, .p5 { grid-column: span 4; }
.p3 img, .p4 img, .p5 img { aspect-ratio: 3 / 2; }
.p3 { --r: 1.2deg; --ruban: 96,51,142; }
.p4 { --r: -1.4deg; --rr: 5deg; --ruban-x: 24%; }
.p5 { --r: 1deg; --ruban: 48,110,190; }
.p6, .p7, .p8, .p9 { grid-column: span 6; }
.p6 img, .p7 img, .p8 img, .p9 img { aspect-ratio: 5 / 3; }
.p6 { --r: -1deg; --ruban: 160,20,129; --ruban-x: 70%; }
.p7 { --r: 1.2deg; --rr: 3deg; }
.p8 { --r: .9deg; --ruban: 96,51,142; --ruban-x: 30%; }
.p9 { --r: -1.1deg; --ruban: 48,110,190; }

/* ---------- Points forts : fiches de révision ---------- */
.fiches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 2.4vw, 34px); }
.fiche { --c: var(--bleu); --p: var(--bleu-p); position: relative; padding: 30px 28px 32px; border: 2.5px solid var(--c); border-radius: var(--croquis-grand); background: var(--p); transition: transform .2s, border-radius .2s; }
.fiche:nth-child(even) { border-radius: var(--croquis-grand-2); }
.fiche:nth-child(2) { --c: var(--magenta); --p: var(--magenta-p); }
.fiche:nth-child(3) { --c: #b58200; --p: var(--jaune-p); }
.fiche:nth-child(4) { --c: var(--violet); --p: var(--violet-p); }
.fiche:nth-child(5) { --c: #b58200; --p: var(--jaune-p); }
.fiche svg { width: 62px; height: 62px; fill: none; stroke: var(--c); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 18px; overflow: visible; }
.fiche h3 { margin-bottom: 10px; }
.fiche p { color: var(--encre-2); }
.fiche:hover { transform: rotate(-.7deg) translateY(-3px); }
.fiche:hover svg { animation: gribouille .5s ease-in-out; }

/* ---------- Contact ---------- */
.contact { background: var(--bleu-p); border-top: 2px solid var(--indigo); isolation: isolate; }
.contact-grille { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(44px, 6vw, 92px); align-items: center; }
.contact .intro { margin-top: 28px; }
.coordonnees { margin-top: 40px; padding: 6px 26px 10px; background: var(--blanc); border: 2px solid var(--encre); border-radius: var(--croquis-grand); }
.coordonnees div { padding: 16px 0; border-bottom: 1.5px solid var(--trait); }
.coordonnees div:last-child { border: 0; }
.coordonnees dt { font: 700 17px/1.3 var(--titre); color: var(--violet); }
.coordonnees dd { font-weight: 500; }
.coordonnees a { text-decoration-color: var(--magenta); text-underline-offset: 4px; font-size: 20px; font-weight: 700; }
.plan { --r: 1.4deg; --ruban: 160,20,129; }
.plan iframe { display: block; width: 100%; aspect-ratio: 1 / 1.05; border: 0; background: var(--violet-p); }

/* ---------- Pied de page ---------- */
.regle { height: 44px; border-block: 2px solid var(--encre); background-color: var(--jaune);
  background-image:
    repeating-linear-gradient(90deg, var(--encre) 0 2px, transparent 2px 100px),
    repeating-linear-gradient(90deg, var(--encre) 0 1.5px, transparent 1.5px 50px),
    repeating-linear-gradient(90deg, var(--encre) 0 1px, transparent 1px 10px);
  background-size: 100% 26px, 100% 19px, 100% 12px; background-repeat: no-repeat; }
.pied-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 40px; padding-block: 34px; font-size: 16px; }
.pied-ligne img { width: auto; height: 62px; }
.pied-ligne p:last-child { margin-left: auto; }
.pied a { display: inline-block; padding: 6px 0; text-underline-offset: 4px; }

/* ---------- Tablette et mobile ---------- */
@media (max-width: 1080px) {
  .entete-ligne { gap: 14px; }
  .cahiers { grid-template-columns: minmax(0, 1fr); max-width: 620px; margin-inline: auto; }
}
@media (max-width: 1000px) {
  .fiches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  html { scroll-padding-top: 38px; }
  /* Le logo défile, les onglets du menu restent en haut */
  .entete { top: -78px; }
  .entete-ligne { flex-wrap: wrap; gap: 0; padding-top: 4px; }
  .logo { padding: 6px 0; }
  .logo img { height: 60px; }
  .menu { position: relative; order: 3; width: calc(100% + 2 * var(--gouttiere)); margin: 0 calc(-1 * var(--gouttiere)); justify-content: space-between; padding-inline: calc(var(--gouttiere) - 4px); gap: 0; }
  .menu::before { content: ""; position: absolute; top: 0; left: var(--gouttiere); right: var(--gouttiere); border-top: 1.5px solid rgba(14,68,131,.22); }
  .menu a { flex: 0 1 auto; text-align: center; font-size: clamp(16px, 4.7vw, 20px); padding: 14px 4px 16px; }
  .menu a::after { left: 4px; right: 4px; bottom: 6px; }
  .heros-grille, .cahiers, .contact-grille { grid-template-columns: minmax(0, 1fr); }
  .heros { --m: 8px; }
  .heros-photos { justify-self: start; }
  .heros .tampon { top: -26px; right: -10px; width: clamp(84px, 24.75vw, 128px); }
  .heros-grille { padding-top: 40px; gap: 52px; }
}
@media (max-width: 700px) {
  body { font-size: 16.5px; }
  .planche { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 14px; }
  .p1, .p5, .p6, .p7 { grid-column: 1 / -1; }
  .p2, .p3, .p4, .p8, .p9 { grid-column: span 1; }
  .p2 img { height: auto; }
  .p3 img, .p4 img, .p8 img, .p9 img { aspect-ratio: 1; }
  .planche .p2 { grid-column: 1 / -1; width: 66%; justify-self: center; }
  .p2 img { aspect-ratio: 4 / 5; }
  .planche .tirage { padding: 8px; }
  .tirage figcaption { font-size: 14px; padding: 9px 2px 3px; }
  .tirage::before { width: 74px; height: 23px; top: -12px; }
  .fiches { grid-template-columns: minmax(0, 1fr); }
  .pied-ligne p:last-child { margin-left: 0; }
}
@media (max-width: 480px) {
  .contact .bouton { width: 100%; }
}

@media (max-width: 350px) {
  .logo img { height: 48px; }
  .logo { padding: 12px 0; }
  .bouton.petit { padding-inline: 12px; font-size: 15px; }
}

/* ---------- Mouvement : coupé si l'utilisateur le demande ---------- */
@keyframes gribouille { 25% { transform: rotate(-7deg); } 60% { transform: rotate(6deg); } }
@keyframes trace { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes ecrit { from { left: -4%; transform: rotate(0); } 25% { transform: rotate(-9deg); } 50% { transform: rotate(6deg); } 75% { transform: rotate(-7deg); } to { left: 98%; transform: rotate(0); } }
@keyframes pose { from { opacity: 0; transform: rotate(calc(var(--r, 0deg) + 5deg)) translateY(22px); } }
@keyframes tamponne { from { opacity: 0; transform: rotate(13deg) scale(1.5); } 60% { opacity: 1; transform: rotate(13deg) scale(.96); } }
@keyframes glisse { from { transform: rotate(calc(var(--r, 0deg) + 5deg)) translateY(22px); } }
@keyframes monte { from { opacity: 0; transform: translateY(16px); } }
@media (prefers-reduced-motion: no-preference) {
  .heros .grand { animation: glisse .6s .1s backwards ease-out; }
  .heros .tampon { animation: tamponne .35s 1.1s backwards ease-in; }
  .heros .feutre path[pathLength] { animation: trace .9s .5s both ease-in-out; }
  .heros .crayon { animation: ecrit .9s .5s both ease-in-out; }
  @supports (animation-timeline: view()) {
    .cahier, .fiche { animation: monte both ease-out; animation-timeline: view(); animation-range: entry 0% entry 30%; }
    .planche .tirage, .plan { animation: pose both ease-out; animation-timeline: view(); animation-range: entry 0% entry 35%; }
    .vie .feutre path[pathLength], .contact .feutre path[pathLength] { animation: trace both linear; animation-timeline: view(); animation-range: entry 60% cover 40%; }
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
