/* The colour schemes. THIS FILE IS THE ONLY PLACE A COLOUR IS WRITTEN DOWN.
 *
 * A scheme is a *register*, not a palette — a whole way the page looks:
 *
 *   light      schematic. A technical drawing: white fills, hairline strokes, symbols set
 *              like type. This is what the Milky Way has always been, and naming it stops
 *              the dark scheme being built as its inversion.
 *   dark       console. A stargate control panel as it would look on someone's computer:
 *              the gate lit rather than drawn, the page an instrument rather than a diagram.
 *   atlantis   a custom scheme, and the worked example of "set your own".
 *
 * ---------------------------------------------------------------------------------------
 * THE CASCADE, which is the whole design. A value is looked up by SCHEME and by GATE:
 *
 *   1. `:root`                              the scheme's role defaults
 *   2. `[data-gate="x"]`                    that gate's column, in every scheme
 *   3. `[data-theme="t"][data-gate="x"]`    one scheme's opinion about one gate
 *
 * The order matters and so does the specificity. A gate's column is (0,2,0) and comes after
 * the scheme blocks, so a gate keeps its own chevron colour when the scheme changes — the
 * Milky Way is amber and Atlantis is blue wherever you are. Level 3 is (0,3,0) and beats
 * both, which is how a scheme takes a gate's colour back when it needs to. Nothing at level 3
 * exists yet; the slot is there because these are expected to diverge per scheme later.
 *
 * ADDING A GATE is adding a block at level 2. It inherits every role it does not mention, so
 * a new gate renders on the day it appears and is coloured deliberately later. That is the
 * only thing stopping a scheme x gate table from having to be filled in completely up front.
 *
 * A GATE MAY ALSO NAME THE SCHEME IT OPENS IN, with `theme:` in its manifest — Atlantis opens
 * in `atlantis`, because that is the register it was drawn for. **It is a default, not a lock**:
 * the reader can still choose, and their choice is remembered and wins from then on. A gate that
 * names nothing follows the operating system, like the Milky Way.
 */

/* ==========================================================================================
   light — schematic. Also the bare `:root` defaults, so the page is correct in the moment
   before theme.js stamps an attribute, and correct forever if scripting is off.
   ========================================================================================== */
:root {
	color-scheme: light;

	/* -- the page and the panel -- */
	--page-bg: #FFFFFF;
	--page-ink: #000000;
	--ink-muted: #555555;
	--ink-faint: #999999;
	--line: #999999;
	--line-soft: #CCCCCC;
	--line-faint: #BBBBBB;
	--surface: #FFFFFF;
	--surface-hover: #F0F0F0;
	--surface-alt: #EEEEEE;

	/* -- what the console says -- */
	--accent: #1B1BB3;          /* a locked symbol, a focus ring, the "ready" status */
	--picked: #FF9200;          /* a symbol you have chosen but not yet dialled */
	--danger: #BF3030;          /* a refused address, a release, the iris taking a hit */
	--alert: #1B7FB3;           /* someone is dialling in */
	--blocked: #7A5C1F;         /* a control that will not do anything right now */

	/* -- the gate's drawing -- */
	--gate-ink: #000000;          /* every hairline on the chassis */
	--gate-surface: #FFFFFF;      /* what the chassis is filled with */
	--gate-backdrop: #FFFFFF;     /* the disc behind the event horizon */
	--gate-band: #999999;         /* the edges of the symbol band */
	--gate-divider: #000000;      /* the line between one symbol's cell and the next */
	--gate-chevron-body: #FFFFFF; /* a chevron at rest, before anything locks it */
	--gate-chevron-rest: #FFFFFF;
	--iris-body: #BFC3C6;
	--iris-edge: #000000;
	--ripple: #FFFFFF;

	/* -- the roles, per gate. These are the defaults a gate inherits if it says nothing. -- */
	--chevron-locked-out: #F2A93B;
	--chevron-locked-in: #D98F2A;
	/* The outline of a chevron that is LIT, which is not the same question as the outline of one
	   at rest. A resting chevron is drawn in --gate-ink and reads against the chassis; a lit one
	   has a bright colour behind that outline, so the outline has to read against *that*. In this
	   register --gate-ink is already black and this changes nothing — which is the point: it only
	   starts mattering once the ink goes light. */
	--chevron-edge-lit: #000000;
	--symbol-releasing: #BF3030;
	--symbol-idle: #000000;
	--symbol-locked: #1B1BB3;
	/* Two states a ring that does not turn needs and a turning one has no use for. On Atlantis a
	   leg is a wave travelling round the ring, handing each symbol back one place until it
	   reaches the one being dialled — and without these the whole thing reads as the glyphs
	   twitching at random. `moving` is the slot the wave is touching right now; `found` is the
	   symbol you asked for, lit from the moment the leg starts so you can watch the wave go and
	   get it. Both are deliberately far from `locked` and from each other in hue: cyan in
	   transit, violet for the target. */
	--symbol-moving: #1742b8;
	--symbol-found: #A63BD1;

	/* -- the event horizon. Scheme-level rather than per-gate: a portal drawn for a white page
	      glares on a dark one and a portal drawn for a dark page reads as a hole in a white one,
	      which is the whole reason these moved out of the gates. index.js animates the gradient's
	      radius and its first stop's offset and never touches the colours, so this is only paint.
	      The Milky Way uses core and edge; Atlantis has a middle stop as well. -- */
	--portal-core: #FFFFFF;
	--portal-mid: #66B5FF;
	--portal-edge: #0080FF;

	/* -- the address strip. Its glyphs are a <use> into the page's own <defs> now, so they take
	      a colour like anything else. `idle` is a glyph sitting on the page; the other is a glyph
	      on a filled tile, which is a strong colour in every scheme and wants dark ink. -- */
	--strip-glyph-idle: #000000;
	--strip-glyph: #000000;

	/* -- the keypad and the DHD. Read by JavaScript, which writes fills onto glyph shapes. -- */
	--key-glyph-idle: #000000;
	--key-glyph-locked: #1B1BB3;
	--key-surface: #FFFFFF;
	--key-surface-hover: #F0F0F0;
}

/* ==========================================================================================
   dark — console. Not the schematic inverted: inverting it gives white-on-black hatching,
   which reads as a photographic negative. The gate is lit instead of drawn, the strokes carry
   the light, and the page recedes so the instrument is the only bright thing on it.
   ========================================================================================== */
:root[data-theme="dark"] {
	color-scheme: dark;

	--page-bg: #0E1116;
	--page-ink: #C7D2DD;
	--ink-muted: #8B9AA8;
	--ink-faint: #5A6773;
	--line: #2D3742;
	--line-soft: #232B34;
	--line-faint: #39434E;
	--surface: #161B22;
	--surface-hover: #1E252E;
	--surface-alt: #1A2028;

	/* #1B1BB3 is a strong blue on white and unreadable on this. The role survives; the value
	   cannot, which is exactly why a gate is not allowed to name its own hex. */
	--accent: #58A6FF;
	--picked: #FF9200;
	--danger: #E5484D;
	--alert: #58A6FF;
	--blocked: #C8A45C;

	--gate-ink: #7E97AE;
	--gate-surface: #131A22;
	--gate-backdrop: #0A0F14;
	--gate-band: #232B34;
	--gate-divider: #4A5866;
	--gate-chevron-body: #1B2530;
	--gate-chevron-rest: #1B2530;
	--iris-body: #39434E;
	--iris-edge: #7E97AE;
	--ripple: #C7D2DD;

	/* the ink is light here, and a lit chevron is amber — a light outline on a light chevron is
	   no outline at all, which is exactly what it looked like */
	--chevron-edge-lit: #0E1116;
	--symbol-releasing: #E5484D;
	--symbol-idle: #8FA6BC;
	--symbol-locked: #58A6FF;
	--symbol-moving: #3f57de;
	--symbol-found: #C77DFF;

	/* The schematic's white-hot core is a headlight on this page — the disc stops reading as a
	   pool and becomes the brightest thing in the room. Deeper all the way through: still lit
	   from the middle, but a surface you could look at rather than one that looks back. */
	--portal-core: #8FC4EA;
	--portal-mid: #1E5F9E;
	--portal-edge: #05203F;

	--strip-glyph-idle: #C7D2DD;
	--strip-glyph: #0E1116;

	--key-glyph-idle: #C7D2DD;
	--key-glyph-locked: #58A6FF;
	--key-surface: #161B22;
	--key-surface-hover: #1E252E;
}

/* ==========================================================================================
   atlantis — the custom scheme. Deep ocean navy and a pale, cold blue: the register the
   Atlantis gate was drawn in, made available to the whole page and to every other gate.
   ========================================================================================== */
:root[data-theme="atlantis"] {
	color-scheme: dark;

	--page-bg: #0B1B2E;
	--page-ink: #C4DCEE;
	--ink-muted: #7E97AE;
	--ink-faint: #5A7690;
	--line: #2B4A6B;
	--line-soft: #1D3452;
	--line-faint: #43617F;
	--surface: #12283F;
	--surface-hover: #1A3651;
	--surface-alt: #16283D;

	--accent: #8FB8DA;
	--picked: #F2A93B;
	--danger: #BF3030;
	--alert: #1B7FB3;
	--blocked: #C8A45C;

	--gate-ink: #7E97AE;
	--gate-surface: #16283D;
	--gate-backdrop: #0B1B2E;
	--gate-band: #16283D;
	--gate-divider: #43617F;
	--gate-chevron-body: #16283D;
	--gate-chevron-rest: #25405E;
	--iris-body: #2B4A6B;
	--iris-edge: #7E97AE;
	--ripple: #FFFFFF;

	--chevron-edge-lit: #08192B;
	--symbol-releasing: #BF3030;
	--symbol-idle: #8FB8DA;
	--symbol-locked: #F2A93B;
	--symbol-moving: #3f5cde;
	--symbol-found: #C77DFF;

	--portal-core: #8FC7E8;
	--portal-mid: #2E7FC2;
	--portal-edge: #0B2E63;

	--strip-glyph-idle: #C4DCEE;
	--strip-glyph: #0B1B2E;

	--key-glyph-idle: #C4DCEE;
	--key-glyph-locked: #8FB8DA;
	--key-surface: #12283F;
	--key-surface-hover: #1A3651;
}

/* ==========================================================================================
   Level 2 — a gate's column, in every scheme.

   These come AFTER the scheme blocks and match their specificity, so they win: a gate keeps
   its own chevron colour wherever it is rendered. That is the point — the Milky Way is amber
   and Atlantis is blue, and a reader changing register does not flatten them into each other.

   Dialled-out and dialled-in are two shades of one colour rather than two colours. They are
   close on purpose for now; `.stIn` exists because a gate being dialled AT you should never
   read as one you are dialling, and the shade carries that without shouting. Schemes are
   expected to pull them further apart later, at level 3.
   ========================================================================================== */
:root[data-gate="milkyway"] {
	--chevron-locked-out: #F2A93B;
	--chevron-locked-in: #D98F2A;
}

:root[data-gate="atlantis"] {
	--chevron-locked-out: #1B7FB3;
	--chevron-locked-in: #166A97;
}

/* The testbed is a fixture, not a place, and it borrows the Milky Way's drawing. It borrows
   the Milky Way's column too, so the fixture never needs its own colour decisions. */
:root[data-gate="testbed"] {
	--chevron-locked-out: #F2A93B;
	--chevron-locked-in: #D98F2A;
}

/* ==========================================================================================
   Level 3 — one scheme's opinion about one gate, (0,3,0), beating both blocks above.

   Empty by design. When the schematic and the console want genuinely different chevrons for
   the same gate, this is where that goes, and adding it needs no change anywhere else.
   ========================================================================================== */
