/* ==========================================================
   SMASH FACTORY — page de commande
   ========================================================== */

/* En-tête */
header { position: sticky; top: 0; z-index: 40; background: var(--ink); color: var(--paper); }
.h-in { max-width: 1320px; margin: 0 auto; padding: 0 16px; height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
header .logo-img { height: 48px; }
.h-mid { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; min-width: 0; }
.rbtn { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--ink3); background: var(--ink2); color: var(--paper); border-radius: 12px; padding: 9px 12px; cursor: pointer; font-weight: 700; font-size: 14px; white-space: nowrap; }
.rbtn:hover { border-color: var(--y); }
.rbtn small { color: var(--muted-d); font-weight: 500; }
.rbtn svg { width: 12px; }
.mode { display: flex; background: var(--ink2); border: 1.5px solid var(--ink3); border-radius: 12px; padding: 3px; }
.mode button { border: 0; background: none; padding: 8px 12px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted-d); font-size: 14px; white-space: nowrap; }
.mode button.on { background: var(--y); color: var(--ink); }
.back { font-size: 13px; color: var(--muted-d); white-space: nowrap; }
.back:hover { color: var(--y); }
@media (max-width: 860px) { .back, .rbtn small { display: none; } }
@media (max-width: 640px) {
  .h-in { height: auto; padding: 10px 12px; flex-wrap: wrap; }
  header .logo-img { height: 40px; }
  .h-mid { order: 3; width: 100%; justify-content: space-between; }
  .mode button { padding: 7px 9px; font-size: 13px; }
}


/* Mise en page */
.layout { max-width: 1320px; margin: 0 auto; padding: 26px 16px 120px; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
@media (max-width: 1020px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.top h1 { font-size: clamp(42px, 6vw, 72px); }
.top p { color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search { position: relative; flex: 1; max-width: 340px; min-width: 220px; }
.search input { width: 100%; padding: 13px 14px 13px 42px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; outline: none; }
.search input:focus { box-shadow: 4px 4px 0 var(--ink); }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; }
.closed-note { display: none; background: #fff; border: 2px solid var(--ink); border-left: 10px solid var(--y); border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; font-size: 14.5px; }
.closed-note.on { display: block; }

.cats { position: sticky; top: 74px; z-index: 30; background: var(--paper); padding: 12px 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; border-bottom: 2px solid var(--ink); margin-bottom: 10px; }
@media (max-width: 640px) { .cats { top: 104px; } }
.cats::-webkit-scrollbar { display: none; }
.cats button { flex: none; border: 1.5px solid var(--ink); background: #fff; border-radius: 9px; padding: 9px 14px; font-weight: 700; cursor: pointer; font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.cats button.on { background: var(--ink); color: var(--y); }
.group { padding-top: 26px; }
.group h2 { font-size: 38px; margin-bottom: 4px; display: flex; align-items: baseline; gap: 12px; }
.group h2 small { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .08em; font-weight: 500; }
.group > p { color: var(--muted); margin-bottom: 14px; font-size: 15px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) 136px; border: 2px solid var(--ink); border-radius: var(--r); background: #fff; overflow: hidden; cursor: pointer; text-align: left; transition: transform .15s, box-shadow .15s; min-height: 150px; padding: 0; }
.item:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.item-b { padding: 15px 14px; display: flex; flex-direction: column; min-width: 0; }
.item-b h3 { font-size: 22px; margin: 6px 0 5px; }
.item-b p { font-size: 13.5px; color: var(--muted); flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pr { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 800; font-size: 18px; flex-wrap: wrap; }
.pr small { font-weight: 500; font-size: 12px; color: var(--muted); }
.pill { font-size: 11px; font-weight: 800; background: var(--ink); color: var(--y); border-radius: 99px; padding: 2px 8px; }
.item .ph { border-left: 2px solid var(--ink); }
.plus { position: absolute; right: 8px; bottom: 8px; width: 34px; height: 34px; border-radius: 10px; background: var(--y); color: var(--ink); border: 2px solid var(--ink); display: grid; place-items: center; font-weight: 800; font-size: 20px; }
.qbadge { position: absolute; left: 8px; top: 8px; background: var(--ink); color: var(--y); font-family: var(--mono); font-weight: 700; font-size: 12px; border-radius: 7px; padding: 3px 7px; }
.empty-s { padding: 40px; text-align: center; color: var(--muted); display: none; }

/* Panier */
.cart { position: sticky; top: 94px; border: 2px solid var(--ink); border-radius: var(--r); background: #fff; box-shadow: 6px 6px 0 var(--ink); display: flex; flex-direction: column; max-height: calc(100vh - 114px); }
.cart-h { padding: 18px 18px 12px; border-bottom: 2px dashed var(--line); }
.cart-h > div { display: flex; justify-content: space-between; align-items: center; }
.cart-h h2 { font-size: 28px; }
.cart-h button { border: 0; background: none; font-size: 13px; color: var(--muted); text-decoration: underline; cursor: pointer; }
.cart-r { font-size: 13px; color: var(--muted); margin-top: 4px; }
.cart-close { display: none !important; }
.cart-list { overflow: auto; padding: 4px 18px; flex: 1; }
.ci { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.ci b { font-size: 16px; }
.ci .opts { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.ci .edit { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
.qty { display: flex; align-items: center; border: 1.5px solid var(--ink); border-radius: 9px; overflow: hidden; }
.qty button { width: 32px; height: 30px; border: 0; background: #fff; cursor: pointer; font-weight: 800; font-size: 16px; }
.qty button:hover { background: var(--y); }
.qty span { min-width: 26px; text-align: center; font-weight: 800; font-size: 14px; }
.ci .modify { font-size: 12.5px; border: 0; background: none; text-decoration: underline; cursor: pointer; color: var(--muted); }
.cart-empty { text-align: center; padding: 36px 10px; color: var(--muted); }
.cart-f { padding: 14px 18px 18px; border-top: 2px solid var(--ink); background: var(--paper); border-radius: 0 0 18px 18px; }
.row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 6px; }
.row.total { font-size: 22px; font-weight: 800; margin: 8px 0 14px; }
.warn { font-size: 12.5px; background: var(--y-soft); border: 1.5px solid var(--ink); border-radius: 8px; padding: 6px 10px; margin-bottom: 10px; }
.ups { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 10px; scrollbar-width: none; }
.ups button { flex: none; border: 1.5px dashed var(--ink); border-radius: 9px; background: #fff; padding: 6px 10px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.ups button:hover { background: var(--y); border-style: solid; }
@media (max-width: 1020px) {
  .cart { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 70; border-radius: 20px 20px 0 0; max-height: 88vh; box-shadow: 0 -10px 40px rgba(0, 0, 0, .25); transform: translateY(105%); transition: transform .3s; visibility: hidden; }
  .cart.open { transform: none; visibility: visible; }
  .cart-close { display: inline-block !important; }
  .cart-f { border-radius: 0; }
}
.mbar { display: none; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 60; }
@media (max-width: 1020px) { .mbar { display: flex; } }
.mbar .btn { width: 100%; justify-content: space-between; }
.mbar .count { background: var(--ink); color: var(--y); border-radius: 8px; padding: 2px 9px; font-size: 14px; }
.scrim { position: fixed; inset: 0; background: rgba(17, 17, 17, .6); z-index: 65; opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.on { opacity: 1; pointer-events: auto; }

/* Modales */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; pointer-events: none; }
.sheet { width: min(640px, 100%); max-height: 92vh; background: var(--paper); border: 2px solid var(--ink); border-radius: 22px; box-shadow: 8px 8px 0 var(--ink); display: flex; flex-direction: column; overflow: hidden; transform: translateY(20px) scale(.97); opacity: 0; transition: transform .25s, opacity .25s; }
.modal.on { pointer-events: auto; }
.modal.on .sheet { transform: none; opacity: 1; }
@media (max-width: 640px) { .modal { padding: 0; place-items: end center; } .sheet { border-radius: 22px 22px 0 0; max-height: 94vh; box-shadow: none; } }
.m-img { height: 240px; flex: none; border-bottom: 2px solid var(--ink); position: relative; }
.m-img .ph, .m-img .can { height: 100%; }
.x { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 11px; border: 2px solid var(--ink); background: #fff; font-size: 18px; cursor: pointer; display: grid; place-items: center; z-index: 2; }
.m-body { overflow: auto; padding: 20px 20px 10px; }
.m-body h2 { font-size: 36px; margin-top: 8px; }
.m-body > p { color: var(--muted); margin: 6px 0 4px; }
.tagc { font-family: var(--mono); font-size: 11px; font-weight: 700; background: var(--y); padding: 2px 6px; border-radius: 4px; text-transform: uppercase; }
.og { margin-top: 22px; }
.og-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; gap: 10px; }
.og-h h4 { font-size: 18px; }
.og-h span { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; }
.og-h span.req { color: #B3261E; font-weight: 700; }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 11px; background: #fff; margin-bottom: 8px; cursor: pointer; transition: border-color .15s; }
.opt:hover { border-color: var(--ink); }
.opt input { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; border: 2px solid var(--ink); border-radius: 6px; flex: none; display: grid; place-items: center; cursor: pointer; background: #fff; }
.opt input[type=radio] { border-radius: 50%; }
.opt input:checked { background: var(--ink); }
.opt input:checked::after { content: ""; width: 8px; height: 8px; background: var(--y); border-radius: 2px; }
.opt input[type=radio]:checked::after { border-radius: 50%; }
.opt.sel { border-color: var(--ink); background: var(--y-soft); }
.opt.dis { opacity: .45; pointer-events: none; }
.opt .l { flex: 1; font-weight: 600; }
.opt .l small { display: block; color: var(--muted); font-weight: 500; font-size: 12.5px; }
.opt .p { font-family: var(--mono); font-size: 13px; color: var(--muted); }
textarea.note { width: 100%; border: 1.5px solid var(--line); border-radius: 11px; padding: 12px; min-height: 70px; resize: vertical; background: #fff; outline: none; }
textarea.note:focus { border-color: var(--ink); }
.m-foot { padding: 14px 20px 18px; border-top: 2px solid var(--ink); display: flex; gap: 12px; align-items: center; background: #fff; flex: none; }
.m-foot .btn-y { flex: 1; justify-content: space-between; }

/* Choix du restaurant */
.pick { padding: 26px 20px 22px; overflow: auto; position: relative; }
.pick h2 { font-size: 40px; margin: 10px 0 6px; }
.pick > p { color: var(--muted); margin-bottom: 18px; }
.pick .logo-img { height: 58px; }

/* Validation */
.ck-body { overflow: auto; padding: 22px 20px; position: relative; }
.ck-body h2 { font-size: 38px; margin: 8px 0 4px; }
.stepper { display: flex; gap: 6px; margin: 14px 0 20px; }
.stepper div { flex: 1; height: 6px; border-radius: 9px; background: var(--paper2); border: 1px solid var(--line); }
.stepper div.on { background: var(--y); border-color: var(--ink); }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field label span { font-weight: 500; color: var(--muted); }
.field input { width: 100%; padding: 13px 14px; border: 2px solid var(--ink); border-radius: 11px; background: #fff; outline: none; }
.field input:focus { box-shadow: 3px 3px 0 var(--ink); }
.field .err { color: #B3261E; font-size: 12.5px; margin-top: 4px; display: none; }
.field.bad input { border-color: #B3261E; }
.field.bad .err { display: block; }
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-height: 280px; overflow: auto; padding: 2px; }
@media (max-width: 480px) { .slots { grid-template-columns: repeat(3, 1fr); } }
.slots button { padding: 11px 4px; border: 1.5px solid var(--ink); border-radius: 10px; background: #fff; font-family: var(--mono); font-weight: 700; font-size: 13px; cursor: pointer; }
.slots button.on { background: var(--ink); color: var(--y); }
.slots .asap { grid-column: 1 / -1; font-family: var(--font); font-size: 15px; }
.day-l { grid-column: 1 / -1; font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.recap { background: #fff; border: 1.5px solid var(--ink); border-radius: 12px; padding: 14px; margin-bottom: 16px; font-size: 14px; }
.recap .row { margin: 0 0 5px; }
.recap hr { border: 0; border-top: 1px dashed var(--line); margin: 8px 0; }

/* Confirmation */
.conf { text-align: center; padding: 30px 22px 24px; overflow: auto; }
.check { width: 84px; height: 84px; margin: 0 auto; border-radius: 50%; background: var(--y); border: 2px solid var(--ink); display: grid; place-items: center; animation: pop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.ticket { background: #fff; border: 2px solid var(--ink); border-radius: 16px; margin: 20px auto 18px; max-width: 390px; text-align: left; overflow: hidden; }
.ticket-h { background: var(--ink); color: var(--paper); padding: 16px; display: flex; justify-content: space-between; align-items: center; }
.ticket-h b { font-size: 26px; color: var(--y); font-family: var(--mono); }
.ticket-b { padding: 16px; font-size: 14px; }
.perf { border-top: 2px dashed var(--ink); margin: 12px -16px; }
.big-time { font-size: 44px; font-weight: 800; line-height: 1; margin: 4px 0; }
.progress { display: flex; max-width: 390px; margin: 0 auto 20px; font-size: 12px; }
.progress div { flex: 1; text-align: center; color: var(--muted); }
.progress i { display: block; width: 14px; height: 14px; border-radius: 50%; margin: 0 auto 6px; border: 2px solid var(--ink); background: #fff; transition: background .3s; }
.progress .on { color: var(--ink); font-weight: 700; }
.progress .on i { background: var(--y); }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: var(--ink); color: var(--y); padding: 12px 18px; border-radius: 12px; font-weight: 700; z-index: 95; opacity: 0; transition: all .25s; pointer-events: none; white-space: nowrap; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Produit indisponible */
.item.off { cursor: not-allowed; opacity: .55; filter: grayscale(.8); }
.item.off:hover { transform: none; box-shadow: none; }
.pill.off { background: #fff; color: var(--ink); border: 1.5px solid var(--ink); }

/* Bandeau photo de catégorie */
.g-banner { height: 170px; border: 2px solid var(--ink); border-radius: var(--r); margin-bottom: 16px; }
.g-banner img { object-position: center 45%; }
@media (max-width: 640px) { .g-banner { height: 120px; } }

/* Groupes d'options repliables (accompagnements, desserts, suppléments) */
.og-fold { border: 1.5px solid var(--ink); border-radius: 12px; background: #fff; padding: 0 14px; }
.og-fold > summary { list-style: none; cursor: pointer; padding: 14px 0; margin: 0; }
.og-fold > summary::-webkit-details-marker { display: none; }
.og-fold > summary h4::before { content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 6px; background: var(--y); border: 1.5px solid var(--ink); font-size: 14px; transition: transform .2s; }
.og-fold[open] > summary h4::before { transform: rotate(45deg); }
.og-fold h4 em { font-style: normal; color: var(--muted); font-weight: 600; }
.og-fold .opt:last-child { margin-bottom: 14px; }

/* ==========================================================
   Ajustements responsive
   ========================================================== */
.top p { display: block; }
.top p .dot { margin-right: 6px; vertical-align: middle; }
.cats { top: var(--hh, 74px); }
.cart { top: calc(var(--hh, 74px) + 20px); max-height: calc(100vh - var(--hh, 74px) - 40px); }
@media (max-width: 1180px) and (min-width: 1021px) {
  .layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; }
}
@media (max-width: 1020px) {
  .layout { padding-bottom: 110px; }
  .cart { top: auto; max-height: 88vh; padding-bottom: env(safe-area-inset-bottom); }
  .mbar { bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .h-mid { gap: 8px; }
  .rbtn { flex: none; }
  .mode { flex: 1; min-width: 0; justify-content: flex-end; }
  .mode button { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .search { max-width: none; min-width: 0; flex-basis: 100%; }
  .group h2 { font-size: 32px; flex-wrap: wrap; gap: 4px 10px; }
  .m-img { height: 200px; }
  .m-body h2 { font-size: 30px; }
  .m-foot { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); gap: 10px; }
  .m-foot .btn { padding: 13px 16px; }
  .pick h2, .ck-body h2 { font-size: 32px; }
  .conf h2 { font-size: 32px !important; }
  .big-time { font-size: 38px; }
  .toast { max-width: calc(100vw - 32px); white-space: normal; text-align: center; bottom: calc(90px + env(safe-area-inset-bottom)); }
}
@media (max-width: 360px) {
  .rbtn { padding: 8px 9px; gap: 6px; font-size: 13px; }
  .mode button { padding: 7px 7px; font-size: 12.5px; }
  .slots { grid-template-columns: repeat(3, 1fr); }
}

/* Articles : toujours 2 colonnes. Sur écran étroit, carte verticale (photo au-dessus) */
@media (max-width: 1180px) and (min-width: 1021px), (max-width: 760px) {
  .item { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 0; }
  .item .ph { order: -1; aspect-ratio: 16 / 11; border-left: 0; border-bottom: 2px solid var(--ink); }
  .item .can div { transform: scale(.85); }
  .item-b p { flex: none; }
  .item-b .pr { margin-top: auto; padding-top: 6px; }
}
@media (max-width: 760px) {
  .grid { gap: 10px; }
  .item { border-radius: 16px; }
  .item-b { padding: 10px 10px 12px; }
  .item-b h3 { font-size: 17px; margin: 5px 0 4px; line-height: 1; }
  .item-b p { font-size: 12px; line-height: 1.35; }
  .pr { font-size: 15px; gap: 4px 6px; margin-top: 6px; }
  .pr small { font-size: 11px; }
  .pill { font-size: 10px; padding: 1px 6px; }
  .plus { width: 30px; height: 30px; font-size: 18px; right: 6px; bottom: 6px; }
  .item:hover { transform: none; box-shadow: none; }
}
@media (max-width: 360px) {
  .item-b h3 { font-size: 16px; }
  .item-b p { -webkit-line-clamp: 2; font-size: 11.5px; }
}

/* Barre de catégories : tout visible sur desktop, défilement au doigt sur mobile */
@media (min-width: 1021px) {
  .cats { flex-wrap: wrap; overflow: visible; gap: 6px; }
  .cats button { padding: 8px 12px; }
}
@media (max-width: 1020px) {
  .cats { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
}
