/* صفحه‌ی منو */

/* بالای صفحه */
.menu-top { padding: 48px 0 24px; }
@media (min-width: 768px) { .menu-top { padding: 80px 0 32px; } }
.menu-top .wrap { display: grid; gap: 24px; }
@media (min-width: 900px) { .menu-top .wrap { grid-template-columns: 1fr 380px; align-items: end; } }
.menu-top h1 { font-size: var(--t-h1); line-height: 1.05; }
.menu-top p { color: var(--muted); margin-top: 12px; font-size: var(--t-sm); }

.search { position: relative; }
.search input {
  width: 100%; height: 52px; padding-inline: 44px 44px;
  border: 1px solid var(--line-2); border-radius: 0; background: var(--bg);
  font: inherit; font-size: var(--t-body); color: var(--ink);
  transition: border-color .2s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--ink); }
.search input::-webkit-search-cancel-button { display: none; }
.search .s-icon { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.search .clear { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: none; cursor: pointer; font-size: 22px; color: var(--muted); display: none; }
.search.has-value .clear { display: block; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* کارت‌های دسته (تصویری) */
.cats { padding-bottom: 40px; }
.cats-row { display: grid; grid-auto-flow: column; grid-auto-columns: 132px; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
.cats-row::-webkit-scrollbar { display: none; }
@media (min-width: 1100px) { .cats-row { grid-auto-flow: row; grid-template-columns: repeat(7, 1fr); margin: 0; padding: 0; } }
.cat-card { scroll-snap-align: start; position: relative; display: block; aspect-ratio: 4 / 5; padding: 0; border: 0; overflow: hidden; background: #1c1f17; cursor: pointer; color: #fff; text-align: right; }
.cat-card img { width: 100%; height: 100%; object-fit: cover; object-position: 0% 50%; transition: transform .9s var(--ease); }
.cat-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.7), rgba(0,0,0,0) 60%); }
.cat-card span { position: absolute; z-index: 1; inset-inline: 12px; bottom: 12px; font-size: var(--t-sm); font-weight: 700; line-height: 1.4; }
.cat-card:hover img { transform: scale(1.06); }

/* تب‌های چسبان */
.tabs-bar { position: sticky; top: 76px; z-index: 40; background: var(--surface); border-block: 1px solid var(--line); }
.tabs { display: flex; gap: 28px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; touch-action: pan-x; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; cursor: grab; }
.tabs.dragging { cursor: grabbing; }
.tabs.dragging .tab { pointer-events: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; position: relative; height: 54px; padding: 0; border: 0; background: none; cursor: pointer; font-size: var(--t-sm); color: var(--muted); white-space: nowrap; transition: color .2s; }
.tab::after { content: ""; position: absolute; inset-inline: 0; bottom: -1px; height: 2px; background: var(--ink); transform: scaleX(0); transition: transform .3s var(--ease); }
.tab:hover, .tab[aria-current="true"] { color: var(--ink); }
.tab[aria-current="true"]::after { transform: scaleX(1); }

/* سرصفحه‌ی هر دسته */
.menu-body { padding-bottom: 120px; }
.cat { padding-top: 72px; scroll-margin-top: 132px; }
/* بنر تیره‌ی هر دسته، مثل کارت‌های صفحه‌ی اصلی */
.cat-head { position: relative; overflow: hidden; aspect-ratio: 4 / 3; background: #1c1f17; color: #fff; }
@media (min-width: 600px) { .cat-head { aspect-ratio: 16 / 9; } }
@media (min-width: 900px) { .cat-head { aspect-ratio: 3 / 1; } }
.cat-head img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 0% 55%; }
.cat-head::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to left, rgba(0,0,0,.55), rgba(0,0,0,0) 55%), linear-gradient(to top, rgba(0,0,0,.45), rgba(0,0,0,0) 50%); }
.cat-head-text { position: absolute; z-index: 1; inset-inline-start: 0; bottom: 0; padding: 24px; }
@media (min-width: 768px) { .cat-head-text { padding: 40px 48px; } }
.cat-head .num { display: block; font-size: var(--t-sm); opacity: .75; margin-bottom: 8px; }
.cat-head h2 { font-size: clamp(1.75rem, 1.1rem + 2.6vw, 3.25rem); line-height: 1.15; }
.cat-head .count { display: block; font-size: var(--t-sm); opacity: .85; margin-top: 8px; }

/* آیتم‌ها */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px 16px; padding-top: 28px; }
@media (min-width: 768px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 48px 24px; } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.item { display: flex; flex-direction: column; gap: 12px; padding: 0; border: 0; background: none; text-align: right; cursor: pointer; }
.item-img { position: relative; aspect-ratio: 1; background: #fff; overflow: hidden; border-bottom: 1px solid var(--line); }
.item-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--ease); }
.item:hover .item-img img { transform: scale(1.05); }
.item h3 { font-size: var(--t-body); line-height: 1.45; color: var(--green); }
@media (min-width: 768px) { .item h3 { font-size: var(--t-lg); } }
.item p { font-size: var(--t-sm); color: var(--ink); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .price { margin-top: auto; padding-top: 4px; }

.empty { text-align: center; padding: 96px 0; }
.empty h2 { font-size: var(--t-h3); margin-bottom: 8px; }
.empty p { color: var(--muted); margin-bottom: 24px; }
.searching .cats { display: none; }

.menu-note { margin-top: 72px; padding-top: 24px; border-top: 1px solid var(--line); font-size: var(--t-sm); color: var(--muted); }

/* دکمه‌ی بالا */
.to-top { position: fixed; z-index: 45; bottom: 20px; left: 20px; width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--ink); background: var(--bg); color: var(--ink); cursor: pointer; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .25s, transform .25s var(--ease), background .2s, color .2s; }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--ink); color: var(--bg); }
.to-top svg { width: 18px; height: 18px; }

/* برگه‌ی جزئیات */
.sheet-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(20,20,20,.45); opacity: 0; transition: opacity .3s var(--ease); }
.sheet { position: fixed; z-index: 91; inset-inline: 0; bottom: 0; max-height: 92vh; overflow: auto; background: var(--bg); color: var(--ink); transform: translateY(100%); transition: transform .35s var(--ease); }
.sheet-open .sheet-backdrop { opacity: 1; }
.sheet-open .sheet { transform: none; }
@media (min-width: 768px) {
  .sheet { inset: 50% auto auto 50%; width: min(900px, calc(100vw - 64px)); max-height: calc(100vh - 64px); display: grid; grid-template-columns: 1fr 1fr; transform: translate(-50%, -47%); opacity: 0; transition: transform .3s var(--ease), opacity .3s var(--ease); }
  .sheet-open .sheet { transform: translate(-50%, -50%); opacity: 1; }
}
.sheet-img { aspect-ratio: 1; background: #fff; overflow: hidden; border-bottom: 1px solid var(--line); }
@media (min-width: 768px) { .sheet-img { border-bottom: 0; border-inline-end: 1px solid var(--line); } }
.sheet-img img { width: 100%; height: 100%; object-fit: cover; }
.sheet-body { padding: 24px var(--gutter) 32px; display: flex; flex-direction: column; }
@media (min-width: 768px) { .sheet-body { padding: 48px 40px; } }
.sheet-cat { font-size: var(--t-sm); color: var(--muted); margin-bottom: 12px; }
.sheet-body h3 { font-size: var(--t-h2); margin-bottom: 16px; color: var(--green); }
.sheet-body p { color: var(--ink); line-height: 2; }
.sheet-foot { margin-top: auto; padding-top: 24px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); }
.sheet-body p + .sheet-foot { margin-top: 32px; }
.sheet-foot .price { font-size: var(--t-h3); }
.sheet-nav { display: flex; gap: 8px; margin-top: 20px; }
.sheet-nav button { flex: 1; height: 44px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); cursor: pointer; font-size: var(--t-sm); }
.sheet-nav button:hover { border-color: var(--ink); }
.sheet-nav button:disabled { opacity: .35; cursor: default; border-color: var(--line-2); }
.sheet-close { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 2; width: 44px; height: 44px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; font-size: 24px; line-height: 1; }

/* ================= حالت اپلیکیشنی (موبایل) ================= */

.tab .t-img { display: none; }
.tab-break { display: none; }
.grab { display: none; }
.search-row { display: flex; gap: 8px; align-items: center; }
.search-row .search { flex: 1; }
#viewToggle { display: none; flex: none; width: 46px; height: 46px; border-radius: 12px; background: var(--bg-soft); }
#viewToggle .i-list { display: none; }
.view-grid #viewToggle .i-grid { display: none; }
.view-grid #viewToggle .i-list { display: block; }

/* برگه‌ی اطلاعات کافه */
.info-sheet .sheet-body { text-align: right; }
.info-logo { width: 56px; height: 56px; margin-bottom: 12px; }
.info-sheet h3 { font-size: var(--t-h3); margin-bottom: 20px; color: var(--green); }
.info-sheet .info-row { grid-template-columns: 96px 1fr; }
.info-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 24px; }
.info-actions .btn { padding: 0 8px; }
@media (min-width: 768px) {
  .sheet.info-sheet { grid-template-columns: 1fr; width: min(520px, calc(100vw - 64px)); }
}

@media (max-width: 767px) {
  html { scroll-padding-top: 120px; }
  .menu-page .cats, .menu-title, .to-top { display: none; }
  .menu-page .footer { padding: 24px 0 16px; border-top: 1px solid var(--line); }
  .menu-page .footer-bottom { justify-content: center; text-align: center; }
  #viewToggle { display: inline-grid; }

  /* جستجو */
  .menu-top { padding: 12px 0 4px; }
  .search input { height: 46px; border: 0; border-radius: 12px; background: var(--bg-soft); font-size: 16px; }
  .search input:focus { background: var(--bg-soft-2); }

  /* دسته‌ها به شکل چیپ با عکس کوچک */
  .tabs-bar { top: calc(56px + env(safe-area-inset-top)); border-top: 0; }
  .tabs { gap: 8px; padding: 10px 16px; margin-inline: -16px; scroll-padding-inline: 16px; }
  .tab {
    display: inline-flex; align-items: center; gap: 8px;
    height: 40px; padding-inline: 6px 14px;
    border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink-2); background: var(--bg);
    transition: background .2s, color .2s, border-color .2s;
  }
  .tab::after { display: none; }
  .tab .t-img { display: block; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; object-position: 8% 50%; background: #1c1f17; }
  .tab[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

  /* بخش‌ها */
  .menu-body { padding-bottom: 40px; }
  .cat { padding-top: 24px; scroll-margin-top: 118px; }
  .cat-head { aspect-ratio: 16 / 8; border-radius: 14px; }
  .cat-head-text { padding: 18px 20px; }
  .cat-head h2 { font-size: clamp(1.35rem, 6.4vw, 1.75rem); white-space: nowrap; }
  .cat-head .num { font-size: var(--t-meta); margin-bottom: 4px; }
  .cat-head .count { font-size: var(--t-meta); margin-top: 4px; }

  /* آیتم‌ها — نمای فهرستی (پیش‌فرض موبایل) */
  .grid { grid-template-columns: 1fr; gap: 0; padding-top: 6px; }
  .item {
    display: grid; grid-template-columns: 1fr 96px; grid-template-areas: "text img";
    gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line);
    transition: background .15s;
  }
  .item:last-child { border-bottom: 0; }
  .item:active { background: var(--bg-soft); }
  .item-img { grid-area: img; width: 96px; border: 1px solid var(--line); border-radius: 12px; }
  .item-text { grid-area: text; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  .item h3 { font-size: 1rem; }
  .item p { -webkit-line-clamp: 2; }
  .item .price { padding-top: 2px; }
  .item:hover .item-img img { transform: none; }

  /* نمای شبکه‌ای */
  .view-grid .grid { grid-template-columns: 1fr 1fr; gap: 20px 12px; padding-top: 16px; }
  .view-grid .item { display: flex; flex-direction: column; gap: 10px; padding: 0; border: 0; align-items: stretch; }
  .view-grid .item:active { background: none; transform: scale(.98); }
  .view-grid .item-img { width: 100%; }
  .view-grid .item h3 { font-size: .95rem; }

  .menu-note { margin-top: 32px; text-align: center; font-size: var(--t-meta); }
  .empty { padding: 56px 0; }

  /* برگه‌ها (پایین صفحه، مثل اپ) */
  .sheet { border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); max-height: 90vh; overscroll-behavior: contain; touch-action: pan-y; }
  .sheet.dragging { transition: none; }
  .grab { display: block; position: sticky; top: 0; z-index: 3; height: 24px; background: var(--bg); }
  .grab::before { content: ""; position: absolute; top: 9px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--line-2); }
  .sheet-close { top: 18px; inset-inline-end: 14px; border-radius: 50%; width: 40px; height: 40px; }
  .sheet-img { aspect-ratio: auto; height: min(42vh, 360px); border-bottom: 1px solid var(--line); }
  .sheet-img img { object-fit: contain; }
  .sheet-body { padding: 20px 20px 24px; }
  .sheet-body h3 { font-size: 1.75rem; margin-bottom: 10px; }
  .sheet-foot { padding-top: 18px; }
  .sheet-body p + .sheet-foot { margin-top: 20px; }
  .sheet-nav button { height: 48px; border-radius: 12px; }
  .info-sheet .sheet-body { padding-top: 4px; }
  .info-actions .btn { border-radius: 12px; min-height: 48px; }
}

/* بسته‌بندی متن آیتم (دسکتاپ) */
.item-text { display: flex; flex-direction: column; gap: 8px; flex: 1; }

/* جا برای حرکت آرام عکس بنر هنگام اسکرول (فقط وقتی انیمیشن فعال است) */
.gsap .cat-head > img { top: -9%; height: 118%; }

/* حالت تاریک در منو */
[data-theme="dark"] .item-img { border: 0; border-radius: 14px; }
[data-theme="dark"] .sheet-close { border-color: var(--line-2); }
[data-theme="dark"] .sheet-img { border-color: var(--line); }
[data-theme="dark"] .sheet-backdrop { background: rgba(0, 0, 0, .65); }

/* کارت‌های عکس‌دار دسته‌ها فعلاً پنهان (فقط نوار متنی دسته‌ها نمایش داده می‌شود).
   برای برگرداندن، این خط را پاک کنید. */
.cats { display: none; }
.menu-top { padding-bottom: 40px; }
@media (max-width: 767px) { .menu-top { padding-bottom: 4px; } }
@media (min-width: 768px) { #sheet .sheet-body { justify-content: center; } }

/* موبایل: همه‌ی دسته‌ها کنار هم (چند ردیف، بدون اسکرول افقی) */
@media (max-width: 767px) {
  .tabs { flex-wrap: wrap; justify-content: flex-start; overflow: visible; gap: 6px 5px; padding: 10px 0; margin-inline: 0; touch-action: auto; cursor: default; }
  .tab { flex: 1 1 auto; justify-content: center; height: 34px; padding-inline: 8px; font-size: 12.5px; gap: 0; white-space: nowrap; }
  .tab-break { display: block; flex-basis: 100%; height: 0; }
  .tab .t-img { display: none; }
  .cat { scroll-margin-top: 150px; }
}
