/* ACE Pizzeria: تراتوريا إيطالية دافية. أحمر طماطم، أخضر ريحان قليل، أصفر ACE للوغو، وبرتقالي للزر الأساسي.
   الخط العربي Readex Pro، والكلمات الإيطالية Playfair Display مايل. الزوايا 12px بكل مكان. */

@font-face {
  font-family: "ace-icons";
  src: url("../fonts/icons.woff") format("woff");
  font-display: block;
}

:root {
  --radius: 12px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
  --gutter: 16px;
  --bar-h: 132px;
  --nav-h: 64px;

  /* ثابتين بالوضعين: فوق الفيديو دايماً غامق */
  --media-ink: #f6eee3;
  --media-dim: rgba(246, 238, 227, 0.82);
  --yellow: #f3b63f;
  --yellow-ink: #2a1a04;
  --orange: #ff6b1a;
  --orange-ink: #1d0d03;
  --basil: #5f8f4e;
  --cream: #efe4d0;

  /* فاتح: ورق مطعم إيطالي */
  --bg: #f4ede2;
  --surface: #fbf6ee;
  --surface-2: #ebe1d1;
  --text: #22180f;
  --muted: #6a5848;
  --line: rgba(34, 24, 15, 0.1);
  --tomato: #b0361f;
  --accent-text: #8a5a00;
  --danger: #a3260f;
  --shadow: 80, 38, 12;
  --mark-a: #22180f;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12100d;
    --surface: #1d1814;
    --surface-2: #29211b;
    --text: #f2e9dc;
    --muted: #b8a996;
    --line: rgba(242, 233, 220, 0.09);
    --tomato: #e0573c;
    --accent-text: #f3b63f;
    --danger: #ff9479;
    --shadow: 6, 2, 0;
    --mark-a: #f2e9dc;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #12100d;
  --surface: #1d1814;
  --surface-2: #29211b;
  --text: #f2e9dc;
  --muted: #b8a996;
  --line: rgba(242, 233, 220, 0.09);
  --tomato: #e0573c;
  --accent-text: #f3b63f;
  --danger: #ff9479;
  --shadow: 6, 2, 0;
  --mark-a: #f2e9dc;
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  background: var(--bg);
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Readex Pro", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

h1, h2, h3, p, ul, dl, dd, fieldset, figure { margin: 0; }
ul { padding: 0; list-style: none; }
fieldset { border: 0; padding: 0; min-width: 0; }
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* الكلمات الإيطالية */
.it {
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  unicode-bidi: isolate;
  direction: ltr;
}

.muted { color: var(--muted); }

.ic {
  font-family: "ace-icons";
  font-style: normal;
  font-size: 1.25rem;
  line-height: 1;
}
.ic-sun::before { content: "\e472"; }
.ic-moon::before { content: "\e330"; }
.ic-minus::before { content: "\e32a"; }
.ic-x::before { content: "\e4f6"; }
.ic-check::before { content: "\e182"; }

.skip {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 60;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--yellow);
  color: var(--yellow-ink);
  text-decoration: none;
  transform: translateY(-160%);
}
.skip:focus { transform: none; }

/* ---------- أزرار ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1.0625rem;
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
  transition: transform 120ms var(--ease-out), background-color 160ms, opacity 160ms;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--orange);
  color: var(--orange-ink);
  box-shadow: 0 12px 26px -12px rgba(255, 107, 26, 0.65);
}
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-primary:disabled:active { transform: none; }

.btn-ghost {
  color: var(--media-ink);
  background: rgba(14, 10, 7, 0.35);
  box-shadow: inset 0 0 0 1px rgba(246, 238, 227, 0.4);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  color: inherit;
  transition: transform 120ms var(--ease-out), background-color 160ms;
}
.icon-btn:active { transform: scale(0.94); }

/* ---------- مقدمة اللوغو ---------- */

.intro { display: none; }

/* اللوغو فوق فيديو الفرن نفسه: طبقة غامقة شفافة بدل خلفية سودا */
.has-intro .intro {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at center, rgba(14, 10, 7, 0.45) 0%, rgba(14, 10, 7, 0.82) 70%),
    rgba(14, 10, 7, 0.25);
  color: var(--media-ink);
  animation: intro-out 620ms var(--ease-out) 1250ms forwards;
}
.has-intro .intro-in { animation: mark-out 620ms var(--ease-out) 1250ms forwards; }
.has-intro.intro-skip .intro { display: none; }

.intro-in { display: grid; justify-items: center; gap: 18px; }
.intro-mark { width: 120px; height: auto; overflow: visible; filter: drop-shadow(0 6px 24px rgba(0, 0, 0, 0.55)); }
.im-a, .im-ce { transform-box: fill-box; transform-origin: center; }
.im-a { fill: #f2e9dc; animation: half-in 720ms var(--ease-out) 120ms both; --from: -38%; }
.im-ce { fill: var(--yellow); animation: half-in 720ms var(--ease-out) 120ms both; --from: 38%; }
.intro-word {
  font-size: 1.5rem;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
  direction: ltr;
  animation: word-in 520ms var(--ease-out) 620ms both;
}
.intro-ace { font-weight: 700; letter-spacing: 0.08em; }

@keyframes half-in {
  from { transform: translateX(var(--from)); opacity: 0; }
}
@keyframes word-in {
  from { opacity: 0; transform: translateY(10px); filter: blur(4px); }
}
@keyframes intro-out {
  to { opacity: 0; visibility: hidden; }
}
@keyframes mark-out {
  to { opacity: 0; transform: scale(1.06); filter: blur(6px); }
}

/* ---------- الشريط العلوي ---------- */

.nav {
  --nav-fg: var(--media-ink);
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  padding-top: env(safe-area-inset-top, 0px);
  color: var(--nav-fg);
  transition: background-color 220ms var(--ease-out), box-shadow 220ms var(--ease-out), color 220ms;
}
.nav.is-solid {
  --nav-fg: var(--text);
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--line);
}

.nav-in {
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: 1240px;
  height: var(--nav-h);
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right, 0px)) 0 max(var(--gutter), env(safe-area-inset-left, 0px));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
  direction: ltr;
}
.brand-mark { width: 30px; height: 29px; --mark-ce: var(--yellow); }
.nav .brand-mark { --mark-a: var(--nav-fg); }
.brand-text { font-size: 1.0625rem; white-space: nowrap; }
.brand-ace { font-weight: 700; letter-spacing: 0.06em; }

.nav-links {
  display: none;
  gap: 4px;
  margin-inline-start: auto;
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 500;
}

.nav-actions { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; }

.burger { position: relative; width: 18px; height: 12px; }
.burger span {
  position: absolute;
  inset-inline: 0;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 220ms var(--ease-out), top 220ms var(--ease-out);
}
.burger span:first-child { top: 1px; }
.burger span:last-child { top: 9px; }
.nav-toggle[aria-expanded="true"] .burger span:first-child { top: 5px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .burger span:last-child { top: 5px; transform: rotate(-45deg); }

/* قائمة الموبايل */
@media (max-width: 767px) {
  .nav-links.is-open {
    display: grid;
    position: absolute;
    top: calc(100% - 4px);
    inset-inline: 12px;
    padding: 6px;
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--line), 0 20px 40px -18px rgba(var(--shadow), 0.6);
    animation: drop-in 180ms var(--ease-out);
  }
  .nav-links.is-open a { min-height: 48px; }
}
@keyframes drop-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- البداية ---------- */

.hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 100svh;
  overflow: hidden;
  background: #120d09;
  color: var(--media-ink);
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(14, 10, 7, 0.9) 0%, rgba(14, 10, 7, 0.5) 36%, rgba(14, 10, 7, 0.12) 64%, rgba(14, 10, 7, 0.5) 100%),
    linear-gradient(to left, rgba(14, 10, 7, 0.5), rgba(14, 10, 7, 0) 62%);
}

.hero-in {
  position: relative;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--gutter) calc(56px + env(safe-area-inset-bottom, 0px));
}

.hero-eyebrow { color: var(--yellow); font-size: 1.0625rem; text-align: right; }
.hero h1 {
  margin-top: 8px;
  font-size: clamp(2.5rem, 8.4vw, 4.75rem);
  font-weight: 700;
  line-height: 1.12;
}
.hero-sub {
  margin-top: 14px;
  max-width: 36ch;
  color: var(--media-dim);
  font-size: 1.0625rem;
  text-wrap: pretty;
}
.hero-ctas { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

/* بعد المقدمة: النص بيطلع بالترتيب */
.hero-in > * { animation: rise 640ms var(--ease-out) both; }
.hero-in > :nth-child(2) { animation-delay: 70ms; }
.hero-in > :nth-child(3) { animation-delay: 140ms; }
.hero-in > :nth-child(4) { animation-delay: 210ms; }
.has-intro .hero-in > * { animation-delay: 1500ms; }
.has-intro .hero-in > :nth-child(2) { animation-delay: 1570ms; }
.has-intro .hero-in > :nth-child(3) { animation-delay: 1640ms; }
.has-intro .hero-in > :nth-child(4) { animation-delay: 1710ms; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* ---------- الانفجار ---------- */

.burst { position: relative; background: #0e0b08; color: var(--media-ink); }
.burst-stage { position: relative; height: 100svh; overflow: hidden; }

.burst-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.burst-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(10, 7, 5, 0.85) 0%, rgba(10, 7, 5, 0.25) 38%, rgba(10, 7, 5, 0) 60%),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(10, 7, 5, 0.55) 100%);
}

.burst-caps {
  position: absolute;
  inset: auto 0 0 0;
  max-width: 1240px;
  margin: 0 auto;
  height: 40%;
}
.burst-cap {
  position: absolute;
  bottom: calc(44px + env(safe-area-inset-bottom, 0px));
  inset-inline-start: var(--gutter);
  max-width: 30ch;
  opacity: 0;
}
.burst-cap h2 { font-size: clamp(1.75rem, 5vw, 2.75rem); font-weight: 700; line-height: 1.2; }
.burst-cap p { margin-top: 8px; color: var(--media-dim); font-size: 1.0625rem; }

/* بدون GSAP أو مع حركة أقل: آخر لقطة ثابتة مع آخر جملة */
.burst.is-static .burst-cap[data-cap="2"] { opacity: 1; }

/* ---------- أقسام عامة ---------- */

.section { position: relative; padding-block: clamp(72px, 11vw, 128px); }
.wrap { max-width: 1240px; margin: 0 auto; padding-inline: var(--gutter); }

.sec-head h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
}
.sec-it {
  display: inline-block;
  margin-inline-start: 10px;
  font-size: 0.56em;
  color: var(--tomato);
}
.sec-sub { margin-top: 8px; max-width: 46ch; color: var(--muted); }

/* ---------- المنيو ---------- */

.tabs {
  display: flex;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin-top: 28px;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: none;
  min-height: 44px;
  padding: 0 18px;
  border-radius: calc(var(--radius) - 4px);
  color: var(--muted);
  font-weight: 500;
  transition: background-color 160ms var(--ease-out), color 160ms;
}
.tab[aria-selected="true"] {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--yellow) 45%, transparent);
}

.dishes {
  display: grid;
  gap: 4px 56px;
  margin-top: 28px;
}
.dish {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
}
.dish.no-photo { grid-template-columns: minmax(0, 1fr) auto; padding: 14px 0; }

.dish-photo {
  width: 92px;
  aspect-ratio: 1;
  filter: drop-shadow(0 10px 12px rgba(var(--shadow), 0.45));
}
.dish-photo img { width: 100%; height: 100%; object-fit: contain; }

.dish-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.dish-name { font-size: 1.125rem; font-weight: 600; }
.dish-it { color: var(--tomato); font-size: 0.98rem; }
.dish-desc { margin-top: 2px; color: var(--muted); font-size: 0.9375rem; text-wrap: pretty; }
.dish-price { font-size: 1.125rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.menu-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 28px;
  color: var(--muted);
}
.menu-more a { color: var(--accent-text); font-weight: 500; text-underline-offset: 4px; }
.menu-error { margin-top: 28px; color: var(--danger); }

/* ---------- المركّب ---------- */

.build { padding-bottom: calc(var(--bar-h) + 56px); overflow-x: clip; }

.builder {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.stage { display: grid; justify-items: center; }

/* على الموبايل البيتزا بتصغر حسب طول الشاشة عشان الصينية تضل مبيّنة فوق الشريط */
.pizza {
  position: relative;
  width: min(84vw, 360px, max(220px, 100svh - 470px));
  aspect-ratio: 1;
}

.pizza-scale {
  position: absolute;
  inset: 0;
  transform: scale(var(--scale, 0.92));
  transition: transform 260ms var(--ease-out);
}

.pizza-scale::before {
  content: "";
  position: absolute;
  inset: 3% 3% 1%;
  border-radius: 50%;
  box-shadow:
    0 28px 48px -14px rgba(var(--shadow), 0.55),
    0 8px 16px -6px rgba(var(--shadow), 0.35);
}

.pizza-scale::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--yellow);
  opacity: 0;
  transition: opacity 120ms var(--ease-out);
  pointer-events: none;
}
.pizza.is-target .pizza-scale::after { opacity: 0.85; }

.pizza-base {
  position: relative;
  width: 100%;
  height: 100%;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

.layer {
  position: absolute;
  inset: 0;
  filter: drop-shadow(0 1.5px 1.2px rgba(60, 14, 0, 0.42)) drop-shadow(0 4px 5px rgba(60, 14, 0, 0.16));
}
/* الجبنة المبشورة تحت باقي الإضافات وظلها أخف */
.layer-cheese { filter: drop-shadow(0 1px 0.8px rgba(60, 14, 0, 0.35)); }

.piece {
  position: absolute;
  translate: -50% -50%;
  touch-action: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.piece.is-held { z-index: 2; }

.sizes {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

.sizes-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  right: 4px;
  width: calc((100% - 8px) / 3);
  border-radius: calc(var(--radius) - 4px);
  background: var(--surface-2);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--yellow) 55%, transparent);
  transform: translateX(calc(var(--i, 1) * -100%));
  transition: transform 240ms var(--ease-out);
}

.size {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 6px 4px;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  text-align: center;
  -webkit-user-select: none;
  user-select: none;
}
.size input { position: absolute; opacity: 0; pointer-events: none; }
.size-name { font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
.size-meta { font-size: 0.8125rem; color: var(--muted); line-height: 1.3; }
.size input:checked ~ .size-name { color: var(--accent-text); }
.size:has(input:focus-visible) { outline: 2px solid var(--yellow); outline-offset: 2px; }

.tray {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.tile {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 2px;
  width: 100%;
  min-height: 86px;
  padding: 7px 4px;
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--tint, var(--surface)) 13%, var(--surface));
  box-shadow: 0 0 0 1px var(--line);
  touch-action: none;
  -webkit-touch-callout: none;
  transition: transform 120ms var(--ease-out), box-shadow 160ms var(--ease-out), opacity 160ms;
}
.tile:active { transform: scale(0.97); }
.tile.is-lifted { opacity: 0.55; }

.tile-img {
  width: 44px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 3px 3px rgba(var(--shadow), 0.35));
  pointer-events: none;
}
.tile-name { font-size: 0.875rem; font-weight: 500; line-height: 1.35; }
.tile-price { font-size: 0.8125rem; color: var(--muted); line-height: 1.3; font-variant-numeric: tabular-nums; }

.tile-count {
  position: absolute;
  top: -5px;
  left: -5px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--yellow);
  color: var(--yellow-ink);
  box-shadow: 0 0 0 3px var(--bg);
  font-variant-numeric: tabular-nums;
}
.tile-count[hidden] { display: none; }
.tile.is-max { box-shadow: 0 0 0 1px color-mix(in oklab, var(--yellow) 60%, transparent); }

.ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 14px 14px rgba(var(--shadow), 0.45));
}

/* قبل دخول GSAP. لو ما اشتغل لأي سبب، بيظهر لحاله */
.js-enter .builder { visibility: hidden; animation: reveal 0s 2.5s forwards; }
@keyframes reveal { to { visibility: visible; opacity: 1; } }

/* ---------- زورونا ---------- */

.visit-grid { display: grid; gap: 32px; }
.visit-photo img {
  width: 100%;
  aspect-ratio: 5 / 4;
  object-fit: cover;
  object-position: center 60%;
  border-radius: var(--radius);
}
.facts { display: grid; gap: 18px; margin-top: 22px; }
.facts dt { font-size: 0.875rem; color: var(--muted); }
.facts dd { margin-top: 2px; font-size: 1.0625rem; }
.visit-note { margin-top: 22px; color: var(--muted); max-width: 44ch; }

/* ---------- الفوتر ---------- */

.foot { position: relative; }
.tricolore { display: flex; height: 3px; }
.tricolore span { flex: 1; }
.tricolore span:nth-child(1) { background: var(--basil); }
.tricolore span:nth-child(2) { background: var(--cream); }
.tricolore span:nth-child(3) { background: var(--tomato); }

.foot-in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 36px calc(36px + env(safe-area-inset-bottom, 0px));
}
.foot-demo { color: var(--muted); font-size: 0.875rem; max-width: 60ch; }
.foot-demo a { color: var(--accent-text); text-underline-offset: 4px; }

/* ---------- شريط الطلب ---------- */

.bar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -1px 0 var(--line), 0 -18px 40px -18px rgba(var(--shadow), 0.5);
  transform: translateY(calc(100% + 24px));
  transition: transform 320ms var(--ease-sheet);
}
.bar.is-shown { transform: none; }
.bar:not(.is-shown) .bar-msg { visibility: hidden; }

.bar-in { max-width: 1240px; margin: 0 auto; padding: 8px var(--gutter) 10px; }

.lines {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  touch-action: pan-x;
  -webkit-mask-image: linear-gradient(to left, transparent 0, #000 28px);
  mask-image: linear-gradient(to left, transparent 0, #000 28px);
  margin: 0 calc(var(--gutter) * -1);
  padding: 2px var(--gutter) 8px;
}
.lines::-webkit-scrollbar { display: none; }

.line {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 48px;
  padding-inline: 12px 2px;
  border-radius: var(--radius);
  background: var(--surface-2);
  scroll-snap-align: start;
  transition: background-color 240ms var(--ease-out);
}
.line.is-base { padding-inline: 12px; }
.line.is-new { background: color-mix(in oklab, var(--yellow) 30%, var(--surface-2)); transition-duration: 0ms; }
.line-text { display: grid; line-height: 1.25; white-space: nowrap; }
.line-name { font-size: 0.9375rem; font-weight: 500; }
.line-unit { font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.line-remove {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  color: var(--muted);
}
.line-remove .ic { font-size: 1.1rem; }
.line-remove:active { transform: scale(0.92); }

.line.is-empty {
  min-height: 48px;
  padding-inline: 4px 0;
  background: none;
  color: var(--muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

.bar-row { display: flex; align-items: center; gap: 14px; }
.total { display: grid; line-height: 1.2; min-width: 82px; }
.total-label { font-size: 0.8125rem; color: var(--muted); }
.total-value { font-size: 1.625rem; font-weight: 700; font-variant-numeric: tabular-nums; transition: opacity 140ms; }
.total-value.is-pending { opacity: 0.5; }
.bar .cta { flex: 1; }
.bar-msg { margin-top: 8px; font-size: 0.875rem; color: var(--danger); }

/* ---------- ورقة التأكيد ---------- */

.sheet {
  width: 100%;
  max-width: 520px;
  max-height: calc(100dvh - 24px);
  margin: auto auto 0;
  padding: 18px var(--gutter) calc(18px + env(safe-area-inset-bottom, 0px));
  border: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 -20px 60px -20px rgba(var(--shadow), 0.6);
  overscroll-behavior: contain;
}
.sheet::backdrop { background: rgba(12, 6, 3, 0.55); }
.sheet[open] { animation: sheet-in 280ms var(--ease-sheet); }
.sheet.is-closing { animation: sheet-out 180ms var(--ease-out) forwards; }
.sheet[open]::backdrop { animation: fade-in 220ms var(--ease-out); }
@keyframes sheet-in { from { transform: translateY(32px); opacity: 0; } }
@keyframes sheet-out { to { transform: translateY(16px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }

.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.sheet h2 { font-size: 1.25rem; font-weight: 600; }
.sheet h2:focus { outline: none; }

.summary { display: grid; gap: 2px; }
.summary li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 0.9375rem; }
.summary li + li { border-top: 1px solid var(--line); }
.summary .sum-sub { display: block; font-size: 0.8125rem; color: var(--muted); }
.summary .sum-price { font-variant-numeric: tabular-nums; white-space: nowrap; }

.summary-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 8px 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.summary-total strong { font-size: 1.375rem; font-variant-numeric: tabular-nums; }

.order-form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 0.9375rem; font-weight: 500; }
.field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font-size: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}
.field input:focus-visible { outline: 2px solid var(--yellow); outline-offset: 0; border-color: transparent; }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field-help { font-size: 0.8125rem; color: var(--muted); }
.field-err, .form-err { font-size: 0.875rem; color: var(--danger); }

.sheet-actions { display: grid; gap: 8px; margin-top: 4px; }
.ghost-btn { min-height: 48px; border-radius: var(--radius); color: var(--text); font-weight: 500; }
.ghost-btn:active { transform: scale(0.98); }

#doneView { text-align: center; padding: 10px 0 4px; display: grid; justify-items: center; gap: 10px; }
#doneView[hidden] { display: none; }
#doneView .cta { width: 100%; margin-top: 8px; }
.done-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  background: var(--yellow);
  color: var(--yellow-ink);
}
.done-mark .ic { font-size: 2rem; }
.done-text { color: var(--muted); max-width: 32ch; }
.done-text strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- ماوس فقط ---------- */

@media (hover: hover) and (pointer: fine) {
  .nav-links a:hover { background: color-mix(in oklab, var(--nav-fg) 10%, transparent); }
  .icon-btn:hover { background: color-mix(in oklab, currentColor 10%, transparent); }
  .btn-primary:not(:disabled):hover { filter: brightness(1.06); }
  .btn-ghost:hover { background: rgba(14, 10, 7, 0.55); }
  .tab:not([aria-selected="true"]):hover { color: var(--text); }
  .tile { cursor: grab; }
  .tile:hover { box-shadow: 0 0 0 1px color-mix(in oklab, var(--yellow) 45%, transparent), 0 10px 20px -12px rgba(var(--shadow), 0.5); }
  .piece { cursor: grab; }
  .line-remove:hover { color: var(--text); background: color-mix(in oklab, var(--text) 8%, transparent); }
  .ghost-btn:hover { background: var(--surface-2); }
}

/* ---------- تابلت ---------- */

@media (min-width: 768px) {
  :root { --gutter: 28px; }
  .nav-toggle { display: none; }
  .nav-links { display: flex; }
  .nav-actions { margin-inline-start: 0; }
  .pizza { width: min(440px, max(280px, 100svh - 480px)); }
  .tray { gap: 10px; }
  .tile { min-height: 112px; padding-top: 12px; }
  .tile-img { width: 62px; height: 56px; }
  .size { min-height: 56px; }
  .dish-photo { width: 112px; }
  .burst-cap { bottom: 72px; }
}

/* ---------- ديسكتوب ---------- */

@media (min-width: 1024px) {
  .hero-in { padding-bottom: 88px; }
  .dishes { grid-template-columns: 1fr 1fr; }
  .builder {
    grid-template-columns: minmax(360px, 0.8fr) minmax(0, 1.2fr);
    grid-template-areas: "panel stage";
    align-items: center;
    gap: 48px;
  }
  .panel { grid-area: panel; }
  .stage { grid-area: stage; }
  .pizza { width: min(520px, 40vw, max(320px, 100svh - 300px)); }
  .visit-grid { grid-template-columns: 1fr 1fr; align-items: center; gap: 64px; }
  .visit-photo img { aspect-ratio: 4 / 5; }

  .bar {
    inset: auto 0 16px 0;
    margin: 0 auto;
    max-width: calc(1240px - 56px);
    width: calc(100% - 56px);
    border-radius: var(--radius);
    box-shadow: 0 0 0 1px var(--line), 0 24px 50px -20px rgba(var(--shadow), 0.6);
  }
  .bar-in { display: flex; align-items: center; gap: 20px; padding: 12px 14px 12px 12px; }
  .lines { flex: 1; margin: 0; padding: 0; }
  .bar-row { flex: none; }
  .bar .cta { flex: none; min-width: 180px; }
  .bar-msg { position: absolute; bottom: calc(100% + 8px); right: 16px; margin: 0; padding: 6px 10px; border-radius: var(--radius); background: var(--surface); }

  .sheet { margin: auto; border-radius: var(--radius); }
}

/* ---------- حركة أقل ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-in > * { animation: none; }
  .pizza-scale, .sizes-thumb, .tile, .line, .icon-btn, .btn, .bar, .tab, .nav { transition-duration: 0ms; }
  .sheet[open], .sheet[open]::backdrop { animation: fade-in 120ms linear; }
  .sheet.is-closing { animation: none; }
}
