/*
 * Boutique APEL : une feuille de cahier à grands carreaux (Seyès).
 * Tous les blocs de texte font 32 px de ligne (ou un multiple) pour rester posés sur les lignes du papier.
 */

@font-face {
  font-family: "Playwrite FR Moderne";
  src: url("../fonts/playwrite-fr-moderne-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lexend";
  src: url("../fonts/lexend-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lexend";
  src: url("../fonts/lexend-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --papier: #fdfdfa;
  --ligne-fine: #e1e6f6;
  --ligne-forte: #c3cdee;
  --marge: #d93a52;
  --encre: #1d3fae;
  --encre-fonce: #142f85;
  --texte: #1a2240;
  --discret: #566087;
  --surligneur: #ffe23d;
  --u: 32px;
  --corps: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
  --cursive: "Playwrite FR Moderne", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--papier);
  /* Seyès : lignes principales tous les 32 px, 3 lignes intermédiaires entre chaque. */
  background-image:
    linear-gradient(to bottom, var(--ligne-forte) 1px, transparent 1px),
    linear-gradient(to right, var(--ligne-fine) 1px, transparent 1px),
    linear-gradient(to bottom, var(--ligne-fine) 1px, transparent 1px);
  background-size: var(--u) var(--u), var(--u) var(--u), var(--u) 8px;
  background-position: 0 24px, 0 24px, 0 24px;
  color: var(--texte);
  font-family: var(--corps);
  font-size: 1rem;
  line-height: var(--u);
}

/* La page : une colonne avec la marge rouge du cahier */
.page {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px 0 44px;
}
.page::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 16px;
  width: 2px;
  background: var(--marge);
}

.saut {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 10;
  padding: 0 16px;
  background: var(--texte);
  color: #fff;
}
.saut:focus {
  left: 8px;
  top: 8px;
}

a {
  color: var(--encre);
  text-underline-offset: 3px;
}
a:hover {
  color: var(--encre-fonce);
}
a:focus-visible,
.bouton:focus-visible {
  outline: 3px solid var(--texte);
  outline-offset: 3px;
}

/* En-tête : une ligne, comme le nom de l'école en haut d'une copie */
.entete {
  height: calc(var(--u) * 2);
  display: flex;
  align-items: flex-end;
}
.entete-ecole {
  margin: 0;
  font-size: 0.875rem;
  color: var(--discret);
}

/* Accueil */
.accueil {
  padding-top: var(--u);
}
.accueil h1 {
  margin: 0;
  font-family: var(--cursive);
  font-weight: 400;
  font-size: clamp(1.7rem, 6.2vw, 2.5rem);
  line-height: calc(var(--u) * 2);
  color: var(--encre);
  text-wrap: balance;
}
/* Titre souligné à la règle, en rouge, comme dans un cahier */
.accueil h1::after {
  content: "";
  display: block;
  width: min(100%, 520px);
  height: 7px;
  margin-top: 6px;
  margin-bottom: calc(var(--u) - 13px);
  border-top: 2px solid var(--marge);
  border-bottom: 2px solid var(--marge);
  transform-origin: left center;
  animation: regle 700ms cubic-bezier(0.3, 0.7, 0.2, 1) both;
}
@keyframes regle {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
.accueil-texte {
  margin: 0 0 var(--u);
  max-width: 34em;
}

/* Ventes */
.vente {
  margin-top: var(--u);
  margin-bottom: var(--u);
}
.vente-titre {
  margin: 0;
  font-family: var(--cursive);
  font-weight: 400;
  font-size: 1.5rem;
  line-height: calc(var(--u) * 2);
  color: var(--encre);
}
.vente-echeance {
  margin: 0;
  font-weight: 700;
}
.vente-remise,
.vente-intro {
  margin: 0;
  max-width: 36em;
}
.vente-intro {
  margin-bottom: var(--u);
}
.vente-remise {
  color: var(--discret);
}

.produits {
  list-style: none;
  margin: var(--u) 0 0;
  padding: 0;
}
.produit {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 24px;
  align-items: center;
}
.produit-nom {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.produit-detail {
  margin: 0;
  color: var(--discret);
  font-size: 0.875rem;
}
.produit-action {
  display: flex;
  align-items: center;
  gap: 20px;
  height: calc(var(--u) * 2);
}
.prix {
  font-weight: 700;
  font-size: 1.125rem;
  padding: 0 0.3em;
  white-space: nowrap;
  background: linear-gradient(transparent 52%, var(--surligneur) 52%, var(--surligneur) 90%, transparent 90%);
}

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 132px;
  padding: 0 20px;
  border: 2px solid var(--encre);
  border-radius: 6px;
  background: var(--encre);
  color: #fff;
  font: inherit;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}
a.bouton:hover {
  background: var(--encre-fonce);
  border-color: var(--encre-fonce);
  color: #fff;
}
.bouton-inactif {
  background: transparent;
  border: 2px dashed var(--ligne-forte);
  color: var(--discret);
  cursor: not-allowed;
}

.vente-avenir .vente-titre {
  color: var(--discret);
  font-size: 1.25rem;
}
.vente-avenir .vente-echeance {
  font-weight: 400;
}

/* Comment commander : une vraie séquence, donc numérotée */
.etapes {
  margin: var(--u) 0;
}
.etapes-titre {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.etapes-liste {
  margin: 0;
  padding-left: 1.6em;
  max-width: 36em;
}
.etapes-liste li::marker {
  font-family: var(--cursive);
  color: var(--marge);
  font-weight: 400;
}
.etapes-note {
  margin: 0;
  color: var(--discret);
  max-width: 36em;
}

.avis {
  margin: 0 0 var(--u);
  padding: 0 12px;
  background: #fff3a6;
  max-width: 36em;
}

/* Pied de page */
.pied {
  padding: var(--u) 0 calc(var(--u) * 2);
  font-size: 1rem;
  color: var(--discret);
}
.pied p {
  margin: 0;
}

/* Pages de texte (mentions légales) */
.texte h1 {
  margin: var(--u) 0 var(--u);
  font-family: var(--cursive);
  font-weight: 400;
  font-size: clamp(1.4rem, 5vw, 2rem);
  line-height: calc(var(--u) * 2);
  color: var(--encre);
  text-wrap: balance;
}
.texte h2 {
  margin: var(--u) 0 0;
  font-size: 1rem;
  font-weight: 700;
}
.texte p,
.texte ul {
  margin: 0 0 var(--u);
  max-width: 38em;
}
.texte ul {
  padding-left: 1.4em;
}

/* Mobile : le bouton passe sous le produit */
@media (max-width: 560px) {
  .page {
    padding-left: 34px;
    padding-right: 16px;
  }
  .page::before {
    left: 10px;
  }
  .produit {
    grid-template-columns: 1fr;
  }
  .produit-action {
    justify-content: space-between;
  }
  .bouton {
    flex: 1;
    max-width: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .accueil h1::after {
    animation: none;
  }
}
