:root {
  /* Thème « cahier d'animaux » : papier ivoire, crayons bleu cobalt, jaune tournesol, corail */
  --bg: oklch(98.5% 0.008 90);
  --card: oklch(99.5% 0.004 90);
  --ink: oklch(30% 0.04 265);
  --muted: oklch(52% 0.03 265);
  --line: oklch(92% 0.015 85);
  --bleu: oklch(50% 0.2 262);
  --bleu-dark: oklch(42% 0.19 262);
  --bleu-pale: oklch(94% 0.04 262);
  --jaune: oklch(86% 0.17 90);
  --jaune-pale: oklch(96% 0.07 95);
  --corail: oklch(68% 0.17 35);
  --corail-dark: oklch(60% 0.18 35);
  --corail-pale: oklch(95% 0.04 35);
  --ok: oklch(40% 0.1 155);
  --ok-bg: oklch(94% 0.05 155);
  --err: oklch(45% 0.15 20);
  --err-bg: oklch(94% 0.04 20);
  --radius: 18px;
  --shadow: 0 2px 0 var(--line), 0 10px 24px -14px oklch(30% 0.04 265 / .25);
  --display: Fredoka, "Nunito", system-ui, sans-serif;
  --sans: Nunito, system-ui, -apple-system, sans-serif;
  --script: Caveat, "Segoe Script", cursive;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); }
main { max-width: 680px; margin: 0 auto; padding: 0 16px calc(40px + env(safe-area-inset-bottom)); }
h1 { font: 700 clamp(2.2rem, 7vw, 3rem)/1.05 var(--display); margin: 0 0 4px; color: var(--bleu); letter-spacing: -.01em; }
h2 { font: 600 1.35rem/1.2 var(--display); margin: 28px 0 10px; color: var(--bleu); }
h3 { font: 700 1rem/1.3 var(--sans); margin: 4px 0 8px; }
a { color: var(--bleu); text-underline-offset: 3px; }
p { margin: 0 0 12px; }
small { color: var(--muted); }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

/* ---- Accueil : plein écran, contenu centré ---- */
.hero { text-align: center; padding: 0 0 6px; }
main:has(.hero.home) { padding-bottom: 0; }
.hero.home { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 12px 0 24px; }
.btn-main {
  display: inline-block; margin: 6px 0 22px; padding: 16px 34px; border-radius: 999px;
  background: var(--corail); color: var(--card); font: 700 1.15rem/1.2 var(--display); text-decoration: none;
  box-shadow: 0 4px 0 var(--corail-dark);
}
.btn-main:hover { background: var(--corail-dark); color: var(--card); }
.btn-main:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--corail-dark); }
.listhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 4px; }
.listhead .back { margin: 0; }
.listhead h1 { font-size: 1.4rem; margin: 0; }
.hero .fanions { width: min(84%, 440px); margin: 0 auto 10px; }
.hero .parade { display: flex; justify-content: center; align-items: flex-end; gap: clamp(8px, 3vw, 18px); margin: 0 auto 14px; }
.hero .parade img { height: clamp(56px, 16vw, 84px); width: auto; animation: pop .6s var(--ease) both; }
.hero .parade img:nth-child(2) { animation-delay: .07s; }
.hero .parade img:nth-child(3) { animation-delay: .14s; height: clamp(72px, 20vw, 104px); }
.hero .parade img:nth-child(4) { animation-delay: .21s; }
.hero .parade img:nth-child(5) { animation-delay: .28s; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.92); } }
.hero .parents { font: 600 1.7rem/1 var(--script); color: var(--corail); margin: 0 0 16px; }
.hero .intro { max-width: 52ch; margin: 0 auto 14px; }
@media (min-width: 800px) {
  .hero.home { padding: 0; }
  .hero.home .fanions { width: 360px; margin-bottom: 4px; }
  .hero.home .intro { font-size: 1.08rem; max-width: 58ch; }
  .hero.home .parade img { height: 100px; }
  .hero.home .parade img:nth-child(3) { height: 124px; }
  .hero.home .second { margin-top: 4px; }
}
.hero .second {
  display: flex; align-items: center; gap: 12px; max-width: 520px; margin: 0 auto 8px; padding: 10px 14px; text-align: left;
  background: var(--jaune-pale); border-radius: 12px; color: var(--ink); font-size: .95rem;
  transform: rotate(-1deg); box-shadow: 0 2px 0 var(--jaune);
}
.hero .second img { flex: none; width: 52px; height: 52px; object-fit: contain; }
.hero .second span { flex: 1; }

/* ---- Filtres : un libellé de 24px, puis un contrôle de 48px ---- */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; align-items: start; margin: 18px 0 18px; }
.filters > :only-child { grid-column: 1 / -1; }
.filters .lbl { display: block; height: 24px; line-height: 24px; font-weight: 700; font-size: .9rem; }
.filters .slider output { font-weight: 800; color: var(--bleu); }
.filters input[type="range"] { margin: 0; height: 48px; }
.filters noscript button { margin-top: 8px; }

.dd { position: relative; }
.dd summary { list-style: none; cursor: pointer; }
.dd summary::-webkit-details-marker { display: none; }
.dd .box {
  position: relative; display: flex; align-items: center; height: 48px; padding: 0 36px 0 14px;
  background: var(--card); border: 2px solid var(--line); border-radius: 999px; font-weight: 700;
}
.dd .box::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border: solid var(--bleu); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); transition: transform .15s ease-out;
}
.dd[open] .box::after { transform: rotate(-135deg); margin-top: -2px; }
.dd[open] .box { border-color: var(--bleu); }
.dd ul {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  background: var(--card); border: 2px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  animation: dd-in .18s var(--ease);
}
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } }
.dd li a { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 600; }
.dd li a:hover { background: var(--bleu-pale); }
.dd li a.on { background: var(--jaune-pale); color: var(--ink); }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; background: none; border: 0; padding: 0; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; background: var(--line); }
input[type="range"]::-moz-range-track { height: 8px; border-radius: 999px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; margin-top: -9px; border-radius: 50%;
  background: var(--corail); border: 3px solid var(--card); box-shadow: 0 1px 4px oklch(0% 0 0 / .2);
}
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--corail); border: 3px solid var(--card); box-shadow: 0 1px 4px oklch(0% 0 0 / .2); }
input[type="range"]:focus-visible { outline: 2px solid var(--bleu); outline-offset: 4px; }

/* ---- Grille et cartes ---- */
.grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (min-width: 520px) { .grid { gap: 16px; } .card .body { padding: 14px; } .card h3 { font-size: 1.02rem; } }
@media (min-width: 800px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: flex; flex-direction: column; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  overflow: hidden; color: inherit; text-decoration: none; box-shadow: var(--shadow);
}
.card img, .card .noimg { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--card); border-bottom: 2px solid var(--line); }
.card .noimg { background: var(--bleu-pale); }
.card .body { padding: 10px 12px 12px; flex: 1; display: flex; flex-direction: column; }
.card h3 { flex: 1; font-size: .92rem; margin: 4px 0 8px; }
.card.funded { opacity: .55; filter: saturate(.6); }

.tag {
  display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 10px; border-radius: 999px;
  background: var(--bleu-pale); color: var(--bleu-dark); margin: 0 6px 2px 0;
}

.progress { position: relative; height: 26px; border-radius: 999px; background: var(--jaune-pale); overflow: hidden; margin: 8px 0 0; }
.progress .bar { height: 100%; background: var(--jaune); transition: width .3s; }
.progress .pct {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font: 800 .82rem/1 var(--sans); color: var(--ink);
}

.empty { color: var(--muted); text-align: center; padding: 24px 0; font-weight: 600; }
.empty img { width: 110px; margin: 0 auto 10px; }

/* ---- Page produit ---- */
.back { display: inline-block; margin: 14px 0 12px; text-decoration: none; font-weight: 700; }
.product > img { border-radius: var(--radius); max-height: 42vh; object-fit: contain; margin: 0 auto 16px; background: var(--card); border: 2px solid var(--line); width: 100%; }
.product .head { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.product h1 { font-size: 1.6rem; margin: 6px 0 6px; }
.product .note { color: var(--muted); margin: 0 0 8px; font-size: .95rem; }
.product .price { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 14px; }
.product .price strong { font: 700 1.9rem/1 var(--display); color: var(--ink); }
.product .price .rest { color: var(--corail-dark); font-weight: 800; }
.btn-out { display: block; text-align: center; padding: 12px; border: 2px solid var(--bleu); border-radius: 999px; font-weight: 800; text-decoration: none; }
.btn-out:hover { background: var(--bleu); color: var(--card); }
.product .progress { margin: 14px 0 0; }
.how { margin: 26px 0 10px; }
.again { text-align: center; color: var(--muted); margin: 16px 0; }
.done { background: var(--ok-bg); color: var(--ok); padding: 12px; border-radius: var(--radius); text-align: center; font-weight: 700; }

.action { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); margin: 10px 0; box-shadow: var(--shadow); }
.action[open] { border-color: var(--bleu); }
.action summary { padding: 14px 18px; font: 600 1.08rem/1.4 var(--display); color: var(--ink); cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.action summary::after {
  content: "+"; flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--corail); color: var(--card); font: 700 1.3rem/1 var(--display);
}
.action[open] summary::after { content: "−"; }
.action summary::-webkit-details-marker { display: none; }
.action form { padding: 0 18px 18px; }
.hint { color: var(--muted); font-size: .92rem; }

/* ---- Formulaires ---- */
form label { display: block; margin: 0 0 12px; font-weight: 700; }
input, textarea, select {
  display: block; width: 100%; margin-top: 4px; padding: 12px 14px; font: inherit; font-size: 16px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink);
}
input:focus, textarea:focus { outline: 2px solid var(--bleu); outline-offset: 0; border-color: transparent; }
.radios { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.radios legend { font-weight: 700; margin-bottom: 6px; }
.radios label { margin: 0; font-weight: 600; }
.radios input { position: absolute; opacity: 0; width: 0; height: 0; }
.radios span { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); }
.radios input:checked + span { background: var(--jaune-pale); border-color: var(--jaune); }
.radios input:focus-visible + span { outline: 2px solid var(--bleu); outline-offset: 2px; }
.bounds { display: flex; justify-content: space-between; margin-top: 2px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
button {
  width: 100%; min-height: 50px; padding: 12px 18px; font: 700 1.02rem/1.2 var(--display);
  background: var(--corail); color: var(--card); border: 0; border-radius: 999px; cursor: pointer;
  box-shadow: 0 3px 0 var(--corail-dark);
}
button:hover:not(.link):not(.danger):not(.copy) { background: var(--corail-dark); }
button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--corail-dark); }
button.link { background: none; color: var(--bleu); width: auto; min-height: 0; padding: 0; font: inherit; box-shadow: none; }
button.danger { background: none; color: var(--err); width: 44px; min-height: 44px; font-size: 1.3rem; padding: 0; box-shadow: none; }

.flash { padding: 12px 16px; border-radius: var(--radius); margin: 14px 0 12px; font-weight: 700; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }

.payment { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 18px; margin: 12px 0; }
.payment ul { margin: 0; padding: 0; list-style: none; }
.payment li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.payment li strong { grid-column: 1 / -1; font-size: .85rem; color: var(--muted); }
.payment li .val { min-width: 0; overflow-wrap: anywhere; font-weight: 800; font-size: 1.05rem; }
.payment .copy { width: auto; min-height: 36px; padding: 6px 14px; font-size: .9rem; background: var(--bleu-pale); color: var(--bleu-dark); box-shadow: none; }
.payment .copy:hover { background: var(--bleu); color: var(--card); }

/* ---- Pied de page ---- */
.libre { text-align: center; margin-top: 28px; }
.libre p { color: var(--muted); font-weight: 600; margin: 0 0 10px; }
.libre .btn-main { margin: 0; }
.footer { text-align: center; margin-top: 44px; }
.footer img { width: 120px; margin: 0 auto 6px; }
.footer p { font: 600 1.5rem/1.2 var(--script); color: var(--corail); }

/* ---- Admin ---- */
.login { max-width: 360px; margin: 15vh auto 0; }
.adminbar { display: flex; align-items: baseline; gap: 16px; padding-top: 16px; }
.adminbar h1 { flex: 1; }
.adminbar form { width: auto; }
form.inline { display: flex; gap: 8px; }
form.inline input { margin: 0; }
form.inline button { width: auto; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.products li, .contribs li { align-items: flex-start; gap: 12px; padding: 12px 0; }
.contribs .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 4px; }
.contribs .meta a { font-weight: 600; }
.contribs .free { color: var(--muted); font-weight: 600; }
.contribs .msg { margin: 2px 0 4px; font-style: italic; color: var(--muted); }
.contribs small { font-size: .8rem; }
.contribs form { align-self: center; }
.products .thumb { flex: none; width: 56px; height: 56px; object-fit: cover; border-radius: 12px; border: 2px solid var(--line); background: var(--card); }
.products .thumb.noimg { background: var(--bleu-pale); }
.products strong { display: block; line-height: 1.3; }
.products .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 6px; }
.products .meta .tag { margin: 0; }
.products .price { font-weight: 800; color: var(--ink); }
.products .status, .contribs .status { font-size: .72rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.products .status.reserved, .products .status.funded { background: var(--ok-bg); color: var(--ok); }
.products .status.partial { background: var(--jaune-pale); color: var(--ink); }
.contribs .status.money { background: var(--jaune-pale); color: var(--ink); }
.contribs .status.hand, .contribs .status.ship { background: var(--ok-bg); color: var(--ok); }
.products .actions { display: flex; gap: 6px; }
.products .actions a { font-size: .82rem; font-weight: 700; text-decoration: none; padding: 4px 12px; border-radius: 999px; border: 2px solid var(--line); color: var(--bleu); }
.products .actions a:hover { background: var(--bleu-pale); border-color: var(--bleu-pale); }
.products form { align-self: center; }
.list form { width: auto; }
.preview { max-height: 220px; width: auto; border-radius: var(--radius); margin-bottom: 12px; }

/* ---- Transitions : fondu entre pages, image produit partagée, micro-interactions ---- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 220ms var(--ease) both vt-out; }
::view-transition-new(root) { animation: 320ms var(--ease) both vt-in; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
::view-transition-group(*) { animation-duration: 380ms; animation-timing-function: var(--ease); }
button, a, input, select, textarea, .card, .dd li a, .btn-out { transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s, transform .15s, opacity .15s; }
a.card:hover { transform: translateY(-3px); box-shadow: 0 2px 0 var(--line), 0 16px 28px -14px oklch(30% 0.04 265 / .35); }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(*), ::view-transition-new(*) { animation: none; }
  .hero .parade img { animation: none; }
  * { transition: none !important; }
}
