/* ==========================================================================
   EDAMA QMS Design Tokens
   Single source of truth for all CSS custom properties.
   Brand Colors: Deep Blue (#003B7A), Medium Blue (#0072BC),
                 Teal (#27A9B8), Light Teal (#5ABFCA), Gray (#8C8C8C)
   ========================================================================== */

:root {
    /* Brand palette (from EDAMA logo) */
    --brand-primary: #0072BC;
    --brand-secondary: #003B7A;
    --brand-deep: #003B7A;
    --brand-blue: #0072BC;
    --brand-teal: #27A9B8;
    --brand-teal-light: #5ABFCA;
    --brand-navy: #003B7A;
    --brand-lime: #92D050;      /* the brand's lime (My Day's `--p-lime` reads it): the routine tile's dot in the phone bar's sheet (UX S6 Task 7) */

    /* Series colours (UX D5): the first five projects a person times, in order; the rest are Other. Never used for text. */
    --series-1: #0072BC;
    --series-2: #D9730D;
    --series-3: #1F9E8F;
    --series-4: #8A5CC2;
    --series-5: #C2417A;
    --series-other: #8A97A6;

    /* The month's shades (UX S2a, Ruling 39): five steps of one blue by hours logged. Text on steps 1 to 4 is the page's dark ink; only step 5
       takes white (white on step 4 is 3.5 to 1, under the 4.5 the text needs). */
    --heat-1: #DCEBF7;
    --heat-2: #B4D4EE;
    --heat-3: #7FB4E0;
    --heat-4: #3D8FCE;
    --heat-5: #0072BC;
    --heat-5-ink: #FFFFFF;
    --on-brand: #FFFFFF;        /* a label on a --brand-primary button (shared buttons write #fff here) */

    /* The timer control when nothing runs */
    --timer-idle-bg: #FFFFFF;
    --timer-idle-border: #CFDCEA;
    --timer-idle-text: #1F2A44;

    /* The timer's status line: a Logged message, and the words of a refusal (light surfaces only) */
    --timer-say-bg: #ECFDF3;
    --timer-say-border: #6DD4A0;
    --timer-say-text: #0A5C37;
    --timer-say-error-bg: #FFFBEB;
    --timer-say-error-border: #F0D060;
    --timer-say-error-text: #8A5A0B;

    /* The header search box's panel (timer-picker.css): a light surface that hangs under the control. */
    --picker-bg: #FFFFFF;
    /* The background of a panel that drops from the header over the page (the menu's More panel): opaque, never --surface (white at 0.95), or the page's headings read through it. */
    --panel-drop-bg: #FFFFFF;
    --picker-border: #CFDCEA;
    --picker-shadow: 0 22px 50px rgba(0, 59, 122, 0.18);
    --picker-row-on: #EEF6FF;
    --picker-new-bg: #F8FBFE;
    --picker-new-border: #B9CFE6;
    --picker-field-border: #CFDCEA;
    --picker-focus: #CFE4F7;
    --tab-lit-border: 1px solid #bfdbfe;   /* the lit tab of the menu row (.shell-tab--active) and More lit for a place pinned or under it */
    --bar-bg: #FFFFFF;                     /* the phone bar's own ground (UX S6): the strip at the window's foot, under 768 px */
    --sheet-veil: rgba(228, 238, 248, .6); /* the veil behind a sheet that rises from the phone bar: My Day's own scrim colour (myday.css) */

    /* The building blocks (UX S7, Task 2): five type sizes, the touch target, the focus ring and the button family's look. Additions only:
       no value above or below changes, and `site.css`'s `:root` (loaded later) defines none of these names. Rem, so a reader's larger default
       font still scales the text. `--type-body` and `--type-title` are reference values that no rule of the stage reads (the live body is 14px,
       `--text-lg` 17px); `--type-page` is the plan's guess and nothing reads it. `blocks.css` reads the rest. */
    --type-caption: 0.75rem;    /* 12px: the floor for any text */
    --type-meta: 0.875rem;      /* 14px */
    --type-body: 0.9375rem;     /* 15px */
    --type-title: 1.125rem;     /* 18px */
    --type-page: 1.5rem;        /* 24px */
    --target: 44px;             /* a control's touch target is 44 by 44 */
    --focus-ring: 2px solid var(--brand-primary);   /* the ring today's four shared rules draw, made one name */
    --focus-offset: 2px;
    --btn-line: #CFDCEA;        /* the plain button's border: the timer control's idle line, the header's own */
    --btn-plain-bg: #FFFFFF;    /* the plain button's ground: light, never a fill */
    --btn-gap: var(--sp-2);     /* between a button's icon and its words, in either direction of writing */

    /* Neutrals */
    --bg-1: #F5F8FA;
    --bg-2: #EAF6F8;
    --ink: #1A2035;
    --ink-soft: #475569;
    --neutral-50: #F8FAFB;
    --neutral-100: #F0F4F7;
    --neutral-200: #DDE8EF;
    --neutral-400: #8C8C8C;
    --neutral-500: #64748b;
    --neutral-600: #475569;
    --neutral-700: #334155;
    --neutral-900: #003B7A;
    --text-muted: #8C8C8C;
    --card: rgba(255, 255, 255, 0.95);
    --line: rgba(0, 59, 122, 0.1);

    /* Semantic */
    --success: #059669;
    --success-bg: #ECFDF5;
    --success-border: #6dd4a0;
    --success-ink: #0a5c37;     /* text on --success-bg: the header's running pill ink (about 7.5 to 1); --success gives about 3.6 to 1 */
    --warning: #D97706;
    --warning-bg: #FEF9C3;
    --warning-border: #f0d060;
    --danger: #DC2626;
    --danger-bg: #FEF2F2;
    --danger-border: #e4938a;
    --danger-ink: #9B1C1C;      /* text on --danger-bg: 12px text needs more than --danger gives */
    --warning-ink: #7A4A00;     /* text on --warning-bg */
    --info: #0072BC;
    --info-bg: #EEF6FF;
    --info-border: #80b3ff;

    /* Spacing scale (4px rhythm) */
    --sp-1: 0.25rem;    /* 4px */
    --sp-2: 0.5rem;     /* 8px */
    --sp-3: 0.75rem;    /* 12px */
    --sp-4: 1rem;       /* 16px */
    --sp-5: 1.25rem;    /* 20px */
    --sp-6: 1.5rem;     /* 24px */
    --sp-8: 2rem;       /* 32px */

    /* Typography — Fonts */
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-heading: 'Plus Jakarta Sans', 'DM Sans', sans-serif;
    --font-mono: 'JetBrains Mono', 'Menlo', monospace;
    --font-ar: 'IBM Plex Sans Arabic', 'DM Sans', sans-serif;

    /* Typography — Scale (modular 1.25) */
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-lg: 1.125rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;
    --text-3xl: 2.5rem;

    /* Typography — Weights */
    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    /* Tabular numbers for data alignment */
    --font-tabular: 'tnum';

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius: 10px;
    --radius-full: 9999px;

    /* Surface and border */
    --surface: rgba(255, 255, 255, 0.95);
    --border: rgba(0, 59, 122, 0.12);

    /* Layout tokens */
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 60px;
    --header-height: 48px;
    /* The record drawer (stage 8, Task 8): its width, and how far it travels in when it opens. */
    --drawer-width: 560px;
    --drawer-travel: 40px;

/* ── Stacking order ──────────────────────────────────────────────────────
   Overlays used to pick their own number, each one outbidding the last: the
   product carried 31 distinct z-index values between 6 and 100000. The result
   was that the My Routine drawer (10100) sat above the header (50), the
   confirm dialog (9999) and the toasts (10000) — so opening the routine
   buried the notifications dropdown, any confirmation, and any toast.

   Use these names. A new overlay that needs its own layer belongs in this
   list, not on a bigger number.

   The values sit deliberately high: they RAISE the few components below into
   the right order without lowering anything that already works, so overlays
   this scale has not reached yet keep their current behaviour.
   ──────────────────────────────────────────────────────────────────────── */
    --z-widget: 9999;      /* ambient, always-there: messenger bubble        */
    --z-drawer-backdrop: 10099;
    --z-drawer: 10100;     /* side panels: My Routine, contextual drawers    */
    --z-bar: 10150;        /* the phone bar and its sheets (UX S6): above the drawers 10100 and their backdrop, below the header */
    --z-header: 10200;     /* fixed top bar AND anything anchored to it      */
    --z-modal: 10300;      /* dialogs and confirmations — cover the header   */
    --z-toast: 10400;      /* transient feedback — above everything working  */
    --z-skip-link: 100000; /* keyboard escape hatch — first, always          */

    --content-max-width: 1120px;

    /* Animation */
    --duration: 200ms;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);

    /* Motion — named curves */
    --motion-spring: cubic-bezier(.22, .8, .22, 1);
    --motion-ease:   cubic-bezier(.4, 0, .2, 1);
    --motion-duration: 200ms;
    --motion-duration-slow: 480ms;

    /* Shadows — named for context */
    --shadow-drawer: -1px 0 0 rgba(0,59,122,0.04), -36px 0 100px -24px rgba(0,59,122,0.18);
    --shadow-modal:  0 20px 60px -20px rgba(0,59,122,0.25), 0 4px 12px rgba(0,59,122,0.08);
    --shadow-editor: 0 1px 3px rgba(0,59,122,0.04);
    --shadow-sheet:  0 -4px 24px rgba(0,59,122,0.12);   /* a bottom sheet's lift: My Day's six (UX S2b Task 10) */
    --shadow-strip:  0 1px 2px rgba(0,59,122,0.06);
    --tab-lit-shadow: 0 1px 3px rgba(0, 114, 188, 0.12);   /* the lit tab's lift, with --tab-lit-border */

    /* Glassmorphism System */
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-bg-heavy: rgba(255, 255, 255, 0.88);
    --glass-border: rgba(255, 255, 255, 0.25);
    --glass-blur: 12px;
    --glass-shadow-sm: 0 1px 3px rgba(0,59,122,0.04), 0 1px 2px rgba(0,59,122,0.06);
    --glass-shadow-md: 0 4px 12px rgba(0,59,122,0.06), 0 2px 4px rgba(0,59,122,0.04);
    --glass-shadow-lg: 0 12px 32px rgba(0,59,122,0.08), 0 4px 8px rgba(0,59,122,0.04);

    /* Extended Spacing */
    --sp-10: 40px;
    --sp-12: 48px;
    --sp-16: 64px;
    --sp-20: 80px;

    /* RGB variant for rgba() usage */
    --primary-rgb: 0, 114, 188;

    /* My Day's areas (UX S2b): the tiles under the day and the panel a press opens. Measures of the sketch's .world. */
    --area-gap: 12px;
    --area-tile-radius: 16px;
    --area-tile-pad-y: 14px;
    --area-tile-pad-x: 16px;
    --area-tile-min-height: 264px;   /* the grid's row minimum: the height of a tile with its figures (Task 3 measured the fullest, Projects with three rows, "and n more" and the deliverables line, at 259 at 1440 and 390 wide; 264 leaves it room) */
    --area-wide-min-height: 136px;   /* Across EDAMA spans the row and has no chart: its own, smaller minimum (UX S2b Task 4 measured its filled body at 135 px at 1440; below 1000 px areas.css raises it to 180, measured 179 at 390) */
    --area-tile-lift: 0 8px 22px rgba(0, 114, 188, 0.12);
    --area-panel-width: min(430px, 100%);
    --area-scrim: rgba(228, 238, 248, 0.6);
    /* The figures in the tiles (Task 2): a column's plot, a day's pale rest and a day off's hatch. */
    --area-col-height: 64px;
    --area-rest: rgba(0, 114, 188, 0.16);
    --area-hatch: rgba(107, 114, 128, 0.5);

    /* The Inbox's six kind badges (stage 10, Task 3): the pairs inbox.html carried as literals, background then ink. */
    --inbox-badge-approve-bg: #fef3c7;
    --inbox-badge-approve-ink: #92400e;
    --inbox-badge-assigned-bg: #dbeafe;
    --inbox-badge-assigned-ink: #1e40af;
    --inbox-badge-mention-bg: #e0e7ff;
    --inbox-badge-mention-ink: #3730a3;
    --inbox-badge-escalated-bg: #fee2e2;
    --inbox-badge-escalated-ink: #991b1b;
    --inbox-badge-system-bg: #f1f5f9;
    --inbox-badge-system-ink: #475569;
    --inbox-badge-update-bg: #dcfce7;
    --inbox-badge-update-ink: #166534;
    /* The lit segment of the Inbox's two-list control and the white on it. */
    --inbox-tab-on-ink: #ffffff;
}
