/*
 * shajara.sa: the pages the stores and the invitation links need (G3.6, G9.5).
 *
 * Every value is the app's: the design handoff's tokens (`assets/shajara.css`) in light, and
 * `lib/colors.dark.ts` in dark, where the shadows go black as R6 there says. The hero is the
 * welcome screen's (`app/(auth)/index.tsx`, 01 Auth frame A): an indigo plane pinned to its
 * light values in both themes, with the logotype in parchment, as the brand brief locks it.
 * The code field is the join screen's (02 Onboarding frame F), the prose card the legal
 * screen's (`components/support/pieces.tsx`). No borders between sections (the No-Line rule):
 * tone, space and soft shadows.
 */

@font-face { font-family: 'Cairo'; src: url('/fonts/Cairo-400.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Cairo'; src: url('/fonts/Cairo-600.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Cairo'; src: url('/fonts/Cairo-700.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Cairo'; src: url('/fonts/Cairo-800.ttf') format('truetype'); font-weight: 800; font-display: swap; }
/* Inter draws Latin only (a code, an address, a store's name, an English page), so an Arabic page fetches none it does not draw. */
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-400.ttf') format('truetype'); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-600.ttf') format('truetype'); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-700.ttf') format('truetype'); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+FEFF, U+FFFD; }

:root {
  color-scheme: light dark;

  /* Surfaces: page, section, card (L0, L1, L2). */
  --surface: #f6f1e7;
  --surface-low: #f0eade;
  --surface-lowest: #ffffff;
  --field: #ffffff;
  --quiet: #f0eade;

  /* Text, and indigo as a foreground (links, the quiet button's label). */
  --text-1: #1b2637;
  --text-2: #5a6070;
  --text-3: #686870;
  --accent: #002444;

  /* Brand. `--primary` is indigo as a surface (the main button), `--gold` the heritage gold. */
  --primary: #002444;
  --on-primary: #fcf9f4;
  --gold: #775a19;
  --gold-wash: rgba(119, 90, 25, 0.10);

  /* The ghost border, the only border allowed: on a field. */
  --ghost: rgba(0, 36, 68, 0.12);
  --ghost-focus: rgba(0, 36, 68, 0.55);
  --ghost-button: rgba(0, 36, 68, 0.45);

  --shadow-soft: 0 2px 10px rgba(0, 36, 68, 0.05);
  --shadow-ambient: 0 1px 2px rgba(0, 36, 68, 0.04), 0 8px 24px rgba(0, 36, 68, 0.06);
  --shadow-sheet: 0 -16px 40px rgba(0, 36, 68, 0.22);

  /* The hero is pinned: the same in both themes. */
  --hero-top: #012c52;
  --hero-mid: #002444;
  --hero-bottom: #011d38;
  --on-dark: #fcf9f4;
  --on-dark-2: rgba(252, 249, 244, 0.74);
  --ring: rgba(252, 249, 244, 0.10);

  --font-ar: 'Cairo', system-ui, sans-serif;
  --font-en: 'Inter', system-ui, sans-serif;
  --font-ui: var(--font-ar);

  --r-card: 20px;
  --r-field: 14px;
  --r-btn: 16px;
  --r-sheet: 34px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #0a0a0c;
    --surface-low: #121215;
    --surface-lowest: #1f1f23;
    --field: #1b1b1f;
    --quiet: #26262b;

    --text-1: #f3ede4;
    --text-2: #b9b0a4;
    --text-3: #968d81;
    --accent: #8fb4dc;

    --primary: #0e2e52;
    --gold: #d3ad5b;
    --gold-wash: rgba(211, 173, 91, 0.14);

    --ghost: rgba(143, 180, 220, 0.12);
    --ghost-focus: rgba(143, 180, 220, 0.55);
    --ghost-button: rgba(143, 180, 220, 0.45);

    --shadow-soft: 0 2px 10px rgba(0, 0, 0, 0.37);
    --shadow-ambient: 0 1px 2px rgba(0, 0, 0, 0.29), 0 8px 24px rgba(0, 0, 0, 0.44);
    --shadow-sheet: 0 -16px 40px rgba(0, 0, 0, 0.66);
  }
}

/* English pages read in Inter, as the app's chrome does under English. */
:root:lang(en) { --font-ui: var(--font-en); }

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

/* `hidden` wins over every display rule below: the invitation's script hides and shows with it. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface);
  color: var(--text-1);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--ghost-focus); outline-offset: 3px; }

/* Latin runs inside Arabic (a code, an address, a store's name) keep their own face and direction. */
.en { font-family: var(--font-en); }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ── The hero: the welcome screen's lockup ─────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(165deg, var(--hero-top) 0%, var(--hero-mid) 46%, var(--hero-bottom) 100%);
  color: var(--on-dark);
  text-align: center;
  padding: max(64px, calc(env(safe-area-inset-top) + 48px)) 24px 86px;
}
.rings {
  position: absolute;
  top: -86px;
  left: 50%;
  width: 520px;
  height: 520px;
  margin-left: -260px;
  opacity: 0.55;
  pointer-events: none;
}
.rings span { position: absolute; border-radius: 50%; border: 1px solid var(--ring); }
.rings .r1 { inset: 0; }
.rings .r2 { inset: 70px; }
.rings .r3 { inset: 140px; }
.rings .r4 { inset: 210px; }
.rings .spark {
  /* The ring box is laid out left to right (its geometry is the motif's, not the text's). */
  top: 210px;
  left: 255px;
  width: 7px;
  height: 7px;
  border: 0;
  background: #775a19;
  box-shadow: 0 0 10px rgba(119, 90, 25, 0.6);
}
.lockup { position: relative; }
.mark {
  font-family: var(--font-ar);
  font-weight: 800;
  font-size: 74px;
  line-height: 1;
  color: var(--on-dark);
}
.rule { width: 44px; height: 2px; background: #775a19; margin: 22px auto; }
.tagline { font-size: 15.5px; color: var(--on-dark-2); }

/* The sheet that rises over the hero, as on the welcome screen. */
.sheet {
  position: relative;
  margin-top: -40px;
  background: var(--surface);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--shadow-sheet);
  flex: 1;
  padding: 26px 26px calc(32px + env(safe-area-inset-bottom));
}
.sheet-inner { width: 100%; max-width: 440px; margin: 0 auto; }
.sheet { display: flex; flex-direction: column; }
/* Inside the sheet, the footer sits at its foot: the sheet's shadow would draw a seam above one outside it. */
.sheet .foot { margin-top: auto; padding: 40px 0 0; }

/* ── Headings and text ─────────────────────────────────────────────────────── */
.eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 12px;
}
:lang(en) .eyebrow { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; }
.title { font-weight: 700; font-size: 26px; line-height: 1.25; color: var(--text-1); }
.sub { font-size: 14.5px; line-height: 1.7; color: var(--text-2); margin-top: 10px; }

/* ── The code: the join screen's field, with «نسخ» where «لصق» sits ─────────── */
.code-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 24px 0 8px; }
.code {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--field);
  border: 1px solid var(--ghost);
  border-radius: var(--r-field);
  min-height: 56px;
  padding: 0 16px;
}
.code-value {
  flex: 1;
  font-family: var(--font-en);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--text-1);
  direction: ltr;
  text-align: left;
  user-select: all;
  -webkit-user-select: all;
}
.copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 4px;
  background: none;
  border: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  cursor: pointer;
}
.copy svg { width: 15px; height: 15px; flex: none; }

/* ── Buttons: the app's, 16 radius, 16 by 20 padding ───────────────────────── */
.actions { display: flex; flex-direction: column; gap: 11px; margin-top: 24px; }
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 16px 20px;
  border: 0;
  border-radius: var(--r-btn);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  cursor: pointer;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--ghost-button); }
.btn-quiet { background: var(--quiet); color: var(--accent); }
.btn-primary:active, .btn-quiet:active, .btn-ghost:active { transform: scale(0.98); }

.stores { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.stores .btn { font-family: var(--font-en); font-size: 15px; }

/* The quiet note under a step, as 02 Onboarding's `.ob-note`. */
.note { display: flex; align-items: flex-start; gap: 8px; margin-top: 22px; font-size: 12.5px; line-height: 1.7; color: var(--text-3); }
.note svg { width: 16px; height: 16px; flex: none; margin-top: 3px; }
.note-strong { color: var(--text-2); font-weight: 600; }

/* ── Document pages: a compact indigo band with the logotype, then the column ── */
.band {
  position: relative;
  overflow: hidden;
  background: linear-gradient(165deg, var(--hero-top) 0%, var(--hero-mid) 46%, var(--hero-bottom) 100%);
  padding: max(18px, env(safe-area-inset-top)) 20px 18px;
}
/* The motif sits top-start on an indigo plane, bleeding off the corner (brand-kit tokens, ringMotif). */
.band .rings { top: -300px; left: auto; right: auto; margin-left: 0; inset-inline-start: -300px; }
.band-row { position: relative; display: flex; align-items: center; justify-content: space-between; max-width: 680px; margin: 0 auto; }
.band .mark { font-size: 30px; line-height: 1.2; }
.band a.home { color: var(--on-dark); }
.lang-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--on-dark-2);
}
.lang-link svg { width: 17px; height: 17px; }
.lang-link .ar-name { font-family: var(--font-ar); }
.lang-link .en-name { font-family: var(--font-en); }
.hero .lang-link { position: absolute; top: max(12px, env(safe-area-inset-top)); inset-inline-end: 16px; }

.page { width: 100%; max-width: 680px; margin: 0 auto; padding: 26px 20px 24px; flex: 1; }
.page h1 { font-weight: 700; font-size: 24px; line-height: 1.55; color: var(--text-1); }
.updated { font-size: 12px; color: var(--text-3); margin: 6px 0 14px; }
.lead { font-size: 14.5px; line-height: 1.7; color: var(--text-2); margin: 8px 0 18px; }
.card {
  background: var(--surface-lowest);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.card + .card, .card + h2, .section + .section { margin-top: 16px; }
.card p { font-size: 13.5px; line-height: 25px; color: var(--text-2); }
.card h2 { font-size: 15px; font-weight: 600; line-height: 26px; color: var(--text-1); margin-bottom: -13px; }
.card .btn { margin-top: -4px; }
.qa h3 { font-size: 15px; font-weight: 600; line-height: 26px; color: var(--text-1); margin-bottom: 7px; }
.qa p { font-size: 13.5px; line-height: 25px; color: var(--text-2); }
.section-title { font-size: 12px; font-weight: 700; color: var(--text-3); margin: 26px 4px 10px; }
:lang(en) .section-title { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; }
.mail { font-family: var(--font-en); font-weight: 600; direction: ltr; unicode-bidi: isolate; }

/* ── Footer ────────────────────────────────────────────────────────────────── */
.foot {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 8px 20px calc(28px + env(safe-area-inset-bottom));
  text-align: center;
}
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; }
.foot nav a { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.foot small { display: block; margin-top: 4px; font-size: 11.5px; color: var(--text-3); }

/* Wider screens: the same column, a little more air, and a body size a desk reads well. */
@media (min-width: 720px) {
  .page { padding-top: 40px; }
  .card { padding: 24px 26px; }
  .card p, .qa p { font-size: 15px; line-height: 28px; }
  .band .mark { font-size: 34px; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn { transition: transform 0.12s ease; }
  .copy-done { animation: settle 0.2s ease-out; }
  @keyframes settle { from { opacity: 0.4; } to { opacity: 1; } }
}

/* One store on a phone fills the row; a computer sees both, side by side (`assets/invite.js`). */
.stores-one { grid-template-columns: 1fr; }
.mail-line { text-align: center; font-size: 13.5px; }
.page-h2 { font-size: 17px; font-weight: 700; color: var(--text-1); margin: 30px 0 0; }
