/* Popote — feuille de style. Sobre, « photo d'abord », lisible en cuisine.
   Clair par défaut, sombre automatique (RNF-3/4). Cibles tactiles ≥ 44 px. */
:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --surface-2: #f3ede4;
  --ink: #241f1b;
  --ink-soft: #6b615a;
  --line: #e5dcd0;
  --brand: #b4451f;      /* terre cuite */
  --brand-ink: #ffffff;
  --brand-soft: #f6e3d8;
  --accent: #2f7d55;     /* vert herbe */
  --danger: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(60,40,20,.08), 0 6px 20px rgba(60,40,20,.05);
  --tap: 44px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17130f; --surface: #211b16; --surface-2: #2b241d;
    --ink: #f3ece3; --ink-soft: #b6a99c; --line: #3a2f26;
    --brand: #e0703f; --brand-soft: #3a241a; --accent: #57b483;
  }
}
/* Bascule manuelle du thème (bouton en-tête), prioritaire sur la préférence système */
:root[data-theme="dark"] {
  --bg: #17130f; --surface: #211b16; --surface-2: #2b241d;
  --ink: #f3ece3; --ink-soft: #b6a99c; --line: #3a2f26;
  --brand: #e0703f; --brand-soft: #3a241a; --accent: #57b483;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.wrap { width: min(1100px, 92vw); margin-inline: auto; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; }
img { max-width: 100%; height: auto; display: block; }

.skip { position: absolute; left: -999px; top: 0; background: var(--brand); color: #fff; padding: .6rem 1rem; }
.skip:focus { left: 8px; top: 8px; z-index: 100; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* En-tête */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 1rem; padding: .5rem 0; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.3rem; color: var(--ink); letter-spacing: -.02em; }
.brand-mark { font-size: 1.3rem; }
.site-search { display: flex; flex: 1 1 240px; min-width: 180px; }
.site-search input { flex: 1; min-height: var(--tap); border: 1px solid var(--line); border-right: 0;
  border-radius: 999px 0 0 999px; padding: 0 1rem; background: var(--bg); color: var(--ink); font-size: 1rem; }
.site-search button { min-width: var(--tap); min-height: var(--tap); border: 1px solid var(--line);
  border-radius: 0 999px 999px 0; background: var(--brand); color: #fff; cursor: pointer; font-size: 1.1rem; }
.site-nav { display: flex; align-items: center; gap: .35rem; }
.site-nav a { padding: .55rem .7rem; border-radius: 10px; color: var(--ink); min-height: var(--tap); display: inline-flex; align-items: center; }
.site-nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav-cta { background: var(--brand); color: var(--brand-ink) !important; }
.nav-cta:hover { filter: brightness(1.05); }
.theme-toggle { background: none; border: 1px solid var(--line); border-radius: 999px;
  min-width: var(--tap); min-height: var(--tap); cursor: pointer; font-size: 1.15rem; color: var(--ink); }
.theme-toggle:hover { background: var(--surface-2); }

/* Menu utilisateur */
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; padding: .55rem .7rem; border-radius: 10px; min-height: var(--tap); display: inline-flex; align-items: center; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu[open] summary { background: var(--surface-2); }
.usermenu-panel { position: absolute; right: 0; top: 110%; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); min-width: 200px; padding: .35rem; display: grid; gap: .15rem; }
.usermenu-panel a, .usermenu-panel button { padding: .6rem .7rem; border-radius: 8px; text-align: left; }
.usermenu-panel a:hover, .usermenu-panel button:hover { background: var(--surface-2); }

/* Messages */
.messages { margin-top: 1rem; display: grid; gap: .5rem; }
.msg { padding: .8rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.msg-success { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.msg-error, .msg-danger { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.msg-warning { border-color: #c98a1a; }

main { padding: 1.5rem 0 3rem; }

/* Boutons & formulaires */
.btn { display: inline-flex; align-items: center; gap: .4rem; min-height: var(--tap); padding: .55rem 1.1rem;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; font-size: 1rem; font-weight: 600; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(1.05); background: var(--brand); }
.btn-ghost { background: transparent; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-sm { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }
.linklike { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; }

label { font-weight: 600; display: block; margin-bottom: .25rem; }
input, select, textarea {
  width: 100%; min-height: var(--tap); padding: .5rem .7rem; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
}
textarea { min-height: 5rem; resize: vertical; }
/* Cases à cocher / boutons radio : taille naturelle + alignement avec le libellé */
input[type="checkbox"], input[type="radio"] {
  width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0; flex: 0 0 auto;
  accent-color: var(--brand); vertical-align: middle; cursor: pointer;
}
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) {
  display: inline-flex; align-items: center; gap: .5rem; font-weight: 400; margin: .15rem 0;
  min-height: 32px; cursor: pointer;
}
.field { margin-bottom: 1rem; }
.help { color: var(--ink-soft); font-size: .88rem; }
.errorlist { color: var(--danger); list-style: none; padding: 0; margin: .25rem 0; font-size: .9rem; }

/* Cartes & grilles */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.1rem; }
.recipe-card { display: flex; flex-direction: column; }
.recipe-card .thumb { aspect-ratio: 4 / 3; background: var(--surface-2); object-fit: cover; width: 100%; }
.recipe-card .thumb-fallback { display: grid; place-items: center; font-size: 2.5rem; color: var(--ink-soft); aspect-ratio: 4/3; background: var(--surface-2); }
.recipe-card .body { padding: .8rem .9rem 1rem; display: flex; flex-direction: column; gap: .4rem; }
.recipe-card h3 { margin: 0; font-size: 1.05rem; }
.recipe-card .meta { color: var(--ink-soft); font-size: .85rem; display: flex; gap: .6rem; flex-wrap: wrap; }

/* Badges */
.badges { display: flex; flex-wrap: wrap; gap: .35rem; }
.badge { font-size: .78rem; padding: .18rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); }
.badge-brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }

/* Étoiles */
.stars { --pct: 0%; display: inline-block; font-size: 1.1rem; line-height: 1; position: relative; color: var(--line); }
.stars::before { content: "★★★★★"; }
.stars .fill { position: absolute; inset: 0; width: var(--pct); overflow: hidden; color: #e0a52b; white-space: nowrap; }
.stars .fill::before { content: "★★★★★"; }
.star-input button { background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--line); min-width: 40px; min-height: 40px; }
.star-input button.on { color: #e0a52b; }

/* Fiche recette */
.recipe-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1.5rem; align-items: start; }
.recipe-hero img { border-radius: var(--radius); width: 100%; }
.recipe-cols { display: grid; grid-template-columns: 320px 1fr; gap: 2rem; margin-top: 2rem; }
.ingredients li { padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.ingredients .adjust { color: var(--ink-soft); font-style: italic; }
.steps li { margin-bottom: 1rem; }
.serv-select { display: flex; align-items: center; gap: .5rem; }
.serv-select input { width: 5rem; text-align: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }

.aisle-group { margin-bottom: 1.4rem; }
.aisle-group h3 { border-bottom: 2px solid var(--brand-soft); padding-bottom: .3rem; }
.check-item { display: flex; align-items: center; gap: .7rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.check-item input[type=checkbox] { width: 24px; height: 24px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1.2rem; }
.filters .row { display: flex; flex-wrap: wrap; gap: .8rem; }
.filters .row > div { flex: 1 1 160px; }

.section { margin-bottom: 2.4rem; }
.section > h2 { display: flex; align-items: baseline; gap: .6rem; }
.muted { color: var(--ink-soft); }
.empty { text-align: center; color: var(--ink-soft); padding: 3rem 1rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); color: var(--ink-soft); padding: 1.5rem 0; margin-top: auto; }
.site-footer .wrap { display: flex; justify-content: space-between; font-size: .9rem; }

/* Auth centré */
.auth-card { max-width: 420px; margin: 3rem auto; }
.auth-card .card { padding: 2rem; }

@media (max-width: 760px) {
  .recipe-hero, .recipe-cols { grid-template-columns: 1fr; }
  .site-search { order: 3; flex-basis: 100%; }
}

/* Statistiques */
.stat-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .5rem .3rem; border-bottom: 1px solid var(--line); }
.stat-row:last-child { border-bottom: 0; }
.stat-label { flex: 1; }
.stat-bar-row { display: flex; align-items: center; gap: .8rem; margin: .4rem 0; }
.stat-bar-label { flex: 0 0 40%; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-bar { flex: 1; height: 18px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.stat-bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 999px; min-width: 2px; }
.stat-bar-num { flex: 0 0 2.5rem; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Aide dépliable par écran */
.aide-box { border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  padding: .3rem .9rem; margin-bottom: 1.2rem; }
.aide-box > summary { cursor: pointer; font-weight: 600; padding: .5rem 0; list-style: none; }
.aide-box > summary::-webkit-details-marker { display: none; }
.aide-box > summary::before { content: "❔ "; }
.aide-box[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: .5rem; }
.aide-box ul { margin: .3rem 0 .6rem; padding-left: 1.2rem; }
.aide-box li { margin: .2rem 0; }

/* Mode cuisine (RF-9) */
.cook-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.cook-stepbox { padding: 1.5rem; margin: 1rem 0; }
.cook-progress { color: var(--ink-soft); font-weight: 700; margin-bottom: .5rem; }
.cook-text { font-size: 1.5rem; line-height: 1.5; margin: 0 0 1rem; }
.cook-nav { display: flex; gap: .8rem; }
.cook-timers { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.timer-card { display: inline-flex; align-items: center; gap: .6rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: .4rem .5rem .4rem .9rem;
  font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.timer-card.done { background: var(--brand-soft); color: var(--brand); animation: blink 1s step-start infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* Impression (RF-7.4) */
@media print {
  .site-header, .site-footer, .toolbar, .theme-toggle, .serv-select, .filters,
  .messages, form, .cook-nav, .cook-timers, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; text-decoration: none; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .recipe-hero { grid-template-columns: 35% 1fr; }
  .recipe-cols { grid-template-columns: 38% 1fr; gap: 1.5rem; }
  .badge { border: 1px solid #999; }
}
