/* ==================================================
   منوی مشتری
================================================== */

.wrap {
  width: min(100%, 1040px);
  margin-inline: auto;
  padding-inline: 16px;
}

/* ---------- انیمیشن‌ها ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

@keyframes drop {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

@keyframes float {
  50% {
    translate: 0 -6px;
  }
}

@keyframes swell-a {
  50% {
    transform: translateY(5px);
  }
}

@keyframes swell-b {
  50% {
    transform: translateY(-5px);
  }
}

@keyframes grow {
  from {
    transform: scaleX(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.94);
  }
}

@keyframes pop-out {
  to {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- سربرگ ---------- */

.masthead {
  overflow: hidden;
  background: var(--ink);
  padding-top: 26px;
  text-align: center;
}

.badge {
  width: 116px;
  height: 116px;
  margin: 0 auto;
  padding: 5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.14),
    0 16px 32px rgba(0, 0, 0, 0.3);
  animation: pop 0.8s cubic-bezier(0.2, 1.25, 0.35, 1) both,
    float 6s ease-in-out 1s infinite;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.badge img {
  -webkit-user-drag: none;
  pointer-events: none;
}

.badge img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.wave {
  display: block;
  width: 100%;
  height: 54px;
  margin-top: 6px;
  margin-bottom: -1px;
  overflow: visible;
}

.wave .w1 {
  animation: swell-a 5s ease-in-out infinite;
}

.wave .w2 {
  animation: swell-b 4s ease-in-out infinite;
}

/* ---------- جستجو و دسته‌ها ---------- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 249, 252, 0.94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  animation: drop 0.6s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.toolbar-inner {
  display: grid;
  gap: 10px;
  padding-block: 12px;
}

.search {
  position: relative;
}

.search > svg {
  position: absolute;
  inset-inline-start: 16px;
  top: 50%;
  width: 18px;
  height: 18px;
  translate: 0 -50%;
  color: var(--muted);
  pointer-events: none;
  transition: color 0.2s, scale 0.2s;
}

.search:focus-within > svg {
  color: var(--sea);
  scale: 1.12;
}

.search input {
  width: 100%;
  height: 46px;
  padding-inline: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.search input::-webkit-search-cancel-button {
  display: none;
}

.search input::placeholder {
  color: #7a8e9e;
}

.search input:focus {
  outline: none;
  border-color: var(--sea);
  box-shadow: 0 0 0 4px rgba(27, 127, 196, 0.16);
}

.clear {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  translate: 0 -50%;
  border: 0;
  border-radius: 50%;
  background: var(--foam);
  color: var(--ink-2);
  transition: background 0.2s, rotate 0.25s;
  animation: pop 0.25s both;
}

.clear:hover {
  background: #d6e8f5;
  rotate: 90deg;
}

.clear svg {
  width: 14px;
  height: 14px;
}

.tabs {
  position: relative;
  display: flex;
  gap: 8px;
  margin-inline: -16px;
  padding: 2px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 18px), transparent);
}

.tabs::-webkit-scrollbar {
  display: none;
}

/* مستطیل تیره‌ای که زیر دسته‌ی فعال می‌لغزد */
.tab-pill {
  position: absolute;
  top: 2px;
  left: 0;
  height: 40px;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: 0 8px 18px -8px rgba(13, 43, 69, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s cubic-bezier(0.2, 0.85, 0.25, 1),
    width 0.5s cubic-bezier(0.2, 0.85, 0.25, 1), opacity 0.25s;
}

.tab-pill.ready {
  opacity: 1;
}

.tab-pill.instant {
  transition: none;
}

.tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.3s, color 0.3s, border-color 0.3s, transform 0.15s;
  animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
  animation-delay: calc(var(--i, 0) * 50ms + 0.35s);
}

.tab-count {
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--foam);
  color: var(--sea-deep);
  font-size: 11.5px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  transition: background 0.3s, color 0.3s;
}

.tab:hover {
  border-color: var(--sea);
  color: var(--sea-deep);
}

.tab:active {
  transform: scale(0.95);
}

.tab[aria-current="true"] {
  border-color: transparent;
  background: transparent;
  color: #fff;
}

.tab[aria-current="true"] .tab-count {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* ---------- لیست محصولات ---------- */

#menu {
  padding-block: 26px 72px;
  min-height: 60vh;
}

.section + .section {
  margin-top: 40px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.4;
}

.section-head .count {
  color: var(--muted);
  font-size: 13px;
}

.section-head::after {
  content: "";
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(270deg, var(--sea), var(--line) 60%);
  align-self: center;
  transform-origin: right center;
}

.animate .section-head h2,
.animate .section-head .count {
  animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.animate .section-head::after {
  animation: grow 0.9s 0.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 760px) {
  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

/* ---------- کارت محصول ---------- */

.card {
  position: relative;
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(13, 43, 69, 0.04),
    0 10px 24px -18px rgba(13, 43, 69, 0.28);
  transition: translate 0.35s cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 0.35s, border-color 0.35s;
}

.card::before {
  content: "";
  position: absolute;
  inset-block: 18px;
  inset-inline-start: -1px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--sea), var(--sun));
  transform: scaleY(0);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.animate .card {
  animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
  animation-delay: calc(var(--i, 0) * 55ms);
}

@media (hover: hover) {
  .card:hover {
    translate: 0 -3px;
    border-color: #b6d2e5;
    box-shadow: 0 1px 2px rgba(13, 43, 69, 0.05),
      0 20px 34px -22px rgba(13, 43, 69, 0.4);
  }

  .card:hover::before {
    transform: scaleY(1);
  }

  .card:hover .thumb img {
    transform: scale(1.03);
  }
}

.thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(160deg, #f1f8fd, var(--foam));
  align-self: start;
  isolation: isolate;
}

/* نسخه‌ی محو همان عکس، جاهای خالی کنار عکس را پر می‌کند تا کل عکس دیده شود */
.thumb::before {
  content: "";
  position: absolute;
  inset: -12px;
  background: var(--img, none) center / cover no-repeat;
  filter: blur(12px) saturate(1.15);
  opacity: 0.55;
}

.thumb img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.thumb .cone {
  width: 50px;
  height: 50px;
}

.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(13, 43, 69, 0.07);
  pointer-events: none;
}

button.thumb {
  cursor: zoom-in;
}

/* برچسب‌های روی عکس */

.tag {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.tag svg {
  width: 11px;
  height: 11px;
}

.tag-hot {
  inset-block-start: 7px;
  inset-inline-start: 7px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--sun-deep);
  box-shadow: 0 2px 8px rgba(13, 43, 69, 0.16);
}

.tag-off {
  inset-block-end: 7px;
  inset-inline-start: 7px;
  background: var(--sun-deep);
  color: #fff;
  box-shadow: 0 2px 8px rgba(168, 77, 0, 0.35);
}

.veil {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  background: rgba(13, 43, 69, 0.62);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.card .body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.name {
  margin: 2px 0 0;
  font-size: 16.5px;
  font-weight: 800;
  line-height: 1.55;
}

.desc {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.75;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .body > :nth-last-child(2) {
  margin-bottom: 10px;
}

/* ---------- قیمت ---------- */

.price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin-top: auto;
  padding-top: 9px;
  border-top: 1px dashed #cfdde8;
}

.price {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.4;
}

.price .unit {
  margin-inline-start: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.price.now {
  color: var(--sun-deep);
}

.old {
  color: var(--muted);
  font-size: 13px;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.card.is-out .name,
.card.is-out .price {
  color: var(--muted);
}

.card.is-out .thumb img {
  filter: grayscale(1);
}

/* ---------- وضعیت‌ها ---------- */

.state {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 64px 16px;
  text-align: center;
  color: var(--muted);
  animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.state .cone {
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
  animation: float 3.5s ease-in-out infinite;
}

.state h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

.state p {
  margin: 0;
  max-width: 34ch;
}

.btn {
  margin-top: 14px;
  height: 42px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  transition: background 0.2s, transform 0.15s;
}

.btn:hover {
  background: var(--ink-2);
}

.btn:active {
  transform: scale(0.96);
}

.skeleton .thumb,
.skeleton .line {
  background: linear-gradient(100deg, #e6eef4 30%, #f3f7fa 50%, #e6eef4 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}

.skeleton .line {
  height: 14px;
  margin-top: 10px;
  border-radius: 6px;
}

/* ---------- نمایش بزرگ محصول ---------- */

.viewer {
  width: fit-content;
  max-width: 94vw;
  max-height: 94vh;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.viewer[open] {
  animation: pop-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.05);
}

.viewer.closing {
  animation: pop-out 0.22s ease-in forwards;
}

.viewer::backdrop {
  background: rgba(7, 23, 38, 0.82);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.viewer[open]::backdrop {
  animation: fade-in 0.3s;
}

.viewer.closing::backdrop {
  animation: fade-out 0.22s forwards;
}

/* فقط خود عکس، با نسبت اصلی و کامل */
.viewer-card {
  position: relative;
}

.viewer-card img {
  display: block;
  width: auto;
  height: auto;
  min-width: min(94vw, 360px);
  max-width: 94vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.6);
}

.viewer-close {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transition: rotate 0.3s, transform 0.15s;
}

.viewer-close:hover {
  rotate: 90deg;
}

.viewer-close:active {
  transform: scale(0.9);
}

.viewer-close svg {
  width: 16px;
  height: 16px;
}