/* ============================================================================
   MAITRI NIGHT THEME  ·  "gentler at 11pm" (design-system principle #6)
   Link AFTER tokens.css. Activates via [data-theme="night"] (set by theme.js) and,
   for [data-theme="auto"], the OS preference.

   IMPORTANT: many screens use PRIMITIVE color tokens directly (--ink-900, --teal-50,
   etc.), so the night theme overrides the PRIMITIVES — not only the role tokens — so
   every usage (role or direct) flips correctly and stays readable. The one exception is
   --ink-900 used as a *background* (chat bubbles / toasts): those use --color-inverse,
   which is overridden separately below so it doesn't invert with the ink text.

   Parity with MaitriColor.dark (iOS) and MaitriNight (Android).
   ========================================================================= */

:root[data-theme="night"],
:root[data-theme="auto"] {

  /* ---- warm neutrals (surfaces) ---- */
  --paper-0:   #221D16;   /* raised surface (cards)       */
  --paper-50:  #26201A;
  --paper-100: #14110D;   /* canvas                       */
  --paper-200: #1C1813;   /* sunken / inset               */
  --paper-300: #2A241C;

  /* ---- ink (TEXT) — inverted so it reads on the dark canvas ---- */
  --ink-900: #F4EFE7;     /* primary text  (~14:1 on canvas) */
  --ink-700: #C8BFB1;     /* secondary                       */
  --ink-600: #ADA396;     /* tertiary text (AA on canvas)    */
  --ink-500: #8C8275;     /* hint / non-text                 */
  --ink-300: #574E42;     /* disabled                        */

  --line:        #352F27;
  --line-strong: #4A4338;

  /* ---- teal — lifted so fills/text read on dark ---- */
  --teal-50:  #16352F;    /* dark tonal background (chips)   */
  --teal-100: #1C4842;
  --teal-200: #265C53;
  --teal-300: #3C8174;
  --teal-400: #4FA396;
  --teal-500: #5BBBAC;
  --teal-600: #4FA396;
  --teal-700: #8FD6C2;    /* teal TEXT / links — light       */
  --teal-800: #B7E4D7;

  /* ---- coral — accent ---- */
  --coral-50:  #38201A;   /* dark tonal background           */
  --coral-100: #4A2A20;
  --coral-200: #5E3526;
  --coral-300: #C0633F;
  --coral-400: #E0744A;
  --coral-500: #EA8A62;
  --coral-600: #F0A07E;   /* coral accent — light            */
  --coral-700: #F0A07E;   /* coral text on coral tint        */

  --gold-300: #6B5320;
  --gold-500: #E3B24A;
  --gold-600: #F0CE7A;

  /* ---- semantic (bg = dark tint, 700 = light text) ---- */
  --success-500: #3FB382;  --success-700: #74CCA0;  --success-bg: #15291F;  --success-border: #2C5C45;
  --warning-500: #E0A82E;  --warning-700: #E8C15A;  --warning-bg: #2A2310;  --warning-border: #5A4A1E;
  --danger-500:  #D9694F;  --danger-700:  #ED9C89;  --danger-bg:  #2E1712;
  --info-500:    #5B97C9;  --info-700:    #A1C6E3;  --info-bg:    #16242E;

  /* ---- role tokens that are LITERALS in tokens.css (don't derive) ---- */
  --color-primary:       #1F7A6E;   /* white label = 5.2:1 (AA normal) */
  --color-primary-hover: #18665C;   /* hover darkens → 6.8:1           */
  --color-on-primary:    #FFFFFF;
  --color-overlay-scrim: rgba(0, 0, 0, 0.55);
  --color-focus-ring:    rgba(91, 195, 176, 0.45);

  /* inverse surface (user bubbles / toasts): a light surface w/ dark text in night */
  --color-inverse:    #EDE7DC;
  --color-on-inverse: #211C16;

  /* ---- presence + elevation tuned for dark ---- */
  --maitri-aura-soft: linear-gradient(135deg, rgba(91,195,176,0.18), rgba(46,139,127,0.10));

  /* logo-theme marks, brightened so they read on the dark canvas */
  --logo-node:        #8FD6C2;
  --logo-link:        rgba(143,214,194,0.50);
  --logo-link-bright: #8FD6C2;
  --logo-core:        #8FD6C2;
  --logo-mote:        #B6F4E3;
  --logo-glow:        rgba(143,214,194,0.55);
  --logo-tile:        #1C4842;

  --shadow-1: 0 1px 2px rgba(0,0,0,0.35);
  --shadow-2: 0 2px 8px rgba(0,0,0,0.40);
  --shadow-3: 0 8px 24px rgba(0,0,0,0.50);
  --shadow-4: 0 16px 48px rgba(0,0,0,0.60);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] { color-scheme: dark; }
}
