/* portuno panel — design tokens. Single source for colour, type, spacing, geometry and motion.
   Imported first by every stylesheet of internal/portal. Semantic names only in templates
   (var(--color-text-primary)), never raw values. Dark theme is the only theme in v1; a light theme
   is a second block under :root[data-theme="light"] that redefines the same names and nothing else.
   Author: hyperion/portuno-designer, 2026-10-16. Rationale: design/DESIGN-LANGUAGE.md. */

:root {
  color-scheme: dark;

  /* ---- colour: surfaces (Revolut-measured, REFERENCE.md §1) ---- */
  --color-bg:            #000000;   /* page canvas, tab-bar canvas */
  --color-surface-1:     #141316;   /* cards, list containers, sheets, dialogs */
  --color-surface-2:     #2f2e31;   /* icon discs, chips, segmented control track, skeleton base */
  --color-surface-3:     #3a393d;   /* hover on surface-2, active tab pill */
  --color-field:         #1f1e21;   /* inputs, search, textarea */
  --color-field-hover:   #252427;
  --color-overlay:       rgba(0, 0, 0, 0.6);   /* scrim behind sheets and dialogs */
  --color-line:          rgba(255, 255, 255, 0.08); /* the ONE allowed line: table header underline, dialog header */

  /* ---- colour: text ---- */
  --color-text-primary:   #f2f2f2;
  --color-text-secondary: #9a9a9e;
  --color-text-tertiary:  #6b6b70;  /* placeholders, disabled labels (AA on surface-1 for ≥ 18 px only; use for placeholders, never for body) */
  --color-text-on-cta:    #0a0a0a;
  --color-text-on-accent: #ffffff;

  /* ---- colour: action and state (one accent per screen) ---- */
  --color-cta:            #eaeaea;  /* primary button fill */
  --color-cta-hover:      #ffffff;
  --color-cta-pressed:    #d4d4d4;
  --color-accent:         #4f8cff;  /* toggles on, active nav, progress, links, focus ring */
  --color-accent-soft:    rgba(79, 140, 255, 0.16);
  --color-ok:             #35c66b;
  --color-ok-soft:        rgba(53, 198, 107, 0.16);
  --color-warn:           #f5b942;
  --color-warn-soft:      rgba(245, 185, 66, 0.16);
  --color-danger:         #ff5a5f;
  --color-danger-soft:    rgba(255, 90, 95, 0.16);
  --color-neutral:        #6b6b70;  /* "unknown / never seen" status dot */
  --color-impersonation:  #f5b942;  /* the staff banner: warn colour, full-opacity fill, black text */

  /* ---- type ---- */
  --font-sans: "Inter", "InterFallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "JetBrainsMonoFallback", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-feature-tabular: "tnum" 1, "lnum" 1;     /* every number in a table, gauge or amount */
  --font-feature-mono:    "zero" 1;               /* slashed zero in JetBrains Mono */

  --text-display-size: 34px; --text-display-line: 40px; --text-display-weight: 600; --text-display-tracking: -0.02em;
  --text-title-size:   28px; --text-title-line:   34px; --text-title-weight:   600; --text-title-tracking:   -0.015em;
  --text-h2-size:      20px; --text-h2-line:      28px; --text-h2-weight:      600; --text-h2-tracking:      -0.01em;
  --text-body-size:    15px; --text-body-line:    22px; --text-body-weight:    400;
  --text-body-strong-weight: 500;
  --text-label-size:   13px; --text-label-line:   18px; --text-label-weight:   500;
  --text-caption-size: 12px; --text-caption-line: 16px; --text-caption-weight: 400;
  --text-mono-size:    14px; --text-mono-line:    22px; /* mono at body scale: ports, CIDRs, keys */

  /* ---- spacing (unit 4) ---- */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-6: 24px; --space-8: 32px; --space-12: 48px; --space-16: 64px;
  --gutter: 16px;            /* phone side margin; also card inner padding */
  --gutter-desktop: 32px;

  /* ---- geometry (fixed heights are what make zero-displacement checkable) ---- */
  --radius-card:   16px;
  --radius-field:  12px;
  --radius-pill:   999px;
  --radius-chip:   8px;
  --h-row:         56px;   /* list row, table row, settings row, nav item */
  --h-row-dense:   48px;   /* staff tables on desktop only */
  --h-control:     44px;   /* minimum touch target; icon buttons, secondary pills */
  --h-field:       56px;   /* text input incl. its floating label; label 13 px + value 15 px inside */
  --h-field-help:  20px;   /* ONE reserved helper/error line under every field (two lines = 40px where the spec says so) */
  --h-cta:         56px;   /* primary pill */
  --h-button:      44px;   /* secondary and tertiary buttons, dialog buttons */
  --h-tabbar:      64px;   /* floating bottom pill */
  --h-topbar:      56px;
  --h-banner:      40px;   /* impersonation and account-state banners */
  --h-filter-icon: 24px;   /* reserved slot in every table header */
  --w-rail:        240px;  /* desktop left rail */
  --w-dialog:      560px;  /* desktop dialog width; sheet on phone */
  --w-sheet-side:  420px;  /* desktop side sheet (audit detail, row detail) */
  --w-icon-disc:   40px;
  --w-switch:      52px;   --h-switch: 32px;
  --size-status-dot: 10px;
  --maxw-content:  1120px;

  /* ---- elevation: none by lines; tone only. Sheets get a scrim, dialogs a soft shadow ---- */
  --shadow-dialog: 0 24px 64px rgba(0, 0, 0, 0.6);
  --shadow-popover: 0 8px 24px rgba(0, 0, 0, 0.5);

  /* ---- focus ---- */
  --focus-ring: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--color-accent);

  /* ---- motion (Revolut-measured: median 189 ms, ease-out; REFERENCE.md §4) ---- */
  --motion-fast:    150ms;  /* toggles, chips, hover, focus, button press */
  --motion-nav:     250ms;  /* page cross-fade, sheet slide, dialog fade */
  --motion-stagger: 50ms;   /* per list item on first render, capped at 8 items */
  --motion-skeleton: 1400ms;
  --ease-out:   cubic-bezier(0.2, 0, 0, 1);
  --ease-in:    cubic-bezier(0.4, 0, 1, 1);
  --ease-inout: cubic-bezier(0.4, 0, 0.2, 1);

  /* ---- z-index ladder ---- */
  --z-banner: 40; --z-tabbar: 30; --z-popover: 50; --z-sheet: 60; --z-dialog: 70; --z-toast: 80;
}

@media (prefers-reduced-motion: reduce) {
  :root { --motion-fast: 0ms; --motion-nav: 0ms; --motion-stagger: 0ms; --motion-skeleton: 0ms; }
}

/* Fallback faces with metric overrides so the swap from system font to Inter / JetBrains Mono
   causes zero reflow (layout-stability rule). Values are Inter 4.0 and JetBrains Mono 2.304 metrics
   against Arial / Courier New; the builder keeps them in sync with the shipped woff2 files. */
@font-face { font-family: "InterFallback"; src: local("Arial"); ascent-override: 90.44%; descent-override: 22.52%; line-gap-override: 0%; size-adjust: 107.12%; }
@font-face { font-family: "JetBrainsMonoFallback"; src: local("Courier New"); ascent-override: 102%; descent-override: 30%; line-gap-override: 0%; size-adjust: 100%; }
