/* ==========================================================
   Kétogenic — Design system de l'application
   Même univers que la landing : papier, crème, olive, terracotta.
   ========================================================== */
:root {
  --bg: #fbf8f1;
  --bg-2: #f3ecdf;
  --surface: #fffdf8;
  --surface-2: #f3ecdf;
  --surface-solid: #fffdf8;
  --border: rgba(31, 38, 28, 0.1);
  --border-strong: rgba(31, 38, 28, 0.2);
  --text: #1f261c;
  --text-2: #4b5244;
  --text-3: #7c8174;
  --on-accent: #fbf8f1;

  /* "lime" reste le nom de l'accent principal dans le code : c'est désormais l'olive */
  --lime: #45562c;
  --lime-2: #5f7340;
  --green: #8fa36b;
  --avocado: #45562c;
  --coral: #c4623a;
  --amber: #d9a441;
  --sky: #6f9fb5;
  --violet: #9c7aa8;

  --fat: #d9a441;
  --protein: #c4623a;
  --carbs: #8fa36b;

  --grad-brand: linear-gradient(135deg, #45562c 0%, #5f7340 100%);
  --grad-warm: linear-gradient(135deg, #ecc977 0%, #e0a95a 100%);
  --shadow-lg: 0 24px 50px -28px rgba(31, 38, 28, 0.35), 0 6px 16px -10px rgba(31, 38, 28, 0.15);
  --shadow-glow: 0 20px 40px -26px rgba(31, 38, 28, 0.4);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;

  --font: "Karla", system-ui, -apple-system, Segoe UI, sans-serif;
  --font-display: "Young Serif", Georgia, serif;
  --font-hand: "Caveat", cursive;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
::selection { background: #e8c36a; color: var(--text); }

.aurora { display: none; }

/* Typography */
.display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; line-height: 1.1; }
.gradient-text { color: var(--lime); }
.eyebrow { display: inline-block; font-family: var(--font-hand); font-size: 22px; line-height: 1; color: var(--coral); }
.muted { color: var(--text-2); }
.tiny { font-size: 12px; color: var(--text-3); }

/* Buttons */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 24px; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 700; font-size: 15px; cursor: pointer;
  transition: transform .3s var(--ease), background .3s, border-color .3s, color .3s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--text); color: var(--on-accent); border-color: var(--text); }
.btn-primary:hover { background: var(--lime); border-color: var(--lime); transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--text); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn .ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,.35); transform: scale(0); animation: ripple .6s var(--ease); pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 1px 0 rgba(31, 38, 28, 0.03);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--bg-2); border: 1px solid transparent; color: var(--text-2);
}
.chip.lime { color: var(--lime); background: rgba(69, 86, 44, .09); }
.chip.pro { color: var(--text); background: var(--grad-warm); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; font-weight: 700; color: var(--text); display: flex; justify-content: space-between; align-items: baseline; }
.field label output { font-family: var(--font-display); font-weight: 400; font-size: 16px; color: var(--lime); font-variant-numeric: tabular-nums; }
.input, .select {
  width: 100%; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--bg); border: 1px solid var(--border-strong); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus, .select:focus { border-color: var(--lime); box-shadow: 0 0 0 4px rgba(69, 86, 44, .1); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234b5244' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 99px;
  background: linear-gradient(90deg, var(--lime) var(--p, 50%), #e3d8c3 var(--p, 50%));
  outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--lime); box-shadow: 0 3px 8px rgba(31, 38, 28, .2);
  transition: transform .2s var(--ease);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--lime); }

.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--bg-2); flex-wrap: wrap; }
.segmented button {
  flex: 1; padding: 8px 12px; border: 0; border-radius: 999px; background: transparent;
  font-size: 13px; font-weight: 700; color: var(--text-2); cursor: pointer; transition: all .3s var(--ease);
  white-space: nowrap;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--text); color: var(--on-accent); }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* Toast */
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
  padding: 12px 20px; border-radius: 999px; background: var(--text); color: var(--on-accent);
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 700; display: flex; gap: 10px; align-items: center;
  animation: toastIn .45s var(--ease);
}
.toast.out { animation: toastOut .4s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 22px; }
.logo-mark { width: 28px; height: 28px; display: grid; place-items: center; }
.logo-mark svg { width: 28px; height: 28px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
}
