/* NAMCHE colour - FINAL (confirmed by the brand owner against _Dok3, Aug 2026).

   Two layers, from two places in the .fig:

   | Tone - the named palette, Greek. _Dok3 / 394:1221 "Farbsystem".
     GAIA is the neutral spine and carries the interface. OKEANOS and HELIOS
     are labelled "Illustration / Editorial - keine UI-Token" in the file and
     are not to be used for product chrome.

   | Role - the UI system, _Dok2 "Farbsystem [Himalaja] - systematisiert (v2)".
     Four roles, each a surface tone (source: "Oberfläche") plus a 50–900 ramp.
     The file's construction rule: the surface tone holds the original tonality
     (L≈78%) so text on it stays safe, and the ramp is built around it.

     Every value below is marked ✓AA in the source - but that is measured
     against FULL-STRENGTH ink (#111111 or #FFFFFF), which is the only pairing
     the source specifies. It is not a guarantee that survives a tint: this
     system's 65% muted ink clears AA on the page and fails on the coloured
     fields. See --text-muted and --text-on-field below.

   This supersedes "Farbkonzept [Annäherung]" (v1); the deprecated
   [Annäherung] aliases were removed in the Aug 2026 cleanup - see archive/HISTORY.md
   for the old-name → successor map. */
:root{

  /* ── Tone | GAIA - the neutral spine ─────────────────────────────
     The only tone group cleared for interface use. */
  --gaia-erebos:#262626;   /* ink, marks, rules */
  --gaia-nyx:#66666e;      /* mid grey */
  --gaia-rhea:#bab4ab;     /* warm stone */
  --gaia-selene:#f1efe8;   /* the page - identical to the old Nebel */
  --gaia-olymp:#f0f2f5;    /* cool near-white */

  /* ── Tone | OKEANOS - cold, green → deep blue ────────────────────
     Illustration and editorial only. Not UI tokens. */
  --okeanos-demeter:#7ca45c;
  --okeanos-artemis:#0e7a5f;
  --okeanos-amphitrite:#22a6a0;
  --okeanos-atlas:#94c7e6;
  --okeanos-poseidon:#1a387a;
  --okeanos-uranos:#0d1738;

  /* ── Tone | HELIOS - warm, yellow → violet ───────────────────────
     Illustration and editorial only. Not UI tokens. */
  --helios-helios:#ffd433;
  --helios-eos:#f2942e;
  --helios-hestia:#eb4629;
  --helios-chloris:#e03894;
  --helios-apollon:#b88cd1;
  --helios-aion:#738cd9;

  /* ── Role | Primary - Rhododendron ───────────────────────────────*/
  --color-primary-surface:#f09ea5;  /* surface tone, L≈78% */
  --color-primary-50:#f8eced;
  --color-primary-100:#f0c7cb;
  --color-primary-200:#eb9da4;
  --color-primary-300:#e9727c;
  --color-primary-400:#e34a58;
  --color-primary-500:#dd2233;
  --color-primary-600:#b51c2a;
  --color-primary-700:#90141f;
  --color-primary-800:#6a0c14;
  --color-primary-900:#42060b;

  /* ── Role | Secondary - Lapislazuli ──────────────────────────────*/
  --color-secondary-surface:#a3b9eb;
  --color-secondary-50:#ecf0f8;
  --color-secondary-100:#c9d4ee;
  --color-secondary-200:#a1b7e7;
  --color-secondary-300:#789ae2;
  --color-secondary-400:#537dda;
  --color-secondary-500:#2d60d2;
  --color-secondary-600:#254fac;
  --color-secondary-700:#1b3d88;
  --color-secondary-800:#122b63;
  --color-secondary-900:#0a1a3d;

  /* ── Role | Accent - Taglilie ────────────────────────────────────*/
  --color-accent-surface:#f8c995;
  --color-accent-50:#f9f3eb;
  --color-accent-100:#f3dcc4;
  --color-accent-200:#f3c696;
  --color-accent-300:#f5b065;
  --color-accent-400:#f39a3a;
  --color-accent-500:#f0840f;
  --color-accent-600:#c56c0c;
  --color-accent-700:#9c5508;
  --color-accent-800:#723d04;
  --color-accent-900:#462501;

  /* ── Role | Neutral - Granit → Hochgebirgsnacht ──────────────────
     The UI grey scale: borders, fills, disabled states. Distinct from GAIA,
     which is the brand's neutral spine - GAIA is warm and named, this is a
     cool functional ramp. Use GAIA for page and ink, this for UI furniture. */
  --color-neutral-50:#f7f7f8;
  --color-neutral-100:#dddee0;
  --color-neutral-200:#c2c4ca;
  --color-neutral-300:#a7aab4;
  --color-neutral-400:#8c909d;
  --color-neutral-500:#727786;
  --color-neutral-600:#5b5f6b;
  --color-neutral-700:#454851;
  --color-neutral-800:#2e3036;
  --color-neutral-900:#17181c;

  /* ── Semantic / Feedback ─────────────────────────────────────────
     Deliberately independent of the brand colours; backgrounds kept very
     light for text fields (source note). */
  --color-success-bg:#eaf6f2;
  --color-success-base:#12946e;
  --color-success-dark:#0b5b44;
  --color-warning-bg:#f6f1e9;
  --color-warning-base:#c77a12;
  --color-warning-dark:#5e3908;
  --color-error-bg:#f6eaee;
  --color-error-base:#b0184a;
  --color-error-dark:#5a0c26;
  --color-info-bg:#ecf1f4;
  --color-info-base:#3f8fc4;
  --color-info-dark:#18384e;

  /* ── Contrast spectrum - Himalaya, whole-colour fields ───────────
     FINAL Aug 2026 (_Dok3 "himalaya_kontrast_spektrum"). Five light/dark
     pairs, named in English after the file's Himalayan flora labels.
     _Dok3 usage rule: the LIGHT field takes dark text (#111111 - 9.7:1 to
     17.5:1); the DARK partner is its own field for buttons/overlays
     ("action"), taking white text (#FFFFFF - 5.0:1 to 14.0:1). Never mix
     across pairs. The dark value also works as ink on its light partner. */
  --contrast-glacier-lake:#add8e6;
  --contrast-glacier-lake-ink:#1d4e62;
  --contrast-himalaya-poppy:#bfa6e8;
  --contrast-himalaya-poppy-ink:#371a65;
  --contrast-rhododendron:#f09999;
  --contrast-rhododendron-ink:#6f1111;
  --contrast-monks-robe:#f5bc72;
  --contrast-monks-robe-ink:#774708;
  --contrast-mustard-bloom:#f9ee72;
  --contrast-mustard-bloom-ink:#7a7105;
  --contrast-text-dark:#111111;  /* text on the light fields */
  --contrast-text-light:#ffffff; /* text on the dark fields (buttons/overlays) */

  /* ── Raster - the X/8 diagram colours ────────────────────────────
     Unchanged. Spec colours, not product chrome; the metaball engine's
     default theme reads these by value (generator/constants.js). */
  --namche-raster-cyan:#8be0ff;   /* the X module */
  --namche-raster-pink:#fbaaff;   /* the surrounding field */
  --namche-raster-grey:#d9d9d9;   /* X/8 unit ticks */

  --namche-black:#000000;
  --namche-white:#ffffff;

  /* ── UI states - added in the Aug 2026 freeze ────────────────────
     readme.md documented these as v2 additions but they were never written;
     Input/Toggle/Stat already reference them. Aliases into the fixed palette:
     the Semantik set for feedback, the system accent for focus/on. */
  --state-positive:var(--color-success-base);
  --state-negative:var(--color-error-base);
  --state-warning:var(--color-warning-base);
  --state-info:var(--color-info-base);
  --focus-ring:var(--accent-system);
  --disabled-opacity:0.4; /* @kind other */

  /* ── Semantic aliases - the API ──────────────────────────────────
     Point these at the new system; everything downstream follows. */
  --surface-page:var(--gaia-selene);          /* unchanged value */
  --surface-invert:var(--gaia-erebos);        /* was Basalt #2c2c2a */
  --surface-deck:var(--namche-white);
  --surface-deck-invert:var(--namche-black);
  --surface-card:var(--color-accent-surface);     /* was Strelitzie */
  --surface-card-alt:var(--color-secondary-surface); /* was Rittersporn */
  --surface-card-quiet:var(--gaia-selene);
  --surface-scrim:rgba(38,38,38,0.65);            /* the one overlay scrim */

  --text-primary:var(--gaia-erebos);
  /* The 65% tint is PAGE ONLY. On Selene it measures 4.56:1 - AA for body
     copy, with almost nothing to spare. On every role surface it fails:
     3.47:1 on Primary, 3.57:1 on Secondary, 4.01:1 on Accent. Body copy on a
     field takes --text-on-field instead. */
  --text-muted:rgba(38,38,38,0.65);
  /* Full-strength ink for copy on a coloured field - 7.31:1 on Primary,
     7.71:1 on Secondary, 9.93:1 on Accent. The source specifies exactly this:
     a light field takes dark text at full strength, never a tint. */
  --text-on-field:var(--gaia-erebos);
  --text-invert:var(--gaia-selene);
  --text-deck:var(--namche-black);
  --text-deck-invert:var(--namche-white);
  --text-link:var(--gaia-erebos);
  --text-link-hover:rgba(38,38,38,0.65);

  --line-hairline:rgba(0,0,0,1);              /* drawn at 0.5px */
  --line-rule:var(--gaia-erebos);
  --accent-system:var(--color-secondary-800); /* was Jade; OKEANOS is not a UI token */
  --mark-color:var(--gaia-erebos);            /* see mark note in archive/HISTORY.md */

  /* ── Imagery - approved by the designer (Mitch), Aug 2026, _Dok3 628:112 ──
     Photography (human senses in closeup) is unified by the Hestia filter:
     desaturated photo + a --image-tint layer in multiply. Bold NAMCHE sits on
     a full --image-field. HELIOS/OKEANOS tones are cleared as full-bleed
     application fields (posters, social, device shells) - still not product
     chrome tokens. */
  --image-tint:var(--helios-hestia);
  --image-field:var(--helios-hestia);
}

/* ── Night - FINAL (2026-08-24, approved by the brand owner) ─────────
   The dark theme, derived from the system's own inversion pair and first
   proven in production on ui.namche.ai. Three principles:

   | The neutral spine flips: Erebos is the ground, Selene the ink
     (13.15:1). GAIA stays warm - night never swaps in the cool
     functional neutrals.
   | Surfaces LIFT instead of casting shadows: the system has no
     elevation, so "above" is Erebos raised toward Selene (oklab), in
     five steps. Selene ink clears 7:1 on every step.
   | Tones are paint, not roles: GAIA, OKEANOS, HELIOS, the role ramps
     and the Himalaya fields are identical day and night. A Taglilie
     card is a Taglilie card at midnight. Night re-points only the
     semantic aliases and the feedback set.

   Opt-in: night is the `.dark` class on the root; without it, day. */
:root{
  /* Night surface ramp - Erebos lifted toward Selene in oklab.
     Literal values; the derivation percentages are the record. */
  --night-raised:#303030;    /* +6% - cards, sheets (Selene 11.47:1) */
  --night-overlay:#343433;   /* +8% - menus, popovers (10.83:1) */
  --night-quiet:#373737;     /* +10% - muted fields, hover (10.35:1) */
  --night-line:#424241;      /* +16% - borders, separators */
  --night-control:#4d4d4b;   /* +22% - input strokes */
  /* Selene at 65% over Erebos, flattened to a solid so it stays one
     colour on every night surface: 8.87:1 on the ground, 7.73:1 on
     raised - the muted voice keeps AA everywhere. */
  --night-ink-muted:#c8c6c1;

  /* Feedback, lifted for the dark ground. Each base clears 4.5:1 on
     Erebos AND on its own night bed; Selene clears 10:1 on every bed.
     Error needs the deepest lift (46% vs 28%): Rhododendron's ink-heavy
     base is built for light fields. */
  --color-success-night:#66ae8f;  --color-success-bg-night:#2a3832;
  --color-warning-night:#d59b5f;  --color-warning-bg-night:#403529;
  --color-error-night:#d6858f;    --color-error-bg-night:#3f292c;
  --color-info-night:#75aacf;     --color-info-bg-night:#2d3840;
}
.dark{
  color-scheme:dark;
  --surface-page:var(--gaia-erebos);
  --surface-invert:var(--gaia-selene);
  --surface-card-quiet:var(--night-raised);
  --text-primary:var(--gaia-selene);
  --text-muted:var(--night-ink-muted);
  --text-invert:var(--gaia-erebos);
  --text-link:var(--gaia-selene);
  --text-link-hover:var(--night-ink-muted);
  /* The one stroke, flipped: pure white where day draws pure black. */
  --line-hairline:rgba(255,255,255,1);
  --line-rule:var(--gaia-selene);
  /* Day's Lapislazuli 800 vanishes on ink; the 300 step keeps the same
     hue at 5.42:1 - non-text 3:1 holds with margin on raised surfaces. */
  --accent-system:var(--color-secondary-300);
  --mark-color:var(--gaia-selene);
  --color-success-base:var(--color-success-night);
  --color-success-bg:var(--color-success-bg-night);
  --color-warning-base:var(--color-warning-night);
  --color-warning-bg:var(--color-warning-bg-night);
  --color-error-base:var(--color-error-night);
  --color-error-bg:var(--color-error-bg-night);
  --color-info-base:var(--color-info-night);
  --color-info-bg:var(--color-info-bg-night);
}
