/* ==========================================================
   AZ COFFEE — استایل‌ها
   پالت (فقط ۳ رنگ):
     --bg      پس‌زمینه تیره
     --text    متن کرم
     --accent  طلایی/کاراملی (دکمه‌ها و لینک‌ها)
   بقیه‌ی سایه‌ها از همین رنگ‌ها با شفافیت ساخته می‌شوند.
   ========================================================== */

:root {
  --bg: #1a1a1a;
  --text: #f5f0e8;
  --accent: #c9a86a;

  --muted: rgba(245, 240, 232, 0.72);
  --line: rgba(245, 240, 232, 0.14);
  --surface: rgba(245, 240, 232, 0.05);

  --radius: 14px;
  --header-h: 64px;
}

/* ---------- ریست و پایه ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Vazirmatn', Tahoma, system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.9;
  min-height: 100vh;
}

body.no-scroll { overflow: hidden; }

img { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 16px; }

.skip-link {
  position: absolute; top: -100px; inset-inline-start: 8px; z-index: 100;
  padding: 8px 16px; border-radius: 8px;
  background: var(--accent); color: var(--bg);
}
.skip-link:focus { top: 8px; }

/* ---------- دکمه‌ها ---------- */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 500;
  text-align: center;
  transition: opacity .2s, transform .2s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover:not(:disabled) { opacity: .9; transform: translateY(-1px); }
.btn-ghost { border: 1px solid var(--accent); color: var(--accent); }
.btn-ghost:hover { background: var(--surface); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-block { display: block; width: 100%; }

.icon-btn {
  position: relative;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 1.1rem;
  transition: background .2s;
}
.icon-btn:hover { background: var(--surface); }

/* ---------- هدر ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(26, 26, 26, 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
}
.logo {
  font-weight: 700; letter-spacing: .08em; color: var(--text);
  direction: ltr; unicode-bidi: isolate;
}
.logo span { color: var(--accent); }
.logo:hover { text-decoration: none; }

.header-actions { display: flex; align-items: center; gap: 4px; }
.cart-count {
  position: absolute; top: 2px; inset-inline-start: 2px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: var(--accent); color: var(--bg);
  font-size: .72rem; font-weight: 700; line-height: 18px; text-align: center;
}

/* منوی دسکتاپ: در موبایل مخفی است */
.site-nav { display: none; }

/* ---------- قهرمان ---------- */
.hero {
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
  display: flex; align-items: center;
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, rgba(26,26,26,.75) 0%, rgba(26,26,26,.92) 100%),
    url('https://images.unsplash.com/photo-1495474472287-4d71bcdd2085?w=1400&q=65&auto=format&fit=crop');
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
.hero-inner { padding-block: 64px; }
.eyebrow { color: var(--accent); letter-spacing: .1em; font-size: .9rem; margin-bottom: 8px; }
.hero h1 { font-size: clamp(1.9rem, 7vw, 3.4rem); font-weight: 700; line-height: 1.4; max-width: 18ch; }
.hero-text { color: var(--muted); max-width: 46ch; margin: 16px 0 28px; }

/* ---------- بخش‌ها ---------- */
.section { padding-block: 64px; }
.section-alt { background: var(--surface); }
.section-title { font-size: 1.6rem; font-weight: 500; margin-bottom: 24px; }
.section-title::after {
  content: ''; display: block; width: 44px; height: 2px; margin-top: 10px; background: var(--accent);
}
.status { color: var(--muted); padding-block: 12px; }

/* ---------- کارت‌های دسته‌بندی (تصویر نیمه‌ی بالا، محو به سمت پایین) ---------- */
.cat-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(2, 1fr);
}
.cat-card {
  position: relative; display: block;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  transition: border-color .2s, transform .2s;
}
.cat-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.cat-img {
  position: absolute; top: 0; inset-inline: 0;
  width: 100%; height: 62%;
  object-fit: cover;
  /* تصویر هرچه به پایین نزدیک‌تر شود کم‌رنگ‌تر می‌شود */
  -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 35%, transparent 100%);
}
.cat-title {
  position: absolute; inset-inline: 0; bottom: 0;
  padding: 16px 12px 18px;
  text-align: center; font-weight: 500; line-height: 1.6;
}

/* ---------- صفحه‌ی دسته‌بندی و محصول ---------- */
.view { padding-block: 24px 64px; min-height: 70vh; }
.back-link { display: inline-block; margin-bottom: 12px; padding-block: 8px; }
.view-title { font-size: 1.6rem; font-weight: 500; }
.view-sub { color: var(--muted); margin: 6px 0 24px; }

.product-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
}
.card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  transition: border-color .2s;
}
a.card:hover { text-decoration: none; border-color: var(--accent); }
.card-img {
  aspect-ratio: 4 / 3; width: 100%; height: auto; object-fit: cover;
  background: var(--surface);
}
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { font-size: 1.05rem; font-weight: 500; line-height: 1.6; }
.card-desc {
  color: var(--muted); font-size: .9rem; line-height: 1.8; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-price { font-weight: 700; margin-top: 8px; }
.card-price small { font-weight: 300; color: var(--muted); }
.card.is-soldout .card-img { opacity: .45; filter: grayscale(.6); }

/* صفحه‌ی محصول */
.pdp { max-width: 720px; margin-inline: auto; }
.pdp-img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--radius); background: var(--surface);
}
.pdp-title { font-size: 1.5rem; font-weight: 700; line-height: 1.6; margin-top: 18px; }
.pdp-desc { margin-top: 8px; margin-bottom: 20px; }
.pdp-desc p { color: var(--muted); margin-bottom: 6px; }

/* انتخابگرها (وزن، رست، نوع قهوه) */
.sel { margin-bottom: 14px; }
.sel-heads { display: flex; gap: 10px; }
.sel-head {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: 0;
  padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); text-align: start;
  transition: border-color .2s;
}
.sel-head:hover, .sel-head[aria-expanded="true"] { border-color: var(--accent); }
.sel-title { font-size: .8rem; color: var(--muted); line-height: 1.7; }
.sel-val { font-weight: 500; line-height: 1.7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.sel-val.is-empty { color: var(--muted); font-weight: 400; }

.sel-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 8px; padding: 8px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg);
}
.opt {
  min-height: 40px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
  transition: all .2s;
}
.opt:hover { border-color: var(--accent); color: var(--text); }
.opt.is-active { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 500; }
.kg-wrap { display: inline-flex; align-items: center; gap: 6px; }
.kg-input {
  width: 112px; min-height: 40px; padding: 6px 12px;
  font: inherit; font-size: 16px; color: var(--text); direction: ltr; text-align: center;
  background: var(--surface); border: 1px solid var(--accent); border-radius: 999px;
}
.kg-input:focus { outline: none; }
.kg-unit { color: var(--muted); font-size: .85rem; }

.pdp-buy {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line);
  display: grid; gap: 12px;
}
.pdp-price-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pdp-price-label { color: var(--muted); }
.pdp-price { font-size: 1.35rem; font-weight: 700; color: var(--accent); }
.pdp-error { color: var(--accent); font-size: .9rem; }

/* ---------- پشتیبانی / تماس ---------- */
.support-text { color: var(--muted); max-width: 56ch; margin-bottom: 18px; }
.support-links { display: flex; flex-wrap: wrap; gap: 10px; }
.support-links .btn { padding: 10px 22px; }
.contact-list { display: grid; gap: 12px; }
.contact-list li {
  display: flex; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.contact-list span { color: var(--muted); min-width: 84px; }
.contact-list em { font-style: normal; }
.about p { color: var(--muted); max-width: 62ch; margin-bottom: 12px; }

/* ---------- فوتر ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 32px; }
.footer-inner { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.socials { display: flex; gap: 18px; flex-wrap: wrap; }
.copy { color: var(--muted); font-size: .85rem; }

/* ---------- پنل‌های کشویی ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .6); }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 70;
  width: min(420px, 100%);
  background: var(--bg);
  border-right: 1px solid var(--line);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform .3s ease, visibility 0s linear .3s;
}
/* منوی کشویی از سمت راست */
.drawer-right {
  left: auto; right: 0; width: min(300px, 86%);
  border-right: 0; border-left: 1px solid var(--line);
  transform: translateX(100%);
}
.drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform .3s ease, visibility 0s;
}

.menu-links { display: flex; flex-direction: column; padding: 8px 16px; }
.menu-links a { color: var(--text); padding: 14px 4px; border-bottom: 1px solid var(--line); }
.menu-links a:hover { color: var(--accent); text-decoration: none; }

.drawer-view { display: flex; flex-direction: column; height: 100%; }
.checkout-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: 1.1rem; font-weight: 500; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }
.drawer-foot {
  padding: 16px; border-top: 1px solid var(--line); display: grid; gap: 12px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.total-row { display: flex; justify-content: space-between; align-items: center; }

.cart-items { display: grid; gap: 14px; }
.cart-item {
  display: grid; grid-template-columns: 64px 1fr; gap: 12px;
  padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.cart-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
.ci-name { font-size: .95rem; line-height: 1.6; }
.ci-opts { color: var(--muted); font-size: .8rem; line-height: 1.7; }
.ci-price { color: var(--muted); font-size: .85rem; }
.ci-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; }
.qty button { width: 40px; height: 40px; font-size: 1.1rem; }
.qty span { min-width: 24px; text-align: center; }
.ci-remove { color: var(--muted); font-size: .85rem; text-decoration: underline; padding: 8px; }
.ci-remove:hover { color: var(--accent); }

/* ---------- فرم ---------- */
.checkout-form label { display: block; margin: 14px 0 6px; font-size: .9rem; color: var(--muted); }
.checkout-form label:first-child { margin-top: 0; }
.checkout-form input,
.checkout-form textarea {
  width: 100%; padding: 12px 14px;
  font: inherit; font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
}
.checkout-form input:focus,
.checkout-form textarea:focus { outline: none; border-color: var(--accent); }
.note { margin-top: 12px; color: var(--muted); font-size: .85rem; }
.form-error { margin-top: 12px; color: var(--accent); font-size: .9rem; }

/* ---------- پیام کوتاه (Toast) ---------- */
.toast {
  position: fixed; top: calc(var(--header-h) + 12px); inset-inline: 16px; margin-inline: auto; z-index: 80;
  width: fit-content; max-width: calc(100% - 32px);
  padding: 10px 20px; border-radius: 999px;
  background: var(--accent); color: var(--bg); font-size: .9rem; font-weight: 500;
  opacity: 0; transform: translateY(-12px); pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.is-show { opacity: 1; transform: translateY(0); }

/* ---------- تبلت و دسکتاپ ---------- */
@media (min-width: 768px) {
  .container { padding-inline: 24px; }
  .nav-toggle { display: none; }

  .site-nav { display: flex; gap: 28px; }
  .site-nav a { color: var(--muted); }
  .site-nav a:hover { color: var(--accent); text-decoration: none; }

  .section { padding-block: 96px; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .footer-inner { flex-direction: row; align-items: center; justify-content: space-between; }
}
@media (min-width: 1000px) {
  .cat-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
