/* Maison Sésame · Expérience Commande Client « Warm Parisian Modernism »
   Inspiré par l'art de vivre des bistrots contemporains parisiens.
   Lin naturel, terre cuite, encre nuit, touches de laiton et de sauge. */

@import url('tokens.css');

:root {
  --ink: #1c1c19;
  --bissap: #a1361f;
  --bissap-deep: #86230c;
  --sesame: #f6f3ee;
  --brume: #fcf9f4;
  --baobab: #386641;
  --line: #ebe8e3;
  --muted: #57423d;
  --safe: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--font);
  font-size: 14px;
  line-height: 20px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.lock { overflow: hidden; }

button { font: inherit; color: inherit; cursor: pointer; -webkit-appearance: none; appearance: none; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }

/* En-tête Supérieur */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px 10px;
  background: rgba(252, 249, 244, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(235, 232, 227, 0.7);
}

.brand {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  font-family: var(--font-display); font-size: 20px; font-weight: 600; font-style: italic;
  letter-spacing: -0.01em; color: var(--on-surface);
}
.brand .brand-mark {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  overflow: hidden; background: var(--primary-container); color: var(--on-primary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 16px; font-weight: 700; font-style: normal;
  box-shadow: var(--shadow-sm);
}
.brand .brand-mark[hidden] { display: none; }
.brand > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.brand-slogan {
  font-family: var(--font); font-size: 11px; font-weight: 500; font-style: normal;
  color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: -1px;
}
.brand-slogan[hidden] { display: none; }

.top-badges { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--surface-container-low); color: var(--on-surface-variant);
  font-size: 11px; font-weight: 600;
}
.status-badge .dot {
  width: 6px; height: 6px; border-radius: 50%; background: #386641;
}

.table-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--radius-pill);
  background: var(--surface-container-high); color: var(--on-surface);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  box-shadow: var(--shadow-sm);
}
.table-chip::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary); animation: pulseDot 2s infinite;
}
@keyframes pulseDot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.85); } }

/* Carte du Restaurant */
main {
  padding: 8px 16px calc(160px + var(--safe));
  max-width: 800px; margin: 0 auto;
}

.cat { scroll-margin-top: 68px; margin-bottom: 24px; }
.cat h2 {
  margin: 18px 4px 12px;
  font-family: var(--font-display); font-size: 22px; font-weight: 600;
  letter-spacing: -0.01em; color: var(--on-surface);
}
.grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px;
}

/* Vignette Plat (Dish Card) */
.tile {
  position: relative; user-select: none; -webkit-user-select: none;
  background: var(--surface-container-lowest);
  border-radius: var(--radius-lg); padding: 10px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--surface-container-high);
  display: flex; flex-direction: column; justify-content: space-between;
  transition: transform .14s var(--ease), box-shadow .14s var(--ease);
}
.tile:active { transform: scale(0.98); }
.tile:not([data-qty="0"]) {
  border-color: var(--primary-fixed-dim);
  box-shadow: 0 0 0 2px var(--primary), var(--shadow-sm);
}

.tile-media {
  position: relative; border-radius: var(--radius-md); overflow: hidden;
  background: var(--surface-container); aspect-ratio: 1; width: 100%;
}
.tile-hit {
  display: block; width: 100%; height: 100%; padding: 0; border: 0;
  overflow: hidden; background: transparent; cursor: pointer;
}
.tile-hit img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transition: transform .25s var(--ease);
}
.tile:hover .tile-hit img { transform: scale(1.05); }

/* Badge d'accompagnement sur l'image */
.tile-badge {
  position: absolute; top: 6px; left: 6px;
  padding: 2px 7px; border-radius: var(--radius-pill);
  background: rgba(161, 54, 31, 0.9); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}

.tile-name {
  display: block; margin: 10px 2px 4px;
  font-size: 14px; font-weight: 600; line-height: 18px; color: var(--on-surface);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; padding: 0 2px;
}
.tile-price {
  font-size: 15px; font-weight: 700; color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.tile-add {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%; border: 0;
  background: var(--primary-container); color: var(--on-primary);
  font-size: 18px; font-weight: 700; line-height: 1;
  box-shadow: var(--shadow-sm); transition: transform .1s, background .15s;
}
.tile-add:active { transform: scale(0.9); background: var(--primary); }

/* Stepper tactile sur la vignette */
.stepper {
  position: absolute; left: 6px; right: 6px; bottom: 6px;
  display: none; grid-template-columns: 42px 1fr 42px; align-items: center;
  height: 42px; border-radius: var(--radius-pill);
  background: var(--on-surface); color: var(--surface);
  box-shadow: var(--shadow-md);
}
.tile:not([data-qty="0"]) .stepper { display: grid; }
.stepper button {
  height: 42px; border: 0; background: none; color: #fff;
  font-size: 22px; font-weight: 700; line-height: 1; border-radius: var(--radius-pill);
}
.stepper button:active { background: rgba(255, 255, 255, 0.2); }
.stepper output {
  text-align: center; font-size: 16px; font-weight: 700; color: #fff;
  font-variant-numeric: tabular-nums;
}

/* Zone du Pouce (Dock) */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; gap: 8px;
  padding: 10px 14px calc(10px + var(--safe));
  background: linear-gradient(to bottom, rgba(252,249,244,0) 0%, rgba(252,249,244,0.92) 20px, var(--surface) 100%);
  max-width: 680px; margin: 0 auto;
}

/* Rail de Catégories */
.rail {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 4px 2px;
}
.rail::-webkit-scrollbar { display: none; }
.rail button {
  flex: none; height: 38px; padding: 0 16px; border: 0; border-radius: var(--radius-pill);
  background: var(--surface-container-high); color: var(--on-surface);
  font-size: 13px; font-weight: 600; transition: all .15s var(--ease);
}
.rail button[aria-current="true"] {
  background: var(--on-surface); color: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* Bouton Panier Flottant */
.cart-bar {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  width: 100%; height: 56px; padding: 0 18px 0 12px; border: 0; border-radius: var(--radius-lg);
  background: var(--primary-container); color: var(--on-primary); text-align: left;
  font-size: 15px; font-weight: 600; box-shadow: var(--shadow-accent);
  transition: transform .12s var(--ease), background .15s;
  animation: rise .28s var(--ease);
}
.cart-bar:active { transform: scale(0.98); background: var(--primary); }
.cart-count {
  display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px;
  border-radius: var(--radius-pill); background: rgba(0, 0, 0, 0.2);
  color: var(--on-primary); font-size: 13px; font-weight: 700;
}
.cart-total {
  font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* Tiroir de Commande (Sheet) */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; }
.sheet-bg { position: absolute; inset: 0; background: rgba(28, 28, 25, 0.48); backdrop-filter: blur(4px); }
.sheet-panel {
  position: relative; display: flex; flex-direction: column;
  width: 100%; max-height: 90dvh;
  background: var(--surface); border-radius: 28px 28px 0 0;
  box-shadow: var(--shadow-lg); border-top: 1px solid var(--surface-container-high);
  animation: rise .3s var(--ease);
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 8px;
}
.sheet-head h2 {
  margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 600;
  color: var(--on-surface);
}
.round {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: var(--surface-container-high);
  color: var(--on-surface); transition: background .12s;
}
.round:active { background: var(--surface-container-highest); }
.sheet-body { overflow-y: auto; padding: 8px 20px 16px; overscroll-behavior: contain; }

/* Lignes du Panier */
.lines { margin: 0 0 16px; padding: 0; list-style: none; }
.lines li {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px;
  padding: 10px 0; border-bottom: 1px solid var(--surface-container-high);
}
.lines .l-name { font-size: 14px; font-weight: 600; line-height: 18px; color: var(--on-surface); }
.lines .l-sum { grid-column: 1; font-size: 14px; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.mini {
  grid-column: 2; grid-row: 1 / span 2;
  display: grid; grid-template-columns: 36px 28px 36px; align-items: center; justify-items: center;
  height: 38px; border-radius: var(--radius-pill); background: var(--surface-container-low);
  border: 1px solid var(--surface-container-high);
}
.mini button { width: 36px; height: 38px; border: 0; background: none; font-size: 20px; font-weight: 700; border-radius: 50%; color: var(--on-surface); }
.mini output { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; color: var(--on-surface); }

/* Choix Sur Place / À Emporter */
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.choice button {
  display: grid; justify-items: center; align-content: center; gap: 6px;
  min-height: 80px; border: 1.5px solid var(--surface-container-high); border-radius: var(--radius-lg);
  background: var(--surface-container-low); color: var(--on-surface);
  font-size: 14px; font-weight: 600; transition: all .15s var(--ease);
}
.choice button svg { color: var(--on-surface-variant); }
.choice button[aria-pressed="true"] {
  background: var(--surface-container-lowest); border-color: var(--primary);
  color: var(--primary); box-shadow: var(--shadow-sm);
}
.choice button[aria-pressed="true"] svg { color: var(--primary); }

.table-block { margin-top: 14px; }
.field-label { margin: 0 0 8px 2px; font-size: 13px; font-weight: 600; color: var(--on-surface-variant); }
.table-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.table-grid button {
  height: 48px; border: 1px solid var(--surface-container-high); border-radius: var(--radius-md);
  background: var(--surface-container-low); font-size: 16px; font-weight: 700;
  color: var(--on-surface); font-variant-numeric: tabular-nums; transition: all .12s;
}
.table-grid button[aria-pressed="true"] {
  background: var(--primary); border-color: var(--primary); color: var(--on-primary);
  box-shadow: var(--shadow-sm);
}
.link {
  margin-top: 10px; padding: 6px 2px; border: 0; background: none;
  font-weight: 600; font-size: 13px; color: var(--primary);
  text-decoration: underline; text-underline-offset: 3px;
}

/* Pied du Panier & Paiement */
.sheet-foot {
  display: grid; gap: 8px; padding: 12px 20px calc(16px + var(--safe));
  border-top: 1px solid var(--surface-container-high); background: var(--surface-container-lowest);
}
.hint { margin: 0; min-height: 1.25em; text-align: center; font-size: 12px; font-weight: 600; color: var(--error); }
.hint:empty { display: none; }

.pay {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; min-height: 52px; padding: 8px 16px; border-radius: var(--radius-lg);
  font-size: 15px; font-weight: 700; transition: all .15s var(--ease);
}
.pay small { font-size: 12px; font-weight: 500; opacity: 0.88; }
.pay-main {
  border: 0; background: var(--primary-container); color: var(--on-primary);
  box-shadow: var(--shadow-accent);
}
.pay-main:hover { background: var(--primary); }
.pay-main:active { transform: scale(0.98); }
.pay-alt {
  border: 1.5px solid var(--surface-container-highest); background: var(--surface-container-low);
  color: var(--on-surface);
}
.pay-alt:active { background: var(--surface-container-high); }
.pay:disabled { opacity: .4; box-shadow: none; cursor: not-allowed; }
.sheet-total { margin: 2px 0 0; text-align: center; font-size: 13px; font-weight: 600; color: var(--on-surface-variant); }

.notice {
  margin: 0; padding: 10px 14px; border-radius: var(--radius-md);
  background: var(--surface-container-lowest); color: var(--error); font-size: 13px; font-weight: 600;
  text-align: center; border: 1px solid var(--error-container);
}

/* Tiroir Variantes et Options (Chooser) */
.chooser { z-index: 45; }
.chooser-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chooser-id img {
  flex: 0 0 auto; width: 48px; height: 48px; border-radius: var(--radius-md);
  object-fit: cover; background: var(--surface-container);
}
.chooser-id h2 { font-size: 18px !important; font-family: var(--font-display); line-height: 1.2; }
.opt-group { margin: 0 0 16px; padding: 0; border: 0; min-width: 0; }
.opt-group legend {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  width: 100%; margin-bottom: 8px; padding: 0;
}
.opt-group legend span { font-size: 14px; font-weight: 700; color: var(--on-surface); }
.opt-group legend small {
  color: var(--on-surface-variant); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.opt-group[data-done="false"] legend small { color: var(--primary); }
.opt-list { display: grid; gap: 6px; }
.opt {
  display: flex; align-items: center; gap: 10px; min-height: 48px; width: 100%;
  padding: 0 14px; border: 1.5px solid var(--surface-container-high); border-radius: var(--radius-md);
  background: var(--surface-container-lowest); color: var(--on-surface); font: inherit;
  font-size: 13px; font-weight: 600; text-align: left; transition: all .12s;
}
.opt > span:first-child { flex: 1; min-width: 0; }
.opt-price {
  color: var(--primary); font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
button.opt[aria-pressed="true"], .opt-count[data-on="true"] {
  border-color: var(--primary); background: var(--primary-fixed); color: var(--on-primary-fixed);
}
.opt-count { padding-right: 4px; }
.opt-count .mini { grid-column: auto; grid-row: auto; height: 38px; }
.opt-count .mini button:disabled { opacity: .3; }
.opt-empty { margin: 0; color: var(--on-surface-variant); font-size: 13px; }
.lines .l-opts { display: block; margin-top: 3px; color: var(--on-surface-variant); font-size: 12px; }

/* Suivi de Commande en Temps Réel (Track) */
.track {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto;
  display: flex; flex-direction: column; justify-content: space-between; gap: 20px;
  padding: calc(28px + env(safe-area-inset-top, 0px)) 20px calc(20px + var(--safe));
  background: var(--surface); color: var(--on-surface);
  transition: background .3s ease;
}
.track-top {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: var(--surface-container-lowest); border-radius: var(--radius-xl);
  padding: 24px 18px; box-shadow: var(--shadow-md); border: 1px solid var(--surface-container-high);
}
.track-kicker {
  margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--primary);
}
.track-code {
  margin: 4px 0 12px; font-size: clamp(64px, 22vw, 96px); font-weight: 800;
  line-height: 1; letter-spacing: -0.04em; color: var(--on-surface);
  font-variant-numeric: tabular-nums;
}
.track-title {
  margin: 0 0 6px; font-family: var(--font-display); font-size: 24px; font-weight: 600;
  line-height: 1.15; color: var(--on-surface);
}
.track-sub {
  margin: 0; font-size: 14px; line-height: 20px; color: var(--on-surface-variant);
  max-width: 32ch;
}

/* Stepper Visuel de Suivi */
.steps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none;
}
.steps li {
  padding-top: 10px; border-top: 4px solid var(--surface-container-high);
  font-weight: 600; font-size: 12px; color: var(--on-surface-variant);
  transition: all .25s var(--ease); text-align: center;
}
.steps li.on {
  border-top-color: var(--primary); color: var(--primary); font-weight: 700;
}

.track-actions { display: grid; gap: 10px; }

@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Responsive Grand Écran */
@media (min-width: 700px) {
  .top { padding: 14px 28px; }
  main { max-width: 1080px; padding: 12px 28px calc(180px + var(--safe)); }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 18px 16px; }
  .sheet { justify-content: center; align-items: center; }
  .sheet-panel { max-width: 540px; border-radius: 28px; max-height: 85dvh; }
  .track { max-width: 580px; margin: 0 auto; }
}
@media (min-width: 1000px) {
  .grid { grid-template-columns: repeat(4, 1fr); gap: 20px 16px; }
}
