:root {
  --bg: #f7f3ec;
  --surface: #fffdf9;
  --surface-2: #f0ebe2;
  --ink: #1f1b16;
  --muted: #6d655b;
  --line: #e3dbcf;
  --accent: #d9553b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe5de;
  --veg: #3f7a4a;
  --veg-soft: #e2efe2;
  --spicy: #b4321f;
  --spicy-soft: #f8e0da;
  --shadow: 0 1px 2px rgba(31, 27, 22, .06), 0 8px 24px rgba(31, 27, 22, .06);
  --radius: 14px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15130f;
    --surface: #1f1c17;
    --surface-2: #29251f;
    --ink: #f3ede4;
    --muted: #a99f92;
    --line: #36312a;
    --accent: #f0785c;
    --accent-ink: #1a0f0b;
    --accent-soft: #3a221b;
    --veg: #8fc79a;
    --veg-soft: #1f3123;
    --spicy: #f29a86;
    --spicy-soft: #3b201a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15130f;
  --surface: #1f1c17;
  --surface-2: #29251f;
  --ink: #f3ede4;
  --muted: #a99f92;
  --line: #36312a;
  --accent: #f0785c;
  --accent-ink: #1a0f0b;
  --accent-soft: #3a221b;
  --veg: #8fc79a;
  --veg-soft: #1f3123;
  --spicy: #f29a86;
  --spicy-soft: #3b201a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .4; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* En-tête */
.hero { padding-top: 40px; padding-bottom: 20px; }
.hero .eyebrow {
  margin: 0 0 6px;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(32px, 8vw, 46px);
  line-height: 1.05;
  letter-spacing: -.01em;
}
.hero p { margin: 10px 0 0; color: var(--muted); max-width: 46ch; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.name-card { padding: 16px; display: grid; gap: 6px; max-width: 480px; }
.name-card label { font-weight: 600; font-size: 14px; }
input[type="text"], input[type="password"], textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }

.banner {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  font-size: 14px;
}
.banner[hidden] { display: none; }

/* Navigation des catégories */
.cats {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-top: 20px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.cats .wrap {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-top: 10px;
  padding-bottom: 10px;
  scrollbar-width: none;
}
.cats .wrap::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 14px;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink);
}
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.toggle[aria-pressed="true"] { background: var(--veg-soft); border-color: var(--veg); color: var(--veg); }

/* Carte */
main.wrap { padding-bottom: calc(140px + env(safe-area-inset-bottom)); }
.section { margin-top: 28px; }
.section h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
}
.section .sub { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 860px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.item {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
}
.item .photo {
  aspect-ratio: 1;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.item .photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.item .info { flex: 1; padding: 10px 12px 4px; }
.item .name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.item .desc { color: var(--muted); font-size: 13px; line-height: 1.35; margin-top: 2px; }
.item .price { font-size: 14px; font-weight: 600; color: var(--accent); margin-top: 4px; font-variant-numeric: tabular-nums; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.tag.veg { background: var(--veg-soft); color: var(--veg); }
.tag.spicy { background: var(--spicy-soft); color: var(--spicy); }

.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 12px 12px;
}
.stepper button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.stepper button.plus { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.stepper .qty { flex: 1; text-align: center; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper.empty .minus, .stepper.empty .qty { display: none; }
.stepper.empty button.plus {
  width: 100%;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.hide-nonveg .item:not([data-veg]) { display: none; }
.hide-nonveg .section.no-veg { display: none; }

/* Barre du bas */
.bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .06);
}
.bar .wrap { display: flex; align-items: center; gap: 12px; }
.bar .count { flex: 1; font-size: 14px; color: var(--muted); }
.bar .count strong { display: block; color: var(--ink); font-size: 16px; }

.btn {
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--spicy); }

/* Feuille de sélection */
dialog {
  width: min(560px, 100vw);
  max-height: 90vh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  color: var(--ink);
}
@media (min-width: 600px) { dialog { margin: auto; border-radius: 20px; } }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.sheet { padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.sheet h3 { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.sheet ul { list-style: none; margin: 0; padding: 0; }
.sheet li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sheet li.total { font-weight: 700; border-bottom: 0; }
.sheet li .q { font-weight: 700; font-variant-numeric: tabular-nums; }
.sheet .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.sheet label { font-weight: 600; font-size: 14px; }
.error { color: var(--spicy); font-size: 14px; margin: 0; }
.error:empty { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  transition: .25s;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 20;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%); }

footer { color: var(--muted); font-size: 13px; padding: 24px 0 0; text-align: center; }
