/* ==========================================================================
   M_S Perfumes — base: design tokens, reset, typography, buttons, helpers
   Palette: white canvas · near-black ink · deep red (buttons, ticker, sale only)
   ========================================================================== */

:root {
  /* colour */
  --white: #ffffff;
  --ink: #0f0f11;            /* near-black: text, footer, dark surfaces */
  --ink-soft: #1b1b20;
  --text: #17171a;
  --muted: #6c6c74;
  --line: #e9e9ec;           /* hairline borders */
  --canvas: #ffffff;
  --tile: #f4f3f1;           /* light product / tile background */
  --red: #a80f1d;            /* deep red: primary buttons, sale labels */
  --red-hover: #8a0b17;
  --red-deep: #6f0a14;       /* announcement ticker */

  /* type: Poppins draws the Latin letters (brand and product names, digits) and Cairo
     the Arabic ones, so one stack serves both languages */
  --font: "Poppins", "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, Roboto, Arial, sans-serif;

  /* reading direction as a number: 1 left-to-right, -1 right-to-left (see below).
     Multiply horizontal offsets by it, e.g. translateX(calc(8px * var(--dx))). */
  --dx: 1;

  /* layout */
  --container: 1280px;
  --gutter: 16px;
  --radius: 14px;
  --radius-pill: 999px;

  /* motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 0.18s;
  --t: 0.35s;

  /* stacking */
  --z-suggest: 45;           /* search suggestions: above the page, below the sticky header */
  --z-header: 50;
  --z-overlay: 90;
  --z-drawer: 100;
  --z-toast: 110;
}

@media (min-width: 768px)  { :root { --gutter: 28px; } }
@media (min-width: 1200px) { :root { --gutter: 40px; } }

:root[dir="rtl"] { --dx: -1; }

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 78px;        /* one-row sticky header on mobile */
}

@media (min-width: 900px) {
  html { scroll-padding-top: 130px; }
  html[lang="ar"] { scroll-padding-top: 136px; }   /* the Arabic nav row stands a little taller */
}

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-locked { overflow: hidden; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p, figure { margin: 0; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  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: 200;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  transition: top var(--t-fast);
}
.skip-link:focus { top: 12px; }

/* ---------- layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1.7rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.2;
  white-space: nowrap;
  transition:
    background-color var(--t-fast) ease,
    color var(--t-fast) ease,
    border-color var(--t-fast) ease,
    transform var(--t-fast) var(--ease),
    box-shadow var(--t) var(--ease);
}

.btn--primary { background: var(--red); color: #fff; }
.btn--primary:hover {
  background: var(--red-hover);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px -12px rgba(168, 15, 29, 0.7);
}
.btn--primary:active { transform: translateY(0); box-shadow: none; }

.btn--outline { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn--outline:hover { background: var(--ink); color: #fff; }

.btn--block { width: 100%; }
.btn svg { width: 1.05em; height: 1.05em; flex: none; }

/* disabled (Checkout while the cart is empty): flat grey, no hover lift */
.btn:disabled,
.btn:disabled:hover,
.btn:disabled:active {
  background: #e7e7ea;
  border-color: transparent;
  color: #9a9aa2;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

/* ---------- Arabic (the default language) ----------
   Direction is handled with logical properties (inline-start / inline-end) across
   the stylesheets; only things that cannot be logical (transforms, gradients) get
   a [dir="rtl"] rule next to the component. Typography is handled here. */
html[lang="ar"] { font-size: 106.25%; }              /* Arabic needs a little more size to read as comfortably */
html[lang="ar"] body { font-size: 16px; line-height: 1.8; }

/* Arabic letters join, so letter-spacing would pull the words apart (and a negative
   one would crush them), and there are no capitals to style. Latin brand and
   product names are marked lang="en" and keep their spaced capitals. */
html[lang="ar"] .ticker,
html[lang="ar"] .eyebrow,
html[lang="ar"] .hero__eyebrow:not([lang="en"]),
html[lang="ar"] .hero__title,
html[lang="ar"] .section__title,
html[lang="ar"] .sale-pill,
html[lang="ar"] .collection__label,
html[lang="ar"] .footer__title,
html[lang="ar"] .site-nav__link,
html[lang="ar"] .btn {
  letter-spacing: 0;
  text-transform: none;
}

/* a returning English visitor: keep the (Arabic) first paint hidden for a moment,
   until js/i18n.js has translated it; the inline script in <head> sets and clears this */
.i18n-pending body { visibility: hidden; }

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