/* =============================================================================
   Faragiri design tokens.

   THE PALETTE IS GENERATED, NOT PICKED. Every colour below was produced in
   OKLCH at a fixed chroma per role, then converted to sRGB, and that is the
   only reason the eight pillars read as one family. Picked by eye, they did
   not: an earlier set ran from L 0.60 to L 0.78 and C 0.13 to C 0.23, so the
   violet was dark and shouty while the amber was pale and calm, and two hues
   sat 27 degrees apart and could not be told apart at a glance. A taxonomy
   cannot have a loud member, and it cannot have two members that look the same.
   If you add a ninth pillar, regenerate the whole set -- do not eyedrop
   something that looks nice next to the others, because "looks nice next to"
   is exactly the process that produced the set this replaced.

     hues        30 165 300  75 210 345 120 255   at 45 degree spacing
     display     C .18, clamped to the sRGB gamut, L chosen per hue as the
                 most saturated that still clears 7.6:1 on --paper
     prose       display L + .095, C .105, floor 10.8:1
     L band      0.703 to 0.800 -- a 0.097 spread, against 0.18 before

   THE HUES ARE NOT IN WHEEL ORDER AROUND THE RING, and that is the point. The
   eight pillars are 45 degrees apart, which is the widest even spacing eight
   hues can have; laid out sequentially the ring would run coral, gold, green,
   jade, azure, indigo, violet, rose and read as one continuous spectrum. A
   spectrum is a scale, and a scale implies the pillars are ordered by degree of
   something. They are not. So the hue index steps by three around the ring
   instead of by one, which puts 135 degrees between every pair of neighbours
   and makes the set read as eight labels rather than one gradient. This is the
   same reason the identity has never allowed the pillar hues into a gradient.

   The lightness curve is not flat, and that is deliberate. Flat L is correct in
   theory and wrong on a black ground: sRGB simply cannot hold a light saturated
   blue, so equalising to the blue's ceiling drags the gold down to a bronze and
   the whole set goes muddy. The curve stays inside a 0.10 band, which is close
   enough that no pillar dominates and loose enough that each hue sits where it
   is actually beautiful.

   Two tokens per pillar, and the split is load bearing. `--p-*` is contrast
   checked against the reading ground and is the only one allowed under text.
   `--d-*` is the constellation's own light: fills, glows, rims, dots. Never put
   `--d-*` under a paragraph and never put `--p-*` in a glow.

   Two theme states, and the un-stamped one is the default. An explicit choice
   stamps data-theme on <html>; nothing else stamps anything. Every colour is
   therefore defined in the bare :root block first, and [data-theme="light"]
   only ever *redefines*. A colour whose sole definition sits inside a
   [data-theme] block does not apply in the un-stamped state, which is how a
   page ends up painting one theme's text on the other's ground.

   prefers-color-scheme is deliberately not consulted. A visitor whose OS is in
   light mode is not asking for a different constellation; they are asking for
   light documents, and this one is a sky. The light palette below is generated
   from the same eight hue angles and kept contrast correct for the day it is
   wanted -- an admin view, a print sheet, a reader who asks for it.
   ========================================================================== */

:root{
  color-scheme:dark;

  /* --- the ground. A neutral ramp at hue 275, one step bluer than the light
         that falls on it, so the shadows read cool against warm bodies and a
         large dark field never goes to dead grey. --- */
  --paper:#04050D;
  --paper-2:#090B16;
  --surface:#141725;
  --surface-2:#1F2232;
  --ink:#F1F2F9;      /* 18.2:1 on --paper */
  --ink-2:#B8BCCC;    /* 10.8:1 */
  --ink-3:#868B9E;    /*  6.0:1 */
  --rule:#292D3D;
  --rule-2:#3D4153;

  /* --- pillar hues, text safe on --paper. Lowest is 10.8:1. --- */
  --p-language:#FFA99A;
  --p-design:#97F3CB;
  --p-media:#CCB2FC;
  --p-code:#FFD59B;
  --p-systems:#8DEEFF;
  --p-ai:#F5A8D3;
  --p-marketing:#C6DA8A;
  --p-business:#8FC0FF;

  /* --- pillar hues, display only: fills, glows, rims, orbit lights, dots.
         Lowest is 7.6:1 on --paper, so they stay legible as marks. --- */
  --d-language:#FF735F;
  --d-design:#00DFA2;
  --d-media:#B586FF;
  --d-code:#FCAB00;
  --d-systems:#00D5EF;
  --d-ai:#F271BF;
  --d-marketing:#A3C001;
  --d-business:#55A1FF;

  /* --- and the centre, which is not a colour at all.
         It used to take the hue of whichever world you were standing in, which
         on the atlas home meant the centre and one orb were the same colour:
         the thing everything orbits looked like another sibling that had
         wandered into the middle. Giving it a hue of its own fixed that and
         kept the wrong idea -- that the core is another member of the set.

         It is not. It is what the set orbits. So it is achromatic: pure neutral,
         C exactly 0, a white star with eight coloured worlds around it. This is
         the one choice here that cannot ever collide, at any ring size, in any
         locale, if a ninth pillar is added, or if these hues are all replaced
         tomorrow -- because it is not on the wheel to begin with. Do not tint
         it. The world's own hue still washes the sky and the eyebrow, so you
         have not stopped being told where you are. --- */
  --d-core:#E1E1E1;
  --p-core:#EEEEEE;

  --on-fill:#04050D;

  /* local, always overridden by the component that sets a pillar */
  --dot:var(--ink-3);

  --shadow-1:0 1px 2px rgb(0 0 0 / .45), 0 10px 28px -14px rgb(0 0 0 / .75);
  --shadow-2:0 2px 6px rgb(0 0 0 / .5), 0 28px 56px -22px rgb(0 0 0 / .85);

  /* The Latin default. fg_script_style() overrides these three per script, so a
     Persian page never names a Latin family it cannot use.

     'FaragiriSans Fallback' is not a face -- it is the metric override in fonts.css,
     and it has to sit BEFORE the real system fallbacks or the browser reaches a
     plain Arial first and the line box is the wrong height for the ~200 ms
     before the webfont lands. Every visible jump this site could have during a
     font swap is prevented by the position of that one string. */
  --f-display:'Faragiri Sans','FaragiriSans Fallback','Helvetica Neue',Arial,sans-serif;
  --f-text:'Faragiri Sans','FaragiriSans Fallback','Helvetica Neue',Arial,sans-serif;
  --f-mono:'DM Mono','SFMono-Regular',Menlo,Consolas,monospace;

  /* The weights the type scale is built from, named once.

     Faragiri Sans carries 100..900 and IRANYekanX 100..1000 from a single
     variable file each, so these are free to be anything -- which is the point
     of naming them here rather than hard coding 700 in nine places. A script
     that needs a different tuning overrides the tokens, not the components.

     Persian runs one step lighter than Latin at the display sizes. The script is
     denser to begin with: IRANYekanX at 800 next to FaragiriSans at 800 does not read
     as the same emphasis, it reads as shouting. */
  --w-display:800;   /* h1, the hero, the orb core */
  --w-head:700;      /* h2 */
  --w-name:600;      /* a node's name, in an index row or an orb */
  --w-body:400;
  --w-label:400;     /* eyebrows, counts, the rail */

  /* Set per locale by fg_script_style(). Arabic and Devanagari read small
     next to Latin at the same nominal size, so the whole scale moves rather
     than individual components being restyled per locale. */
  --script-scale:1;

  /* --- the sky itself. --void is the inside of a body: darker than the page,
         so a planet reads as a hole punched in the sky with light around its
         edge. It is a token because the SVG gradients need it too, and three
         near blacks drifting apart by hand is how a scene stops matching. --- */
  --void:#010205;
  --night:#020307;
  --night-2:#060711;
  --wash-1:#14172E;
  --wash-2:#1C0D1F;
  --hair:rgb(255 255 255 / .10);
  --hair-2:rgb(255 255 255 / .19);

  /* The deepening at the very top of the sky, where the masthead sits. A token
     rather than a literal in atlas.css for one reason: it is the only colour in
     the scene that is darker than --paper, so it is the only one that inverts
     rather than adapts when the ground goes light. Everything else up there is
     a hue at low alpha and survives either ground; a near-black at 82% over
     #EBECF2 is a grey band across the top of the page. */
  --sky-cap:rgb(1 2 8 / .82);

  --wrap:1180px;
  --rail:132px;
  --head-h:64px;
}

/* The daylight escape hatch. Same eight hue angles, regenerated for a light
   ground: prose at L .515 so the weakest still clears 4.5:1 on --paper, display
   at L .655 so a dot is a dot rather than a stain. Opt in, and complete. */
:root[data-theme="light"]{
  color-scheme:light;
  --paper:#EBECF2;
  --paper-2:#E1E2EA;
  --surface:#FDFDFF;
  --surface-2:#F4F5FA;
  --ink:#131730;      /* 14.9:1 on --paper */
  --ink-2:#404660;    /*  7.9:1 */
  --ink-3:#64687B;    /*  4.7:1 */
  --rule:#D0D2DC;
  --rule-2:#B8BBC8;

  --p-language:#BA4031;
  --p-design:#007956;
  --p-media:#7E53BC;
  --p-code:#906000;
  --p-systems:#007584;
  --p-ai:#AD4185;
  --p-marketing:#5F7100;
  --p-business:#1769C4;

  --d-language:#E16453;
  --d-design:#00AA7B;
  --d-media:#A176E3;
  --d-code:#C18200;
  --d-systems:#00A3B7;
  --d-ai:#D263A7;
  --d-marketing:#859D00;
  --d-business:#4491F0;
  --d-core:#4D4D4D;
  --p-core:#3D3D3D;

  --on-fill:#FDFDFF;
  --void:#0B0D18;
  --sky-cap:transparent;
  --shadow-1:0 1px 2px rgb(19 23 48 / .06), 0 8px 24px -12px rgb(19 23 48 / .18);
  --shadow-2:0 2px 4px rgb(19 23 48 / .08), 0 24px 48px -20px rgb(19 23 48 / .28);
}
