/* =====================================================
   Kashane storefront shell :: premium RTL chrome
   Loaded on every page after app.css so it refines the
   base layer. Tokens here are the single source of truth
   for the warm-neutral palette and the one brand accent.
   ===================================================== */

@font-face { font-family:'Vazirmatn'; src:url('../fonts/Vazirmatn-SemiBold.woff2') format('woff2'); font-weight:600; font-display:swap; }
@font-face { font-family:'Vazirmatn'; src:url('../fonts/Vazirmatn-ExtraBold.woff2') format('woff2'); font-weight:800; font-display:swap; }
@font-face { font-family:'Vazirmatn'; src:url('../fonts/Vazirmatn-Black.woff2') format('woff2'); font-weight:900; font-display:swap; }

:root {
  --mk-bg: #faf7f2;
  --mk-surface: #ffffff;
  --mk-surface-2: #f3eee6;
  --mk-ink: #221b15;
  --mk-ink-deep: #17110c;
  --mk-espresso: #26190f;
  --mk-text: #2a231d;
  --mk-text-soft: #7b6f63;
  --mk-line: #eae1d5;
  --mk-accent: #cc4514;
  --mk-accent-deep: #a93710;
  --mk-accent-tint: #fbede4;
  --mk-accent-ink: #8f2e0c;
  --mk-success: #1f7a4d;
  --mk-success-soft: #e2f3ea;
  --mk-warning: #b45309;
  --mk-cream: #f6efe6;
  --mk-shadow-sm: 0 4px 18px rgba(38, 25, 15, 0.06);
  --mk-shadow-md: 0 12px 34px rgba(38, 25, 15, 0.10);
  --mk-shadow-lg: 0 22px 54px rgba(38, 25, 15, 0.14);
  --mk-ease: cubic-bezier(.22, 1, .36, 1);
}

body {
  font-family: "Vazirmatn", system-ui, sans-serif;
  background: var(--mk-bg);
  color: var(--mk-text);
}

::selection { background: var(--mk-accent); color:#fff; }

/* Stroke icon baseline shared by header, nav and bottom nav. */
.ic { display: inline-block; vertical-align: middle; flex: 0 0 auto; }

/* ---------------- Header ---------------- */
/* Grid-true header: every row height and gap snaps to the 4/8 scale, all
   controls share one 44px touch target and one pill geometry. */

.header {
  position: sticky;
  top: 0;
  z-index: 60;
}

.header--sticky {
  position: sticky;
  top: 0;
  z-index: 60;
}

.header__main {
  background: color-mix(in oklab, var(--mk-surface) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--mk-line);
}

/* Utility strip: quiet light lane, compact, never wraps. */
.header__utility {
  background: var(--mk-surface-2);
  border-bottom: 1px solid var(--mk-line);
  color: var(--mk-text-soft);
  font-size: .78rem;
  line-height: 1;
}

.header__utility-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 36px;
  padding: 0;
}

.header__utility-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.header__utility-note .ic { flex: 0 0 auto; opacity: .8; }

.header__utility-links { display: flex; gap: 4px; }

.header__utility-links a {
  padding: 8px 10px;
  border-radius: 8px;
  color: inherit;
  transition: color .2s var(--mk-ease);
}

.header__utility-links a:hover { color: var(--mk-accent-deep); }

/* Main bar: logo / search / actions on one 72px row, 24px gutters. */
.header__top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  min-height: 72px;
  padding: 12px 0;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  font-size: 1.22rem;
  letter-spacing: -.01em;
  color: var(--mk-ink);
}

.header__logo img { width: 40px; height: 40px; }

/* Search is the hero control of the header: tallest element, full pill. */
.search {
  position: relative;
  max-width: 640px;
  width: 100%;
  justify-self: center;
}

.search form {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 20px;
  background: var(--mk-surface-2);
  border: 1.5px solid transparent;
  border-radius: 999px;
  transition: border-color .25s var(--mk-ease), background-color .25s var(--mk-ease), box-shadow .25s var(--mk-ease);
}

.search form:focus-within {
  background: var(--mk-surface);
  border-color: var(--mk-accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--mk-accent) 14%, transparent);
}

.search__icon { display: grid; place-items: center; color: var(--mk-text-soft); }

.search__input {
  border: 0;
  outline: 0;
  width: 100%;
  min-height: 44px;
  background: transparent;
  font: inherit;
  font-size: .95rem;
  color: var(--mk-ink);
}

.search__input::placeholder { color: color-mix(in oklab, var(--mk-text-soft) 80%, transparent); }

/* Actions: one geometry (44px pill), three quiet members. */
.header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  max-width: 200px;
  padding: 0 16px;
  border: 1px solid var(--mk-line);
  border-radius: 999px;
  background: var(--mk-surface);
  color: var(--mk-ink);
  font-size: .88rem;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color .2s var(--mk-ease), color .2s var(--mk-ease);
}

.account-btn:hover { border-color: var(--mk-accent); color: var(--mk-accent); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--mk-line);
  border-radius: 999px;
  background: var(--mk-surface);
  color: var(--mk-ink);
  transition: border-color .2s var(--mk-ease), color .2s var(--mk-ease);
}

.icon-btn:hover { border-color: var(--mk-accent); color: var(--mk-accent); }
.icon-btn.is-active { background: var(--mk-accent-tint); border-color: var(--mk-accent); color: var(--mk-accent); }

.cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--mk-accent);
  color: #fff;
  font-size: .88rem;
  font-weight: 800;
  transition: background-color .2s var(--mk-ease);
}

.cart-btn:hover { background: var(--mk-accent-deep); }

.cart-btn__count {
  min-width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  margin-inline-start: 2px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--mk-accent-ink);
  font-size: .74rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.cart-btn__count[hidden] { display: none; }

/* Category row: 44px touch lane, links vertically centred, 8px rhythm. */
.nav {
  position: relative;
  border-top: 1px solid color-mix(in oklab, var(--mk-line) 72%, transparent);
  background: color-mix(in oklab, var(--mk-surface) 96%, transparent);
}

/* Edge fade hinting that the category row continues; an overlay (not a mask)
   so the hover mega menus inside the list are never clipped. */
.nav::after {
  content: "";
  position: absolute;
  inset-inline-end: 0;
  inset-block: 0;
  width: 64px;
  background: linear-gradient(to left, transparent, var(--mk-surface));
  pointer-events: none;
}

.nav__list {
  display: flex;
  align-items: stretch;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.nav__item { position: relative; display: flex; }

.nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--mk-text-soft);
  border-radius: 10px;
  transition: color .2s var(--mk-ease), background-color .2s var(--mk-ease);
}

.nav__link:hover { color: var(--mk-accent); background: var(--mk-accent-tint); }
.nav__link:focus-visible { outline: 2px solid var(--mk-accent); outline-offset: -2px; }
.nav__link.is-active { color: var(--mk-ink); }
.nav__link .ic { flex: 0 0 auto; opacity: .75; }
.nav__link:hover .ic { opacity: 1; }

/* "All categories" chip sits on the same 44px lane as its siblings. */
.nav__link--all {
  gap: 8px;
  margin-inline: 4px 8px;
  min-height: 36px;
  align-self: center;
  padding: 0 16px;
  border-radius: 10px;
  background: var(--mk-accent-tint);
  color: var(--mk-accent-ink);
  font-weight: 800;
  font-size: .88rem;
}

.nav__link--all:hover { background: var(--mk-accent); color: #fff; }
.nav__link--all.is-active { background: var(--mk-accent); color: #fff; }

.nav__link--offer { color: var(--mk-accent); font-weight: 700; }
.nav__link--offer:hover { color: var(--mk-accent-deep); }

/* Full-width panel that receives the open mega menu (moved in by ui.js),
   because the scrolling category row would clip a dropdown inside it. */
.nav-mega {
  position: absolute;
  inset-inline: 0;
  inset-block-start: 100%;
  z-index: 70;
  display: none;
}

.nav-mega.is-open { display: block; }

.nav-mega .mega {
  position: static;
  display: grid;
  inset: auto;
  width: min(86vw, 720px);
  min-width: 0;
  /* Inline start is set by ui.js to the hovered item's position. */
  margin: 0;
}

.badge--danger {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--mk-accent-tint);
  color: var(--mk-accent-ink);
  font-size: .78rem;
  font-weight: 800;
}

.mega {
  position: absolute;
  inset-inline-end: 0;
  inset-block-start: calc(100% + 1px);
  z-index: 70;
  display: none;
  min-width: 480px;
  max-width: min(86vw, 720px);
  grid-template-columns: repeat(3, 1fr);
  gap: 20px 24px;
  padding: 24px;
  background: var(--mk-surface);
  border: 1px solid var(--mk-line);
  border-radius: 16px;
  box-shadow: var(--mk-shadow-lg);
}

.nav__item:hover > .mega, .nav__item:focus-within > .mega { display: grid; }

.mega__col-title {
  display: block;
  margin-bottom: 10px;
  font-size: .9rem;
  font-weight: 800;
  color: var(--mk-ink);
}

.mega__col-title:hover { color: var(--mk-accent); }

.mega__link {
  display: block;
  padding: 6px 0;
  font-size: .85rem;
  color: var(--mk-text-soft);
}

.mega__link:hover { color: var(--mk-accent); }

/* Search suggestions panel */
.search__panel {
  position: absolute;
  inset-inline: 0;
  inset-block-start: calc(100% + 8px);
  z-index: 80;
  max-height: 420px;
  overflow: auto;
  padding: 10px;
  background: var(--mk-surface);
  border: 1px solid var(--mk-line);
  border-radius: 16px;
  box-shadow: var(--mk-shadow-lg);
}

/* ---------------- Footer ---------------- */

.footer {
  margin-top: var(--sp-12, 64px);
  padding-block: 0;
  background: var(--mk-cream);
  border-top: 1px solid var(--mk-line);
  color: var(--mk-text-soft);
}

.footer .container { padding-top: 52px; }

.footer__grid { display: grid; gap: 34px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .footer__grid { grid-template-columns: 1.5fr repeat(3, 1fr); } }

.footer strong { color: var(--mk-ink); font-size: 1.08rem; }

.footer .text-sm { color: var(--mk-text-soft); line-height: 1.9; }

.footer__title {
  margin-bottom: 14px;
  font-size: .98rem;
  font-weight: 800;
  color: var(--mk-ink);
}

.footer__link {
  display: block;
  padding: 5px 0;
  font-size: .87rem;
  color: var(--mk-text-soft);
  transition: color .2s var(--mk-ease), transform .2s var(--mk-ease);
}
.footer__link:hover { color: var(--mk-accent-deep); transform: translateX(-3px); }

.newsletter { display: flex; gap: 8px; margin-top: 16px; max-width: 340px; }
.newsletter .input {
  min-height: 46px;
  background: var(--mk-surface);
  border-color: var(--mk-line);
  color: var(--mk-text);
}
.newsletter .input::placeholder { color: var(--mk-text-soft); }
.newsletter .btn--primary { background: var(--mk-accent); border: 0; color:#fff; }
.newsletter .btn--primary:hover { background: var(--mk-accent-deep); }

.footer__bottom {
  margin-top: 42px;
  padding: 18px 0;
  border-top: 1px solid var(--mk-line);
  font-size: .82rem;
  color: var(--mk-text-soft);
  text-align: center;
}

/* ---------------- Mobile bottom nav ---------------- */

.bottom-nav {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 65;
  display: flex;
  justify-content: space-around;
  background: color-mix(in oklab, var(--mk-surface) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--mk-line);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav__item {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 8px var(--sp-1);
  font-size: 11px;
  font-weight: 600;
  color: var(--mk-text-soft);
  min-height: 56px;
  transition: color .2s var(--mk-ease);
}
.bottom-nav__item.is-active { color: var(--mk-accent); }

body:has(.bottom-nav) { padding-bottom: 58px; }
@media (min-width: 1024px) { .bottom-nav { display: none; } body:has(.bottom-nav) { padding-bottom: 0; } }

/* ---------------- Responsive header ---------------- */

@media (max-width: 1024px) {
  .account-btn__label { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 860px) {
  /* Trust note yields its row to the service links on phones. */
  .header__utility-note { display: none; }
  .header__utility-links { margin-inline: auto; }
  .header__utility-links a:nth-child(1),
  .header__utility-links a:nth-child(2) { display: none; }

  .header__top {
    grid-template-columns: auto auto;
    grid-template-areas:
      "logo actions"
      "search search";
    gap: 12px;
    min-height: 0;
    padding: 8px 0;
  }

  .header__logo { grid-area: logo; }
  .header__actions { grid-area: actions; justify-self: end; }

  .header__logo img { width: 34px; height: 34px; }
  .header__logo span { font-size: 1.05rem; }

  /* Phone lane: account collapses to a 44px icon button, mirroring the
     wishlist button, so logo + 3 icons always fit one row. */
  .account-btn { width: 44px; padding: 0; justify-content: center; }
  .account-btn__label { display: none; }

  .search { grid-area: search; max-width: none; min-width: 0; }
  .search form { min-height: 44px; padding: 0 16px; }
  .search__input { min-width: 0; }

  .cart-btn { padding: 0 14px; }
}

@media (max-width: 480px) {
  /* Compact cart: icon + count only, keeps the header on one line */
  .cart-btn { padding: 0 12px; gap: 0; }
  .cart-btn__label { display: none; }

  .header__utility-note { font-size: .72rem; }
  .header__utility-links a { padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .icon-btn, .cart-btn, .footer__link, .nav__link, .bottom-nav__item,
  .search form, .account-btn { transition: none; }
}
