/* =====================================================================
   Primed Health design tokens
   The single source of truth. Every other file in this package (component
   CSS, Tailwind, shadcn) reads these variables and defines no colors of its
   own. Change a value here and it changes everywhere.

   Theme: light by default. Dark applies automatically when the OS is in dark
   mode, unless the app sets data-theme="light" on <html>. Setting
   data-theme="dark" forces dark.

   Density: default everywhere. Add data-density="roomy" to a container
   (usually a detail view or form page) to use roomy spacing inside it.
   ===================================================================== */

:root {
  /* ---- Neutrals ---------------------------------------------------- */
  --pr-surface:      #FFFFFF;  /* page background */
  --pr-raised:       #FFFFFF;  /* cards, rows, panels, dialogs */
  --pr-sunken:       #F6F7F9;  /* message previews, hover fills, read-only fields */
  --pr-line:         #E8E8EA;  /* hairline borders and dividers */
  --pr-line-strong:  #C9CBD0;  /* segmented controls, secondary button borders */
  --pr-border-input: #8E9197;  /* input, select and checkbox borders (3:1 on white) */

  --pr-ink:          #22201E;  /* primary text, primary buttons */
  --pr-ink-muted:        #62666D;  /* secondary text, labels, metadata */
  --pr-ink-faint:        #8E9197;  /* decorative only: icons, dividers, empty dots. Never body text. */
  --pr-on-ink:       #FFFFFF;  /* text on ink-filled buttons, toasts */

  /* ---- Brand accent: Glacier -------------------------------------- */
  --pr-brand:       #2A75B0;  /* logo mark, links, focus ring, selection */
  --pr-brand-2:     #5FB3E8;  /* gradient partner, agent glow only */
  --pr-brand-3:     #A9D8F5;  /* gradient partner, agent glow only */

  /* ---- Agent ------------------------------------------------------- */
  --pr-agent-ink:    #1F5B8C;  /* text in agent chips, badges, draft headers */
  --pr-agent-bg:     #EAF2F9;  /* fill for agent chips and badges */

  /* ---- Case readiness (status) ------------------------------------ */
  --pr-ready:        #2A7249;
  --pr-ready-bg:     #E5F1E9;
  --pr-pending:      #8A5A0E;
  --pr-pending-bg:   #FAEFD9;
  --pr-blocked:      #A3302D;
  --pr-blocked-bg:   #F8E3E1;

  /* ---- Overlays ---------------------------------------------------- */
  --pr-overlay:      rgba(20, 24, 31, .32);  /* dialog scrim */
  --pr-skeleton:     #EEF0F3;                /* loading placeholders */
  --pr-shadow-overlay: 0 20px 60px rgba(20, 24, 31, .18), 0 2px 6px rgba(20, 24, 31, .08);
  --pr-shadow-toast:   0 8px 24px rgba(20, 24, 31, .18);

  /* ---- Agent glow -------------------------------------------------- */
  /* Working spins (the familiar "AI is on it" cue). Waiting holds still but
     is heavier, because a person must decide. */
  --pr-glow-border:  1.5px;  /* while working */
  --pr-glow-border-waiting: 2px;
  --pr-glow-blur:    16px;
  --pr-glow-spread:  4px;
  --pr-glow-opacity: .20;    /* while working */
  --pr-glow-opacity-waiting: .32;
  --pr-glow-period:  3.5s;   /* one full rotation */

  /* ---- Typography -------------------------------------------------- */
  --pr-font-display: "Petrona", "Iowan Old Style", Georgia, serif;
  --pr-font-sans:    "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Four sizes plus display. Nothing else sets a font size. */
  --pr-text-display: clamp(1.875rem, 1.35rem + 2.2vw, 2.625rem); /* 30–42px page titles */
  --pr-text-heading: 1.25rem;     /* 20px section headings, wordmark */
  --pr-text-body:    0.9375rem;   /* 15px content: rows, inputs, messages */
  --pr-text-sm:      0.84375rem;  /* 13.5px controls, metadata, labels, badges, chips */
  --pr-text-xs:      0.75rem;     /* 12px hints, timestamps, counts */

  --pr-leading-tight: 1.08;
  --pr-leading-snug:  1.25;
  --pr-leading-body:  1.5;

  --pr-weight-regular:  400;
  --pr-weight-medium:   500;
  --pr-weight-semibold: 600;

  /* ---- Space (4px base) ------------------------------------------- */
  --pr-space-1: 4px;   --pr-space-2: 8px;   --pr-space-3: 12px;  --pr-space-4: 16px;
  --pr-space-5: 20px;  --pr-space-6: 24px;  --pr-space-8: 32px;  --pr-space-10: 40px;
  --pr-space-12: 48px; --pr-space-16: 64px;
  /* Page rhythm only: the space between a page's major blocks. Components never use these. */
  --pr-space-20: 80px; --pr-space-24: 96px;

  /* ---- Density: default (lists and boards) ------------------------ */
  --pr-row-py:    14px;
  --pr-row-px:    18px;
  --pr-panel-p:   20px;
  --pr-stack-gap: 10px;
  --pr-chip-py:   4px;

  /* ---- Radius: soft ----------------------------------------------- */
  --pr-radius-card:   12px;
  --pr-radius-button: 9px;
  --pr-radius-input:  8px;
  --pr-radius-badge:  8px;
  --pr-radius-pill:   999px;

  /* ---- State marks ------------------------------------------------ */
  /* Shapes (used as masks, painted in the state's color) so a status never
     depends on color alone. Chips, board filters and anything else that
     shows a checklist state use these. */
  --pr-mark-ready:   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.8 5.3 4.1 7.5 8.3 2.6' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --pr-mark-pending: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Ccircle cx='5' cy='5' r='3.6' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E");
  --pr-mark-blocked: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath fill-rule='evenodd' d='M5 .5a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9ZM2.6 4.2h4.8v1.6H2.6Z'/%3E%3C/svg%3E");
  --pr-mark-agent:   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Ccircle cx='5' cy='5' r='4'/%3E%3C/svg%3E");
  --pr-mark-todo:    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Ccircle cx='5' cy='5' r='3.6' fill='none' stroke='%23000' stroke-width='1.3' stroke-dasharray='1.9 1.4'/%3E%3C/svg%3E");

  /* ---- Motion ------------------------------------------------------ */
  --pr-ease-out:      cubic-bezier(.2, .7, .2, 1);
  --pr-duration-fast: 150ms;  /* hover, press */
  --pr-duration-base: 250ms;  /* toasts, tab changes */
  --pr-duration-slow: 400ms;  /* entrances */

  /* ---- Layers ------------------------------------------------------ */
  --pr-z-sticky:  10;
  --pr-z-overlay: 20;
  --pr-z-toast:   30;

  --pr-content-max: 1120px;
  --pr-page-max: 840px;    /* single-column pages, such as Today */
  --pr-topbar-h: 64px;
  --pr-gutter: 24px;
}

/* ---- Density: roomy (detail views and forms) ---------------------- */
[data-density="roomy"] {
  --pr-row-py:    19px;
  --pr-row-px:    22px;
  --pr-panel-p:   26px;
  --pr-stack-gap: 14px;
  --pr-chip-py:   5px;
}

/* ---- Dark theme --------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --pr-surface: #111316; --pr-raised: #1A1D21; --pr-sunken: #15171B;
    --pr-line: #2A2E34; --pr-line-strong: #4A5058; --pr-border-input: #80868F;
    --pr-ink: #EEECE9; --pr-ink-muted: #A3A8B0; --pr-ink-faint: #80868F; --pr-on-ink: #111316;
    --pr-brand: #62ABE2; --pr-brand-2: #7FC8F2; --pr-brand-3: #2F6FA8;
    --pr-agent-ink: #9CCBF0; --pr-agent-bg: #1A2A3A;
    --pr-ready: #6CC293; --pr-ready-bg: #17301F;
    --pr-pending: #E3B062; --pr-pending-bg: #33291A;
    --pr-blocked: #F08C86; --pr-blocked-bg: #3A1F1E;
    --pr-overlay: rgba(0, 0, 0, .55); --pr-skeleton: #23272D;
    --pr-shadow-overlay: 0 20px 60px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
    --pr-shadow-toast: 0 8px 24px rgba(0, 0, 0, .5);
    --pr-glow-opacity: .28; --pr-glow-opacity-waiting: .45;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --pr-surface: #111316; --pr-raised: #1A1D21; --pr-sunken: #15171B;
  --pr-line: #2A2E34; --pr-line-strong: #4A5058; --pr-border-input: #80868F;
  --pr-ink: #EEECE9; --pr-ink-muted: #A3A8B0; --pr-ink-faint: #80868F; --pr-on-ink: #111316;
  --pr-brand: #62ABE2; --pr-brand-2: #7FC8F2; --pr-brand-3: #2F6FA8;
  --pr-agent-ink: #9CCBF0; --pr-agent-bg: #1A2A3A;
  --pr-ready: #6CC293; --pr-ready-bg: #17301F;
  --pr-pending: #E3B062; --pr-pending-bg: #33291A;
  --pr-blocked: #F08C86; --pr-blocked-bg: #3A1F1E;
  --pr-overlay: rgba(0, 0, 0, .55); --pr-skeleton: #23272D;
  --pr-shadow-overlay: 0 20px 60px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
  --pr-shadow-toast: 0 8px 24px rgba(0, 0, 0, .5);
  --pr-glow-opacity: .28; --pr-glow-opacity-waiting: .45;
  color-scheme: dark;
}
