/* ============================================================
   RAPPELLO — parti pris : « l'étiquette de rayon ».
   Le jaune signal des étiquettes d'alerte de supermarché porte
   l'identité ; le rouge est réservé au danger réel. Typo
   Bricolage Grotesque, grande et chaleureuse. Lisible par tous.
   CSS natif, aucun framework (contrainte projet).
   ============================================================ */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/assets/fonts/bricolage-400-800.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Sans';
  src: url('/assets/fonts/instrumentsans-400-700.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/assets/fonts/ibmplexmono-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #faf9f6;
  --card: #ffffff;
  --ink: #1d2126;
  --ink-soft: #5d6470;
  --line: #e6e4de;

  --jaune: #ffd23f;        /* l'étiquette : identité, jamais un signal de danger */
  --jaune-pale: #fff3c9;

  --danger: #c2382c;       /* réservé au risque réel */
  --danger-tint: #f9edeb;
  --ok: #2c7a4b;
  --ok-tint: #ecf5ef;

  --risk-bio: #c2382c;      --risk-bio-tint: #f9edeb;
  --risk-allerg: #955f0a;   --risk-allerg-tint: #f8f0dd;
  --risk-corps: #46688a;    --risk-corps-tint: #ebf1f7;
  --risk-autre: #5d6470;    --risk-autre-tint: #efeff0;

  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --sans: 'Instrument Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { font-size: 106.25%; } /* base 17px : lisibilité pour tous */

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  overflow-x: clip;
}

img { max-width: 100%; }

main { max-width: 74rem; margin: 0 auto; padding: 1.25rem 1.5rem 3.5rem; }
/* les pages de texte long restent confortables à lire */
main.narrow { max-width: 46rem; }

a { color: var(--ink); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--jaune); text-decoration-thickness: 3px; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3 { overflow-wrap: anywhere; }
h1 {
  font-family: var(--display);
  font-weight: 750;
  font-size: clamp(1.8rem, 4.5vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0.5em 0 0.4em;
  text-wrap: balance;
}
h1::first-letter, .card h3::first-letter { text-transform: uppercase; }

/* ---------- en-tête ---------- */

.site-header { background: var(--card); border-bottom: 1px solid var(--line); padding: 0.8rem 1.25rem; }
.site-header .bar {
  max-width: 74rem; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; flex-wrap: wrap;
}
.logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  color: var(--ink) !important;
  text-decoration: none;
  /* coup de surligneur jaune : la signature, discrète et partout */
  background: linear-gradient(transparent 55%, var(--jaune) 55%, var(--jaune) 92%, transparent 92%);
  padding: 0 0.15em;
}
.logo .tld { display: none; }
.site-header nav { display: flex; gap: 0.4rem; }
.site-header nav a {
  font-weight: 600; font-size: 0.98rem;
  color: var(--ink); text-decoration: none;
  padding: 0.4rem 0.8rem; border-radius: 8px;
}
.site-header nav a:hover { background: var(--jaune-pale); }

/* ---------- héros : l'étiquette ---------- */

.hero {
  background: var(--jaune);
  border-radius: 14px;
  margin: 1.5rem 0 1.25rem;
  padding: 1.9rem 1.75rem 1.5rem;
}
.hero h1 { margin-top: 0; }
.hero .tagline { margin: 0 0 1.2rem; font-size: 1.06rem; max-width: 34em; }

.checker { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.checker input {
  flex: 1 1 11rem;
  min-width: 0;
  font-size: 1.15rem;
  font-family: var(--sans);
  padding: 0.75rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
}
.checker input::placeholder { color: #8f959e; }

.hero .alt { margin: 0.9rem 0 0; font-size: 1rem; }
.hero .alt a:hover { text-decoration-color: var(--ink); }
.hero .tally { margin: 1.1rem 0 0; font-size: 0.92rem; color: rgba(29, 33, 38, 0.75); }
.hero .tally strong { color: var(--ink); }

/* ---------- boutons ---------- */

.btn {
  display: inline-block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.08rem;
  background: var(--ink);
  color: #fff !important;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 0.7rem 1.5rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 130ms ease;
}
.btn:hover { background: #343b44; }
.btn:active { background: #000; }
.btn--ghost { background: transparent; color: var(--ink) !important; }
.btn--ghost:hover { background: var(--jaune-pale); }

/* ---------- rayons (univers produits) ---------- */

.rayons {
  display: flex;
  gap: 0.15rem 1.1rem;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--line);
  margin: 1.4rem 0 1.1rem;
}
.rayons a {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  padding: 0.35rem 0.1rem 0.5rem;
  margin-bottom: -2px;
  border-bottom: 4px solid transparent;
}
.rayons a:hover { border-bottom-color: var(--jaune); }
.rayons a[aria-current] { border-bottom-color: var(--ink); }
.rayons .count { color: var(--ink-soft); font-weight: 400; font-size: 0.85em; }

/* ---------- héros + magasin côte à côte sur grand écran ---------- */

.top-grid { display: grid; gap: 1.25rem; align-items: stretch; margin: 1.5rem 0 1.25rem; }
.top-grid .hero { margin: 0; }
@media (min-width: 960px) {
  .top-grid { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); }
}

/* ---------- votre magasin ---------- */

.finder {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem;
}
.finder h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
  margin: 0;
}
.finder label { display: block; font-weight: 400; color: var(--ink-soft); margin-bottom: 0.35rem; }
.finder select {
  width: 100%;
  max-width: 26rem;
  font-size: 1.05rem;
  font-family: var(--sans);
  color: var(--ink);
  padding: 0.65rem 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--card);
}

/* ---------- fil des rappels ---------- */

.section-label {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  margin: 2rem 0 0.9rem;
}

.feed {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(min(19.5rem, 100%), 1fr));
  align-items: stretch;
}
.card { display: flex; flex-direction: column; }
.card .badges { margin: 0; margin-top: auto; display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* photo produit : zone réservée pour une grille régulière */
.card .thumb {
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.card .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.card .thumb--empty::before {
  content: 'Photo non fournie';
  font-size: 0.85rem;
  color: #a9adb4;
}

/* rappels terminés masqués par défaut, interrupteur global (toggle.js) */
body:not(.show-closed) .card--closed { display: none; }
.closed-toggle { margin: 1rem 0 0.2rem; }
.closed-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.closed-toggle input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--ink);
  cursor: pointer;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.2rem 1.05rem;
  transition: border-color 120ms ease;
}
.card:hover { border-color: var(--ink); }
.card h3 {
  font-family: var(--display);
  font-weight: 650;
  font-size: 1.16rem;
  line-height: 1.3;
  margin: 0 0 0.2rem;
}
.card > a { text-decoration: none; }
.card > a::after { content: ''; position: absolute; inset: 0; border-radius: 12px; }
.card .meta { margin: 0 0 0.55rem; color: var(--ink-soft); font-size: 0.95rem; }
.card .meta .brand { font-weight: 600; color: var(--ink); }
.card--closed { opacity: 0.75; }
.closed-tag { color: var(--ok); font-weight: 600; }

.more { margin: 1.3rem 0; }
.pagination { display: flex; justify-content: space-between; margin: 2rem 0; font-weight: 600; }

/* ---------- pastilles de risque ---------- */

.badge {
  display: inline-block;
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.35;
  padding: 0.15em 0.7em;
  border-radius: 7px;
  background: var(--risk-autre-tint);
  color: var(--risk-autre);
}
.badge--listeria, .badge--salmonelle, .badge--e-coli { background: var(--risk-bio-tint); color: var(--risk-bio); }
.badge--allergene-non-declare { background: var(--risk-allerg-tint); color: var(--risk-allerg); }
.badge--corps-etranger { background: var(--risk-corps-tint); color: var(--risk-corps); }
.badge--safe { background: var(--ok-tint); color: var(--ok); }
.badge--stale { background: transparent; border: 1.5px dashed #c3c6cc; color: var(--ink-soft); }

/* ---------- chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 1rem 0; }
.chip {
  font-size: 0.92rem; font-weight: 600;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 9px;
  padding: 0.28rem 0.8rem;
  text-decoration: none;
}
.chip:hover { border-color: var(--ink); background: var(--jaune-pale); }

/* ---------- fiche ---------- */

.eyebrow {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--danger);
  margin: 1.2rem 0 0;
}

.fiche-head { max-width: 54rem; }
.fiche-grid { display: grid; gap: 1.25rem; margin-top: 1.2rem; align-items: start; }
@media (min-width: 960px) {
  .fiche-grid { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); }
}

.fiche, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.6rem 1.75rem;
}
.panel { padding: 1.2rem 1.4rem; }
.panel + .panel { margin-top: 1.25rem; }
.panel h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}
.panel ul { margin: 0.3rem 0; padding-left: 1.2rem; }
.fiche .meta { color: var(--ink-soft); font-size: 0.98rem; margin: 0 0 1rem; }
.fiche section { margin: 1.6rem 0; }
.fiche h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.18rem;
  margin: 0 0 0.35rem;
  /* le surligneur jaune souligne la structure, pas le danger */
  background: linear-gradient(transparent 62%, var(--jaune) 62%, var(--jaune) 96%, transparent 96%);
  display: inline-block;
  padding: 0 0.2em 0 0;
}
.fiche section p, .fiche section ul { margin: 0.3rem 0; }
.fiche section ul { padding-left: 1.2rem; }

.fiche .images { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1.1rem 0; }
.fiche .images img {
  max-width: 165px; max-height: 165px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  padding: 5px;
}
.fiche .images .img-fallback { display: none; }

.gtins { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.gtins code {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.95rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.25rem 0.7rem;
}

.fiche-footer { border-top: 1px solid var(--line); margin-top: 1.9rem; padding-top: 1.1rem; color: var(--ink-soft); font-size: 0.92rem; }

.banner { border-radius: 12px; padding: 0.9rem 1.2rem; margin: 1.1rem 0; background: var(--ok-tint); color: var(--ok); font-size: 1rem; }
.banner--stale { background: #f2f1ec; color: var(--ink-soft); }

/* ---------- scanner ---------- */

.scan-video { width: 100%; max-height: 60vh; background: var(--ink); border-radius: 12px; }
.scan-manual { margin: 1.2rem 0; display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: end; }
.scan-manual label { display: block; width: 100%; font-weight: 600; color: var(--ink-soft); font-size: 0.95rem; }
.scan-manual input {
  font-size: 1.15rem;
  padding: 0.7rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 10px;
  width: 13em;
  max-width: 100%;
}

.scan-result { border-radius: 14px; padding: 1.3rem 1.5rem; margin-top: 1.3rem; }
.scan-result h2 { font-family: var(--display); font-weight: 750; font-size: 1.45rem; margin: 0 0 0.5rem; }
.scan-result--recall { background: var(--danger-tint); border: 2px solid var(--danger); }
.scan-result--recall h2 { color: var(--danger); }
.scan-result--ok { background: var(--ok-tint); border: 2px solid var(--ok); }
.scan-result--ok h2 { color: var(--ok); }
.scan-result .muted { color: var(--ink-soft); font-size: 0.9rem; }

/* ---------- abonnements ---------- */

.subscribe {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.3rem 1.5rem;
  margin: 1.2rem 0;
}
.subscribe h2 { font-family: var(--display); font-weight: 700; font-size: 1.25rem; margin: 0 0 0.4rem; }
.subscribe label { display: block; font-weight: 600; font-size: 0.95rem; color: var(--ink-soft); margin-bottom: 0.3rem; }
.subscribe input[type='email'] {
  font-size: 1.05rem;
  padding: 0.65rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 10px;
  margin: 0 0.6rem 0.6rem 0;
  width: 17em;
  max-width: 100%;
}

/* ---------- pied de page ---------- */

.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 1.6rem 1.25rem 2.2rem;
  text-align: center;
}
.site-footer p { color: var(--ink-soft); font-size: 0.92rem; margin: 0.3rem 0; }
.site-footer nav { display: flex; justify-content: center; gap: 0.6rem 1.4rem; flex-wrap: wrap; margin-top: 0.7rem; }
.site-footer nav a { font-size: 0.92rem; color: var(--ink-soft); }

.updated { color: var(--ink-soft); font-size: 0.95rem; }
.lead { font-size: 1.05rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media (max-width: 540px) {
  html { font-size: 100%; }
  .hero { padding: 1.4rem 1.2rem 1.2rem; margin-top: 1rem; }
  .checker .btn { flex: 1 1 100%; }
  .fiche { padding: 1.3rem 1.2rem; }
}
