/* ==========================================================================
   PayCard — header (variant 07) + mobile full-height sheet
   Scope: .pc-header, .pc-nav, .pc-mega, .pc-actions, .pc-cta, .pc-burger,
          .pc-scrim, .pc-sheet, .pc-acc. Nothing else lives here.
   Palette/timing/depth come from tokens.css — no raw hex below.
   ========================================================================== */

/* ---------- shell ------------------------------------------------------- */
.pc-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header, 60);
  background: color-mix(in srgb, var(--bg-page) 88%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.8);
  backdrop-filter: blur(14px) saturate(1.8);
  border-bottom: 1px solid var(--border-hairline);
  transition: box-shadow var(--dur-base, .22s) var(--ease-out, ease-out),
              background var(--dur-base, .22s) var(--ease-out, ease-out),
              transform var(--dur-base, .26s) var(--ease-out, ease-out);
  will-change: transform;
}
/* headroom: hidden while scrolling down, peek on any upward nudge (≈ one thumb flick).
   Disabled while a mega dropdown is open or the mobile sheet is open, and on
   prefers-reduced-motion. Uses transform so the sticky context isn't broken. */
.pc-header.is-hidden{
  transform: translateY(-100%);
  pointer-events:none; /* so hidden bar can't steal clicks */
}
.pc-header.is-hidden:focus-within,
.pc-header.is-hidden:has(.pc-nav__group:focus-within),
.pc-header.is-hidden:has(.pc-mega.is-open){ transform:none; pointer-events:auto; }

/* condensed (scrolled) state — driven by [data-header].is-condensed */
.pc-header.is-condensed {
  background: color-mix(in srgb, var(--bg-page) 97%, transparent);
  box-shadow: 0 8px 28px -18px rgba(11, 31, 58, .35);
}

.pc-header__inner {
  width: 100%;
  max-width: var(--container);
  min-height: var(--header-h, 72px);
  margin-inline: auto;
  padding-inline: clamp(1.125rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(.75rem, 2vw, 1.5rem);
}

/* ---------- logo -------------------------------------------------------- */
.pc-header__logo {
  display: inline-flex;
  align-items: center;
  color: var(--text-strong);
  text-decoration: none;
  flex: 0 0 auto;
  border-radius: .5rem;
  transition: opacity var(--dur-fast, .14s) ease-out;
}
.pc-header__logo:hover { opacity: .82; }
.pc-header__logo:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

/* Official lockup (mark + Persian wordmark, baked into one SVG).
   Ratio 239:100 must never be distorted — the pair below is the only
   place its size is set, so header/footer can't drift apart. */
.pc-header__lockup {
  display: block;
  width: clamp(8.75rem, 11vw, 11.25rem); /* 140 → 180px, README range */
  height: auto;
  aspect-ratio: 239 / 100;
}

/* ---------- desktop nav ----------------------------------------------- */
.pc-nav {
  display: none;
  align-items: center;
  gap: .25rem;
  flex: 1 1 auto;
  justify-content: center;
}

.pc-nav__group { position: relative; }

.pc-nav__trigger {
  display: inline-flex;
  align-items: center;
  gap: .3125rem;
  padding: .5rem .875rem;
  border-radius: .625rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-body);
  text-decoration: none;
  transition: color var(--dur-fast, .14s) ease-out,
              background-color var(--dur-fast, .14s) ease-out;
}
.pc-nav__trigger:hover,
.pc-nav__group:hover > .pc-nav__trigger,
.pc-nav__group:focus-within > .pc-nav__trigger {
  color: var(--text-strong);
  background: color-mix(in srgb, var(--ink-700) 5%, transparent);
}
.pc-nav__trigger[aria-current="page"] { color: var(--text-strong); }

.pc-nav__chev {
  flex: 0 0 auto;
  transition: transform var(--dur-fast, .14s) ease-out;
}
.pc-nav__group:hover .pc-nav__chev,
.pc-nav__group:focus-within .pc-nav__chev { transform: rotate(180deg); }

.pc-nav__link {
  padding: .5rem .75rem;
  border-radius: .625rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-body);
  text-decoration: none;
  transition: color var(--dur-fast, .14s) ease-out,
              background-color var(--dur-fast, .14s) ease-out;
}
.pc-nav__link:hover {
  color: var(--text-strong);
  background: color-mix(in srgb, var(--ink-700) 5%, transparent);
}
.pc-nav__link[aria-current="page"] { color: var(--text-strong); }

/* ---------- mega dropdown -------------------------------------------- */
.pc-mega {
  position: absolute;
  /* Anchored to the group's physical RIGHT edge — the inline-start edge in
     RTL — so the panel opens aligned with the right side of its trigger,
     which is the standard marketplace-dropdown behaviour for Persian UIs.
     Deliberately NO horizontal transform: with a 352px panel under a 96px
     group, a translateX(-50%) combined with `inset-inline-start: 50%` and
     the RTL logical-property flip resolved the panel ~480px away from its
     trigger (verified). Vertical-only transform for the rise-in. */
  right: 0;
  top: calc(100% + .5rem);
  transform: translateY(-.375rem);
  min-width: 22rem;
  padding: .5rem;
  border-radius: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  box-shadow: 0 24px 56px -28px rgba(11, 31, 58, .45),
              0 2px 6px -3px rgba(11, 31, 58, .18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--dur-base, .22s) var(--ease-out, ease-out),
              transform var(--dur-base, .22s) var(--ease-out, ease-out),
              visibility 0s linear var(--dur-base, .22s);
  /* anchor to the group so hover-bridge keeps it open */
}
.pc-nav__group:hover .pc-mega,
.pc-nav__group:focus-within .pc-mega,
.pc-mega.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s, 0s, 0s;
}

/* Viewport clamp: the LAST nav group sits near the left edge in RTL, so a
   22rem panel right-anchored there would overflow the left side. Flip it to
   left-anchored instead. */
.pc-nav__group:last-child .pc-mega { right: auto; left: 0; }

.pc-mega__grid {
  display: grid;
  gap: .125rem;
}

.pc-mega__item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .75rem;
  border-radius: .75rem;
  text-decoration: none;
  color: var(--text-body);
  transition: background-color var(--dur-fast, .14s) ease-out,
              color var(--dur-fast, .14s) ease-out;
}
.pc-mega__item:hover {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  color: var(--text-strong);
}
.pc-mega__item[aria-current="page"] {
  background: color-mix(in srgb, var(--ink-700) 5%, transparent);
  color: var(--text-strong);
}

.pc-mega__icon {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  inline-size: 1.1rem;
  block-size: 1.1rem;
  color: var(--text-muted);
  opacity: .9;
}
.pc-mega__icon svg { inline-size: 16px; block-size: 16px; }
.pc-mega__item:hover .pc-mega__icon { color: var(--accent-strong); }

.pc-mega__icon--shop{
  /* shop items (★ derived from PC_CATS ★) also render as a quiet dot, not a logo —
     the CTA says "فروشگاه", the row says "گیفت‌کارت · ۳ موجود" — the eye
     should read the words first. */
  color: var(--text-muted);
}
.pc-mega__item:hover .pc-mega__icon--shop{ color: var(--accent-strong); }

.pc-mega__text {
  display: flex;
  flex-direction: column;
  gap: .125rem;
  min-width: 0;
  flex: 1 1 auto;
}
.pc-mega__title {
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.3;
}
.pc-mega__stock {
  display: inline-flex;
  align-items: center;
  gap: .1875rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--verified);
}

.pc-mega__go {
  flex: 0 0 auto;
  color: var(--text-muted);
  transition: transform var(--dur-fast, .14s) ease-out,
              color var(--dur-fast, .14s) ease-out;
}
.pc-mega__item:hover .pc-mega__go {
  color: var(--accent-strong);
  transform: translateX(-.1875rem); /* RTL: arrow points left */
}


.pc-actions__btn--shop{
  text-decoration:none;
  display:none;
  gap:.35rem;
}
.pc-actions__btn--shop .pc-actions__txt{ font-size:.875rem; font-weight:700; }

/* ---------- actions --------------------------------------------------- */
.pc-actions {
  display: flex;
  align-items: center;
  gap: .375rem;
  flex: 0 0 auto;
}

.pc-actions__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: .75rem;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-strong);
  text-decoration: none;
  transition: border-color var(--dur-fast, .14s) ease-out,
              background-color var(--dur-fast, .14s) ease-out,
              color var(--dur-fast, .14s) ease-out;
}
.pc-actions__btn:hover {
  border-color: color-mix(in srgb, var(--ink-700) 30%, transparent);
  background: var(--bg-sunken);
}
.pc-actions__btn:active { transform: translateY(1px); }

.pc-actions__txt {
  font-size: var(--fs-sm);
  font-weight: 700;
}

/* cart badge */
.pc-actions__badge {
  position: absolute;
  top: -.375rem;
  inset-inline-end: -.375rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding-inline: .25rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink-900);
  font-size: .6875rem;
  font-weight: 800;
  line-height: 1.25rem;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg-surface);
}
.pc-actions__badge[data-cart-count]:not([hidden]) { display: block; }

/* ---------- CTA ------------------------------------------------------- */
.pc-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 44px;
  padding: .5rem 1.25rem;
  border-radius: .75rem;
  background: var(--bg-inverse);
  color: var(--text-on-inverse);
  text-decoration: none;
  box-shadow: 0 8px 18px -12px rgba(11, 31, 58, .7);
  transition: background-color var(--dur-fast, .14s) ease-out,
              transform var(--dur-fast, .14s) ease-out;
}
.pc-cta:hover { background: var(--bg-inverse-deep); }
.pc-cta:active { transform: translateY(1px); }

.pc-cta__label {
  font-size: var(--fs-sm);
  font-weight: 800;
  white-space: nowrap;
}

/* ---------- burger (mobile only) ------------------------------------- */
.pc-burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: .75rem;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-strong);
  cursor: pointer;
  transition: border-color var(--dur-fast, .14s) ease-out,
              background-color var(--dur-fast, .14s) ease-out;
}
.pc-burger:hover { background: var(--bg-sunken); }
.pc-burger[aria-expanded="true"] { background: var(--bg-sunken); }

/* ---------- scrim ----------------------------------------------------- */
.pc-scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet, 70);
  background: rgba(11, 31, 58, .5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity var(--dur-base, .22s) var(--ease-out, ease-out);
}
.pc-scrim.is-visible {
  opacity: 1;
}
.pc-scrim[hidden] { display: none; }

/* ---------- mobile sheet --------------------------------------------- */
.pc-sheet {
  position: fixed;
  z-index: var(--z-sheet, 70);
  /* Persian RTL drawer convention: slides in from the RIGHT (physical) edge.
     Use physical left/right + translateX(100%) so the direction can never
     be misread by an engine's logical-property mapping. `overflow-x: clip`
     on <html> (base.css) pins the fixed layer to the visual viewport even
     when the RTL scroll origin sits 1px off. */
  top: 0; bottom: 0;
  right: 0;
  left: auto;
  width: min(88vw, 26rem);
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-hairline);
  box-shadow: -24px 0 60px -32px rgba(11, 31, 58, .5);
  transform: translateX(100%); /* slide in from the right (physical) edge */
  transition: transform var(--dur-slow, .34s) var(--ease-out, ease-out);
}
.pc-sheet.is-open { transform: translateX(0); }
.pc-sheet[hidden] { display: none; }

.pc-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid var(--border-hairline);
  flex: 0 0 auto;
}
.pc-sheet__brand {
  display: block;
  width: 8.5rem;
  height: auto;
  aspect-ratio: 239 / 100;
}
.pc-sheet__close {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .75rem;
  border: 1px solid var(--border-hairline);
  background: var(--bg-sunken);
  color: var(--text-strong);
  cursor: pointer;
}
.pc-sheet__close:hover { background: var(--border-subtle); }

.pc-sheet__body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.125rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* account row */
.pc-sheet__account {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .75rem;
  border-radius: .875rem;
  border: 1px solid var(--border-hairline);
  background: var(--bg-sunken);
  color: var(--text-strong);
  text-decoration: none;
  text-align: inline-start;
}
.pc-sheet__avatar {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  color: var(--text-strong);
}
.pc-sheet__account-text {
  display: flex;
  flex-direction: column;
  gap: .125rem;
  min-width: 0;
  flex: 1 1 auto;
}
.pc-sheet__account-title {
  font-size: var(--fs-sm);
  font-weight: 800;
}
.pc-sheet__account-sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.pc-sheet__account-go { color: var(--text-muted); }

/* category tiles */
.pc-sheet__tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
  gap: .5rem;
}
.pc-sheet__tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .375rem;
  padding: .875rem .5rem;
  border-radius: .875rem;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-strong);
  text-decoration: none;
  transition: border-color var(--dur-fast, .14s) ease-out,
              background-color var(--dur-fast, .14s) ease-out;
}
.pc-sheet__tile:hover {
  border-color: color-mix(in srgb, var(--ink-700) 30%, transparent);
  background: var(--bg-sunken);
}
.pc-sheet__tile-icon {
  display: inline-grid;
  place-items: center;
  inline-size: 1.5rem;
  block-size: 1.5rem;
  color: var(--text-muted);
}
.pc-sheet__tile-icon svg{ inline-size:18px; block-size:18px; }
.pc-sheet__tile-name {
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.3;
}

/* accordion */
.pc-sheet__groups {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  border-top: 1px solid var(--border-hairline);
  padding-top: 1rem;
}
.pc-acc { border-bottom: 1px solid var(--border-subtle); }
.pc-acc:last-child { border-bottom: 0; }

.pc-acc__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  width: 100%;
  padding: .875rem .25rem;
  background: none;
  border: 0;
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 800;
  color: var(--text-strong);
  cursor: pointer;
}
.pc-acc__chev {
  flex: 0 0 auto;
  color: var(--text-muted);
  transition: transform var(--dur-base, .22s) var(--ease-out, ease-out);
}
.pc-acc__head[aria-expanded="true"] .pc-acc__chev { transform: rotate(180deg); }

.pc-acc__panel {
  display: flex;
  flex-direction: column;
  gap: .125rem;
  padding-block: .25rem .875rem;
}
.pc-acc__panel[hidden] { display: none; }

.pc-acc__link {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .625rem .75rem .625rem .25rem;
  border-radius: .625rem;
  color: var(--text-body);
  text-decoration: none;
  font-size: var(--fs-sm);
  transition: background-color var(--dur-fast, .14s) ease-out,
              color var(--dur-fast, .14s) ease-out;
}
.pc-acc__link:hover {
  background: var(--bg-sunken);
  color: var(--text-strong);
}
.pc-acc__icon {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  inline-size: 1.15rem;
  block-size: 1.15rem;
  color: var(--text-muted);
}
.pc-acc__icon svg{ inline-size:15px; block-size:15px; }
.pc-sheet__tile-icon--shop, .pc-acc__icon--shop{ color: var(--text-muted); opacity:.95; }
.pc-acc__name { flex: 1 1 auto; font-weight: 600; }
.pc-acc__stock {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--verified);
}

/* flat links */
.pc-sheet__flat {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  border-top: 1px solid var(--border-hairline);
  padding-top: 1rem;
}
.pc-sheet__flat-link {
  padding: .5rem .875rem;
  border-radius: 999px;
  border: 1px solid var(--border-hairline);
  color: var(--text-body);
  text-decoration: none;
  font-size: var(--fs-xs);
  font-weight: 700;
  transition: border-color var(--dur-fast, .14s) ease-out,
              color var(--dur-fast, .14s) ease-out;
}
.pc-sheet__flat-link:hover {
  border-color: color-mix(in srgb, var(--ink-700) 30%, transparent);
  color: var(--text-strong);
}

/* footer of the sheet */
.pc-sheet__foot {
  flex: 0 0 auto;
  padding: 1.125rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-hairline);
  background: var(--bg-sunken);
  display: flex;
  flex-direction: column;
  gap: .625rem;
}
.pc-sheet__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--btn-h-sm, 44px);
  border-radius: .75rem;
  background: var(--bg-inverse);
  color: var(--text-on-inverse);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 800;
  transition: background-color var(--dur-fast, .14s) ease-out;
}
.pc-sheet__cta:hover { background: var(--bg-inverse-deep); }
.pc-sheet__brandmark{
  margin:0;
  text-align:center;
  font-size:.6875rem;
  font-weight:600;
  letter-spacing:.04em;
  color:var(--text-muted);
  opacity:.85;
}
.pc-sheet__brandmark span{ font-weight:400; opacity:.9; }

/* ==========================================================================
   Mobile tightening — the single-row header must not overflow a 360–400px
   viewport. Icon-only actions + a smaller lockup + reduced chrome achieve
   that without wrapping. Without this, logo+2×44px+CTA+burger exceeded the
   inner content box and both edges were cropped at 390px.
   ========================================================================== */
@media (max-width: 1023px) {
  .pc-header__inner { padding-inline: .75rem; gap: .5rem; }
  .pc-header__lockup { width: clamp(6.75rem, 29vw, 8.75rem); }
  .pc-actions { gap: .25rem; }
  .pc-actions__btn { width: 2.375rem; height: 2.375rem; border-radius: .625rem; }
  .pc-actions__btn svg { width: 18px; height: 18px; }
  .pc-cta { min-block-size: 2.375rem; padding: .5rem .875rem; border-radius: .625rem; }
  .pc-cta__label { font-size: .8125rem; }
  .pc-actions__txt { display: none; } /* icon-only on mobile */
  .pc-burger { width: 2.375rem; height: 2.375rem; }
  .pc-actions__btn--cart, .pc-actions__btn--shop{ display:none !important; }
}
@media (max-width: 370px) {
  .pc-header__lockup { width: 6.25rem; }
  .pc-cta { padding: .5rem .75rem; }
}

@media (min-width: 1024px) {
  .pc-nav { display: flex; }
  .pc-burger { display: none; }
  /* keep the icon-only profile/cart compact, CTA visible */
  .pc-actions__txt { display: none; }
}

@media (min-width: 1200px) {
  .pc-actions__txt { display: inline; }
}

/* utility-bar is part of the sticky stack; it scrolls away while the
   header sticks, so the header must not inherit its top offset. */
.utilbar { position: relative; z-index: 1; }

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .pc-header,
  .pc-mega,
  .pc-sheet,
  .pc-scrim,
  .pc-nav__chev,
  .pc-acc__chev,
  .pc-mega__go,
  .pc-actions__btn,
  .pc-cta,
  .pc-sheet__tile,
  .pc-acc__link,
  .pc-sheet__flat-link,
  .pc-nav__trigger,
  .pc-nav__link {
    transition-duration: 1ms;
  }
}
