/* ═══════════════════════════════════════════════════════════════════════════════
   base.css — reset, element defaults, and the type scale.
   Uses CSS logical properties throughout so RTL mirrors with no override rules.
   ═══════════════════════════════════════════════════════════════════════════════ */

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

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* The sticky nav pill would otherwise cover an anchored heading. */
  scroll-padding-block-start: calc(var(--nav-height) + var(--s3));
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  /* An artifact-style host paints its own ground, and a transparent body borrows
     the wrong theme — so always paint explicitly. */
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ff-sans);
  font-size: var(--fs-body-md);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* No page should ever scroll sideways; wide children get their own scroller. */
  overflow-x: hidden;
}

/* Arabic renders wider and has no italic. Prevent fake-bold on display text,
   where synthesis is most visible. */
[lang="ar"] body { font-synthesis-weight: none; }
[lang="ar"] i, [lang="ar"] em { font-style: normal; font-weight: var(--fw-medium); }

/* The inline <symbol> sprite: takes no space and never paints. A class, not a
   style attribute — the CSP is style-src 'self' with no 'unsafe-inline'. */
.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

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

img { background: var(--bg-lift); }

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

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

ul, ol { list-style: none; }

strong, b { font-weight: var(--fw-bold); }

hr {
  border: 0;
  border-block-start: 1px solid var(--hairline);
}

::selection {
  background: var(--accent);
  color: var(--accent-on);
}

/* ── Focus ────────────────────────────────────────────────────────────────────
   Ink, never accent-on-accent: a yellow ring on a yellow button is invisible.
   :focus-visible only, so mouse users never see it. */
:focus-visible {
  outline: var(--focus-ring) solid var(--ink);
  outline-offset: 2px;
  border-radius: var(--r2);
}

.skip-link {
  position: absolute;
  inset-block-start: var(--s2);
  inset-inline-start: var(--s2);
  z-index: 200;
  padding: var(--s2) var(--s3);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--r3);
  box-shadow: var(--shadow-dialog);
  font-weight: var(--fw-bold);
  transform: translateY(-200%);
}
.skip-link:focus-visible { transform: none; }

/* ── Type scale ───────────────────────────────────────────────────────────────
   Mirrors app_typography_extension.dart. Note where --text-faint-strong is used:
   anything below 18.66px bold must not use the weaker faint token (see the a11y
   note in tokens.css). */

.t-display-xl,
.t-display-lg,
.t-display-md {
  font-weight: var(--fw-black);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-display);
  text-wrap: balance;
}
.t-display-xl { font-size: var(--fs-display-xl); }
.t-display-lg { font-size: var(--fs-display-lg); }
.t-display-md { font-size: var(--fs-display-md); font-weight: var(--fw-bold); }

/* Landing-page section titles: the heaviest weight, set tight, like the
   headlines on the store screenshots. */
.t-section {
  font-size: var(--fs-section);
  font-weight: var(--fw-black);
  line-height: 1.02;
  letter-spacing: -.035em;
  text-wrap: balance;
}
[lang="ar"] .t-section { line-height: var(--lh-tight); letter-spacing: 0; }

.t-heading-xl,
.t-heading-lg {
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  text-wrap: balance;
}
.t-heading-xl { font-size: var(--fs-heading-xl); }
.t-heading-lg { font-size: var(--fs-heading-lg); }

.t-heading-md {
  font-size: var(--fs-heading-md);
  font-weight: var(--fw-medium);
  line-height: 1.33;
}
.t-heading-sm {
  font-size: var(--fs-heading-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
}

.t-title-lg { font-size: var(--fs-title-lg); font-weight: var(--fw-semibold); line-height: 1.4; }
.t-title-md { font-size: var(--fs-title-md); font-weight: var(--fw-semibold); line-height: 1.5; }
.t-title-sm { font-size: var(--fs-title-sm); font-weight: var(--fw-semibold); line-height: 1.5; }

.t-body-lg { font-size: var(--fs-body-lg); line-height: var(--lh-body); }
.t-body-md { font-size: var(--fs-body-md); line-height: var(--lh-body); }
.t-body-sm { font-size: var(--fs-body-sm); line-height: 1.5; }

.t-label {
  font-size: var(--fs-label-md);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-label);
}

.t-caption {
  font-size: var(--fs-caption);
  line-height: 1.45;
  letter-spacing: var(--ls-caption);
  color: var(--text-faint-strong);
}

/* Colour helpers. --text-faint is large-text-only by contrast; the small classes
   above already hard-code the accessible variant. */
.dim { color: var(--text-faint-strong); }
.dim-lg { color: var(--text-faint); }

/* An eyebrow above a section heading: a small pill with the accent dot.
   Uppercase is meaningless in Arabic, and the Arabic strings are already
   written in their final form. align-self keeps the pill its own width inside
   a stretching flex column; a centred head re-centres it. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: var(--s2);
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: var(--card);
  border: 1px solid var(--hairline-strong);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink);
}
.eyebrow::before {
  content: "";
  inline-size: 8px;
  block-size: 8px;
  border-radius: var(--r-pill);
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
[lang="ar"] .eyebrow {
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--fs-body-sm);
}
