:root {
  --bg-page: #F7F3EC;
  --bg-card: #FFFFFF;
  --text-primary: #1B1812;
  --text-secondary: #6B5E45;
  --accent-gold: #BAA47B;
  --accent-gold-soft: rgba(186, 164, 123, 0.18);
  --accent-bronze-soft: rgba(107, 94, 69, 0.08);
  --border-divider: rgba(107, 94, 69, 0.15);
  --border-card: rgba(107, 94, 69, 0.12);
  --overlay-scrim: rgba(27, 24, 18, 0.35);
  --shadow-soft: 0 8px 24px rgba(27, 24, 18, 0.06);
  --shadow-fab: 0 10px 28px rgba(27, 24, 18, 0.14);
  --shadow-sheet: 0 -8px 20px rgba(27, 24, 18, 0.06);
  --radius-card: 12px;
  --radius-pill: 999px;
  --nav-h: 60px;
  --content-max: 1280px;
  --space-page-x: 0.625rem;
  --space-section-y: 1.25rem;
  --ctrl-min-h: 40px;
  --serif-ar: "Amiri", serif;
  --serif-en: "Cormorant Garamond", serif;
  --sans-ar: "Cairo", sans-serif;
  --sans-en: "Inter", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--sans-en);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

html[lang="ar"] body {
  font-family: var(--sans-ar);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.page-shell {
  min-height: 100vh;
  background: var(--bg-page);
  padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-divider);
}

.site-header-inner,
.menu-section-inner {
  width: min(var(--content-max), calc(100% - var(--space-page-x) * 2));
  margin: 0 auto;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.625rem;
  min-height: var(--nav-h);
  padding: 0.375rem 0;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
}

.brand-logo {
  height: 40px;
  width: auto;
  max-width: min(120px, 38vw);
  object-fit: contain;
  object-position: start center;
}

html[dir="rtl"] .brand-logo {
  object-position: end center;
}

.lang-toggle,
.cart-fab,
.tier-pill,
.add-btn,
.qty-btn,
.remove-line,
.checkout-btn,
.close-cart,
.category-link {
  border: 0;
  cursor: pointer;
  font: inherit;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.lang-toggle {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 1rem;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-divider);
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
}

.lang-toggle:hover,
.lang-toggle:focus-visible {
  color: var(--text-primary);
  border-color: var(--accent-gold);
  background: var(--accent-gold-soft);
}

.category-nav {
  position: sticky;
  top: var(--nav-h);
  z-index: 20;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.625rem max(var(--space-page-x), calc((100% - var(--content-max)) / 2 + var(--space-page-x)));
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-divider);
}

.category-nav::-webkit-scrollbar {
  display: none;
}

.category-link {
  flex: 0 0 auto;
  min-height: var(--ctrl-min-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.875rem;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  border: 1px solid var(--border-divider);
  background: var(--accent-bronze-soft);
  white-space: nowrap;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
}

.category-link.active,
.category-link:hover {
  color: var(--text-primary);
  border-color: var(--accent-gold);
  background: var(--accent-gold-soft);
}

.menu-section {
  padding: var(--space-section-y) 0;
  scroll-margin-top: calc(var(--nav-h) + 52px);
}

.menu-section + .menu-section {
  padding-top: 0.5rem;
}

.section-title {
  margin: 0 0 0.75rem;
  padding-bottom: 0.375rem;
  border-bottom: 2px solid var(--accent-gold);
  display: inline-block;
  font-family: var(--serif-en);
  font-size: clamp(1.3125rem, 4.5vw, 1.75rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--text-primary);
  max-width: 100%;
  overflow-wrap: anywhere;
}

html[lang="ar"] .section-title,
html[lang="ar"] .item-name,
html[lang="ar"] .item-price-single,
html[lang="ar"] .cart-title {
  font-family: var(--serif-ar);
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem;
}

.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  box-shadow: none;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.item-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-gold);
  box-shadow: var(--shadow-soft);
}

.item-image-wrap {
  aspect-ratio: 16 / 10;
  background: var(--accent-bronze-soft);
  overflow: hidden;
}

.item-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.item-card:hover .item-image-wrap img {
  transform: scale(1.02);
}

.item-image-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 0.5rem;
  text-align: center;
}

.item-body {
  padding: 0.625rem;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.item-name {
  margin: 0 0 0.25rem;
  font-family: var(--serif-en);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.item-desc {
  margin: 0 0 0.375rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.45;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  min-height: calc(0.75rem * 1.45 * 2);
}

.item-price-single {
  margin: 0 0 0.375rem;
  font-family: var(--serif-en);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--accent-gold);
}

.tier-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.3125rem;
  width: 100%;
  margin: 0 0 0.375rem;
}

.tier-pill {
  box-sizing: border-box;
  flex: 1 1 calc(50% - 0.15625rem);
  max-width: calc(50% - 0.15625rem);
  min-width: 0;
  min-height: 36px;
  padding: 0.3125rem 0.375rem;
  border-radius: var(--radius-pill);
  background: var(--accent-bronze-soft);
  color: var(--text-secondary);
  border: 1px solid var(--border-divider);
  font-size: 0.625rem;
  font-weight: 500;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.tier-pill:hover,
.tier-pill:focus-visible {
  border-color: var(--accent-gold);
  color: var(--text-primary);
}

.tier-pill.active {
  background: var(--accent-gold);
  color: var(--text-primary);
  border-color: var(--accent-gold);
  font-weight: 600;
}

.card-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-top: 0.125rem;
}

.add-btn {
  min-height: var(--ctrl-min-h);
  min-width: var(--ctrl-min-h);
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--accent-gold);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.add-btn:hover,
.add-btn:focus-visible {
  filter: brightness(0.96);
  transform: translateY(-1px);
}

.add-btn:active {
  transform: translateY(0);
}

.cart-fab {
  position: fixed;
  z-index: 40;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  inset-inline-end: calc(1rem + env(safe-area-inset-right, 0px));
  width: 56px;
  height: 56px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: var(--accent-gold);
  color: var(--text-primary);
  box-shadow: var(--shadow-fab);
  display: none;
  align-items: center;
  justify-content: center;
}

.cart-fab.visible {
  display: inline-flex;
}

.cart-fab:hover,
.cart-fab:focus-visible {
  transform: translateY(-2px);
}

.cart-badge {
  position: absolute;
  top: -2px;
  inset-inline-end: -2px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--text-primary);
  color: var(--bg-card);
  border: 2px solid var(--accent-gold);
  font-size: 0.75rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.cart-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-scrim);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 45;
}

.cart-overlay.animating {
  transition: opacity 0.25s ease;
}

.cart-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.cart-panel {
  position: fixed;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  visibility: hidden;
  pointer-events: none;
}

.cart-panel.animating {
  transition: transform 0.28s ease;
}

.cart-panel.open {
  visibility: visible;
  pointer-events: auto;
}

.cart-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-divider);
  flex: 0 0 auto;
}

.cart-footer {
  flex: 0 0 auto;
  padding: 0.875rem 1rem calc(0.875rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-divider);
  background: var(--bg-card);
}

.cart-title {
  margin: 0;
  font-family: var(--serif-en);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

.close-cart {
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.75rem;
  line-height: 1;
  border-radius: 50%;
}

.close-cart:hover,
.close-cart:focus-visible {
  background: var(--accent-bronze-soft);
  color: var(--text-primary);
}

.cart-lines {
  flex: 1 1 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cart-empty {
  color: var(--text-secondary);
  text-align: center;
  padding: 2rem 0;
  font-size: 1rem;
}

.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--border-divider);
}

.line-name {
  margin: 0 0 0.15rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.line-tier,
.line-subtotal {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.line-subtotal {
  color: var(--accent-gold);
  font-weight: 600;
  margin-top: 0.25rem;
}

.line-controls {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 0.375rem;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.qty-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-bronze-soft);
  color: var(--text-primary);
  border: 1px solid var(--border-divider);
  font-size: 1.125rem;
  line-height: 1;
}

.qty-btn:hover,
.qty-btn:focus-visible {
  border-color: var(--accent-gold);
  background: var(--accent-gold-soft);
}

.remove-line {
  min-height: 44px;
  padding: 0 0.5rem;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.875rem;
  font-size: 1rem;
  color: var(--text-primary);
}

.cart-total-row strong {
  color: var(--accent-gold);
  font-size: 1.125rem;
}

.checkout-btn {
  width: 100%;
  min-height: 48px;
  background: var(--accent-gold);
  color: var(--text-primary);
  border-radius: var(--radius-pill);
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.checkout-btn:hover:not(:disabled),
.checkout-btn:focus-visible:not(:disabled) {
  filter: brightness(0.96);
}

.checkout-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.empty-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 3rem 1rem;
  font-size: 1rem;
}

/* Mobile-first: bottom sheet cart (< 640px) */
.cart-panel {
  inset-inline: 0;
  bottom: 0;
  top: auto;
  width: 100%;
  max-height: min(88vh, calc(100dvh - env(safe-area-inset-top, 0px)));
  border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--border-divider);
  transform: translateY(110%);
}

.cart-panel.open {
  transform: translateY(0);
}

.cart-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  box-shadow: var(--shadow-sheet);
}

@media (min-width: 640px) {
  :root {
    --nav-h: 68px;
    --space-page-x: 1rem;
    --space-section-y: 1.375rem;
    --ctrl-min-h: 40px;
  }

  .page-shell {
    padding-bottom: 0;
  }

  .site-header-inner,
  .menu-section-inner {
    width: min(var(--content-max), calc(100% - var(--space-page-x) * 2));
  }

  .site-header-inner {
    gap: 0.75rem;
    padding: 0.5rem 0;
  }

  .brand-logo {
    height: 44px;
    max-width: min(140px, 42vw);
  }

  .category-nav {
    gap: 0.625rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .category-link {
    min-height: 44px;
    padding: 0 1rem;
    font-size: 0.875rem;
  }

  .menu-section {
    scroll-margin-top: calc(var(--nav-h) + 60px);
  }

  .section-title {
    margin-bottom: 0.875rem;
    font-size: clamp(1.375rem, 2.5vw, 1.625rem);
  }

  .items-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .item-body {
    padding: 0.625rem;
  }

  .item-name {
    font-size: 0.9375rem;
  }

  .item-desc {
    font-size: 0.75rem;
    min-height: calc(0.75rem * 1.45 * 2);
  }

  .item-price-single {
    font-size: 0.8125rem;
  }

  .tier-pill {
    min-height: 36px;
    padding: 0.3125rem 0.4375rem;
    font-size: 0.625rem;
  }

  .add-btn {
    font-size: 0.75rem;
    padding: 0.4375rem 0.625rem;
  }

  .cart-panel {
    inset: 0;
    inset-inline-start: auto;
    inset-inline-end: 0;
    top: 0;
    bottom: 0;
    width: min(420px, 100%);
    max-height: none;
    height: 100%;
    border-radius: 0;
    border-top: 0;
    border-inline-start: 1px solid var(--border-divider);
    transform: translateX(105%);
  }

  html[dir="rtl"] .cart-panel {
    inset-inline-start: 0;
    inset-inline-end: auto;
    transform: translateX(-105%);
  }

  .cart-panel.open {
    transform: translateX(0);
  }

  html[dir="rtl"] .cart-panel.open {
    transform: translateX(0);
  }

  .cart-footer {
    position: static;
    box-shadow: none;
  }
}

@media (min-width: 1024px) {
  :root {
    --nav-h: 72px;
    --space-page-x: 1.25rem;
    --space-section-y: 1.75rem;
    --ctrl-min-h: 44px;
  }

  .site-header-inner,
  .menu-section-inner {
    width: min(var(--content-max), calc(100% - var(--space-page-x) * 2));
  }

  .category-link {
    font-size: 0.9375rem;
  }

  .section-title {
    margin-bottom: 1rem;
    font-size: 1.75rem;
  }

  .items-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
  }

  .item-image-wrap {
    aspect-ratio: 5 / 4;
  }

  .item-body {
    padding: 0.875rem;
  }

  .item-name {
    font-size: 1.125rem;
    margin-bottom: 0.3125rem;
  }

  .item-desc {
    font-size: 0.8125rem;
    -webkit-line-clamp: 3;
    min-height: calc(0.8125rem * 1.45 * 3);
    margin-bottom: 0.5rem;
  }

  .item-price-single {
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
  }

  .item-image-placeholder {
    font-size: 0.875rem;
  }

  .tier-list {
    gap: 0.375rem;
    margin-bottom: 0.5rem;
  }

  .tier-pill {
    flex: 1 1 auto;
    max-width: none;
    min-height: 38px;
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
  }

  .card-footer {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    padding-top: 0.25rem;
  }

  .add-btn {
    width: auto;
    min-width: var(--ctrl-min-h);
    padding: 0.5625rem 1rem;
    font-size: 0.875rem;
  }

  .cart-title {
    font-size: 1.375rem;
  }

  .cart-header,
  .cart-lines,
  .cart-footer {
    padding-inline: 1.125rem;
  }
}

@media (max-width: 359px) {
  .brand-logo {
    height: 36px;
  }

  .site-header-inner {
    gap: 0.5rem;
  }

  .items-grid {
    gap: 0.5rem;
  }

  .item-body {
    padding: 0.5rem;
  }
}
