/* style.css — Origamiz, design ludique mobile-first */

@font-face {
  font-family: 'Fredoka';
  src: url('../fonts/fredoka.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2013-2014, U+2018-2019, U+201C-201D, U+2026;
}
@font-face {
  font-family: 'Fredoka';
  src: url('../fonts/fredoka-ext.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+1E00-1EFF, U+0152-0153;
}

:root {
  --bg: #FFF6E9;
  --carte: #FFFFFF;
  --encre: #2A2440;
  --encre-doux: #6B6486;
  --primaire: #6C5CE7;
  --primaire-fonce: #5546D6;
  --facile: #22A85C;
  --facile-fond: #E4F7EC;
  --moyen: #E8890C;
  --moyen-fond: #FFF0D4;
  --difficile: #E5395D;
  --difficile-fond: #FFE5EA;
  --rayon: 22px;
  --ombre: 0 6px 20px rgba(42, 36, 64, .08), 0 2px 6px rgba(42, 36, 64, .05);
  --ombre-forte: 0 10px 30px rgba(42, 36, 64, .14);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Fredoka', 'Baloo 2', 'Comic Sans MS', ui-rounded, system-ui, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 174, 31, .10) 0 42px, transparent 43px),
    radial-gradient(circle at 88% 14%, rgba(62, 141, 243, .09) 0 36px, transparent 37px),
    radial-gradient(circle at 78% 72%, rgba(47, 191, 113, .08) 0 46px, transparent 47px),
    radial-gradient(circle at 8% 84%, rgba(240, 97, 158, .08) 0 34px, transparent 35px);
  background-attachment: fixed;
  color: var(--encre);
  line-height: 1.45;
  min-height: 100dvh;
}

/* ── Barre du haut ────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255, 246, 233, .86);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(42, 36, 64, .06);
}
.logo { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--encre); }
.logo svg { width: 30px; height: 30px; }
.logo b { font-size: 1.25rem; font-weight: 700; letter-spacing: .3px; }
.logo b i { font-style: normal; color: var(--primaire); }
.slogan { font-size: .8rem; color: var(--encre-doux); display: none; }

/* ── Héros ────────────────────────────────────────────────────────────── */
.heros { text-align: center; padding: 26px 18px 8px; }
.heros h1 { font-size: clamp(1.7rem, 6vw, 2.5rem); font-weight: 700; }
.heros .surligne {
  background: linear-gradient(120deg, transparent 6%, #FFE3A6 6% 94%, transparent 94%);
  border-radius: 6px; padding: 0 6px;
}
.heros p { margin-top: 8px; color: var(--encre-doux); font-size: .98rem; max-width: 34rem; margin-inline: auto; }

/* ── Filtres ──────────────────────────────────────────────────────────── */
.filtres { display: grid; gap: 8px; padding: 14px 16px 4px; }
.rang-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.rang-chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 2px solid rgba(42, 36, 64, .12); background: #fff;
  font: inherit; font-weight: 600; font-size: .9rem; color: var(--encre);
  padding: 8px 15px; border-radius: 999px; cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s, border-color .15s;
}
.chip:active { transform: scale(.94); }
.chip.actif { border-color: transparent; color: #fff; box-shadow: var(--ombre); }
.chip.actif.tous, .chip.cat.actif { background: var(--primaire); }
.chip.actif.facile { background: var(--facile); }
.chip.actif.moyen { background: var(--moyen); }
.chip.actif.difficile { background: var(--difficile); }

.compte { padding: 0 20px 10px; font-size: .82rem; color: var(--encre-doux); }

/* ── Grille de cartes ─────────────────────────────────────────────────── */
.grille {
  display: grid; gap: 14px; padding: 6px 16px 10px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 640px) { .grille { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
@media (min-width: 980px) { .grille { grid-template-columns: repeat(4, 1fr); } }

.carte {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: var(--carte); border-radius: var(--rayon); overflow: hidden;
  box-shadow: var(--ombre);
  transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), box-shadow .22s;
  animation: apparait .4s both; animation-delay: calc(var(--i) * 35ms);
}
.carte:hover { transform: translateY(-5px) rotate(-.6deg); box-shadow: var(--ombre-forte); }
.carte:active { transform: scale(.97); }
@keyframes apparait { from { opacity: 0; transform: translateY(14px) scale(.97); } }

.carte-visuel {
  aspect-ratio: 1 / 1; display: grid; place-items: center; padding: 10px;
}
.carte-visuel svg { width: 88%; height: 88%; filter: drop-shadow(0 3px 5px rgba(42, 36, 64, .10)); transition: transform .25s; }
.carte:hover .carte-visuel svg { transform: scale(1.07) rotate(-2deg); }

.carte-corps { padding: 10px 13px 8px; flex: 1; }
.carte-titre { font-size: 1rem; font-weight: 600; line-height: 1.25; }
.carte-meta { display: flex; gap: 10px; margin-top: 5px; font-size: .76rem; color: var(--encre-doux); }

.carte-pied {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; font-size: .78rem; font-weight: 600;
}
.carte-pied.facile { background: var(--facile-fond); color: var(--facile); }
.carte-pied.moyen { background: var(--moyen-fond); color: var(--moyen); }
.carte-pied.difficile { background: var(--difficile-fond); color: var(--difficile); }
.pastille {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; color: #fff;
  background: var(--primaire); animation: rebond 2.6s infinite;
}
.pastille.facile { background: var(--facile); }
.pastille.moyen { background: var(--moyen); }
.pastille.difficile { background: var(--difficile); }
@keyframes rebond { 0%, 100% { transform: translateY(0); } 8% { transform: translateY(-3px); } 16% { transform: translateY(0); } }
.carte-pied .age { opacity: .85; font-weight: 500; }

.centre { text-align: center; padding: 18px 0 8px; }

/* ── Boutons ──────────────────────────────────────────────────────────── */
.gros-bouton {
  font: inherit; font-weight: 700; font-size: 1rem; color: #fff;
  background: var(--primaire); border: 0; border-radius: 999px;
  padding: 14px 26px; min-height: 52px; cursor: pointer;
  box-shadow: 0 5px 0 var(--primaire-fonce);
  transition: transform .12s, box-shadow .12s, filter .15s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
.gros-bouton:hover { filter: brightness(1.06); }
.gros-bouton:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--primaire-fonce); }
.gros-bouton.second { background: #fff; color: var(--encre); box-shadow: 0 5px 0 rgba(42, 36, 64, .18); }
.gros-bouton.second:active { box-shadow: 0 1px 0 rgba(42, 36, 64, .18); }
.gros-bouton:disabled { opacity: .35; pointer-events: none; }

/* ── Lecteur de tutoriel ──────────────────────────────────────────────── */
.lecteur { max-width: 620px; margin: 0 auto; padding: 0 14px 30px; }
.lecteur-haut { display: flex; align-items: center; gap: 12px; padding: 12px 0 12px; }
.retour {
  flex: 0 0 auto; width: 46px; height: 46px; display: grid; place-items: center;
  background: #fff; border-radius: 16px; box-shadow: var(--ombre);
  font-size: 1.3rem; font-weight: 700; color: var(--encre); text-decoration: none;
  transition: transform .15s;
}
.retour:active { transform: scale(.9); }
.lecteur-titre h2 { font-size: 1.15rem; font-weight: 700; line-height: 1.2; }
.lecteur-titre .pastille { margin-top: 4px; animation: none; font-size: .7rem; }
.objectif {
  margin-left: auto; flex: 0 0 auto; width: 52px; height: 52px;
  background: #fff; border-radius: 50%; padding: 5px;
  box-shadow: var(--ombre); border: 2px dashed rgba(108, 92, 231, .45);
}
.objectif svg { width: 100%; height: 100%; }

.etape-apres {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 8px 14px;
  background: var(--facile-fond); border-radius: 16px; width: 100%;
}
.etape-apres span { font-size: .8rem; font-weight: 700; color: var(--facile); flex: 0 0 auto; }
.etape-apres svg { width: 64px; height: 48px; flex: 0 0 auto; }
.etape-apres::after {
  content: "Vérifie que ton papier ressemble à ça ✅";
  font-size: .78rem; color: var(--encre-doux); text-align: right; flex: 1;
}

.progression { height: 9px; background: rgba(42, 36, 64, .08); border-radius: 99px; overflow: hidden; }
.progression-barre { height: 100%; width: 0; border-radius: 99px; transition: width .3s ease; }
.progression-barre.facile { background: var(--facile); }
.progression-barre.moyen { background: var(--moyen); }
.progression-barre.difficile { background: var(--difficile); }

.etape-zone { position: relative; margin-top: 14px; }
.etape-carte {
  background: #fff; border-radius: 26px; box-shadow: var(--ombre);
  padding: 14px; min-height: 300px;
  display: flex; flex-direction: column; align-items: center;
}
.etape-dessin { width: 100%; max-width: 340px; }
.etape-dessin svg { width: 100%; height: auto; display: block; }
.etape-texte { font-size: 1.08rem; font-weight: 500; text-align: center; padding: 10px 8px 6px; max-width: 30rem; }

.entrer-g { animation: entrerG .3s ease both; }
.entrer-d { animation: entrerD .3s ease both; }
@keyframes entrerG { from { opacity: 0; transform: translateX(28px); } }
@keyframes entrerD { from { opacity: 0; transform: translateX(-28px); } }

.lecteur-commandes {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 0 6px;
}
.lecteur-commandes .gros-bouton { flex: 1; justify-content: center; padding-inline: 12px; }
.num-etape { font-weight: 700; font-size: .9rem; color: var(--encre-doux); white-space: nowrap; }

/* Écran Bravo */
.bravo { justify-content: center; gap: 6px; text-align: center; }
.bravo-art { width: 72%; max-width: 280px; }
.bravo-art svg { width: 100%; height: auto; filter: drop-shadow(0 6px 12px rgba(42, 36, 64, .15)); animation: flotter 3s ease-in-out infinite; }
@keyframes flotter { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.bravo h3 { font-size: 1.5rem; margin-top: 6px; }
.bravo p { color: var(--encre-doux); padding: 4px 10px 10px; }
.bravo-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.confetti {
  position: absolute; top: -12px; width: 9px; height: 13px; border-radius: 3px;
  animation: tomber linear forwards; z-index: 5; pointer-events: none;
}
@keyframes tomber {
  to { transform: translateY(105vh) rotate(var(--dr)); opacity: .2; }
}

/* ── Galerie (QA) ─────────────────────────────────────────────────────── */
.galerie-modele { padding: 14px 16px; }
.galerie-modele h2 { font-size: 1.05rem; padding-bottom: 8px; }
.galerie-modele small { color: var(--encre-doux); font-weight: 500; }
.galerie-etapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.galerie-etapes .mini { background: #fff; border-radius: 12px; padding: 4px; box-shadow: var(--ombre); }
.galerie-etapes .mini svg { width: 100%; height: auto; }
.galerie-etapes figcaption { text-align: center; font-size: .68rem; color: var(--encre-doux); }
.galerie-etapes .rendu { outline: 3px solid var(--primaire); }

/* ── Pied de page ─────────────────────────────────────────────────────── */
.pied {
  text-align: center; color: var(--encre-doux); font-size: .8rem;
  padding: 22px 16px max(20px, env(safe-area-inset-bottom));
}
.pied a { color: var(--primaire); }

/* ── Accessibilité ────────────────────────────────────────────────────── */
:focus-visible { outline: 3px solid var(--primaire); outline-offset: 2px; border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

@media (min-width: 640px) {
  .slogan { display: block; }
  .heros { padding-top: 36px; }
}
