/* DOB Burger — digital menu.
   Phone/tablet: screen 1 = category cards; screen 2 = one category (back button + chips to switch).
   Desktop (≥1024px): fixed category rail on the right + card grid inspired by the printed menu. */
:root {
  --red: #F20A0A; --red-dark: #c40707; --orange: #FF8B00; --ink: #16181d; --muted: #5b6470;
  --card: #fff; --line: #f0e6e3; --bg: #faf7f5;
  --font: 'Cairo', 'Segoe UI', Tahoma, system-ui, sans-serif; --font-en: 'Alexandria', 'Cairo', sans-serif;
  --shadow: 0 10px 30px rgba(120, 40, 20, .08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body.menu-page { margin: 0; font-family: var(--font); color: var(--ink); line-height: 1.55; background: var(--bg); }
img { max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* corporate price list marker */
body.is-corporate .m-sub { color: var(--red); background: #fff3f0; border: 1px solid #ffd6cc; padding: 3px 14px; border-radius: 999px; }

/* ---------- header ---------- */
.m-head { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 22px 16px 10px; }
.m-logo img { width: 140px; }
.m-sub { color: var(--muted); font-weight: 800; font-size: 13px; letter-spacing: .5px; }

/* ---------- screen 1: category cards ---------- */
.m-catgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 8px 16px 40px; max-width: 640px; margin: 0 auto; }
.m-catcard { display: flex; flex-direction: column; align-items: center; text-align: center; background: var(--card); border-radius: 22px; padding: 14px 10px 14px; box-shadow: var(--shadow); border: 1px solid var(--line); position: relative; overflow: hidden; transition: transform .15s; }
.m-catcard:active { transform: scale(.97); }
.m-catcard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: linear-gradient(90deg, var(--red), var(--orange)); }
.m-catcard-img { width: 112px; height: 112px; display: flex; align-items: center; justify-content: center; margin: 6px 0 8px; }
.m-catcard-img img { width: 112px; height: 112px; object-fit: contain; filter: drop-shadow(0 8px 12px rgba(0,0,0,.15)); }
.m-catcard-en { font-family: var(--font-en); font-size: 17px; font-weight: 900; color: var(--red); letter-spacing: .3px; line-height: 1.1; }
.m-catcard-ar { font-size: 15px; font-weight: 800; }
.m-catcard-n { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.m-img-ph { opacity: .3; }

/* ---------- screen 2: category toolbar ---------- */
.m-cats { position: sticky; top: 0; z-index: 20; background: rgba(250,247,245,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.m-cats-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px 4px; }
.m-back { border: 0; background: var(--red); color: #fff; font-weight: 800; padding: 7px 14px; border-radius: 999px; cursor: pointer; box-shadow: 0 6px 14px rgba(242,10,10,.25); }
.m-cats-title { font-size: 18px; font-weight: 900; }
.m-cats-track { display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.m-cats-track::-webkit-scrollbar { display: none; }
.m-chip { flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); font-weight: 800; font-size: 13.5px; color: var(--ink); transition: .15s; }
.m-chip.on { background: var(--red); border-color: var(--red); color: #fff; }

/* view switching (phone/tablet): default = categories screen */
.m-cats, .m-cat { display: none; }
body.view-cat .m-catgrid { display: none; }
body.view-cat .m-cats { display: block; }
body.view-cat .m-cat.is-open { display: block; }
body.no-js .m-cat { display: block; }   /* fallback without JavaScript: everything visible */
body.no-js .m-cats { display: none; }

/* ---------- category section ---------- */
.m-main { max-width: 640px; margin: 0 auto; padding: 12px 16px 40px; }
.m-cat { scroll-margin-top: 110px; background: var(--card); border-radius: 22px; box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; border: 1px solid var(--line); }
.m-cat-head { padding: 12px 18px 6px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.m-cat-en { font-family: var(--font-en); font-size: 22px; font-weight: 900; color: var(--red); letter-spacing: .3px; }
.m-cat-ar { font-size: 15px; font-weight: 800; color: var(--muted); }
.m-cat-note { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.m-items { display: flex; flex-direction: column; }

/* item row (phone) */
.m-item { display: grid; grid-template-columns: 88px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); }
.m-item.has-sheet { cursor: pointer; }
.m-item:active { background: #fff7f5; }
.m-img img { width: 88px; height: 88px; object-fit: contain; display: block; filter: drop-shadow(0 6px 10px rgba(0,0,0,.12)); }
.m-name { margin: 0; font-size: 15.5px; font-weight: 900; line-height: 1.3; }
.m-name-en { display: block; font-family: var(--font-en); font-size: 11.5px; color: var(--red); font-weight: 700; }
.m-desc { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.m-off { display: inline-block; margin-top: 4px; font-size: 11px; color: #fff; background: #9ca3af; padding: 2px 8px; border-radius: 999px; }
.is-off .m-img img, .is-off .m-name, .is-off .m-desc { opacity: .45; }
.m-price { background: var(--red); color: #fff; border-radius: 12px; padding: 7px 10px; text-align: center; min-width: 68px; }
.m-price b { display: block; font-family: var(--font-en); font-size: 16px; font-weight: 900; line-height: 1.1; }
.m-price small { display: block; font-size: 9.5px; opacity: .9; margin-top: 2px; }
.m-table, .m-plist { display: none; }
.has-sheet .m-price::after { content: "▾ الأسعار"; display: block; font-size: 9px; opacity: .85; margin-top: 2px; }

/* compact rows for extras & sauces */
.layout-addons .m-item, .layout-sauces .m-item { grid-template-columns: 56px 1fr auto; padding: 9px 14px; }
.layout-addons .m-img img, .layout-sauces .m-img img { width: 56px; height: 56px; }

/* offers */
.layout-offers { border: 2px dashed var(--red); background: #fff6f5; }

/* footer: branches as tidy cards with call buttons */
.m-foot { padding: 28px 0 8px; }
.m-foot-brand { text-align: center; }
.m-foot-title { text-align: center; font-size: 20px; font-weight: 900; margin: 10px 0 12px; color: var(--ink); }
.m-pick { max-width: 420px; margin: 0 auto 12px; display: flex; flex-direction: column; gap: 6px; }
.m-pick-label { font-size: 13px; color: var(--muted); font-weight: 700; text-align: center; }
.m-pick-select { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-weight: 800; color: var(--ink); appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F20A0A' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 14px center; background-size: 18px; }
.m-pick-select:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.m-branches { list-style: none; padding: 0; margin: 0 auto; max-width: 420px; display: grid; gap: 10px; }
body:not(.no-js) .m-branch { display: none; }
body:not(.no-js) .m-branch.is-picked { display: flex; }
.m-branch { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); align-items: center; text-align: center; }
.m-branch-info { display: flex; flex-direction: column; }
.m-branch-name { font-weight: 900; font-size: 15px; }
.m-branch-city { color: var(--muted); font-size: 12.5px; }
.m-branch-phones { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.m-call { font-size: 16px; padding: 9px 16px; }
.m-call { display: inline-flex; align-items: center; gap: 6px; background: #fff3f0; color: var(--red); border: 1px solid #ffd6cc; border-radius: 999px; padding: 6px 12px; font-family: var(--font-en); font-weight: 800; font-size: 14px; }
.m-call:active { background: var(--red); color: #fff; }
.m-foot-note { color: var(--muted); font-size: 12px; text-align: center; margin: 16px 0 0; }
body.view-cat .m-foot { display: none; }

/* bottom sheet (phone/tablet) */
.m-sheet[hidden] { display: none; }
.m-sheet { position: fixed; inset: 0; z-index: 50; }
.m-sheet-back { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.m-sheet-card { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 26px 26px 0 0; padding: 18px 18px 28px; max-height: 88vh; overflow: auto; animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.m-sheet-x { position: absolute; top: 12px; left: 12px; border: 0; background: #f3f4f6; width: 34px; height: 34px; border-radius: 50%; font-size: 16px; cursor: pointer; }
.m-sheet-img img { display: block; width: 210px; height: 210px; object-fit: contain; margin: 0 auto 8px; filter: drop-shadow(0 10px 16px rgba(0,0,0,.18)); }
.m-sheet-card h2 { margin: 0; font-size: 22px; font-weight: 900; }
.m-sheet-en { font-family: var(--font-en); color: var(--red); font-weight: 700; font-size: 13px; }
.m-sheet-card p { color: var(--muted); font-size: 14px; }
.m-sheet-prices { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.m-sheet-prices li { display: flex; justify-content: space-between; align-items: center; background: #fff5f0; border: 1px solid #ffe0cc; border-radius: 12px; padding: 10px 14px; font-weight: 800; }
.m-sheet-prices b { font-family: var(--font-en); color: var(--red); font-size: 18px; }

/* tablet */
@media (min-width: 768px) {
  .m-catgrid { grid-template-columns: repeat(3, 1fr); max-width: 900px; }
  .m-main { max-width: 900px; }
  .m-items { display: grid; grid-template-columns: 1fr 1fr; }
  .m-item:nth-child(odd) { border-inline-end: 1px solid var(--line); }
}

/* ---------- desktop: rail + grid, printed-menu feel ---------- */
@media (min-width: 1024px) {
  html { scroll-padding-top: 24px; }
  body.menu-page { background: var(--bg) linear-gradient(115deg, #fff 0 40%, #f6efec 40% 60%, #fff 60%); }
  .m-catgrid { display: none !important; }
  .m-cats, .m-cat, .m-foot { display: block !important; }
  .m-cats-bar { display: none; }
  .m-head { flex-direction: row; justify-content: space-between; max-width: 1360px; margin: 0 auto; padding: 22px 32px 10px; }
  .m-logo img { width: 190px; }
  .m-sub { font-size: 15px; }
  .m-cats { position: fixed; top: 110px; right: 0; width: 220px; background: transparent; border: 0; backdrop-filter: none; z-index: 10; }
  .m-cats-track { flex-direction: column; overflow: visible; padding: 10px 24px; gap: 6px; }
  .m-chip { border-radius: 12px; padding: 10px 16px; font-size: 15px; background: rgba(255,255,255,.85); }
  .m-chip.on { transform: translateX(-6px); box-shadow: 0 8px 20px rgba(242,10,10,.3); }
  .m-main { max-width: 1360px; padding: 10px 270px 60px 32px; margin: 0 auto; }
  .m-cat { background: transparent; box-shadow: none; border-radius: 0; border: 0; overflow: visible; margin-bottom: 40px; }
  .m-cat-head { display: inline-flex; background: var(--red); color: #fff; padding: 10px 40px 10px 28px; clip-path: polygon(0 0, 100% 0, 96% 100%, 3% 100%); margin: 0 0 18px; box-shadow: 0 10px 24px rgba(242,10,10,.25); }
  .m-cat-en { font-size: 36px; color: #fff; }
  .m-cat-ar { color: #fff; opacity: .95; }
  .m-cat-note { flex-basis: auto; font-size: 13px; margin-inline-start: 12px; color: #fff; }
  .m-items { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
  .m-item { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 14px; gap: 8px; position: relative; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
  .m-item:nth-child(odd) { border-inline-end: 1px solid var(--line); }
  .m-item:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(120,40,20,.12); }
  .m-img img { width: 100%; height: 200px; object-fit: contain; }
  .m-name { font-size: 18px; }
  .m-desc { font-size: 13px; -webkit-line-clamp: unset; }
  .m-price { position: absolute; top: 12px; left: 12px; border-radius: 8px 0 8px 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 8% 100%); padding: 6px 12px 6px 16px; box-shadow: 0 6px 14px rgba(242,10,10,.3); }
  .m-price small, .has-sheet .m-price::after { display: none; }
  .m-table { display: table; width: 100%; border-collapse: collapse; font-size: 13px; margin-top: auto; }
  .m-table th { font-family: var(--font-en); color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; }
  .m-table td { text-align: center; font-family: var(--font-en); font-weight: 900; color: var(--red); padding: 4px 2px; border-top: 1px dashed var(--line); }
  .m-table tbody th { text-align: right; font-family: var(--font); font-size: 12px; }
  .m-plist { display: grid; list-style: none; padding: 0; margin: auto 0 0; gap: 4px; }
  .m-plist li { display: flex; justify-content: space-between; font-size: 13px; border-top: 1px dashed var(--line); padding-top: 4px; }
  .m-plist b { font-family: var(--font-en); color: var(--red); }
  .m-item.has-sheet { cursor: default; }
  .layout-addons .m-items, .layout-sauces .m-items { grid-template-columns: repeat(5, 1fr); }
  .layout-addons .m-item, .layout-sauces .m-item { padding: 10px; }
  .layout-addons .m-img img, .layout-sauces .m-img img { height: 110px; }
  .layout-offers { border: 3px dashed var(--red); border-radius: 26px; padding: 18px; background: rgba(255,255,255,.7); }
  .layout-offers .m-items { grid-template-columns: repeat(3, 1fr); }
  .layout-offers .m-item { background: var(--red); color: #fff; border: 0; }
  .layout-offers .m-desc { color: rgba(255,255,255,.9); }
  .layout-offers .m-price { background: #fff; color: var(--red); }
  .layout-offers .m-img { display: none; }
  .m-foot { padding-top: 40px; }
  .m-pick { max-width: 480px; }
  .m-branches { max-width: 480px; }
}
@media (min-width: 1440px) {
  .m-items { grid-template-columns: repeat(5, 1fr) !important; }
  .layout-offers .m-items { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .m-sheet-card { animation: none; } }
