/* Perkival site theme (PER-4188; role names mirror the app theme, PER-4177). The ONE file that holds raw values.
 * Component CSS reads roles only: no hex, no rgb(), no px except 0 and 1px.
 * Roles follow the shadcn convention: a surface role and its "-foreground" pair.
 * Layout knobs are data attributes on <html>:
 *   data-theme="light|dark"   palette (the runtime stamps the resolved theme)
 *   data-density="compact|comfortable"   row and control height
 *   data-radius="none|default"           corner radius
 *   data-contrast="more"                 stronger muted text and borders
 * Scales: space 0 4 8 12 16 24 32 48 64 · type 12/16 14/20 16/24 20/28 32/40 48/56 ·
 * radius 0 4 8 12 999 · border 0 1 2. */

:root {
  /* Surface and text roles */
  --background: #f6f7f9;
  --foreground: #1c1d26;
  --card: #fff;
  --card-foreground: #1c1d26;
  --popover: #fff;
  --popover-foreground: #1c1d26;
  --muted: #eef0f4;
  --muted-foreground: #5c5f6e;
  --secondary: #eef0f4;
  --secondary-foreground: #4a4c5a;
  --border: #e4e5eb;
  --border-strong: #cfd1da;
  --input: #cfd1da;
  --ring: #4a55d0;
  --primary: #4a55d0;
  --primary-foreground: #fff;
  --link: #3f49c0;
  --destructive: #b42318;
  --destructive-foreground: #fff;
  --warning: #b4540a;
  --success: #1f7a4d;
  --inverse: #1c1d26;
  --inverse-foreground: #fff;
  --scrim: rgb(16 18 28 / 40%);
  --shadow-popover: 0 1px 1px rgb(16 18 28 / 4%), 0 8px 24px rgb(16 18 28 / 12%);
  --shadow-figure: 0 1px 1px rgb(16 18 28 / 6%), 0 16px 48px rgb(16 18 28 / 18%);
  --shadow-seg: 0 1px 1px rgb(16 18 28 / 8%);

  /* Card art (issuer card faces; data, not UI chrome) */
  --card-art-edge: rgb(16 24 40 / 12%);
  --card-art-platinum-a: #e4e7ec;
  --card-art-platinum-b: #b9c0ca;
  --card-art-gold-a: #e2bd72;
  --card-art-gold-b: #b8873a;
  --card-art-sapphire-a: #24427a;
  --card-art-sapphire-b: #142a52;
  --card-art-green-a: #2f8f6b;
  --card-art-green-b: #1d634a;
  --card-art-rose-a: #c7765c;
  --card-art-rose-b: #9a4f39;
  --card-art-onyx-a: #3a3f47;
  --card-art-onyx-b: #1d2026;
  --card-art-chip-a: #f1dfae;
  --card-art-chip-b: #c9a75c;

  /* Type */
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --text-1: 12px;
  --text-2: 14px;
  --text-3: 16px;
  --text-4: 20px;
  --text-5: 32px;
  --text-6: 48px;
  --leading-1: 16px;
  --leading-2: 20px;
  --leading-3: 24px;
  --leading-4: 28px;
  --leading-5: 40px;
  --leading-6: 56px;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --tracking-tight: -0.02em;
  --tracking-caps: 0.06em;

  /* Space (N x 4px, on the scale only) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;

  /* Size (fixed boxes: icons, controls, columns; N x 4px) */
  --size-3: 12px;
  --size-4: 16px;
  --size-5: 20px;
  --size-6: 24px;
  --size-7: 28px;
  --size-8: 32px;
  --size-9: 36px;
  --size-10: 40px;
  --size-11: 44px;
  --size-12: 48px;
  --size-14: 56px;
  --size-16: 64px;
  --size-20: 80px;
  --size-24: 96px;
  --size-30: 120px;
  --size-40: 160px;
  --size-45: 180px;
  --size-50: 200px;
  --size-55: 220px;
  --size-60: 240px;
  --size-70: 280px;
  --size-80: 320px;
  --size-90: 360px;
  --size-100: 400px;
  --size-120: 480px;
  --size-140: 560px;
  --size-150: 600px;
  --size-160: 640px;
  --size-180: 720px;
  --size-200: 800px;
  --size-240: 960px;
  --size-280: 1120px;
  --size-300: 1200px;

  --size-2: 8px;

  --size-1: 4px;

  /* Radius and border */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;
  --border-width: 1px;
  --border-width-strong: 2px;
  --ring-width: 2px;
  --ring-offset: 2px;

  /* Knob-driven roles */
  --row-min: var(--size-11);
  --control-h: var(--size-8);
}

:root[data-theme="dark"] {
  --background: #121219;
  --foreground: #ececf1;
  --card: #1a1b23;
  --card-foreground: #ececf1;
  --popover: #20212b;
  --popover-foreground: #ececf1;
  --muted: #23242f;
  --muted-foreground: #9a9cac;
  --secondary: #23242f;
  --secondary-foreground: #b7b9c6;
  --border: #2b2d3a;
  --border-strong: #3a3d4d;
  --input: #3a3d4d;
  --ring: #7c85ff;
  --primary: #5560dc;
  --primary-foreground: #fff;
  --link: #a3aaff;
  --destructive: #f2877d;
  --destructive-foreground: #121219;
  --warning: #f0a35e;
  --success: #6fcf9c;
  --inverse: #ececf1;
  --inverse-foreground: #121219;
  --scrim: rgb(0 0 0 / 60%);
  --shadow-popover: 0 0 0 1px rgb(255 255 255 / 6%), 0 8px 24px rgb(0 0 0 / 48%);
  --shadow-figure: 0 0 0 1px rgb(255 255 255 / 8%), 0 16px 48px rgb(0 0 0 / 56%);
  --shadow-seg: 0 0 0 1px rgb(255 255 255 / 8%);
  --card-art-edge: rgb(255 255 255 / 14%);
}

/* Pages without a runtime (static site) follow the OS scheme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --background: #121219;
    --foreground: #ececf1;
    --card: #1a1b23;
    --card-foreground: #ececf1;
    --popover: #20212b;
    --popover-foreground: #ececf1;
    --muted: #23242f;
    --muted-foreground: #9a9cac;
    --secondary: #23242f;
    --secondary-foreground: #b7b9c6;
    --border: #2b2d3a;
    --border-strong: #3a3d4d;
    --input: #3a3d4d;
    --ring: #7c85ff;
    --primary: #5560dc;
    --primary-foreground: #fff;
    --link: #a3aaff;
    --destructive: #f2877d;
    --destructive-foreground: #121219;
    --warning: #f0a35e;
    --success: #6fcf9c;
    --inverse: #ececf1;
    --inverse-foreground: #121219;
    --scrim: rgb(0 0 0 / 60%);
    --shadow-popover: 0 0 0 1px rgb(255 255 255 / 6%), 0 8px 24px rgb(0 0 0 / 48%);
    --shadow-figure: 0 0 0 1px rgb(255 255 255 / 8%), 0 16px 48px rgb(0 0 0 / 56%);
    --shadow-seg: 0 0 0 1px rgb(255 255 255 / 8%);
    --card-art-edge: rgb(255 255 255 / 14%);
  }
}

:root[data-density="comfortable"] {
  --row-min: var(--size-14);
  --control-h: var(--size-10);
}
:root[data-radius="none"] {
  --radius-sm: 0;
  --radius: 0;
  --radius-lg: 0;
}
:root[data-contrast="more"] {
  --muted-foreground: var(--secondary-foreground);
  --border: var(--border-strong);
}
