/**
 * Dark theme "Ink at night": the paper turns into deep ink, the ink into
 * paper. Persimmon still marks only what is live; as text it gets lighter
 * (accent-600/700), as a surface under light text it stays (accent-fill).
 *
 * The layouts link this file after the other stylesheets (Appearance::stylesheet()):
 * with media="(prefers-color-scheme: dark)" while the device decides, for
 * every page when the learner chose dark, and with media="not all" when they
 * chose light (so the settings page can switch without a reload).
 *
 * Nearly everything follows from the tokens. Below them, the few components
 * that need more than new values.
 */

:root {
  color-scheme: dark;

  /* Primary: from ink to paper. 700 is what buttons, chips and links are
     made of; 50-200 are the quiet tints behind selected things. */
  --color-primary-50: #1f2533;
  --color-primary-100: #283041;
  --color-primary-200: #3a4357;
  --color-primary-300: #59627a;
  --color-primary-400: #8a92a7;
  --color-primary-500: #b2b9c9;
  --color-primary-600: #f7f2e8;
  --color-primary-700: #e9e2d5;
  --color-primary-800: #f3eee4;
  --color-primary-900: #fbf8f2;

  /* Accent: 600/700 are persimmon as text, light enough for the dark
     grounds; 500 and the fill stay deep under light text. */
  --color-accent-50: #2b1a15;
  --color-accent-100: #3b211a;
  --color-accent-200: #5e3022;
  --color-accent-300: #e49c80;
  --color-accent-400: #e0805f;
  --color-accent-500: #c4472d;
  --color-accent-600: #f08a6a;
  --color-accent-700: #f6a78b;
  --color-accent-fill: #c4472d;
  --color-accent-fill-hover: #b3412a;
  --color-on-accent: #ffffff;

  /* Neutrals: blue-grey, to sit on the ink */
  --color-gray-50: #1c2029;
  --color-gray-100: #232835;
  --color-gray-200: #2c3240;
  --color-gray-300: #3d4454;
  --color-gray-400: #6c7385;
  --color-gray-500: #9096a4;
  --color-gray-600: #b0b4bd;
  --color-gray-700: #cfccc4;
  --color-gray-800: #e3dfd6;
  --color-gray-900: #f1ece3;

  /* Semantic: 50 a dark tint for backgrounds, 600/700 light for text */
  --color-success-50: #15241c;
  --color-success-500: #4f9a6c;
  --color-success-600: #7cc196;
  --color-success-700: #9bd3b1;

  --color-warning-50: #2a2213;
  --color-warning-500: #d9a441;
  --color-warning-600: #e3b558;
  --color-warning-700: #edc982;

  --color-error-50: #2d1816;
  --color-error-500: #e0675a;
  --color-error-600: #f08074;
  --color-error-700: #f6a39a;

  --color-info-50: #1a2232;
  --color-info-500: #7b9bd0;
  --color-info-600: #9db6dd;
  --color-info-700: #bccce8;

  /* Grounds: the page darkest, cards a step up, wells inside cards a step down */
  --color-bg-primary: #1a1e28;
  --color-bg-secondary: #12151c;
  --color-bg-tertiary: #151921;
  --color-bg-card: #1a1e28;
  --color-bg-overlay: rgba(5, 7, 11, 0.62);
  --color-bg-hover: #242a37;
  --color-bg-selected: #262d3c;
  --color-ink-panel: #232b3d;

  /* Text: paper tones (all at least 5:1 on cards) */
  --color-text-primary: #ece5d8;
  --color-text-secondary: #b4ad9f;
  --color-text-tertiary: #9f998d;
  --color-text-inverse: #12151c;
  --color-text-muted: #b4ad9f;

  --color-border-light: #2b313e;
  --color-border-medium: #3b4252;
  --color-border-dark: #5e6577;

  --icon-select-arrow: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b4ad9f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");

  --color-grammar-0: #f08a6a;
  --color-grammar-1: #6fb3d2;
  --color-grammar-2: #d9b44a;
  --color-grammar-3: #a99be0;

  /* Shadows: plain black, the ink ones would vanish */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.35), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 24px -6px rgba(0, 0, 0, 0.5), 0 4px 8px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 40px -10px rgba(0, 0, 0, 0.55);
  --shadow-2xl: 0 28px 56px -16px rgba(0, 0, 0, 0.6);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.25);
  --shadow-card-hover: 0 4px 12px -4px rgba(0, 0, 0, 0.45);
  --glass-shadow-hover: 0 4px 12px -4px rgba(0, 0, 0, 0.45);
  --glass-shadow-strong: 0 8px 24px -8px rgba(0, 0, 0, 0.55);
}

@layer overrides {
  /* Light text on dark grounds looks heavier than dark on light */
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* The ink panels sit on ink now: a hairline keeps their edge */
  .vocab-practice,
  .home-start,
  .auth__story,
  .public-sample {
    box-shadow: inset 0 0 0 1px #313a50;
  }

  .toast {
    box-shadow: inset 0 0 0 1px #313a50, 0 10px 30px rgba(0, 0, 0, 0.5);
  }

  /* Deleting stays a deep red with light text, like persimmon buttons
     (error-600 is a light red here, made for text) */
  .btn--danger {
    --btn-bg: #b4372c;
    --btn-bg-hover: #9e3027;
    --btn-text-color: #fffdf8;
  }

  /* The server log stays a dark terminal (primary-800 is light here) */
  .maintenance-log pre {
    background: #0d1016;
    color: #d9d3c7;
  }
}
