/**
 * Undal design tokens — docs/undal/07-ux-screenshot-analysis.md §2.
 *
 * The colours are sampled from brand/undal/*.jpg and every text pair below was
 * measured against WCAG 2.2; the ratio is in the comment so a future change has
 * to argue with a number. `undal/scripts/lint-tokens.mjs` fails the build if a
 * hex value appears outside this file.
 *
 * Two rules that are easy to break by accident:
 *   - `--u-line` is decoration only (1.22:1). A boundary that carries meaning
 *     uses `--u-line-strong`.
 *   - `--u-amber` is 3.61:1 on ink: icons and map blips only, never text.
 */

:root {
  color-scheme: light;

  /* ink & paper */
  --u-ink: #23302e; /* 12.66:1 on paper — AAA */
  --u-ink-soft: #5b6360; /* 5.71:1 on paper — AA */
  --u-ink-faint: #8a918e; /* disabled only */
  --u-paper: #f7f6f2;
  --u-surface: #ffffff;
  --u-surface-2: #efeee8;
  --u-line: #e2e0d9; /* decoration */
  --u-line-strong: #cfcec6; /* inputs, meaningful dividers */

  /* role inks, sampled from the references */
  --u-customer: #23302e;
  --u-partner: #213d35;
  --u-rider: #1f3c31;
  --u-accent: #721a26; /* 10.27:1 on paper — AAA */

  /* semantic */
  --u-success: #1f6b4f; /* 6.41:1 on white */
  --u-danger: #a32035; /* 7.46:1 on white */
  --u-warning-bg: #fff4d6;
  --u-danger-bg: #fbe9ec; /* a failed bubble's paper; --u-danger ink on it is 7.9:1 */
  --u-warning-ink: #6b4a00; /* 7.36:1 on warning bg */
  --u-amber: #b47600; /* 3.61:1 on ink — non-text only */

  /* type */
  --u-font-display: 'Quicksand', 'Hind Siliguri', system-ui, sans-serif;
  --u-font-body: 'Hind Siliguri', 'Noto Sans Bengali', system-ui, sans-serif;
  --u-font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* spacing — 4 px base */
  --u-1: 4px;
  --u-2: 8px;
  --u-3: 12px;
  --u-4: 16px;
  --u-5: 20px;
  --u-6: 24px;
  --u-8: 32px;
  --u-10: 40px;
  --u-12: 48px;

  /* radius */
  --u-r-sm: 8px;
  --u-r-md: 12px;
  --u-r-lg: 16px;
  --u-r-xl: 24px;
  --u-r-pill: 999px;

  /* elevation */
  --u-shadow-1: 0 1px 2px rgba(35, 48, 46, 0.06), 0 1px 1px rgba(35, 48, 46, 0.04);
  --u-shadow-2: 0 8px 24px rgba(35, 48, 46, 0.1), 0 2px 6px rgba(35, 48, 46, 0.06);
  /* The scrim behind a modal. Ink, not black: a black scrim shifts the hue of
     everything behind it and the panel stops looking like the same product. */
  --u-scrim: rgba(35, 48, 46, 0.38);

  /* motion */
  --u-ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --u-dur-fast: 120ms;
  --u-dur: 200ms;
  --u-dur-slow: 320ms;

  /* targets */
  --u-tap: 44px;
}

[data-theme='dark'] {
  color-scheme: dark;

  --u-ink: #edebe4;
  --u-ink-soft: #a8afab;
  --u-ink-faint: #7c8480;
  --u-paper: #141917;
  --u-surface: #1c2320;
  --u-surface-2: #232b27;
  --u-line: #2c3531;
  --u-line-strong: #3a443f;

  --u-customer: #c9d3cf;
  --u-partner: #bfd2c9;
  --u-rider: #c2d6cb;
  --u-accent: #e8a0a8;

  --u-success: #5fd1a0;
  --u-danger: #f08398;
  --u-danger-bg: #3a1b21;
  --u-warning-bg: #2e2712;
  --u-warning-ink: #f3d08a;
  --u-amber: #e0a33a;

  --u-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --u-shadow-2: 0 8px 24px rgba(0, 0, 0, 0.5);
  --u-scrim: rgba(0, 0, 0, 0.56);
}

/* ---------------------------------------------------------------------------
 * Base
 * ------------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--u-paper);
  color: var(--u-ink);
  font-family: var(--u-font-body);
  font-size: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  /* 1.55 is the Bengali value, not the English one: Bengali runs taller. */
  line-height: 1.55;
  /* Long Bengali words and long Bangladesh addresses must wrap, not overflow. */
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  font-family: var(--u-font-display);
  line-height: 1.2;
  margin: 0 0 var(--u-3);
  font-weight: 600;
}

h1 {
  font-size: clamp(1.375rem, 1.1rem + 1.2vw, 2rem);
}

h2 {
  font-size: clamp(1.125rem, 1rem + 0.7vw, 1.375rem);
}

p {
  margin: 0 0 var(--u-3);
}

a {
  color: inherit;
  text-decoration-color: var(--u-line-strong);
  text-underline-offset: 0.2em;
}

/* Every price is tabular, so a column of fares lines up. */
.u-money {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* Focus is never removed, only styled. */
:focus-visible {
  outline: 2px solid var(--u-ink);
  outline-offset: 2px;
  border-radius: var(--u-r-sm);
}

/* Reduced motion: transforms become opacity, nothing loops. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Visually hidden but available to a screen reader. */
.u-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
