/* ==========================================================================
   AnyLaw.online — shared design tokens
   One file for every front: Library, Courts, Co-counsel, Desk.
   Rules and usage: see /DESIGN.md. Do not hard-code colours or sizes in a
   front; add a token here instead.
   ========================================================================== */

/* Fonts ------------------------------------------------------------------
   Official brand fonts: TWK Ghost (serif) and ABC Diatype (sans) — paid
   licences, not yet bought. Until then the free stand-ins below are used.
   To switch: add @font-face rules for the licensed files and put their
   names first in --font-serif / --font-sans. Nothing else changes.        */
@import url("https://fonts.googleapis.com/css2?family=Gloock&family=Inter:wght@400;500;600&family=Newsreader:opsz,wght@6..72,400;6..72,500&family=Noto+Nastaliq+Urdu:wght@400;500;600&display=swap");

:root {
  /* ---- Type families ---- */
  --font-logo:  "Gloock", "Newsreader", Georgia, serif;                 /* logo only */
  --font-serif: "TWK Ghost", "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans:  "ABC Diatype", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-urdu:  "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;
  --font-mono:  ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* ---- Colour: neutrals (warm monochrome) ---- */
  --ink-950: #0F0E0D;   /* sidebar, modal header band, logo square */
  --ink-900: #1A1917;   /* primary button */
  --ink-800: #33312C;   /* sidebar active row, primary hover */
  --ink-700: #4A4741;   /* sidebar hover */

  --text:        #191817;  /* body text, headings */
  --text-muted:  #6A6660;  /* secondary text, labels, breadcrumb parent */
  --text-faint:  #9C988F;  /* disabled, decorative group labels only (2.9:1) — placeholders use --text-muted */
  --text-on-ink: #F7F6F4;  /* text on dark surfaces */
  --text-on-ink-muted: #A8A49C;

  --canvas:      #F7F6F4;  /* page background */
  --surface:     #FFFFFF;  /* cards, tables, modals */
  --surface-2:   #F4F3F1;  /* secondary buttons, tags, table group rows, input wells */
  --surface-3:   #EEECE8;  /* hover on surface-2 */
  --selected:    #EFF2F3;  /* selected option card (cool tint, as in Harvey) */

  --border:        #EBE9E4;
  --border-strong: #D9D6CF;
  --focus-ring:    #1A1917;

  /* ---- Colour: status (only place colour appears) ---- */
  --ok-text:      #197951;  --ok-bg:      #DDF3E5;   /* Reported, Decided, Allowed, Favourable */
  --danger-text:  #A3283A;  --danger-bg:  #FCE3E6;   /* Disputed, Dismissed, Urgent, Error */
  --pending-text: #9B5514;  --pending-bg: #FBEBD7;   /* Pending, Alleged, Approved for reporting */
  --warn-text:    #B23A16;  --warn-bg:    #FBE7DF;   /* Sources differ, Limits reached */
  --neutral-text: #6A6660;  --neutral-bg: #F4F3F1;   /* Indeterminate, Court copy, Unknown */
  --unread-dot:   #3B6FE0;  /* unread notifications only */

  /* ---- Charts (greys first; colour only for "needs attention") ---- */
  --chart-1: #4A4741;
  --chart-2: #C9C6BF;
  --chart-3: #8D8982;
  --chart-alert: #6B4A44;
  --chart-grid: #EBE9E4;

  /* ---- Type scale (px; desktop) ---- */
  --fs-hero:    72px;  --lh-hero:    1.05;   /* serif 400 — marketing/home hero */
  --fs-display: 48px;  --lh-display: 1.08;   /* serif 400 — section hero */
  --fs-title:   36px;  --lh-title:   1.15;   /* serif 400 — page titles */
  --fs-metric:  44px;  --lh-metric:  1.0;    /* serif 400 — big numbers */
  --fs-modal:   30px;  --lh-modal:   1.2;    /* serif 400 — modal header band */
  --fs-h2:      20px;  --lh-h2:      1.35;   /* sans 500 — card / section titles */
  --fs-h3:      16px;  --lh-h3:      1.4;    /* sans 500 — list item titles */
  --fs-read:    17px;  --lh-read:    1.65;   /* sans 400 — statute & judgment text */
  --fs-body:    15px;  --lh-body:    1.5;    /* sans 400 — UI text */
  --fs-small:   13px;  --lh-small:   1.45;   /* sans 400 — meta, labels */
  --fs-micro:   12px;  --lh-micro:   1.35;   /* chart axes and legends only */
  --tracking-serif: -0.015em;
  --tracking-sans:  -0.005em;
  --weight-regular: 400;
  --weight-medium:  500;

  /* ---- Spacing (4px steps) ---- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px; --sp-20: 80px;

  /* ---- Radius ---- */
  --r-tag:      6px;
  --r-control:  8px;    /* buttons, inputs, selects, file chips */
  --r-card:     12px;
  --r-panel:    16px;   /* modals, drawers, composer, app frame */
  --r-pill:     999px;

  /* ---- Elevation (shadows only on floating layers) ---- */
  --shadow-none: none;
  --shadow-pop:   0 4px 16px rgba(15, 14, 13, 0.08), 0 1px 3px rgba(15, 14, 13, 0.06);  /* menus, popovers */
  --shadow-modal: 0 24px 64px rgba(15, 14, 13, 0.16), 0 2px 8px rgba(15, 14, 13, 0.08); /* modals, drawers */

  /* ---- Layout ---- */
  --sidebar-w:   272px;
  --topbar-h:    64px;
  --tabbar-h:    56px;     /* + safe-area inset on phones */
  --content-max: 1200px;
  --reading-max: 68ch;
  --tap-min:     44px;     /* Apple HIG minimum hit target */

  /* ---- Motion ---- */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;
}

/* Phones ----------------------------------------------------------------- */
@media (max-width: 640px) {
  :root {
    --fs-hero: 40px;    --fs-display: 32px;  --fs-title: 28px;
    --fs-metric: 36px;  --fs-modal: 24px;    --fs-h2: 18px;
    --fs-body: 16px;    /* never below 16px in inputs: stops iOS zoom */
  }
}

/* Urdu ------------------------------------------------------------------- */
:root:lang(ur), [lang="ur"] {
  --font-sans:  var(--font-urdu);
  --font-serif: var(--font-urdu);
  --lh-body: 2.0;  --lh-read: 2.1;  --lh-h2: 1.9;  --lh-title: 1.7;  --lh-display: 1.6;  --lh-hero: 1.5;
  --tracking-serif: 0;  --tracking-sans: 0;
}

/* Reduced motion (HIG) --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-base: 0ms; --dur-slow: 0ms; }
}

/* Base ------------------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--tracking-sans);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "liga", "kern";
}
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--r-control); }
::selection { background: #E4E1DA; }
