/* ==========================================================
   داروچین — shared foundation
   Every home sets its own tokens in its page stylesheet
   (daroochin-apothecary.css / daroochin-vitality.css / daroochin-derma.css).
   This file only reads tokens; it never decides the look.
   ========================================================== */

:root {
  --bg: #f6f4ef;
  --surface: #ece8df;
  --surface-2: #e2dccf;
  --ink: #1d2b30;
  --muted: #55636a;
  --accent: #0d7480;
  --accent-ink: #ffffff;
  --danger: #b3261e;
  --radius: 14px;
  --radius-sm: 10px;
  --container: 1320px;
  --gutter: clamp(16px, 3vw, 32px);
  --font-display: system-ui, sans-serif;
  --font-text: system-ui, sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --shadow-float: 0 18px 50px -12px rgba(15, 25, 30, .28), 0 4px 12px -4px rgba(15, 25, 30, .12);
  --step-small: 0.875rem;
  --step-body: 1rem;
  --step-lead: clamp(1.125rem, 1.02rem + .4vw, 1.375rem);
  --step-head: clamp(1.75rem, 1.2rem + 2.2vw, 3rem);
  --step-display: clamp(2.5rem, 1.4rem + 4.6vw, 5.5rem);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-text);
  font-size: var(--step-body);
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.25; font-weight: 700; text-wrap: balance; }
p { text-wrap: pretty; }
[x-cloak] { display: none !important; }

::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
input::placeholder { color: var(--muted); opacity: 1; }
html { scrollbar-color: color-mix(in srgb, var(--ink) 35%, transparent) transparent; }
::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink) 30%, transparent); border-radius: 10px; border: 2px solid var(--bg); }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 999; padding: 10px 16px; background: var(--ink); color: var(--bg); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.icon { width: 22px; height: 22px; flex-shrink: 0; }
.icon-sm { width: 18px; height: 18px; flex-shrink: 0; }
.icon-lg { width: 28px; height: 28px; flex-shrink: 0; }

/* ---------- buttons (shape comes from tokens) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  border-radius: var(--btn-radius, var(--radius-sm));
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 0.975rem; white-space: nowrap;
  transition: transform .25s var(--ease-out), background-color .25s, color .25s, box-shadow .25s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn--ink { background: var(--ink); color: var(--bg); }
.btn--soft { background: var(--surface); color: var(--ink); }
.btn--block { width: 100%; }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: .9rem; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%;
  transition: background-color .2s, transform .2s var(--ease-out);
}
.icon-btn:hover { background: var(--surface); }
.icon-btn:active { transform: scale(.94); }
.badge-count {
  position: absolute; top: 2px; inset-inline-end: 0;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink);
  font-size: .72rem; font-weight: 700; line-height: 20px; text-align: center;
}

.link-arrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.link-arrow svg { transition: transform .3s var(--ease-out); }
.link-arrow:hover svg { transform: translateX(-4px); }

/* ---------- price ---------- */
.price { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.price strong { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.price small { font-size: .8rem; color: var(--muted); }
.price del { font-size: .875rem; color: var(--muted); }
.off-tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--danger); color: #fff; font-size: .78rem; font-weight: 800; }

/* ---------- reveal (content is visible unless JS runs) ---------- */
.js [data-reveal] > * { opacity: 0; transform: translateY(24px); }
.js [data-reveal].is-in > * {
  opacity: 1; transform: none;
  transition: opacity .7s var(--ease-out), transform .9s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 75ms);
}

/* ---------- swiper rtl helpers ---------- */
.swiper { overflow: hidden; }
.swiper-slide { height: auto; }
.slider-nav { display: flex; gap: 8px; }
.slider-nav button {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); color: var(--ink); transition: background-color .2s, color .2s, transform .2s;
}
.slider-nav button:hover { background: var(--ink); color: var(--bg); }
.slider-nav button.swiper-button-disabled { opacity: .35; pointer-events: none; }
.slider-dots { display: flex; gap: 6px; justify-content: center; }
.slider-dots .swiper-pagination-bullet { width: 8px; height: 8px; margin: 0 !important; background: var(--ink); opacity: .25; border-radius: 8px; transition: width .3s var(--ease-out), opacity .3s; }
.slider-dots .swiper-pagination-bullet-active { width: 26px; opacity: 1; }

/* ---------- overlay + drawers ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(12, 18, 20, .45);
}
.drawer {
  position: fixed; top: 0; bottom: 0; z-index: 901;
  width: min(420px, 92vw);
  background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-float);
}
.drawer--start { right: 0; }
.drawer--end { left: 0; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; background: var(--surface); }
.drawer__head h2 { font-size: 1.25rem; }
.drawer__body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.drawer__foot { padding: 18px 22px 22px; background: var(--surface); display: grid; gap: 14px; }

.ship-meter { display: grid; gap: 8px; font-size: .9rem; }
.ship-meter__bar { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.ship-meter__bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .5s var(--ease-out); }

.cart-line { display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; }
.cart-line + .cart-line { border-top: 2px dotted color-mix(in srgb, var(--ink) 18%, transparent); }
.cart-line img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface); }
.cart-line h3 { font-family: var(--font-text); font-size: .95rem; font-weight: 700; line-height: 1.5; }
.cart-line .price strong { font-size: 1rem; }
.qty { display: inline-flex; align-items: center; gap: 2px; background: var(--surface); border-radius: 999px; padding: 3px; }
.qty button { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; transition: background-color .2s; }
.qty button:hover { background: var(--bg); }
.qty output { min-width: 26px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.empty-state { text-align: center; padding: 48px 12px; display: grid; gap: 14px; justify-items: center; }
.empty-state svg { width: 72px; height: 72px; color: var(--muted); }
.empty-state p { color: var(--muted); }

.toast {
  position: fixed; z-index: 950; bottom: 24px; left: 50%;
  translate: -50% 0;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 12px;
  background: var(--ink); color: var(--bg);
  font-size: .95rem; font-weight: 600;
  box-shadow: var(--shadow-float);
  width: max-content;
  max-width: calc(100vw - 32px);
}

/* mobile menu */
.m-nav a, .m-nav summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 4px; font-weight: 600; cursor: pointer; list-style: none;
}
.m-nav summary::-webkit-details-marker { display: none; }
.m-nav details[open] summary svg { rotate: 180deg; }
.m-nav details ul { padding: 0 12px 10px; }
.m-nav details ul a { font-weight: 500; color: var(--muted); padding: 10px 4px; }
.m-nav > li + li { border-top: 2px dotted color-mix(in srgb, var(--ink) 14%, transparent); }

/* ---------- transitions used with x-transition ---------- */
.t-fade-enter { transition: opacity .3s ease; }
.t-slide-enter { transition: transform .45s var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* drawer/x-transition states */
.opacity-0 { opacity: 0; }
.drawer-out-end { transform: translateX(-100%); }
.drawer-out-start { transform: translateX(100%); }
section[id], article[id] { scroll-margin-top: 150px; }

/* demo-page previews: show everything at once */
.is-preview [data-reveal] > * { opacity: 1 !important; transform: none !important; }
.is-preview { scrollbar-width: none; }
.is-preview::-webkit-scrollbar { display: none; }
