/* ============================================================================
   Aidea — design tokens · Midnight
   ----------------------------------------------------------------------------
   This file is the ONLY place where design values live. Everything else in the
   app refers to these names.

   Two layers:
     1. Midnight palette  (--midnight-*)  the shared Brainstorm Design System —
        Midnight, value for value. Retune the palette here and only here.
     2. Roles            (--color-*, --font-*, --space-*, …)  what components
        use. Roles point at the palette, so a component never names a hue.

   Naming:  --<category>-<role>[-<variant>]   e.g. --color-primary-hover
            spacing is named by its size:     --space-16 is 16px

   One theme: Midnight is dark only.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* ── 1 · Midnight palette ────────────────────────────────────────────── */
  /* Surfaces: lighter and more purple as they rise */
  --midnight-bg-base:        #0E0B24;  /* app background: deep indigo-navy */
  --midnight-bg-surface:     #17133A;  /* cards and editor */
  --midnight-bg-raised:      #211C4D;  /* menus, modals, capture sheet */
  --midnight-bg-sunken:      #090718;  /* sidebars and rails, input wells */
  --midnight-border-subtle:  #2C2660;  /* dividers */
  --midnight-border-strong:  #4A4390;  /* emphasised edges (decorative) */
  --midnight-border-control: #6F67BF;  /* Aidea addition: control edges need 3:1, border-strong is 2.1:1 on surface */
  --midnight-text-primary:   #F7F5FF;  /* body text (Aidea: brightened from Midnight's #EEEBFF) */
  --midnight-text-secondary: #CDC8EE;  /* metadata (Aidea: brightened from #B4AEDB) */
  --midnight-text-muted:     #A6A1D2;  /* hints and placeholders (Aidea: brightened from #8A84B8; now 5.3:1 or better everywhere) */

  /* Accents */
  --midnight-blue:           #5BA8FF;  /* primary actions, links, active navigation */
  --midnight-blue-hover:     #7DBBFF;  /* Aidea addition: blue under the pointer */
  --midnight-blue-soft:      #1C2E5C;  /* selected rows, highlighted search matches */
  --midnight-purple:         #A98BFF;  /* secondary emphasis: expansion threads (features), linked ideas */
  --midnight-purple-soft:    #2E2266;  /* hovered rows, chip backgrounds */
  --midnight-orange:         #FF9A3D;  /* spark: the capture button, new-idea moments, action-button outlines, the logo */
  --midnight-orange-soft:    #4A2A14;  /* live-transcript wash, just-saved glow */
  --midnight-on-accent:      #0E0B24;  /* text and icons on a blue, purple or orange fill */
  --midnight-focus:          #C4B0FF;  /* focus rings */

  /* Idea states (reserved: Aidea doesn't track states yet) */
  --midnight-state-seed:     #FF9A3D;
  --midnight-state-growing:  #5BA8FF;
  --midnight-state-parked:   #8A84B8;
  --midnight-state-shipped:  #A98BFF;

  /* Feedback */
  --midnight-success:        #4FD1A1;  /* saved, synced */
  --midnight-warning:        #FFC857;  /* unsynced, low-confidence transcript */
  --midnight-error:          #FF6B7A;  /* failed save or recording; destructive actions */
  --midnight-info:           #5BA8FF;  /* tips and neutral notices */

  /* ── 2 · Colour roles ────────────────────────────────────────────────── */
  --color-background:       var(--midnight-bg-base);
  --color-surface:          var(--midnight-bg-surface);     /* idea cards, the editor's fields */
  --color-surface-raised:   var(--midnight-bg-raised);      /* modals, the capture sheet, toasts */
  --color-surface-sunken:   var(--midnight-bg-sunken);      /* icon rail, bottom bar, input wells */
  --color-border:           var(--midnight-border-subtle);  /* dividers and card edges (decorative) */
  --color-border-emphasis:  var(--midnight-border-strong);  /* an edge that should be noticed, e.g. a hovered card */
  --color-border-strong:    var(--midnight-border-control); /* anything you click or type into */
  --color-text-primary:     var(--midnight-text-primary);
  --color-text-secondary:   var(--midnight-text-secondary); /* previews, metadata; use this (not muted) on tinted rows */
  --color-text-muted:       var(--midnight-text-muted);     /* hints, placeholders, timestamps */
  --color-focus:            var(--midnight-focus);
  --color-overlay:          rgba(9, 7, 24, 0.72);           /* dims the page behind a modal or sheet */

  --color-primary:          var(--midnight-blue);           /* primary buttons, links, the selected idea */
  --color-primary-hover:    var(--midnight-blue-hover);
  --color-on-primary:       var(--midnight-on-accent);
  --color-primary-subtle:   var(--midnight-blue-soft);      /* selected card */

  --color-secondary:        var(--midnight-purple);         /* features (the expansion thread), counts */
  --color-on-secondary:     var(--midnight-on-accent);
  --color-secondary-subtle: var(--midnight-purple-soft);    /* hovered rows, chips */
  --color-row-hover:        var(--midnight-purple-soft);

  --color-accent:           var(--midnight-orange);         /* capture, "new" and the logo; never text */
  --color-on-accent:        var(--midnight-on-accent);
  --color-accent-subtle:    var(--midnight-orange-soft);    /* live transcript, just-dictated flash */
  --color-action-outline:   var(--midnight-orange);        /* Aidea: edge of outlined action buttons and mics */
  --color-action-outline-hover: var(--midnight-orange-soft); /* an outlined action button under the pointer */
  --color-recording:        var(--midnight-orange);         /* a mic while it listens — capture is orange */
  --color-on-recording:     var(--midnight-on-accent);

  --color-success:          var(--midnight-success);
  --color-success-subtle:   color-mix(in srgb, var(--midnight-success) 16%, var(--midnight-bg-surface));
  --color-warning:          var(--midnight-warning);
  --color-warning-subtle:   color-mix(in srgb, var(--midnight-warning) 16%, var(--midnight-bg-surface));
  --color-danger:           var(--midnight-error);
  --color-on-danger:        var(--midnight-on-accent);
  --color-danger-subtle:    color-mix(in srgb, var(--midnight-error) 16%, var(--midnight-bg-surface));
  --color-info:             var(--midnight-info);
  --color-info-subtle:      color-mix(in srgb, var(--midnight-info) 16%, var(--midnight-bg-surface));

  /* ── Typography ──────────────────────────────────────────────────────── */
  --font-body:    "Inter", system-ui, "Segoe UI", sans-serif;               /* UI and body */
  --font-heading: "Inter", system-ui, "Segoe UI", sans-serif;               /* page and section headings */
  --font-serif:   "Source Serif 4", Georgia, "Times New Roman", serif;      /* idea titles: a written-down feel */
  --font-mono:    "JetBrains Mono", ui-monospace, Menlo, monospace;         /* timestamps, durations, counts */

  /* Midnight type scale — size and line height, always used as a pair */
  --font-size-display: 32px;  --line-height-display: 40px;  /* type.display — idea title, serif */
  --font-size-title:   24px;  --line-height-title:   32px;  /* type.title — page titles, wordmark, idea title on phones */
  --font-size-heading: 18px;  --line-height-heading: 26px;  /* type.heading — section and card titles, modal titles */
  --font-size-body:    16px;  --line-height-body:    26px;  /* type.body — idea text, features, transcripts */
  --font-size-small:   14px;  --line-height-small:   20px;  /* type.small — metadata, buttons, previews, hints */
  --font-size-caption: 12px;  --line-height-caption: 16px;  /* type.caption — labels, chips, timestamps */

  --font-weight-regular:  400;
  --font-weight-medium:   500;  /* captions */
  --font-weight-semibold: 600;  /* headings, titles, buttons */
  --letter-spacing-tight: -0.01em;  /* Inter at title size and above */
  --measure:              70ch;     /* longest line for short centred copy (empty states) */

  /* ── Spacing · Midnight 4px scale, named by size ─────────────────────── */
  --space-hairline: 2px;  /* waveform bars and icon rows only — below the scale */
  --space-4:   4px;
  --space-8:   8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-24: 24px;
  --space-32: 32px;
  --space-48: 48px;
  --space-64: 64px;

  /* ── Corner radius ───────────────────────────────────────────────────── */
  --radius-control: 6px;    /* inputs, buttons, chips */
  --radius-card:    12px;   /* cards, feature entries, fields */
  --radius-sheet:   16px;   /* sheets and modals */
  --radius-full:    999px;  /* the capture button, pills, the waveform */

  /* ── Elevation: purple glow instead of drop shadow ───────────────────── */
  --glow-1: 0 0 0 1px rgba(169, 139, 255, 0.10);                                         /* barely lifted: a hovered card */
  --glow-2: 0 0 0 1px rgba(169, 139, 255, 0.14), 0 8px 28px rgba(88, 60, 200, 0.28);     /* floating: the feature box, toasts */
  --glow-3: 0 0 0 1px rgba(169, 139, 255, 0.18), 0 16px 48px rgba(88, 60, 200, 0.40);    /* above everything: sheets, modals */
  --glow-capture: 0 0 0 6px rgba(255, 154, 61, 0.14), 0 10px 32px rgba(255, 154, 61, 0.35); /* the capture button */
  --glow-new: 0 0 0 1px rgba(255, 154, 61, 0.55), 0 0 24px rgba(255, 154, 61, 0.30);     /* a just-saved card, fading out */

  /* ── Borders and focus ───────────────────────────────────────────────── */
  --border-width-thin:  1px;
  --border-width-thick: 2px;   /* title underline while editing, recording ring */
  --focus-ring-width:   2px;
  --focus-ring-offset:  2px;
  --size-hairline:      1px;   /* screen-reader-only boxes */

  /* ── Sizes · controls and icons ──────────────────────────────────────── */
  --size-touch-min:     44px;  /* smallest tap target (Midnight: at least 44 × 44) */
  --size-control-md:    44px;  /* buttons, search, inline mics */
  --size-control-sm:    36px;  /* compact buttons; their tap area is still padded to 44 */
  --size-icon-button:   44px;  /* square icon-only buttons */
  --size-capture:       64px;  /* the floating capture button */
  --size-rail-item:     56px;  /* a view or settings button in the rail or bottom bar */
  --size-bottom-bar:    64px;  /* phones: the bottom navigation bar */
  --size-icon-sm:       18px;
  --size-icon-md:       20px;
  --size-icon-lg:       28px;  /* inside the capture button */
  --icon-stroke:        1.5;   /* outline icons on a 24-unit grid */
  --size-checkbox:      18px;
  --size-dot-sm:         6px;  /* save-status dot */
  --size-dot-md:         8px;  /* "new idea" dot */
  --size-accent-edge:    3px;  /* coloured left edge of a feature entry */
  --size-wave-bar:       3px;  /* waveform bar width (small) */
  --size-wave-bar-lg:    6px;  /* waveform bar width in the capture sheet */
  --size-wave-min:       4px;
  --size-wave-max:      16px;
  --size-wave-max-lg:   72px;
  --size-pulse-offset:   6px;  /* gentle ring outside a listening mic */

  /* ── Sizes · fields ──────────────────────────────────────────────────── */
  --size-field-min:          56px;
  --size-field-min-large:   120px;  /* the idea's own text */
  --size-field-min-feature:  44px;
  --size-field-min-composer: 52px;  /* "Expand this idea" */
  --size-field-min-dialog:  160px;  /* text in a modal or sheet */
  --size-search-inset:       40px;  /* room for the search icon */
  --size-search-icon-x:      12px;
  --size-search-icon-y:      13px;
  --size-skeleton-line:      12px;  /* loading placeholder bar height */

  /* ── Sizes · brand mark (five waveform bars) ─────────────────────────── */
  --size-brand-mark:  24px;
  --size-brand-bar:    4px;
  --size-brand-gap:    3px;
  --size-brand-bar-1: 10px;
  --size-brand-bar-2: 20px;
  --size-brand-bar-3: 14px;
  --size-brand-bar-4: 22px;
  --size-brand-bar-5:  8px;

  /* ── Layout ──────────────────────────────────────────────────────────── */
  --layout-rail-width:    72px;    /* desktop and tablet: the icon rail (logo, views, settings) */
  --layout-list-width:    360px;   /* the list of idea cards */
  --layout-list-width-tablet: 336px; /* the list on tablets, so the idea keeps room */
  --layout-brand-width-tablet: 176px; /* tablets: the logo and name; the capture bar takes the rest of the top row */
  --layout-detail-max:    760px;   /* the idea column's base width; desktop adds half the space either side */
  --layout-sheet-max:     640px;   /* capture sheet */
  --layout-modal-max:     640px;
  --layout-toast-max:     480px;
  --layout-toast-vw:       92vw;
  --layout-modal-vh:       90vh;
  --breakpoint-mobile-max: 599px;   /* single column; list or idea, one at a time */
  --breakpoint-tablet-max: 1023px;  /* rail, list and idea side by side; no bottom bar */
                                    /* CSS can't use variables in media queries: the app reads these
                                       and sets .is-mobile or .is-tablet on <html>. */

  /* ── Motion ──────────────────────────────────────────────────────────── */
  --duration-short:  0.12s;  /* hover and press */
  --duration-medium: 0.22s;  /* sheets, panels, toasts */
  --duration-long:   0.32s;  /* moving between views */
  --duration-glow:   1.2s;   /* orange glow on a just-saved card, fading */
  --duration-wave:   0.9s;   /* one waveform bar cycle */
  --duration-wave-step: 0.12s;
  --duration-pulse:  1.6s;   /* gentle pulse while recording */
  --easing-out:    cubic-bezier(0.2, 0.8, 0.2, 1);
  --easing-spring: cubic-bezier(0.34, 1.56, 0.64, 1);  /* capture moments */
  --motion-rise:     16px;   /* how far sheets and toasts slide in */
  --motion-pulse-scale: 1.18;
  --motion-hover-scale: 1.04;  /* the capture button under the pointer */
  --motion-press-scale: 0.96;  /* the capture button while pressed */

  /* ── Opacity and layers ──────────────────────────────────────────────── */
  --opacity-disabled:    0.45;
  --opacity-placeholder: 0.8;
  --opacity-pulse:       0.6;
  --opacity-dimmed:      0.5;
  --z-nav:     20;
  --z-capture: 30;
  --z-toast:   40;
  --z-modal:   50;
}
