/* ==========================================================
   فروشگاه کیکپ‌خونه — استایل اصلی
   فهرست: ۱) متغیرهای رنگ  ۲) پایه  ۳) هدر و لوگو  ۴) صفحه اصلی
          ۵) محصولات  ۶) وبلاگ و فوتر  ۷) سبد خرید  ۸) ریسپانسیو
   ========================================================== */

/* ---------- ۱) متغیرهای رنگ (تاریک پیش‌فرض، روشن در پایین) ---------- */
:root,
:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #151b23;
  --card: #1b222c;
  --ink: #e8edf3;
  --mute: #8d99a8;
  --line: #27303b;
  --acc: #2dd4bf;
  --accink: #04201c;
  --key: #f5a524;
  --price: #f5a524;
  --pic1: #222b37;
  --pic2: #2c3846;
  --ok: #4ade80;
  --err: #ff8a8a;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #eef1f5;
  --surface: #ffffff;
  --card: #ffffff;
  --ink: #151a22;
  --mute: #5c6776;
  --line: #d9dfe7;
  --acc: #0f766e;
  --accink: #ffffff;
  --key: #f5a524;
  --price: #b45309;
  --pic1: #e8edf3;
  --pic2: #d3dbe5;
  --err: #c0392b;
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef1f5;
    --surface: #ffffff;
    --card: #ffffff;
    --ink: #151a22;
    --mute: #5c6776;
    --line: #d9dfe7;
    --acc: #0f766e;
    --accink: #ffffff;
    --price: #b45309;
    --pic1: #e8edf3;
    --pic2: #d3dbe5;
    --err: #c0392b;
            color-scheme: light;
  }
}

/* ---------- ۲) پایه ---------- */
:root {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Vazirmatn, Tahoma, sans-serif;
  line-height: 1.8;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
:focus-visible { outline: 2px solid var(--key); outline-offset: 2px; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--mute); }

h2 { font-size: 22px; margin: 40px 0 14px; }

.cta {
  display: inline-block;
  background: var(--key);
  color: #2b1700;
  border: 0;
  border-radius: 10px;
  padding: 10px 22px;
  font-weight: 800;
  cursor: pointer;
}
.cta.full { width: 100%; }

/* ---------- ۳) هدر و لوگو ---------- */
header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.bar { display: flex; align-items: center; gap: 16px; height: 64px; }

.logo { display: flex; align-items: center; gap: 10px; }
.logo .mark { width: 40px; height: 40px; flex: none; border-radius: 10px; }
.logo .words { display: flex; flex-direction: column; line-height: 1.15; }
.logo b { font-size: 19px; font-weight: 800; }
.logo b span { color: var(--acc); }
.logo small {
  font-size: 9px;
  letter-spacing: 2.5px;
  color: var(--mute);
  direction: ltr;
  text-align: right;
}

nav {
  display: flex;
  gap: 18px;
  margin-inline-start: auto;
  color: var(--mute);
  font-size: 14px;
}
nav a:hover { color: var(--ink); }

.acts { display: flex; align-items: center; gap: 8px; }

.tbtn {
  width: 36px;
  height: 34px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
}

.cartbtn {
  background: var(--acc);
  color: var(--accink);
  border: 0;
  border-radius: 10px;
  padding: 6px 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- ۴) صفحه اصلی ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: center;
  padding: 48px 0 32px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.4;
  margin: 0 0 12px;
  font-weight: 800;
}
.hero p { color: var(--mute); max-width: 46ch; margin: 0 0 20px; }

.keycap {
  justify-self: center;
  width: 200px;
  height: 200px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: linear-gradient(160deg, #ffd58a, var(--key));
  box-shadow: 0 18px 0 #b77a1e, 0 36px 50px #0007;
  font-size: 84px;
  font-weight: 800;
  color: #2b1700;
  transform: rotate(-6deg);
}

/* ---------- ۵) محصولات ---------- */
.cats { display: flex; flex-wrap: wrap; gap: 10px; }

.cat {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 18px;
  cursor: pointer;
}
.cat[aria-pressed="true"] {
  background: var(--acc);
  border-color: var(--acc);
  color: var(--accink);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.product {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.product .pic {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--pic1), var(--pic2));
  font-size: 56px;
}
.product b { font-size: 14px; line-height: 1.6; min-height: 2.6em; }
.price { color: var(--price); font-weight: 800; }
.product button {
  background: var(--acc);
  color: var(--accink);
  border: 0;
  border-radius: 10px;
  padding: 7px;
  cursor: pointer;
}
.product button:hover { filter: brightness(1.12); }

/* ---------- ۶) وبلاگ و فوتر ---------- */
.blog { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.post {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.post small { color: var(--mute); }

footer {
  margin-top: 56px;
  padding: 28px 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  color: var(--mute);
  font-size: 14px;
}
.cols { display: flex; flex-wrap: wrap; gap: 32px; }
.cols div { min-width: 160px; }

/* ---------- ۷) سبد خرید و فرم‌ها ---------- */
.shade { position: fixed; inset: 0; z-index: 8; display: none; background: #000a; }
.shade.on { display: block; }

.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 9;
  width: min(400px, 92vw);
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px));
  overflow: auto;
  background: var(--surface);
  transform: translateX(-105%);
  visibility: hidden;
  transition: transform 0.25s, visibility 0.25s;
}
.drawer.on { transform: none; visibility: visible; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.x { background: none; border: 0; color: var(--ink); font-size: 24px; cursor: pointer; }

.row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row span { flex: 1; font-size: 14px; }
.row .price { font-size: 13px; }

.qty { display: flex; align-items: center; gap: 6px; }
.qty button {
  width: 26px;
  height: 26px;
  background: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.total { display: flex; justify-content: space-between; margin: 12px 0; font-weight: 800; }

label { display: block; margin-top: 10px; font-size: 13px; color: var(--mute); }
input, textarea, select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.error { min-height: 1.4em; font-size: 13px; color: var(--err); }
.note { margin-top: 10px; font-size: 12px; color: var(--mute); }
.ghost {
  margin-top: 10px;
  padding: 4px 12px;
  background: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.success { padding: 30px 0; text-align: center; }
.success h3 { color: var(--ok); }
.code {
  display: inline-block;
  padding: 6px 16px;
  background: var(--bg);
  border: 1px dashed var(--ok);
  border-radius: 10px;
  font-weight: 800;
  letter-spacing: 1px;
}

/* ---------- ۸) ریسپانسیو و حرکت ---------- */
@media (max-width: 700px) {
  .hero { grid-template-columns: 1fr; }
  .keycap { order: -1; width: 140px; height: 140px; font-size: 56px; }
  nav { display: none; }
  .acts { margin-inline-start: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .drawer { transition: none; }
}
