/* ==========================================================================
   Smart Miswak — Base
   Design tokens, resets, typography, layout primitives
   Arabic (RTL) is the default writing direction; French (LTR) mirrors via
   logical properties. See DESIGN.md for the full rationale.
   ========================================================================== */

:root{
  /* ---- Color — restrained tonal-neutral strategy, OKLCH ----
     Reference: Adanola/Vuori tonal-earth grids — mostly neutral, one
     considered green used sparingly, one warm accent that owns every CTA.
     Not a "committed full-bleed color" system; color is used deliberately,
     in small confident doses, the way the reference brands actually do. */
  --ink:         oklch(19% 0.012 100);
  --paper:       oklch(98% 0.006 90);
  --paper-2:     oklch(95% 0.008 88);
  --stone:       oklch(87% 0.012 80);
  --stone-2:     oklch(72% 0.014 80);
  --sage-900:    oklch(26% 0.035 145);
  --sage-700:    oklch(37% 0.05 145);
  --sage-500:    oklch(52% 0.06 145);
  --sage-300:    oklch(78% 0.035 140);
  --clay:        oklch(62% 0.1 48);
  --clay-700:    oklch(50% 0.1 44);
  --hairline:    oklch(80% 0.015 80);

  --color-bg:          var(--paper);
  --color-surface:     var(--paper-2);
  --color-text:        var(--ink);
  --color-text-muted:  oklch(46% 0.012 100);
  --color-border:      var(--stone);
  --color-accent:      var(--clay);
  --color-accent-ink:  var(--clay-700);

  --text-on-dark:        oklch(97% 0.008 90);
  --text-on-dark-muted:  oklch(82% 0.014 90);

  /* ---- Type — single family, hierarchy from weight + scale + tracking ----
     Alexandria: genuine Arabic+Latin geometric sans (no Latin-with-Arabic-
     fallback seam). One committed family, not a display/body pair — matches
     the reference brands' single-grotesk-system approach. */
  --font-display: "Alexandria", -apple-system, "Segoe UI", sans-serif;
  --font-body: "Alexandria", -apple-system, "Segoe UI", sans-serif;

  /* ---- Space (fluid, generous) ---- */
  --space-1: clamp(4px, 0.3vw, 6px);
  --space-2: clamp(8px, 0.6vw, 10px);
  --space-3: clamp(12px, 1vw, 16px);
  --space-4: clamp(18px, 1.6vw, 22px);
  --space-5: clamp(26px, 2.6vw, 34px);
  --space-6: clamp(34px, 3.6vw, 52px);
  --space-7: clamp(48px, 5.6vw, 76px);
  --space-8: clamp(64px, 7.6vw, 108px);
  --space-9: clamp(84px, 9.6vw, 152px);
  --space-10: clamp(108px, 12vw, 196px);

  /* One radius value per component type — consistency, not chaos.
     Content blocks (panels, cards, tables) stay small/architectural.
     Buttons alone get the Apple-style pill — the one deliberate contrast. */
  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-lg: 4px;
  --radius-pill: 980px;

  --max-width: 1320px;
  --max-width-narrow: 720px;

  --shadow-soft: 0 4px 24px oklch(19% 0.012 100 / 0.06);
  --shadow-lift: 0 16px 48px oklch(19% 0.012 100 / 0.12);

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
}

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

html{ scroll-behavior: smooth; }

html[dir="rtl"] body{ font-family: var(--font-body); }
html[dir="ltr"] body{ font-family: var(--font-body); }

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

img{ max-width: 100%; display: block; }

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

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

button{
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea{
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

h1, h2, h3, h4{
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.08;
  margin: 0 0 var(--space-4);
  letter-spacing: -0.01em;
}

h1{ font-size: clamp(2.5rem, 3.8vw + 1.2rem, 5rem); }
h2{ font-size: clamp(1.9rem, 2vw + 1.1rem, 3rem); }
h3{ font-size: clamp(1.35rem, 1vw + 1rem, 1.8rem); font-weight: 700; }
h4{ font-size: 1.15rem; font-weight: 700; }

/* French/Latin headings read better with real caps tracking than Arabic does */
html[lang="fr"] h1, html[lang="fr"] h2{ text-transform: uppercase; letter-spacing: 0.005em; }

p{ margin: 0 0 var(--space-4); color: var(--color-text); max-width: 62ch; }

.text-muted{ color: var(--color-text-muted); }

.eyebrow{
  display: block;
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--sage-700);
  margin-block-end: var(--space-2);
}
html[dir="rtl"] .eyebrow{ letter-spacing: 0.02em; text-transform: none; }

.container{
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.container-narrow{
  max-width: var(--max-width-narrow);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

section{ padding-block: var(--space-9); }

@media (max-width: 720px){
  section{ padding-block: var(--space-7); }
  .container, .container-narrow{ padding-inline: var(--space-4); }
}

.visually-hidden{
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

::selection{ background: var(--sage-700); color: var(--text-on-dark); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible{
  outline: 2px solid var(--sage-500);
  outline-offset: 2px;
}

/* ---------- Reveal-on-load motion ---------- */
[data-reveal]{
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .7s var(--ease-out-expo), transform .7s var(--ease-out-expo);
}
[data-reveal].is-visible{ opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  [data-reveal]{ opacity: 1; transform: none; transition: none; }
  *{ animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
