/* architecture: landing — navbar + mobile drawer (mobile-first) */
/* ================================================
   3. NAVBAR
   ------------------------------------------------
   حالت پایه = موبایل (کشوی تمام‌قد).
   از ۱۰۲۴px به بالا با @media به نوار افقی دسکتاپ تبدیل می‌شود.
   دلیل ۱۰۲۴ به‌جای ۷۶۸: عناوین فارسی منو بلندند و روی تبلت
   نوار افقی شلوغ می‌شد؛ تبلت هم کشو می‌گیرد که لمسی‌تر است.
   ================================================ */

.skip-link {
  position: absolute;
  top: -100px;
  right: 12px;
  z-index: 10000;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-gold);
  color: var(--accent-on);
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 12px;
  outline: 2px solid var(--text-white);
  outline-offset: 2px;
}

.navbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1000;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--nav-bg);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: none;
  overflow: visible;
  box-shadow:
    0 8px 24px -14px rgba(15, 23, 42, 0.16),
    0 2px 10px rgba(59, 130, 246, 0.08);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* خط لبه شیشه‌ای آبی — دقیقاً روی لبه پایین هدر */
.navbar::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: 100%;
  bottom: auto;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(96, 165, 250, 0.22) 0%,
    rgba(147, 197, 253, 0.95) 12%,
    rgba(59, 130, 246, 1) 50%,
    rgba(147, 197, 253, 0.95) 88%,
    rgba(96, 165, 250, 0.22) 100%
  );
  box-shadow: 0 5px 12px -3px rgba(59, 130, 246, 0.4);
}

/* پس از اسکرول، نوار از هیرو جدا می‌شود */
.navbar.is-scrolled {
  background: var(--nav-bg-scrolled);
  box-shadow: var(--nav-shadow-scrolled);
}

/*
 * ناوبر یک stacking context می‌سازد و کشو داخل آن است،
 * پس هنگام باز بودن منو باید از پرده (۱۱۰۰) بالاتر بیاید.
 */
body.menu-open .navbar {
  z-index: 1102;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: var(--nav-height);
}

/* ——— لوگو ——— */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
  max-height: 100%;
}

.logo-icon {
  width: 36px;
  height: 36px;
  max-height: calc(var(--nav-height) - 16px);
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  font-size: inherit;
  overflow: visible;
  box-shadow: none;
}

.logo-img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  background: transparent;
  /* لوگوی PNG با پس‌زمینه مشکی: screen روی تیره، multiply+invert روی روشن */
  mix-blend-mode: var(--logo-blend, screen);
  filter: var(--logo-filter, none);
  pointer-events: none;
  user-select: none;
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  flex-shrink: 0;
}

.logo-text-brand {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-white);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.logo-text-sub {
  display: none;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ——— دکمه همبرگری ——— */
.hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1102;
  width: var(--tap-target);
  height: var(--tap-target);
  flex-shrink: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--text-white);
  cursor: pointer;
  border-radius: 0;
  padding: 0;
  transition: color 0.25s ease, opacity 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.hamburger:hover,
.hamburger:focus-visible {
  color: var(--accent-gold);
  background: transparent;
  border: 0;
  outline: none;
}

/* وقتی کشو باز است، دکمه بستنِ داخل کشو تنها راه بستن است — دو ضربدر گیج‌کننده بود */
body.menu-open .hamburger {
  opacity: 0;
  pointer-events: none;
}

.hamburger-box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 20px;
  height: 14px;
}

.hamburger-line {
  display: block;
  height: 2px;
  width: 100%;
  background: currentColor;
  border-radius: 2px;
  transform-origin: center;
  transition:
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease;
}

.hamburger.is-active .hamburger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.hamburger.is-active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger.is-active .hamburger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* دکمه میان‌بر ورود کنار همبرگری — فقط موبایل */
.nav-quick-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  flex-shrink: 0;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.08);
  color: var(--accent-gold);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.22s ease, border-color 0.22s ease;
  -webkit-tap-highlight-color: transparent;
}

.nav-quick-login:hover,
.nav-quick-login:focus-visible {
  background: rgba(96, 165, 250, 0.16);
  border-color: rgba(96, 165, 250, 0.45);
  outline: none;
}

body.menu-open .nav-quick-login {
  opacity: 0;
  pointer-events: none;
}

.nav-bar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* ——— پرده پشت کشو ——— */
/*
 * قفل اسکرول هنگام باز بودن کشو.
 * position: fixed لازم است چون سافاری iOS به overflow: hidden روی body پایبند نیست.
 * مقدار top را nav-menu.js ست می‌کند تا موقعیت اسکرول حفظ شود.
 */
body.menu-open {
  position: fixed;
  width: 100%;
  overflow: hidden;
}

.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: var(--overlay-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease;
}

.nav-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* ——— کشوی موبایل ——— */
.nav-menu {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1101;
  width: min(360px, 92vw);
  height: 100dvh;
  padding: 0;
  gap: 0;
  background: var(--drawer-glow), var(--drawer-fill);
  border-left: 1px solid var(--accent-border);
  box-shadow: var(--drawer-shadow);
  transform: translateX(100%);
  transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
}

.nav-menu.active {
  transform: translateX(0);
}

.mobile-menu-head {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: calc(52px + env(safe-area-inset-top, 0px));
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  border-bottom: 1px solid var(--border-color);
}

.mobile-menu-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
  color: var(--text-white);
  font-size: 0.95rem;
}

.mobile-menu-brand-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  background: transparent;
  border: none;
  color: inherit;
  font-size: inherit;
  overflow: visible;
  box-shadow: none;
}

.mobile-menu-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mobile-menu-brand-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-white);
}

.mobile-menu-brand-sub {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
}

.mobile-menu-close {
  width: var(--tap-target);
  height: var(--tap-target);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: var(--glass-fill-hover);
  color: var(--text-gray-light);
  font-size: 1.05rem;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-close:hover,
.mobile-menu-close:focus-visible {
  color: var(--accent-gold);
  border-color: var(--accent-border);
  background: rgba(96, 165, 250, 0.1);
}

/* بدنه اسکرول‌شونده کشو */
.mobile-menu-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  padding: 14px 14px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/*
 * دسته‌بندی منو — کاربر در همان نگاه اول می‌فهمد
 * کدام مسیر مال اوست: نوبت‌گیرنده یا صاحب کسب‌وکار.
 */
.nav-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-inline-start: 2px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent-gold);
  text-transform: none;
}

.nav-group-title i {
  font-size: 0.72rem;
  opacity: 0.9;
}

.nav-group-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to left, transparent, rgba(96, 165, 250, 0.25));
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  list-style: none;
}

.nav-links li {
  display: flex;
  opacity: 0;
  transform: translateX(12px);
}

.nav-menu.active .nav-links li {
  animation: mobileNavItemIn 0.45s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}

.nav-menu.active .nav-links li:nth-child(1) { animation-delay: 0.04s; }
.nav-menu.active .nav-links li:nth-child(2) { animation-delay: 0.07s; }
.nav-menu.active .nav-links li:nth-child(3) { animation-delay: 0.1s; }
.nav-menu.active .nav-links li:nth-child(4) { animation-delay: 0.13s; }
.nav-menu.active .nav-links li:nth-child(5) { animation-delay: 0.16s; }
.nav-menu.active .nav-links li:nth-child(6) { animation-delay: 0.19s; }
.nav-menu.active .nav-links li:nth-child(7) { animation-delay: 0.22s; }
.nav-menu.active .nav-links li:nth-child(8) { animation-delay: 0.25s; }
.nav-menu.active .nav-links li:nth-child(9) { animation-delay: 0.28s; }
.nav-menu.active .nav-links li:nth-child(9) { animation-delay: 0.28s; }
.nav-menu.active .nav-links li:nth-child(9) { animation-delay: 0.28s; }

@keyframes mobileNavItemIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.nav-links a {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 12px 4px;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: right;
  text-decoration: none;
  color: var(--text-gray-light);
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--border-color);
  border-radius: 0;
  transition: color 0.22s ease;
}

.nav-links li:last-child a {
  border-bottom: 0;
}

.nav-links a i {
  width: auto;
  height: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  background: none;
  font-size: 0.86rem;
  color: var(--accent-gold);
  transition: color 0.22s ease;
}

/* فلش کوچک انتهای آیتم — حس «می‌روی به» */
.nav-links a::after {
  content: '';
  width: 6px;
  height: 6px;
  margin-inline-start: auto;
  flex-shrink: 0;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.3;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text-white);
  background: transparent;
  border-color: var(--border-color);
  outline: none;
}

.nav-links a:hover i,
.nav-links a:focus-visible i {
  background: none;
  color: var(--accent-gold);
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after {
  opacity: 0.7;
  transform: rotate(45deg) translate(2px, -2px);
}

.nav-links a:active {
  transform: none;
}

/* بخشی که همین حالا روی صفحه دیده می‌شود */
.nav-links a.is-current {
  color: var(--text-white);
  background: transparent;
  border-color: var(--border-color);
}

.nav-links a.is-current i {
  background: none;
}

/* ——— پابرگ کشو: اقدام اصلی ——— */
.nav-cta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.72);
}

.nav-cta .btn {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 0.84rem;
  gap: 8px;
  justify-content: center;
}

.nav-cta .nav-user-btn-text {
  text-align: center;
}

/* ================================================
   دسکتاپ — نوار افقی
   ================================================ */
@media (min-width: 1024px) {
  .hamburger,
  .mobile-menu-head,
  .nav-overlay,
  .nav-group-title,
  .nav-quick-login {
    display: none;
  }

  .navbar.is-scrolled .navbar-inner {
    height: calc(var(--nav-height) - 6px);
  }

  .navbar-inner {
    justify-content: flex-start;
    gap: 18px;
    transition: height 0.3s ease;
  }

  .logo-icon {
    width: 44px;
    height: 44px;
    max-height: calc(var(--nav-height) - 12px);
  }

  .logo-text-brand {
    font-size: 1rem;
  }

  .logo-text-sub {
    display: block;
    font-size: 0.66rem;
  }

  body.menu-open {
    position: static;
    overflow: visible;
  }

  .nav-menu {
    position: static;
    flex: 1 1 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: auto;
    min-width: 0;
    height: auto;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
    transform: none;
    overflow: visible;
  }

  /* لینک‌ها یک خوشه از راست (کنار لوگو)؛ فاصله یکسان بین همه آیتم‌ها */
  .mobile-menu-body {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding: 0;
    min-width: 0;
    overflow: visible;
  }

  .nav-group {
    display: contents;
  }

  .nav-links {
    flex-direction: row;
    align-items: center;
    gap: 4px;
    width: auto;
    margin: 0;
    padding: 0;
  }

  .nav-links li {
    opacity: 1;
    transform: none;
    animation: none !important;
  }

  .nav-links a {
    flex: none;
    width: auto;
    min-height: 0;
    padding: 8px 11px;
    gap: 7px;
    font-size: clamp(0.82rem, 1vw, 0.92rem);
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    color: var(--text-gray-light);
    background: transparent;
    border: 0;
    border-radius: 10px;
  }

  .nav-links li:last-child a {
    border-bottom: 0;
  }

  /* زیرخط طلایی به‌جای پس‌زمینه — تمیزتر روی نوار افقی */
  .nav-links a::after {
    content: '';
    position: absolute;
    right: 11px;
    left: 11px;
    bottom: 2px;
    width: auto;
    height: 2px;
    margin: 0;
    border: 0;
    border-radius: 2px;
    background: var(--accent-gold);
    transform: scaleX(0);
    transform-origin: right center;
    opacity: 1;
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  }

  .nav-links a i {
    width: auto;
    height: auto;
    border-radius: 0;
    background: none;
    font-size: 0.75rem;
    opacity: 0.7;
  }

  .nav-links a:hover,
  .nav-links a:focus-visible {
    color: var(--text-white);
    background: transparent;
    border-color: transparent;
  }

  .nav-links a:hover i,
  .nav-links a:focus-visible i {
    background: none;
    opacity: 1;
  }

  .nav-links a:hover::after,
  .nav-links a:focus-visible::after {
    transform: scaleX(1);
  }

  .nav-links a.is-current {
    color: var(--text-white);
    background: transparent;
    border-color: transparent;
  }

  .nav-links a.is-current::after {
    transform: scaleX(1);
  }

  .nav-links a.is-current i {
    background: none;
    opacity: 1;
  }

  .nav-links a:active {
    transform: none;
  }

  .nav-cta {
    flex-direction: row;
    align-items: center;
    flex-shrink: 0;
    width: auto;
    margin-inline-start: auto;
    padding: 0;
    border: none;
    background: none;
  }

  .nav-cta .btn {
    width: auto;
    min-height: 0;
    padding: 10px clamp(14px, 1.5vw, 20px);
    font-size: clamp(0.8rem, 0.95vw, 0.88rem);
  }
}

/* آیکون‌های منو روی نمایشگرهای میانی جا را باز می‌کنند */
@media (min-width: 1024px) and (max-width: 1279px) {
  .nav-links a i {
    display: none;
  }

  .nav-links a {
    padding: 8px 9px;
  }

  .logo-text-sub {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-menu,
  .nav-overlay,
  .hamburger-line,
  .nav-links a::after {
    transition-duration: 0.01ms;
  }

  .nav-menu.active .nav-links li {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
