/* DA « carnet de croquis + risographie » — passe accueil (#180).
   Chargé en dernier sur index.html. Trois gestes, rien de plus :
   1. le papier : grille pointée de carnet, feuilles scotchées, coins nets ;
   2. l'encre riso : 2e passage décalé (--color-misreg), aplats, trame demi-teinte, duotone ;
   3. la main : titres soulignés d'un trait de feutre, numéros manuscrits.
   Tout passe par les tokens de styles.css → saisons et thème sombre suivent. */

:root {
  --dot-grid: radial-gradient(color-mix(in srgb, var(--color-text) 16%, transparent) 1px, transparent 1.4px);
  --halftone: radial-gradient(rgba(0, 0, 0, 0.16) 1.1px, transparent 1.6px);
  --tape: color-mix(in srgb, var(--color-misreg) 55%, transparent);
  --sheet-shadow: 0 1px 0 color-mix(in srgb, var(--color-text) 10%, transparent), 0 14px 22px -16px rgba(36, 33, 43, 0.35);
  /* Trait de feutre (masque) : la couleur vient de background, donc de la saison */
  --scribble: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14' preserveAspectRatio='none'%3E%3Cpath d='M3 9c22-5 44-6 66-3s40 4 60 0 44-6 68-2' fill='none' stroke='%23000' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E");
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}
:root[data-theme="dark"] {
  --halftone: radial-gradient(rgba(0, 0, 0, 0.28) 1.1px, transparent 1.6px);
  --tape: color-mix(in srgb, var(--color-misreg) 40%, transparent);
  --sheet-shadow: 0 14px 22px -16px rgba(0, 0, 0, 0.7);
}

html { scrollbar-color: color-mix(in srgb, var(--color-text) 35%, transparent) var(--color-background); }

/* ---------- Titres : feutre + décalage d'encre ---------- */
.index .section-header-artistic .section-icon { display: none; }
.index .section-header-artistic h2,
.index .coach-home h2,
.index .community-cta__content h2 {
  position: relative;
  line-height: 1.05;
  text-wrap: balance;
}
.index .section-header-artistic h2::after,
.index .coach-home h2::after {
  content: '';
  display: block;
  width: min(100%, 7.5em);
  height: 0.28em;
  margin-top: 0.08em;
  background: var(--color-misreg);
  -webkit-mask: var(--scribble) no-repeat center / 100% 100%;
  mask: var(--scribble) no-repeat center / 100% 100%;
}

/* ---------- Hero : le titre s'imprime ---------- */
.page-hero--home h1 {
  line-height: 1;
  letter-spacing: -0.01em;
  text-shadow: var(--misreg-offset) var(--misreg-offset) 0 color-mix(in srgb, var(--color-misreg) 70%, transparent);
  animation: riso-register 1.1s var(--ease-out-expo) both;
}
@media (min-width: 1024px) {
  .page-hero--home { min-height: 520px; }
  .page-hero--home h1 { font-size: clamp(3.5rem, 5vw, 4.75rem); max-width: 15ch; }
}
@keyframes riso-register {
  from { text-shadow: 10px 6px 0 color-mix(in srgb, var(--color-misreg) 70%, transparent); }
}

/* Puce du défi actif = tampon encreur */
.hero-chip {
  background: var(--color-surface);
  color: var(--color-accent);
  border: 1.5px solid currentColor;
  border-radius: 4px;
  transform: rotate(-2deg);
  box-shadow: 2px 2px 0 var(--color-misreg);
}
.hero-chip:hover { transform: rotate(0); box-shadow: 3px 3px 0 var(--color-misreg); }

/* Mention sous les CTA : coup de surligneur */
.index .cta-sub {
  display: inline;
  padding: 0 0.15em;
  color: var(--color-text);
  background: linear-gradient(transparent 55%, color-mix(in srgb, var(--ink-yellow) 75%, transparent) 55%);
}
:root[data-theme="dark"] .index .cta-sub { background: linear-gradient(transparent 55%, rgba(255, 232, 0, 0.28) 55%); }

@media (max-width: 768px) {
  .page-hero--home h1 { font-size: 2.6rem; }
}

/* ---------- Coach : étapes numérotées à la main ---------- */
.index .coach-home__steps { counter-reset: step; }
.index .coach-home__steps li {
  counter-increment: step;
  position: relative;
  padding-left: 3.25rem;
  border-top-style: dashed;
}
.index .coach-home__steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: calc(var(--space-md) - 0.35rem);
  width: 2.3rem;
  height: 2.3rem;
  display: grid;
  place-items: center;
  font: 700 1.6rem/1 var(--font-family-display);
  color: var(--color-accent);
  border: 1.5px solid currentColor;
  border-radius: 52% 48% 50% 46% / 46% 52% 48% 54%;
  box-shadow: 2px 2px 0 var(--color-misreg);
}
@media (min-width: 1024px) {
  .index .coach-home__steps li:first-child::before { top: -0.35rem; }
}

/* ---------- Éclairs : en-tête aligné, cartes-feuilles ---------- */
.eclairs-home .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}
.eclairs-home .section-header .section-header-artistic { margin-bottom: 0; }
.eclairs-subtitle { margin-bottom: var(--space-xl); }
.eclair-card {
  border-color: color-mix(in srgb, var(--color-text) 22%, transparent);
  border-radius: 4px;
  box-shadow: var(--sheet-shadow);
}
.eclair-card__duree {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1.5px solid currentColor;
  border-radius: 4px;
  box-shadow: 2px 2px 0 var(--color-misreg);
}
.index .faq-item a {
  color: var(--color-accent);
  font-weight: 600;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1.5px;
}

/* ---------- Défis en cours : même papier que le reste ---------- */
.index .challenge-card-unified {
  background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  border-radius: 4px;
  box-shadow: var(--sheet-shadow);
}
.index .challenge-card-unified::after { content: none; }
.index .challenge-card-unified .challenge-card-body { background: none; }
.index .challenge-card-unified .challenge-title { font-size: 1.75rem; font-weight: 700; line-height: 1.1; min-height: 2.2em; }

/* ---------- Galerie : 2 colonnes sur mobile (avant : 1 vignette = 1 écran) ---------- */
@media (max-width: 768px) {
  .index .entries-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
}

/* ---------- Chiffres : bande imprimée en aplat + trame ---------- */
.stats-ribbon {
  background: var(--halftone) 0 0 / 6px 6px, var(--color-accent);
  border: 0;
  color: var(--color-on-accent);
  padding-block: var(--space-xl);
}
.stats-ribbon .stat-number,
.stats-grid .stat-item:nth-child(n) .stat-number {
  font-family: var(--font-family-display);
  font-size: clamp(2.4rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1;
  color: var(--color-on-accent);
  text-shadow: 3px 3px 0 color-mix(in srgb, var(--color-misreg) 85%, transparent);
  font-variant-numeric: tabular-nums;
}
.stats-ribbon .stat-label {
  color: color-mix(in srgb, var(--color-on-accent) 88%, transparent);
  font-weight: 600;
}

/* ---------- Comment ça marche + 3 façons : une double page de carnet ---------- */
.index .how-it-works,
.index .challenge-types {
  background: var(--dot-grid) 0 0 / 22px 22px, var(--color-background);
}
.index .how-it-works { padding-bottom: var(--space-xl); }
.index .challenge-types { padding-top: var(--space-xl); }

.index .step-card,
.index .challenge-type-card {
  position: relative;
  overflow: visible;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  border-radius: 3px;
  box-shadow: var(--sheet-shadow);
  transform: rotate(var(--tilt, -1deg));
  transition: transform 300ms var(--ease-out-expo), box-shadow 300ms var(--ease-out-expo);
}
.index .step-card:nth-child(2),
.index .challenge-type-card:nth-child(2) { --tilt: 0.8deg; }
.index .step-card:nth-child(3),
.index .challenge-type-card:nth-child(3) { --tilt: -0.5deg; }
.index .step-card:hover,
.index .challenge-type-card:hover,
.index .challenge-type-card:focus-visible {
  transform: rotate(0) translateY(-3px);
  box-shadow: var(--sheet-shadow), 0 18px 28px -18px rgba(36, 33, 43, 0.4);
}
/* Bout de scotch */
.index .step-card::before,
.index .challenge-type-card::before {
  content: '';
  position: absolute;
  top: -11px;
  left: 50%;
  width: 92px;
  height: 22px;
  translate: -50% 0;
  rotate: -3deg;
  background: var(--tape);
  mix-blend-mode: multiply;
  clip-path: polygon(0 8%, 6% 0, 12% 10%, 20% 2%, 100% 0, 96% 50%, 100% 100%, 88% 92%, 80% 100%, 0 100%, 4% 50%);
}
:root[data-theme="dark"] .index .step-card::before,
:root[data-theme="dark"] .index .challenge-type-card::before { mix-blend-mode: normal; }
.index .step-card:nth-child(2)::before,
.index .challenge-type-card:nth-child(2)::before { rotate: 2deg; background: color-mix(in srgb, var(--ink-blue) 35%, transparent); }
.index .icon-sketch,
.index .challenge-type-card__icon { width: 96px; height: 96px; filter: none; }
.index .card-cta {
  border-radius: 4px;
  box-shadow: 2px 2px 0 var(--color-misreg);
}
.index .card-cta:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--color-misreg); }

/* ---------- Appel final : mosaïque passée en duotone riso ---------- */
.community-cta { isolation: isolate; }
.community-cta__mosaic,
.community-cta:hover .community-cta__mosaic {
  z-index: 0;
  filter: grayscale(1) contrast(1.25) brightness(1.05);
}
.community-cta::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--halftone) 0 0 / 6px 6px, var(--color-accent);
  mix-blend-mode: multiply;
  pointer-events: none;
}
.community-cta__overlay { z-index: 2; background: none; }
.community-cta__content h2 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  color: #FBF8F0;
  text-shadow: 3px 3px 0 color-mix(in srgb, var(--color-misreg) 85%, transparent);
}
.community-cta__content p { color: #FBF8F0; text-shadow: none; font-size: 1.125rem; }
:root[data-theme="dark"] .community-cta::after { background: var(--halftone) 0 0 / 6px 6px, rgba(23, 22, 28, 0.72); mix-blend-mode: normal; }

/* ---------- FAQ : pages lignées plutôt que cartes ---------- */
.index .faq-item {
  background: none;
  border: 0;
  border-bottom: 1.5px dashed color-mix(in srgb, var(--color-text) 25%, transparent);
  border-radius: 0;
  padding: var(--space-md) 0;
  margin: 0;
}
.index .faq-item summary {
  font: 700 1.6rem/1.2 var(--font-family-display);
  display: flex;
  gap: 0.5rem;
}
.index .faq-item summary::before { color: var(--color-accent); width: 1ch; }
.index .faq-image { border-radius: 3px; transform: rotate(-0.6deg); box-shadow: var(--sheet-shadow); }

@media (prefers-reduced-motion: reduce) {
  .page-hero--home h1 { animation: none; }
  .index .step-card,
  .index .challenge-type-card,
  .hero-chip { transition: none; }
}

/* Caveat paraît petit à 1.5rem : titres de section plus présents sur mobile */
@media (max-width: 768px) {
  .index .section-header-artistic h2,
  .index .coach-home h2 { font-size: 2.1rem; }
}

/* ---------- Coach activé : conseil du moment = fiche épinglée au carnet ---------- */
/* Espacement resserré : le conseil suit le hero et précède les Éclairs sans grand vide */
.index #coach-moment { padding-block: var(--space-lg) var(--space-md); }
.index #coach-moment + .eclairs-home { padding-top: var(--space-md); }
.index #coach-moment .coach-home__inner { gap: var(--space-lg); }
.index #coach-moment .coach-home__intro p:empty { display: none; }
.index #coach-moment .coach-home__steps { gap: var(--space-md); }
.index #coach-moment .coach-home__steps > p {
  position: relative;
  margin: 0;
  padding: var(--space-md) var(--space-lg) var(--space-md);
  background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  border-radius: 3px;
  box-shadow: var(--sheet-shadow);
  transform: rotate(var(--tilt, -0.8deg));
}
.index #coach-moment .coach-home__steps > p:nth-child(2) { --tilt: 0.6deg; }
.index #coach-moment .coach-home__steps > p:nth-child(3) { --tilt: -0.4deg; }
/* Bout de scotch */
.index #coach-moment .coach-home__steps > p::before {
  content: '';
  position: absolute;
  top: -0.6rem;
  left: 50%;
  width: 4.5rem;
  height: 1.2rem;
  transform: translateX(-50%) rotate(-3deg);
  background: color-mix(in srgb, var(--ink-yellow) 55%, transparent);
  opacity: 0.85;
}
.index #coach-moment .coach-home__steps strong {
  display: inline;
  font-family: var(--font-family-display);
  font-size: 1.35rem;
  line-height: 1.15;
  background: linear-gradient(transparent 60%, color-mix(in srgb, var(--ink-yellow) 70%, transparent) 60%);
}
.index #coach-moment .coach-home__steps p span { margin-top: var(--space-sm); }
.index .coach-pour-toi { margin-top: var(--space-xl); }
.index .coach-pour-toi h3 { margin-bottom: var(--space-md); }
