/* ==========================================================================
   SALONI — Base: reset, typography, layout primitives
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Lenis drives scrolling; this is the no-JS fallback */
}

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--ff-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color 420ms var(--e-out), color 420ms var(--e-out);
}

/* Latin swaps the face pair; Arabic is the default resolved in tokens.css */
html[lang="en"] {
  --ff-display: var(--ff-display-en);
  --ff-body:    var(--ff-body-en);
}

img, svg, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }

input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

ul, ol { list-style: none; padding: 0; }

:target { scroll-margin-block-start: 6rem; }

/* ---- headings -------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--ff-display);
  font-weight: 600;
  line-height: var(--lh-head);
  text-wrap: balance;
  letter-spacing: -0.005em;
}
/* Tajawal ships 400/500/700/800 — there is no 600, and a browser asked for
   one picks 500 and leaves Arabic display looking underset beside the Latin
   pair. Arabic headings take 700 outright. */
html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3,
html[lang="ar"] h4 { letter-spacing: 0; font-weight: 700; }
html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3 { line-height: calc(var(--lh-head) + .06); }

h1 { font-size: var(--fs-h1); line-height: var(--lh-display); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { text-wrap: pretty; }

a { color: inherit; text-decoration: none; }

strong, b { font-weight: 700; }

/* ---- selection + focus ------------------------------------------------ */
::selection { background: var(--accent); color: var(--accent-on); }

:focus { outline: none; }
:focus-visible {
  outline: var(--focus-w) solid var(--accent);
  outline-offset: var(--focus-off);
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  inset-block-start: -100%;
  inset-inline-start: var(--s-4);
  z-index: 200;
  padding: var(--s-3) var(--s-5);
  background: var(--accent);
  color: var(--accent-on);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.skip-link:focus-visible { inset-block-start: var(--s-4); }

/* ---- layout primitives ------------------------------------------------ */
.wrap {
  inline-size: min(100% - (var(--gutter) * 2), var(--maxw));
  margin-inline: auto;
}
.wrap--wide { inline-size: min(100% - (var(--gutter) * 2), var(--maxw-wide)); }
.wrap--flush { inline-size: min(100%, var(--maxw-wide)); margin-inline: auto; }

.section { padding-block: var(--section-pad); position: relative; }
.section--field { background: var(--field); color: var(--on-field); }
.section--sunk  { background: var(--bg-sunk); }
.section--tight { padding-block: calc(var(--section-pad) * .62); }

.stack > * + * { margin-block-start: var(--flow, var(--s-4)); }

.measure    { max-inline-size: var(--measure); }
html[lang="ar"] .measure { max-inline-size: var(--measure-ar); }

/* ---- the section header rhythm (more space above than below) ---------- */
.sec-head { margin-block-end: clamp(2.5rem, 5vw, 4.25rem); }
.sec-head__title { margin-block-start: var(--s-4); }
.sec-head__lead  { margin-block-start: var(--s-5); color: var(--fg-2); font-size: var(--fs-lead); }
.section--field .sec-head__lead { color: var(--on-field-dim); }

/* ---- eyebrow label + seed rule ---------------------------------------- */
.label {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  font-family: var(--ff-body);
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--accent);
}
/* Arabic must never be letter-spaced — it breaks the joins (DESIGN.md §3) */
html[lang="ar"] .label {
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--fs-xs);
  font-weight: 700;
}

.label__mark { flex: none; inline-size: 1.05em; block-size: 1.05em; color: var(--accent); }

.seed-rule {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--line-2);
}
.seed-rule::before {
  content: "";
  inline-size: 5px; block-size: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.seed-rule::after {
  content: "";
  block-size: var(--hair);
  flex: 1;
  background: currentColor;
}

/* ---- photography (DESIGN.md §8) -----------------------------------------
   Natural colour. The build shipped with every photograph duotoned into the
   palette; that flattened the tonal range until the pictures read as a pink
   filter laid over them rather than as photographs. Cohesion with the field
   now comes from COMPOSITING — a scrim in the field colour over the edges,
   see .shot--dissolve — instead of from staining the pixels, so the subject
   keeps its own light and the rose still owns the region around it.       */
.shot {
  position: relative;
  isolation: isolate;
  background: var(--bg-sunk);
  overflow: hidden;
}
.shot > img {
  inline-size: 100%; block-size: 100%;
  object-fit: cover;
  display: block;
  /* a grade, not a wash: barely enough to keep stock photography from
     looking colder than the page around it */
  filter: saturate(1.05) contrast(1.03);
}
/* full-brightness photographs glare against the night ground — sit them
   back so they read as lit objects in a dark room, not as light sources */
[data-theme="dark"] .shot > img { filter: saturate(.94) contrast(1.02) brightness(.82); }

/* the edge treatment that replaces the duotone: the picture dissolves into
   the field it sits on. --scrim-to is set per direction in rtl.css.      */
.shot--dissolve::after {
  content: "";
  position: absolute; inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(to bottom, var(--field) 0%, transparent 26%),
    linear-gradient(to var(--scrim-to, right), transparent 56%, var(--field) 100%);
}

/* ---- utility ----------------------------------------------------------- */
.vh {
  position: absolute !important;
  inline-size: 1px; block-size: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap; border: 0;
}
.nums { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.center { text-align: center; }
.flow-lg { --flow: var(--s-5); }

/* ---- motion defaults + reduced motion --------------------------------- */
/* Content is visible by default. GSAP's .from() sets its own start states,
   so nothing is hidden by CSS — a no-JS page is fully readable.           */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .vine-path, .vine-leaf, .vine-bloom,
  .hero__trace path, .feature__icon { stroke-dashoffset: 0 !important; opacity: 1 !important; }
  .petals { display: none; }
}
