/* ============================================================
   ORVENA - Base layer
   Reset, document defaults, typography, RTL architecture.
   Consumes design/tokens.css only. No literal values allowed.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--tracking-body);
  color: var(--color-text);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
}

/* ------------------------------------------------------------
   RTL ARCHITECTURE
   The site is authored RTL-first. Every directional property in
   this codebase is a LOGICAL property, so a single dir="rtl"
   flip on <html> produces a correct mirror with no overrides.

   Allowed:   margin-inline / padding-inline / inset-inline /
              border-inline / text-align:start|end / inset-block
   Forbidden: margin-left, padding-right, left, right, float
              (except the four exceptions listed in
               design/DESIGN_DECISIONS.md D-06)
   ------------------------------------------------------------ */

/* Latin fragments inside RTL text (brand names, SKUs, sizes like "50ml")
   must be isolated or the bidi algorithm reorders adjacent punctuation. */
.bidi-isolate,
.brand-name,
.sku,
.volume { unicode-bidi: isolate; }

/* Prices are always Latin numerals, always LTR internally, but they sit
   in the RTL flow. isolate keeps the currency symbol glued to the number. */
.price, .price * {
  font-family: var(--font-numeric);
  font-variant-numeric: tabular-nums;
  unicode-bidi: isolate;
  direction: ltr;
}

/* ---------- Media ---------- */
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; border: 0; }

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: var(--fw-bold); }

h1, .t-h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); letter-spacing: var(--tracking-heading); }
h2, .t-h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: var(--tracking-heading); }
h3, .t-h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); letter-spacing: var(--tracking-heading); }
h4, .t-h4 { font-size: var(--fs-h4); line-height: var(--lh-h4); font-weight: var(--fw-semibold); }

.t-display {
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--tracking-display);
  font-weight: var(--fw-bold);
}
.t-body-lg { font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); }
.t-body    { font-size: var(--fs-body);    line-height: var(--lh-body); }
.t-body-sm { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); }
.t-caption { font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--color-text-secondary); }

.t-eyebrow {
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  font-weight: var(--fw-semibold);
  color: var(--color-accent);
}
/* Arabic and Persian have no uppercase. Forcing text-transform does
   nothing to the glyphs but breaks the visual rhythm the eyebrow relies
   on, so RTL eyebrows switch to weight + colour instead of tracking. */
:lang(ar) .t-eyebrow, :lang(fa) .t-eyebrow {
  text-transform: none;
  letter-spacing: 0;
  font-weight: var(--fw-bold);
  font-size: var(--fs-body-sm);
}

p { margin: 0 0 var(--space-5); }
p:last-child { margin-bottom: 0; }

.t-muted     { color: var(--color-text-muted); }
.t-secondary { color: var(--color-text-secondary); }
.t-center    { text-align: center; }
.t-start     { text-align: start; }
.t-end       { text-align: end; }
.t-balance   { text-wrap: balance; }

/* ---------- Links ---------- */
a { color: inherit; text-decoration: none; }
.link {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 0.28em;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--color-border-strong);
  transition: text-decoration-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.link:hover { color: var(--color-accent); text-decoration-color: var(--color-accent); }

/* ---------- Lists ---------- */
ul, ol { margin: 0; padding: 0; list-style: none; }
.list-bullets { list-style: disc; padding-inline-start: var(--space-6); }
.list-bullets li { margin-bottom: var(--space-3); }

/* ---------- Forms baseline ---------- */
button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}
button { background: none; border: 0; cursor: pointer; }
textarea { resize: vertical; }

/* ---------- Focus ----------
   Visible, single, consistent. Never removed. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- Utility ---------- */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  inset-block-start: var(--space-3);
  inset-inline-start: var(--space-3);
  z-index: var(--z-toast);
  padding: var(--space-3) var(--space-5);
  background: var(--color-ink);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md);
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(0); }

.no-scroll { overflow: hidden; }

.clamp-1, .clamp-2, .clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-1 { -webkit-line-clamp: 1; line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; line-clamp: 3; }

.divider {
  height: 1px;
  background: var(--color-border);
  border: 0;
  margin: 0;
}

/* ---------- Directional icons ----------
   Chevrons, arrows and carets carry meaning tied to reading order.
   In RTL they must physically mirror. Non-directional icons (search,
   heart, bag, user) must NOT - mirroring them looks broken.
   Add .icon-dir to anything that should flip. */
[dir="rtl"] .icon-dir { transform: scaleX(-1); }

/* Scrollbar-adjacent detail: carousels track logical direction */
.scroll-x {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x > * { scroll-snap-align: start; flex: 0 0 auto; }

::selection { background: var(--color-accent-soft); color: var(--color-ink); }


/* ------------------------------------------------------------
   The hidden attribute must actually hide.
   Any component rule that sets `display` (`.navbar__item` is
   `display: flex`) has the same specificity as a bare
   `[hidden]` rule and, being later in the cascade, wins - so
   `el.hidden = true` silently does nothing and the element
   keeps its space. The priority+ nav overflow looked like a
   measurement bug for exactly this reason.
   ------------------------------------------------------------ */
[hidden] { display: none !important; }
