/* FoodJinn — thème clair et sombre automatique (light-dark) */

@font-face {
  font-family: "Space Mono";
  src: url("/fonts/SpaceMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --green: #5e9e3a;
  --green-light: #a6d277;
  --green-ink: light-dark(#3b7020, #b9e08c);
  --bg: light-dark(#fbfcf7, #0e150b);
  --bg-soft: light-dark(#f1f7e9, #142010);
  --surface: light-dark(#ffffff, #18240f);
  --ink: light-dark(#1b2614, #e9f1e2);
  --muted: light-dark(#5a6752, #a9b6a0);
  --line: light-dark(#dfe9d3, #2a3a20);
  --shadow: light-dark(0 18px 50px -20px rgb(59 112 32 / 0.35), 0 18px 50px -20px rgb(0 0 0 / 0.7));

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Space Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 22px;
  --wrap: 1140px;
}

/* Choix du visiteur (interrupteur 🌞/🌚) : toutes les couleurs passent par light-dark() */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--green-ink); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 0.5em; text-wrap: balance; }
h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h3 { font-size: 1.2rem; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 32px; } }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green-ink);
  margin-bottom: 0.8em;
}

/* --- Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.85em 1.4em;
  border-radius: 999px;
  border: 3px solid var(--green);
  background: var(--green-light);
  color: #1b2614;
  font-weight: 650;
  text-decoration: none;
  box-shadow: inset 0 0 0 3px light-dark(#fff, #0e150b);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-2px); text-decoration: none; }
.btn:focus-visible { outline: 3px solid var(--green-ink); outline-offset: 3px; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn-ghost:hover { border-color: var(--green); }
.btn-small { padding: 0.45em 1em; font-size: 0.92rem; box-shadow: inset 0 0 0 2px light-dark(#fff, #0e150b); }
.btn-disabled { opacity: 0.75; cursor: default; }
.btn-disabled:hover { transform: none; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* --- Barre du haut */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 750; font-size: 1.2rem; letter-spacing: -0.02em; }
.nav { display: flex; gap: 24px; margin-left: auto; }
.nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; white-space: nowrap; }
.nav a:hover { color: var(--ink); }
.tools { display: flex; align-items: center; gap: 12px; }
@media (max-width: 960px) {
  .nav { display: none; }
  .tools { margin-left: auto; }
}
@media (max-width: 560px) {
  .topbar-inner { gap: 12px; }
  .brand span { display: none; }
  .get-app { display: none; }
}

/* Interrupteur clair / sombre */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}
.theme-icon { font-size: 1.05rem; transition: opacity 0.25s, transform 0.25s; }
.theme-track {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 2px solid var(--green);
  transition: background 0.25s;
}
.theme-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green);
  transition: transform 0.25s ease;
}
.theme-switch[aria-checked="true"] .theme-track { background: #24331b; }
.theme-switch[aria-checked="true"] .theme-knob { transform: translateX(20px); background: var(--green-light); }
.theme-switch[aria-checked="true"] .theme-icon:first-child,
.theme-switch[aria-checked="false"] .theme-icon:last-child { opacity: 0.4; transform: scale(0.85); }
.theme-switch:focus-visible { outline: 3px solid var(--green-ink); outline-offset: 2px; border-radius: 999px; }
@media (prefers-reduced-motion: reduce) { .theme-knob, .theme-icon, .theme-track { transition: none; } }

/* Menu des langues */
.lang-menu { position: relative; }
.lang-menu summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover, .lang-menu[open] summary { border-color: var(--green); }
.lang-menu summary:focus-visible { outline: 3px solid var(--green-ink); outline-offset: 2px; }
.lang-menu ul {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 190px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 60;
}
.lang-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
}
.lang-menu a:hover { background: var(--bg-soft); }
.lang-menu a[aria-current] { background: var(--bg-soft); font-weight: 650; }
.lang-code { font-family: var(--mono); font-size: 0.8rem; color: var(--green-ink); width: 1.8em; }

/* --- Accueil : en-tête */
.hero {
  position: relative;
  padding: 56px 0 72px;
  overflow-x: clip;
  background:
    radial-gradient(60% 70% at 85% 40%, color-mix(in srgb, var(--green-light) 38%, transparent), transparent 70%),
    radial-gradient(40% 50% at 5% 10%, color-mix(in srgb, var(--green-light) 18%, transparent), transparent 70%);
}
.hero-inner { display: grid; gap: 48px; align-items: center; }
@media (min-width: 900px) {
  .hero { padding: 80px 0 96px; }
  .hero-inner { grid-template-columns: 1.15fr 0.85fr; }
}
.hero h1 { font-size: clamp(2.2rem, 5.2vw, 3.8rem); font-weight: 800; margin-bottom: 0.4em; }
.hero h1 .accent { color: var(--green-ink); }
/* Mots recherchés (« compteur de calories IA ») dans le H1, sans changer le ton du titre */
.h1-kicker {
  display: block;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--green-ink);
  margin-bottom: 0.9em;
}
.lead { font-size: 1.2rem; color: var(--muted); max-width: 34em; margin-bottom: 1.6em; }

.greeting { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 22px; min-height: 48px; }
.greeting img { flex: none; }
.bubble {
  font-family: var(--mono);
  font-size: 0.95rem;
  background: var(--surface);
  border: 2px solid var(--green-light);
  padding: 8px 14px;
  border-radius: 16px 16px 16px 4px;
  box-shadow: var(--shadow);
}
.caret { display: inline-block; width: 0.55em; height: 1.05em; margin-left: 2px; vertical-align: -0.15em; background: var(--green); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret { display: none; } }

.trust { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; padding: 0; margin: 28px 0 0; font-size: 0.9rem; color: var(--muted); }
.trust li { display: inline-flex; align-items: center; gap: 8px; }
.trust li + li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--green-light); margin-right: 12px; }

/* Drapeau suisse en CSS (carré rouge, croix blanche) */
.swiss-flag {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 3px;
  background:
    linear-gradient(#fff, #fff) center / 60% 20% no-repeat,
    linear-gradient(#fff, #fff) center / 20% 60% no-repeat,
    #da291c;
  flex: none;
}

/* Téléphone */
.phone {
  position: relative;
  border-radius: 38px;
  padding: 10px;
  background: #11170e;
  box-shadow: var(--shadow), inset 0 0 0 2px #2c3626;
}
.phone video, .phone img { border-radius: 29px; width: 100%; background: #fff; }
.hero-visual { position: relative; max-width: 320px; margin: 0 auto; }
.hero-visual .phone { transform: rotate(2.5deg); }

.chip {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px;
  background: var(--surface);
  border: 2px solid var(--green-light);
  border-radius: 16px;
  box-shadow: var(--shadow);
  animation: float 6s ease-in-out infinite;
}
.chip-label { font-size: 0.75rem; color: var(--muted); }
.chip-value { font-family: var(--mono); font-size: 1.2rem; font-weight: 700; }
.chip img { width: 96px; }
.chip-kcal { left: -18%; top: 14%; }
.chip-score { right: -16%; top: 44%; animation-delay: -2s; }
.chip-co2 { left: -12%; bottom: 10%; animation-delay: -4s; }
@media (max-width: 560px) {
  .hero-visual { max-width: 260px; }
  .chip { padding: 8px 12px; }
  .chip-value { font-size: 1rem; }
  .chip img { width: 80px; }
  .chip-kcal { left: -12%; }
  .chip-score { right: -12%; }
  .chip-co2 { left: -8%; }
}
@keyframes float { 50% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .chip { animation: none; } }

/* --- Sections */
.section { padding: 88px 0; }
.section > .wrap > h2 { max-width: 18em; }

/* Étapes */
.steps { list-style: none; padding: 0; margin: 40px 0 48px; display: grid; gap: 20px; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.steps p { color: var(--muted); margin: 0; }
.step-num { display: block; font-family: var(--mono); font-size: 2rem; color: var(--green); margin-bottom: 8px; }

.flow { margin: 0; border-radius: var(--radius); overflow: hidden; background: #fff; border: 1px solid var(--line); }

.demo { display: grid; gap: 28px; align-items: center; margin-top: 64px; }
@media (min-width: 860px) { .demo { grid-template-columns: 0.8fr 1.2fr; gap: 48px; } }
.demo-text p { color: var(--muted); }
.demo-video video { border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; }

/* Fonctionnalités */
.features { background: var(--bg-soft); }
.feature-grid { display: grid; gap: 20px; margin-top: 40px; }
@media (min-width: 640px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.feature p { color: var(--muted); margin: 0; }
.feature-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--bg-soft); font-size: 1.6rem; margin-bottom: 14px; }
.nutri-row { display: flex; gap: 4px; margin-top: 16px; }
.nutri-row img { width: 20%; min-width: 0; }

.screens { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 3vw, 40px); margin-top: 64px; max-width: 860px; margin-inline: auto; }
.screens figure { margin: 0; text-align: center; }
.screens figure:nth-child(2) { transform: translateY(-24px); }
.phone-small { border-radius: clamp(16px, 4vw, 32px); padding: clamp(4px, 1vw, 8px); }
.phone-small img { border-radius: clamp(12px, 3vw, 25px); }
.screens figcaption { margin-top: 14px; font-family: var(--mono); font-size: clamp(0.7rem, 1.6vw, 0.85rem); color: var(--muted); }

/* Confidentialité */
.privacy-inner { display: grid; gap: 40px; align-items: start; }
@media (min-width: 900px) { .privacy-inner { grid-template-columns: 1fr 1fr; gap: 64px; } }
.privacy-text p { color: var(--muted); }
.privacy-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.privacy-list li { display: grid; gap: 2px; padding: 18px 22px; border-left: 4px solid var(--green); background: var(--surface); border-radius: 0 16px 16px 0; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.privacy-list span { color: var(--muted); font-size: 0.97rem; }

/* Appel final */
.get { background: var(--bg-soft); }
.get-inner { text-align: center; max-width: 680px; }
.get-inner img { margin: 0 auto 20px; }
.get-inner > p { color: var(--muted); }
.get-inner .cta-row { justify-content: center; margin: 28px 0; }
.note { font-size: 0.85rem; }

/* Apparition */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: none; }
.screens figure:nth-child(2).reveal.visible { transform: translateY(-24px); }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* --- Pages légales */
.legal { max-width: 780px; padding-top: 56px; padding-bottom: 88px; }
.legal-head { border-bottom: 1px solid var(--line); padding-bottom: 24px; margin-bottom: 32px; }
.legal-head h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
.legal-date { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); margin: 0; }
.legal-notice { font-size: 0.92rem; color: var(--muted); padding: 14px 18px; border-radius: 14px; background: var(--bg-soft); border: 1px dashed var(--green-light); }
.prose h2 { font-size: 1.3rem; margin-top: 2em; }
.prose ul { padding-left: 1.3em; }
.prose li { margin-bottom: 0.4em; }
.legal-contact { margin-top: 48px; padding: 22px 26px; background: var(--bg-soft); border-radius: var(--radius); border: 1px solid var(--line); }
.legal-contact p { margin: 0; }

/* --- FAQ (src/faq.md) */
.faq-md h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
.faq-md h2 { font-size: 1.6rem; margin-top: 1.6em; }
.faq-md h3 { font-size: 1.1rem; margin-top: 1.8em; }
.faq-md hr { border: 0; border-top: 1px solid var(--line); margin: 48px 0 0; }
.faq-figure { margin: 24px 0; }
.faq-figure picture img, .faq-figure > img { border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.faq-figure figcaption { margin-top: 10px; font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }
.faq-phone .phone { max-width: 240px; }
.faq-nutri .nutri-row { max-width: 420px; }
.more-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* --- Page de comparaison */
.page { max-width: 900px; padding-top: 56px; padding-bottom: 88px; }
.page-head { border-bottom: 1px solid var(--line); padding-bottom: 24px; margin-bottom: 32px; }
.page-head h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
.page-head .lead { margin-bottom: 0; }
.table-scroll { overflow-x: auto; margin: 32px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.compare-table { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 0.92rem; }
.compare-table caption { text-align: left; padding: 16px 18px 0; font-size: 0.85rem; color: var(--muted); caption-side: bottom; padding-bottom: 16px; }
.compare-table th, .compare-table td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.compare-table thead th { font-family: var(--mono); font-size: 0.8rem; font-weight: 400; letter-spacing: 0.05em; color: var(--muted); }
.compare-table tbody th { font-weight: 650; }
.compare-table .us { background: var(--bg-soft); }
.compare-table .yes { color: var(--green-ink); font-weight: 650; }
.compare-table .unknown { color: var(--muted); }
.compare-table tbody tr:last-child > * { border-bottom: 0; }
.fine { font-size: 0.88rem; color: var(--muted); }

/* --- 404 */
.notfound { text-align: center; }
.notfound img { margin: 0 auto 24px; }
.notfound p { color: var(--muted); }

/* --- Pied de page */
.footer { border-top: 1px solid var(--line); padding: 48px 0 36px; font-size: 0.92rem; }
.footer-inner { display: grid; gap: 28px; }
@media (min-width: 760px) { .footer-inner { grid-template-columns: 1fr auto; } }
.footer-brand p { color: var(--muted); margin: 10px 0 0; }
.swiss { display: inline-flex; align-items: center; gap: 8px; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: var(--ink); text-decoration: none; }
.footer-links a:hover { color: var(--green-ink); text-decoration: underline; }
.footer-copy { grid-column: 1 / -1; color: var(--muted); font-size: 0.82rem; margin: 0; border-top: 1px solid var(--line); padding-top: 20px; }
.footer-copy a { color: inherit; }
