/* ============================================================
   PureLeaf Menu — main.css  ·  Mnum brand
   RTL-first, light theme, mobile-first
   Brand: Primary #0F3D36 · Accent #F26D3D · Background #FAF9F6
          Text #1F2937 / #6B7280 · Borders #E5E7EB · Font Vazirmatn
   Weights: Bold 700 (headlines) · Medium 500 (UI) · Regular 400 (body)
   ============================================================ */

:root {
  --primary:     #0F3D36;
  --primary-2:   #1B5A4F;                 /* lighter green for gradients */
  --accent:      #F26D3D;                 /* decorative only: low contrast on white */
  --accent-tint: rgba(242, 109, 61, .14);

  --bg:       #FAF9F6;
  --surface:  #FFFFFF;
  --surface2: #EEF2F1;                    /* green-tinted neutral for image slots */
  --border:   #E5E7EB;
  --text:     #1F2937;
  --muted:    #6B7280;
  --danger:   #B3261E;

  --font: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;

  --radius:   16px;
  --max-w:    760px;
  --header-h: 56px;
  --tabs-h:   58px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
body.has-tabs { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 16px); }
body.modal-open { overflow: hidden; }

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { width: 100%; max-width: var(--max-w); margin-inline: auto; padding-inline: 16px; }

/* ---------- Brand mark (inline SVG) ---------- */
.brand-mark { display: block; height: auto; color: #fff; }
.brand-mark .bm-arch { fill: currentColor; }
.brand-mark .bm-mark { fill: var(--accent); }

/* ---------- Loading / error ---------- */
.loading, .error-box {
  text-align: center; color: var(--muted); padding: 64px 16px; font-size: .95rem;
}
.loading::before {
  content: ''; display: block; width: 28px; height: 28px; margin: 0 auto 14px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
.error-box { color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }

.fade-in { animation: fadeIn .45s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Home ---------- */
.home-hero {
  background: var(--primary); color: #fff; text-align: center;
  padding: 40px 0 44px; margin-bottom: 24px;
  border-radius: 0 0 32px 32px;
}
.home-hero .brand-mark { width: 60px; margin: 0 auto 16px; }
.home-hero h1 { font-size: 1.7rem; font-weight: 700; line-height: 1.35; }
.home-hero p  { color: rgba(255, 255, 255, .78); margin-top: 6px; font-size: .95rem; }

.cat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding-bottom: 24px;
}
.cat-card {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 1 / 1; border-radius: var(--radius);
  background: linear-gradient(145deg, var(--primary-2), var(--primary));
  transition: transform .2s ease, box-shadow .2s ease;
  box-shadow: 0 2px 10px rgba(15, 61, 54, .12);
}
.cat-card:active { transform: scale(.98); }
.cat-card img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.cat-card::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(15, 61, 54, .92) 0%, rgba(15, 61, 54, .38) 46%, rgba(15, 61, 54, 0) 76%);
}
/* bookmark ribbon — echoes the logo's orange tab */
.cat-card::before {
  content: ''; position: absolute; z-index: 2; top: 0; inset-inline-end: 16px;
  width: 14px; height: 26px; background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}
.cat-card-info {
  position: absolute; inset-inline: 0; bottom: 0; z-index: 1;
  padding: 14px; color: #fff;
}
.cat-card-name  { font-weight: 700; font-size: 1.1rem; line-height: 1.35; }
.cat-card-count { font-size: .8rem; color: rgba(255, 255, 255, .85); margin-top: 2px; }

.btn-primary {
  display: block; width: fit-content; margin: 8px auto 40px;
  padding: 13px 30px; border-radius: 999px;
  background: var(--primary); color: #fff; font-weight: 500;
  box-shadow: 0 4px 14px rgba(15, 61, 54, .22);
  transition: background .2s ease;
}
.btn-primary:hover  { background: var(--primary-2); }
.btn-primary:active { opacity: .9; }

.updated {
  text-align: center; color: var(--muted); font-size: .8rem; padding-bottom: 32px;
}

/* ---------- Menu top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--header-h);
  background: rgba(250, 249, 246, .92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .wrap { height: 100%; display: flex; align-items: center; gap: 12px; }
.topbar-logo {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: grid; place-items: center; background: var(--primary);
}
.topbar-logo .brand-mark { width: 22px; }
.topbar-title { font-weight: 700; font-size: 1.05rem; color: var(--primary); }

/* ---------- Category section ---------- */
.menu-section { scroll-margin-top: calc(var(--header-h) + 8px); padding-top: 22px; }
.menu-section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.2rem; font-weight: 700; color: var(--primary); padding-bottom: 12px;
}
.menu-section-title::before {
  content: ''; width: 5px; height: 20px; border-radius: 3px; background: var(--accent); flex: none;
}
.menu-section-title::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ---------- Item row: image | name+desc | price ---------- */
.item {
  display: grid;
  grid-template-columns: 76px 1fr auto;   /* RTL: image on the right, price on the left */
  align-items: center; gap: 12px;
  width: 100%; text-align: start;
  padding: 10px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(15, 61, 54, .04);
  transition: border-color .2s ease, transform .15s ease;
}
.item:active { transform: scale(.992); border-color: rgba(15, 61, 54, .35); }

.item-img {
  width: 76px; height: 76px; border-radius: 12px; overflow: hidden;
  background: var(--surface2);
}
.item-img img { width: 100%; height: 100%; object-fit: cover; }

/* No photo / broken photo: on-brand placeholder using the Mnum mark */
.is-ph {
  background: var(--surface2) url(/assets/logo-placeholder.svg) center / 46% no-repeat;
}

.item-text { min-width: 0; }
.item-name { font-size: 1.02rem; font-weight: 700; line-height: 1.45; color: var(--text); }
.item-desc {
  font-size: .82rem; color: var(--muted); line-height: 1.6; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.item-price { text-align: end; white-space: nowrap; }
.price-line { font-weight: 700; color: var(--primary); font-size: 1rem; }
.price-line small { font-weight: 500; color: var(--muted); font-size: .72rem; margin-inline-start: 4px; }
.price-line + .price-line { margin-top: 2px; }
.price-line.is-off { color: var(--muted); text-decoration: line-through; opacity: .65; }
.price-currency { display: block; font-size: .7rem; color: var(--muted); font-weight: 400; }

/* Unavailable: faded */
.item.is-off { opacity: .5; }
.item.is-off .item-img img { filter: grayscale(1); }
.item.is-off .price-line { color: var(--muted); text-decoration: line-through; }
.badge-off {
  display: inline-block; margin-inline-start: 6px; padding: 0 8px;
  font-size: .68rem; font-weight: 500; border-radius: 999px;
  background: var(--border); color: #4B5563; vertical-align: middle;
}

/* ---------- Bottom tabs ---------- */
.tabs {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  background: rgba(255, 255, 255, .95);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs-scroll {
  display: flex; gap: 6px; align-items: center;
  height: var(--tabs-h); padding-inline: 12px;
  overflow-x: auto; scrollbar-width: none;
  max-width: var(--max-w); margin-inline: auto;
}
.tabs-scroll::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: 0 0 auto; padding: 8px 16px; border-radius: 999px;
  font-size: .9rem; font-weight: 500; color: var(--muted);
  transition: background .2s ease, color .2s ease;
}
.tab.active { background: var(--primary); color: #fff; }
.tab.active::after {                      /* small orange bookmark-style underline */
  content: ''; position: absolute; bottom: 3px; left: 50%; margin-left: -9px;
  width: 18px; height: 3px; border-radius: 2px; background: var(--accent);
}

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: flex-end; justify-content: center;
  background: rgba(15, 61, 54, .55);
}
.modal.open { display: flex; animation: fadeOnly .2s ease both; }
@keyframes fadeOnly { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  position: relative; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-radius: 24px 24px 0 0;
  animation: sheetUp .28s ease both;
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }

.modal-img { width: 100%; aspect-ratio: 4 / 3; background: var(--surface2); }
.modal-img img { width: 100%; height: 100%; object-fit: cover; }
/* must restate the image: .modal-img's shorthand above would otherwise reset it */
.modal-img.is-ph { background: var(--surface2) url(/assets/logo-placeholder.svg) center / 30% no-repeat; }
.modal-close {
  position: absolute; top: 12px; inset-inline-start: 12px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255, 255, 255, .95); color: var(--primary);
  box-shadow: 0 2px 8px rgba(15, 61, 54, .22);
  font-size: 1.3rem; line-height: 1;
}
.modal-body { padding: 18px 20px 28px; }
.modal-cat {
  display: inline-block; margin-bottom: 8px; padding: 1px 12px; border-radius: 999px;
  background: var(--accent-tint); color: var(--primary); font-size: .78rem; font-weight: 500;
}
.modal-name { font-size: 1.35rem; font-weight: 700; line-height: 1.4; color: var(--text); }
.modal-desc { margin-top: 10px; color: #374151; font-size: .95rem; line-height: 1.9; white-space: pre-line; }

.modal-prices { margin-top: 16px; border-top: 1px solid var(--border); }
.modal-price-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.modal-price-row .v-name { font-weight: 500; color: var(--text); }
.modal-price-row .v-price { font-weight: 700; color: var(--primary); }
.modal-price-row.is-off { opacity: .5; }
.modal-price-row.is-off .v-price { text-decoration: line-through; color: var(--muted); }
.modal-unavailable {
  margin-top: 14px; padding: 8px 14px; border-radius: 12px;
  background: #F3F4F6; color: #4B5563; font-weight: 500; text-align: center;
}

@media (min-width: 640px) {
  .modal { align-items: center; }
  .modal-card { border-radius: 24px; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .item { grid-template-columns: 96px 1fr auto; }
  .item-img { width: 96px; height: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

footer.site-footer {
  text-align: center; color: var(--muted); font-size: .78rem; padding: 12px 0 28px;
}
