/* ============================================================
   Cours d'alimentation — CSS partagé (SaaS)

   Palette, typographie et composants réutilisés depuis cours.html
   (version présentiel). Toute modification doit rester cohérente
   avec les deux versions pour garder une identité visuelle unifiée.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..700;1,9..144,300..600&family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* --- Palette --- */
:root {
  --fern: #4a7c59;
  --fern-dark: #2f5a3e;
  --fern-light: #7fa98a;
  --marigold: #f4a900;
  --honey: #e8c56b;
  --terracotta: #c1555a;
  --terra-deep: #8c3338;
  --cream: #f7f3e8;
  --cream-2: #ede5d0;
  --cream-3: #e0d6bb;
  --ink: #2a2318;
  --ink-2: #4a3f2c;
  --fg: #2a2318;
  --bg: #f7f3e8;
  --surface: #fff;
  --muted: #8a7e60;
  --line: #e6dfc8;
  --line-soft: #f0ebd8;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(42, 35, 24, .06);
  --shadow-md: 0 8px 24px rgba(42, 35, 24, .08);
  --shadow-lg: 0 20px 48px rgba(42, 35, 24, .12);
  --touch: 44px;
  /* couleurs famille nutrimental */
  --glu: #e89a3e;
  --lip: #c7472b;
  --pro: #8b3049;
  --vit: #6ba368;
  --min: #4d7a9e;
  --eau: #7ba8c9;
  --alc: #6e4b3a;
}

[data-theme="dark"] {
  --cream: #1a1611;
  --cream-2: #24201a;
  --cream-3: #2e2920;
  --ink: #f0e6cf;
  --ink-2: #d5c9ab;
  --fg: #f0e6cf;
  --bg: #1a1611;
  --surface: #24201a;
  --line: #3a3427;
  --line-soft: #2e2920;
  --muted: #9a907a;
}

/* --- Reset / base --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--fern); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
  color: var(--fg);
}
h1 em, h2 em, h3 em, h4 em {
  font-style: italic;
  font-weight: 300;
  color: var(--muted);
}
p { margin: 0 0 1em; }
code, pre, .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* --- Helpers --- */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 32px);
}
.container-sm { max-width: 720px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 32px); }
.muted { color: var(--muted); }
.mono { font-family: 'JetBrains Mono', monospace; }
.badge {
  display: inline-block;
  background: rgba(244, 169, 0, 0.18);
  color: #8a6500;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
[data-theme="dark"] .badge { color: var(--marigold); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 15px;
  min-height: var(--touch);
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
  line-height: 1;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--fern);
  color: var(--cream);
}
.btn-primary:hover { background: var(--fern-dark); }
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--cream-2); }
.btn-secondary {
  background: var(--cream-2);
  color: var(--fg);
  border-color: var(--line);
}
.btn-secondary:hover { background: var(--cream-3); }
.btn-lg { padding: 16px 30px; font-size: 17px; }
.btn-sm { padding: 8px 16px; font-size: 13px; min-height: 36px; }

/* --- Topbar --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  background: rgba(247, 243, 232, 0.88);
  border-bottom: 1px solid var(--line);
}
[data-theme="dark"] .topbar { background: rgba(26, 22, 17, 0.88); }
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}
.brand {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 20px;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--marigold);
}
.nav { display: flex; gap: 4px; align-items: center; }
.nav a { color: var(--ink-2); padding: 8px 14px; border-radius: 8px; font-size: 14px; }
.nav a:hover { background: var(--cream-2); text-decoration: none; }

@media (max-width: 700px) {
  .nav a:not(.btn) { display: none; }
}

/* --- Forms --- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: var(--touch);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--fern);
  box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.15);
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; font-style: italic; }
.field .error { color: var(--terracotta); font-size: 13px; margin-top: 6px; }

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 2vw, 28px);
  box-shadow: var(--shadow-sm);
}
.card-lg {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 3vw, 40px);
  box-shadow: var(--shadow-md);
}

/* --- Alerts --- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.5;
  border-left: 3px solid;
}
.alert-error {
  background: rgba(193, 85, 90, 0.1);
  border-color: var(--terracotta);
  color: var(--terra-deep);
}
.alert-success {
  background: rgba(74, 124, 89, 0.12);
  border-color: var(--fern);
  color: var(--fern-dark);
}
.alert-info {
  background: rgba(77, 122, 158, 0.1);
  border-color: var(--min);
  color: #2c4a6e;
}

/* --- Subtle grain texture (matches cours.html) --- */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='1' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.5'/></svg>");
  mix-blend-mode: multiply;
  opacity: 0.04;
  z-index: 1;
}
[data-theme="dark"] body::after { mix-blend-mode: screen; opacity: 0.3; }

/* ============================================================
   Accessibilité (WCAG 2.2 AA)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
:focus-visible {
  outline: 3px solid var(--marigold);
  outline-offset: 2px;
  border-radius: 4px;
}
.btn:focus-visible, a.btn:focus-visible {
  outline: 3px solid var(--marigold);
  outline-offset: 3px;
}
.skip-link {
  position: absolute; top: -100px; left: 12px;
  padding: 10px 18px; background: var(--fern); color: white;
  font-weight: 600; text-decoration: none; border-radius: 6px;
  z-index: 9999; transition: top 0.15s;
}
.skip-link:focus { top: 12px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
main a:not(.btn):not(.brand):not(.nav a) {
  color: var(--fern-dark); text-decoration: underline; text-underline-offset: 3px;
}
