/*
 * dark.css — the dark theme, GENERATED. Do not hand-edit.
 *
 *     python3 tools/dark-palette.py            # rewrite this file
 *     python3 tools/dark-palette.py --check    # verify it is current
 *
 * Linked after athenana.css, so its rule overrides win on source order at
 * equal specificity. It redefines organic.css's OWN tokens rather than
 * introducing a parallel set under new names — the thing athenana.css's
 * header rules out is aliasing the design system, not re-tuning it.
 *
 * Every value below is solved for CONTRAST PARITY: each token sits at the
 * same contrast against the dark ground that its light counterpart sits at
 * against the cream one. That is why none of athenana.css's 3,079 lines
 * needed changing — the ramps' step numbers mean distance from the ground
 * (100..300 background, 700..900 text), and that reading is true in both
 * themes. See tools/dark-palette.py for the derivation.
 *
 * There is deliberately NO [data-theme] selector and no toggle: nothing
 * would consume it yet. Adding one later is a change to the generator.
 */

@media (prefers-color-scheme: dark) {
  :root {
    /* Tells the browser to render form controls, scrollbars and the default
       ::selection dark. Without it a dark page keeps light native widgets. */
    color-scheme: dark;

    --color-bg: #1e1a15;
    --color-surface: #28241f;
    --color-text: #f0e5df;
    --color-accent: #98552a;
    --color-accent-2: #606e4a;

    /* Derived from --color-text so it follows the ground. organic.css
       hardcodes #201e1d here, which is invisible on a dark ground. */
    --color-divider: color-mix(in srgb, var(--color-text) 16%, transparent);

    --color-neutral-100: #232220;
    --color-neutral-200: #1f1d1b;
    --color-neutral-300: #2f2c29;
    --color-neutral-400: #44403a;
    --color-neutral-500: #5d574d;
    --color-neutral-600: #7a7163;   /* 3.60:1 — still FAILS AA, as in the light theme */
    --color-neutral-700: #9c907f;   /* 5.53:1 */
    --color-neutral-800: #c0b39b;
    --color-neutral-900: #e0d5bd;

    --color-accent-100: #2f1e15;
    --color-accent-200: #2a1b12;
    --color-accent-300: #3b2a21;
    --color-accent-400: #5e3a25;
    --color-accent-500: #844d29;
    --color-accent-600: #b0612c;
    --color-accent-700: #e07930;   /* 5.72:1 */
    --color-accent-800: #ffa169;
    --color-accent-900: #ffcdb0;

    --color-accent-2-100: #202515;
    --color-accent-2-200: #191e0f;
    --color-accent-2-300: #282e1d;
    --color-accent-2-400: #3b4230;
    --color-accent-2-500: #505a3f;
    --color-accent-2-600: #68764f;
    --color-accent-2-700: #849762;   /* 5.42:1 */
    --color-accent-2-800: #a4bc79;
    --color-accent-2-900: #c4df94;

    /* organic.css's shadows are #2e2b25 at 14/16/22% — a dark shadow on a
       dark ground is invisible. Near-black at a higher alpha reads as depth
       again; the geometry is unchanged. */
    --shadow-sm: 0 1px 2px color-mix(in srgb, #000 40%, transparent);
    --shadow-md: 0 3px 10px color-mix(in srgb, #000 46%, transparent);
    --shadow-lg: 0 12px 32px color-mix(in srgb, #000 58%, transparent);
  }

  /* .washed lifts publisher images toward a LIGHT ground (brightness 1.1).
     On a dark one that makes every card image glare. Same treatment, damped
     instead of lifted — the saturate/contrast halves are unchanged. */
  .washed { filter: saturate(0.6) contrast(0.85) brightness(0.82) opacity(0.92); }

  /* A tag chip's tint is dark here, so darkening it further on hover is
     nearly invisible. Same 6% step, the other way. */
  a.tag:hover { filter: brightness(1.18); }

  /* THE TWO SCRIMS. Both derive from an ink token — .savedialog::backdrop from
     --color-text, organic's .dialog-backdrop from --color-neutral-900 — which
     inverts to near-white here and LIGHTENED the page behind the dialog
     instead of dimming it. Caught by looking, not by the token maths: a
     scrim's job is a fixed direction, so it is pinned to black rather than
     derived. Raised a little because the ground it dims is already dark.

     Every other color-mix overlay in both files is a hover tint or muted ink
     and is correct unchanged — those SHOULD move away from the ground, which
     is exactly what deriving them from --color-text does. These two are the
     only backgrounds among them; checked by listing every overlay >= 25%. */
  .savedialog::backdrop { background: color-mix(in srgb, #000 60%, transparent); }
  .dialog-backdrop { background: color-mix(in srgb, #000 65%, transparent); }
}
