/* ═══════════════════════════════════════════════════════════════════════════════
   tokens.css — THE single source of truth for colour, spacing, radius, and motion.
   Hand-edited on purpose: tweaking a hex should not require running Node.

   Values mirror the Flutter app so the two stay recognisably the same product:
     Wisp/lib/core/theme/app_colors.dart     ← AppColors, the app's one colour set
     Wisp/lib/core/theme/app_spacing.dart · app_radius.dart
     Wisp/lib/core/theme/app_typography.dart

   RULE: no hex literal belongs in any other stylesheet. The one exception is the
   13 plan-category glow colours, which live as a per-chip --glow in components.css
   because they are data, not theme.
   ═══════════════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;

  /* ── Brand ───────────────────────────────────────────────────────────────── */
  --accent: #F9D73E;              /* AppPalette.brand500 */
  --accent-on: #0E0C12;           /* PlansTheme.onAccent — never white on yellow */
  --accent-soft: rgba(249, 215, 62, .14);   /* AppColors.accentWash */
  --accent-line: rgba(249, 215, 62, .55);   /* AppColors.fillAccent */
  --mascot-ink: #2B1811;          /* the mark's outline */
  --mascot-cream: #FAF6EA;        /* the mark's body */
  --cool: #2B87D4;                /* AppColors.link */
  --cool-soft: rgba(43, 135, 212, .12);

  /* ── Scene grounds ───────────────────────────────────────────────────────── */
  /* The solid backdrop of each onboarding illustration in the app
     (Wisp/assets/onboarding), sampled from the pictures themselves, so a panel
     in one of these runs into its scene with no visible seam. */
  --scene-blue: #234CE5;          /* gym.webp */
  --scene-purple: #5705F5;        /* gaming.webp — also img/onboarding/ here */
  --scene-lime: #A2C21A;          /* chatting.webp */
  --on-scene-dark: #FFFFFF;       /* text on blue and purple */
  --on-scene-light: #0E0C12;      /* text on yellow and lime */
  --night: #0E0C12;               /* AppColors.dark.canvas — the dark sections */

  /* ── Surfaces ────────────────────────────────────────────────────────────── */
  /* A solid white page, the app's plain ground (it dropped its lilac tints,
     #F6F5F8 and #EFEDF4). Cards on it are white too and are told apart by
     their hairline and shadow; quiet slabs inside them use surfaceTonal. */
  --bg: #FFFFFF;                  /* AppColors.background */
  --bg-lift: #F5F5F5;             /* AppColors.surfaceTonal — a quiet slab inside a card */
  --card: #FFFFFF;                /* AppColors.surface */
  --card-2: #F5F5F5;              /* AppColors.surfaceTonal */

  /* ── Ink ─────────────────────────────────────────────────────────────────── */
  --ink: #0E0C12;
  /* A11Y: --text-faint composites to ≈#888689 on --bg = 3.6:1. That passes only
     the 3:1 large-text bar, so use it ONLY at ≥24px, or ≥18.66px bold.
     Everything smaller — body-sm, caption, footer, meta — must use the -strong
     variant (≈5.9:1). base.css already wires the type classes correctly. */
  --text-faint: rgba(17, 13, 26, .50);
  --text-faint-strong: rgba(17, 13, 26, .64);
  --hairline: rgba(17, 13, 26, .10);          /* AppColors.border / divider */
  --hairline-strong: rgba(14, 12, 18, .15);   /* AppColors.trackIdle */

  /* ── Semantic ────────────────────────────────────────────────────────────── */
  --success: #388E3C;
  --danger: #D64545;              /* AppColors.danger */

  /* ── Shadows ─────────────────────────────────────────────────────────────── */
  /* The app's light-mode shadow colour is a warm purple-brown (#2B1A30), not
     black — that warmth is a lot of why the app feels soft. One channel drives
     every shadow so dark mode is a single swap. Note the negative spread. */
  --shadow-rgb: 43, 26, 48;
  --shadow-sm: 0 2px 8px -2px rgba(var(--shadow-rgb), .10);
  --shadow-toast: 0 6px 34px -8px rgba(var(--shadow-rgb), .13);
  --shadow-dialog: 0 18px 40px -4px rgba(var(--shadow-rgb), .18);
  --shadow-lift: 0 28px 60px -12px rgba(var(--shadow-rgb), .22);
  --glow-accent: 0 0 18px 1px rgba(249, 215, 62, .30);

  /* ── Store artwork ───────────────────────────────────────────────────────── */
  /* The cream of the small sparkles on the store listing's yellow slides
     (wisp-store-assets/tools/slides/friends.html). */
  --sparkle-cream: #FFF6DA;
  /* The white of the store artwork's floating pieces — memoji rims, activity
     tiles, the faces chip. Never re-declared by .scheme-night: they stay white
     on a dark tile, as they do on the store's purple slide. */
  --paper: #FFFFFF;

  /* ── Spacing (AppSpacing) ────────────────────────────────────────────────── */
  --s1: 4px;
  --s2: 8px;
  --s3: 16px;
  --s4: 24px;
  --s5: 32px;
  --s6: 48px;
  --s7: 64px;
  --s8: 96px;
  --gutter: clamp(20px, 5vw, 40px);
  --measure: 1140px;

  /* ── Radius (AppRadius, then the app's real component radii) ─────────────── */
  --r1: 4px;
  --r2: 8px;
  --r3: 12px;
  --r4: 16px;
  --r5: 24px;
  --r-pill: 999px;
  --r-toast: 22px;                /* wisp_toast_card.dart */
  --r-dialog: 30px;               /* wisp_dialog.dart */
  --r-sheet: 34px;                /* sheets.dart */
  /* The app draws these as RoundedSuperellipseBorder (Apple squircles). CSS has
     no equivalent, so we use generous plain radii — visually very close. */

  /* ── Motion (verbatim from the app) ──────────────────────────────────────── */
  --e-spring: cubic-bezier(.30, 1.25, .40, 1);   /* overshoot — the "wisp" feel */
  --e-glide: cubic-bezier(.22, 1, .36, 1);       /* ease-out */
  --t-fast: 160ms;
  --t-med: 280ms;
  --t-slow: 520ms;

  /* ── Type ────────────────────────────────────────────────────────────────── */
  /* "thmanyah sans" first: its licence permits use on websites but forbids
     hosting the file, so we never @font-face it — anyone who has it installed
     locally gets the real thing, everyone else gets an excellent system Arabic
     face (SF Arabic on Apple, Noto Sans Arabic on Android). See fonts.css. */
  --ff-sans: "thmanyah sans", ui-sans-serif, system-ui, -apple-system, "SF Arabic",
             "Segoe UI", "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, Arial,
             "Helvetica Neue", sans-serif;

  /* Fluid where the app's fixed sizes would overflow a 360px screen. */
  --fs-display-2xl: clamp(48px, 10vw, 112px);
  --fs-display-xl: clamp(34px, 8.2vw, 56px);
  --fs-display-lg: clamp(30px, 6.6vw, 48px);
  --fs-display-md: clamp(26px, 5vw, 40px);
  --fs-section: clamp(32px, 5.4vw, 60px);   /* landing-page section titles */
  --fs-heading-xl: clamp(24px, 3.6vw, 32px);
  --fs-heading-lg: clamp(22px, 3vw, 28px);
  --fs-heading-md: 24px;
  --fs-heading-sm: 20px;
  --fs-title-lg: 18px;
  --fs-title-md: 16px;
  --fs-title-sm: 14px;
  --fs-body-lg: clamp(17px, 1.5vw, 18px);
  --fs-body-md: 16px;
  --fs-body-sm: 14px;
  --fs-label-md: 14px;
  --fs-caption: 12px;

  --lh-tight: 1.1;
  --lh-snug: 1.28;
  --lh-body: 1.6;
  --ls-display: -1px;
  --ls-label: .1px;
  --ls-caption: .4px;

  --fw-light: 300;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-black: 900;

  /* Direction multiplier — lets decorative transforms mirror without duplicating
     the rule. See the hero card fan in components.css. */
  --dir: 1;

  --focus-ring: 2px;

  /* The sticky nav's full height: 14px above and below a 56px pill. The hero
     pulls itself up by this much so its yellow runs behind the nav, and
     anchored headings scroll to just below it. */
  --nav-height: 84px;
}

/* ── Dark ──────────────────────────────────────────────────────────────────────
   Complete and ready, but NOT shipped: pages render with data-theme="light"
   hardcoded on <html>. To enable, set features.darkMode = true in
   site/site.config.json and rebuild — boot.js then honours prefers-color-scheme
   and the attribute is dropped. Nothing else needs to change, because every
   surface, ink, and shadow above is a variable.
   ────────────────────────────────────────────────────────────────────────────── */
[data-theme="dark"],
/* The same palette, scoped to one element: the chat tile and the footer are
   dark on an otherwise light page. Every token below is re-declared at that
   element, so anything inside it — cards, hairlines, faint text — follows. */
.scheme-night {
  color-scheme: dark;

  --accent-soft: rgba(249, 215, 62, .20);   /* AppColors.accentWash */
  --accent-line: rgba(249, 215, 62, .34);   /* AppColors.fillAccent */
  --cool: #4DA3E8;                          /* AppColors.link */
  --cool-soft: rgba(77, 163, 232, .14);

  --bg: #0E0C12;                  /* AppColors.canvas */
  --bg-lift: #2A2A2A;             /* AppColors.surfaceTonal */
  --card: #15131A;                /* AppColors.surface */
  --card-2: #2A2A2A;              /* AppColors.surfaceTonal */

  --ink: #FFFFFF;                 /* AppColors.onSurface */
  --text-faint: rgba(255, 255, 255, .45);
  --text-faint-strong: rgba(255, 255, 255, .62);
  --hairline: rgba(255, 255, 255, .07);         /* AppColors.border */
  --hairline-strong: rgba(255, 255, 255, .12);  /* AppColors.divider */

  --danger: #F07A7A;              /* AppColors.danger */
  --shadow-rgb: 0, 0, 0;
  --shadow-toast: 0 6px 34px -8px rgba(var(--shadow-rgb), .42);
  --shadow-dialog: 0 18px 40px -4px rgba(var(--shadow-rgb), .50);
  --shadow-lift: 0 28px 60px -12px rgba(var(--shadow-rgb), .55);
}

/* ── Arabic ───────────────────────────────────────────────────────────────────
   Four corrections that most bilingual sites miss. Each is a real rendering bug
   in Arabic, not a preference.
   ────────────────────────────────────────────────────────────────────────────── */
[lang="ar"] {
  /* Arabic is cursive: any tracking breaks glyph joining and reads as broken. */
  --ls-display: 0;
  --ls-label: 0;
  --ls-caption: 0;
  /* Ascenders and diacritics clip at 1.1. */
  --lh-tight: 1.28;
  --lh-snug: 1.4;
  --lh-body: 1.75;
}

[dir="rtl"] {
  --dir: -1;
}
