/* ============================================================
   HELIOCASTLE — LIGHT MODE

   THERE IS NO SWITCH. The theme follows the operating system, through
   prefers-color-scheme, and nothing else. There used to be a sun/moon
   button in the header writing a choice into localStorage; it is gone,
   along with the inline <head> script that read it back.

   THE OPENING FRAME KEEPS ITS NIGHT.

   Light mode turns the page to paper from the pillars strip downwards.
   The hero — night sky, glowing monument, pool of light on the floor,
   the reflection, the header sitting on top of it — is identical in
   both themes. The same holds on a service page and a plan page: the
   hero and the closing band keep their night, everything between them
   turns to paper.

   This was tried the other way round first, and the attempt is worth
   recording because it looked like the obvious move: invert the sky,
   so a visitor in light mode gets the same composition in reverse.
   Inverting a night sky does not give you a day sky. Scattered dark
   dots on white paper do not read as stars, they read as dust on the
   screen; the lines joining them read as scratches; and the monument,
   which is a WHITE line drawing, becomes flat black clip-art with no
   glow to give it depth. The whole hero is built on light emitted in
   darkness, and there is no daylight version of that — there is only
   darkness, or something else entirely.

   So the night stays where the night belongs, and the reading part of
   the page follows the machine.

   Almost nothing below re-styles a component. It redefines the tokens
   the dark theme was already built on, and the rest follows.
   ============================================================ */

@media (prefers-color-scheme: light) {

  :root {
    color-scheme: light;

    --bg: #f2f0ea;
    --bg-rgb: 242 240 234;
    --surface: #ffffff;
    --surface-2: #faf8f3;
    --text: #15161b;
    --muted: #5d5f68;

    --ink-rgb: 24 26 32;
    --line: rgb(var(--ink-rgb) / 0.12);

    /* daylight: nothing glows any more, so the emitted light is only a
       whisper of warm air — the floor is handled by a real shadow below */
    --emit-rgb: var(--accent-dark-rgb);
    --emit-a: 0.35;

    /* shadows go soft instead of pitch black */
    --shadow-rgb: 46 40 32;
    --shadow-a: 0.22;

    /* mid gold is far too pale on paper — accent tones drop two steps so
       small uppercase labels stay readable against the light ground */
    --gold: color-mix(in srgb, rgb(var(--accent-dark-rgb)) 74%, #000);
    --gold-light: rgb(var(--accent-dark-rgb));
    --gold-pale: color-mix(in srgb, rgb(var(--accent-dark-rgb)) 58%, #000);
    --gold-soft: rgb(var(--accent-dark-rgb) / 0.45);

    /* NOTE: the sky tokens — --star-*, --streak-*, --mark-rgb — are
       deliberately NOT redefined here. Every canvas on the site sits
       inside one of the elements below, which hand the dark values
       straight back, so the sky is white on black in both themes. */
  }

  /* ============================================================
     WHAT KEEPS ITS NIGHT
     The sky, the header standing on it, the three kinds of hero, and
     the closing band — which is a picture of a sunset behind two
     ridges, and a picture does not change with the operating system.
     ============================================================ */
  .bg,
  .nav,
  .hero,
  .svc-hero,
  .plan-hero,
  .cta-band {
    color-scheme: dark;

    --bg-rgb: 5 5 5;
    --ink-rgb: 255 255 255;
    --emit-rgb: 255 252 244;
    --emit-a: 1;
    --shadow-rgb: 0 0 0;
    --shadow-a: 1;

    --surface: #101010;
    --surface-2: #141414;
    --text: #ffffff;
    --muted: #9a9a9a;
    --line: rgb(var(--ink-rgb) / 0.07);

    /* gold goes back to its full brightness — it is read on black again */
    --gold: rgb(var(--accent-rgb));
    --gold-light: rgb(var(--accent-light-rgb));
    --gold-pale: rgb(var(--accent-pale-rgb));
    --gold-soft: rgb(var(--accent-rgb) / 0.35);

    /* THE SKY. The canvases read these off themselves, and every one of
       them lives inside this selector list, so the starfield, the
       shooting stars and the dissolving pillar stay exactly as they
       are at night whatever the machine says. */
    --star-rgb: 255 255 255;
    --star-warm-rgb: 232 211 172;
    --star-link-rgb: 207 214 228;
    --star-a: 1;
    --star-density: 1;
    --streak-head-rgb: 255 252 244;
    --streak-tail-rgb: 215 181 126;
    --mark-rgb: 255 255 255;

    /* body sets the inherited colour, so these have to set it again */
    color: var(--text);
  }

  /* THE SKY HAS TO STOP WHERE THE NIGHT STOPS.

     At night .bg is position:fixed behind the whole page, which is
     right when the whole page is black. Here the page is paper from
     the hero's bottom edge down, so a fixed sky would draw stars over
     the reading part of the site. Pinned to the hero instead, painting
     its own black ground under itself.

     --hero-h is measured by js/night-hero.js: there is no way to ask
     in CSS how tall a sibling element is. */
  .bg {
    position: absolute;
    inset: 0 0 auto 0;
    height: var(--hero-h, 100dvh);
    background: #050505;
  }

  /* ============================================================
     BELOW THE HERO, THE PAGE IS PAPER
     Every logo file on the site is white artwork on transparent, drawn
     for a black page. The ones that end up on paper are inverted; the
     ones still standing on black — the header mark, the hero monument,
     the mark on the closing band — are left alone.
     ============================================================ */
  .footer-brand img,
  .foot-bar .brand-mark {
    filter: invert(1);
  }

  /* card artwork stays a lit screen, so keep its fade dark */
  .project-media::after {
    background: linear-gradient(180deg, transparent 58%, rgba(8, 8, 10, 0.75));
  }
}
