/* ==========================================================================
   NovaRail theme tokens
   Loaded FIRST through a blocking link on public pages (and by theme.js on
   older app pages), so --nr-* is available to every later stylesheet.
   Tokens only, plus the brand lockup helpers. No global element rules here:
   a bare `a { }` or `body { }` would out-specify theme-v3's zero-specificity
   :where() defaults and repaint every page.

   Every value below was contrast-checked against its own canvas.
   Ratios noted inline. Do not substitute values without re-checking.
   ========================================================================== */

:root,
[data-theme="dark"] {
  /* Canvas + surfaces. A five-rung ladder, warm rather than neutral grey, so
     a panel reads as raised without a shadow and the eye can rank importance
     from tone alone. Canvas is fixed: the inline nr-first-paint guard in every
     page head hardcodes it, so changing it here would desync first paint. */
  --nr-canvas:          #100F0D;
  --nr-surface:         #191610;  /* standing panels          1.06:1 vs canvas */
  --nr-surface-raised:  #201C15;  /* inputs, code, nested      1.13:1 */
  --nr-surface-active:  #262017;  /* the selected/current one  1.19:1 */
  --nr-border:          #2B2723;
  --nr-border-strong:   #3A342D;

  /* text */
  --nr-text:            #ECEAE3;  /* 15.91:1 */
  --nr-text-secondary:  #B9B4AA;  /*  9.28:1 */
  --nr-text-muted:      #8D8981;  /*  5.50:1 canvas, 4.63:1 on surface-active.
                                        was #7F7C76, which fell to 3.88:1 on a
                                        raised panel and made helper text hard
                                        to read on exactly the panels that
                                        carry it. */

  /* brand */
  --nr-rust:            #C9573A;  /* the rail. fills, seals, graphics, display type */
  --nr-accent-text:     #D66A48;  /* small text + links. 5.49:1 canvas, 4.62:1 on
                                     surface-active. was #CA593C, which was
                                     4.04:1 on a raised panel: under AA. */
  --nr-verified:        #5FB98B;  /*  8.03:1 */

  /* the mark: ring + NOVA take the opposite of the canvas */
  --nr-ring:            var(--nr-text);
}

[data-theme="light"] {
  /* Warm paper, never glaring white. Same five rungs so every component that
     reads the ladder flips without knowing which theme it is in. */
  --nr-canvas:          #F7F2EF;
  --nr-surface:         #FFFCF8;
  --nr-surface-raised:  #FFFFFF;
  --nr-surface-active:  #F3EBE3;
  --nr-border:          #E4DDD8;
  --nr-border-strong:   #CFC7C1;

  /* Ratios below are the WORST of the four grounds above, which is the
     active surface. Every one clears AA there, so no token can fail
     depending on which panel it lands on. */
  --nr-text:            #181510;  /* 14.93:1 */
  --nr-text-secondary:  #55504A;  /*  6.54:1 */
  --nr-text-muted:      #6A645E;  /*  4.95:1 */

  --nr-rust:            #C9573A;  /* unchanged. the rail is always rust. graphics only */
  --nr-accent-text:     #A8452D;  /*  5.01:1 */
  --nr-verified:        #2E7050;  /*  5.02:1 */

  --nr-ring:            var(--nr-text);
}

/* --------------------------------------------------------------------------
   The rule, stated once:
     The rail is ALWAYS --nr-rust.
     The ring and the word NOVA are ALWAYS --nr-text (opposite of canvas).
     Two colours in the mark. Never three.

   --nr-rust is for the rail, borders, fills, and display type only.
   For any text under about 24px, use --nr-accent-text instead. On the light
   canvas rust is 3.85:1, which clears graphics and large text but fails the
   4.5:1 small-text threshold.
   -------------------------------------------------------------------------- */

/* Wordmark split inside the site header/footer lockup: NOVA<b>RAIL</b>.
   .an-brand supplies weight/tracking (theme-v3.css); this only colours RAIL. */
.an-brand b, .nav-logo b, .brand-v2 b, .brand-v2-big b, .acc-brand b, .tb-brand b, .nr-lockup b { color: var(--nr-rust); font-weight: inherit; }

/* Brand orbs (nav-pill, topbar, page-local acc-topbar): every .orb renders the
   REAL mark (ring with gaps, rails passing through), not a CSS approximation.
   Bold cut, same as the favicon, so it survives 14px. Ring flips with theme. */
.orb { border: none !important; border-radius: 0 !important; box-shadow: none !important;
  background: url(data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%20100%20100%22%3E%3Ccircle%20cx=%2250%22%20cy=%2250%22%20r=%2236%22%20fill=%22none%22%20stroke=%22%23ECEAE3%22%20stroke-width=%229%22%20stroke-dasharray=%2282.9%2030.2%22%20stroke-dashoffset=%2298%22/%3E%3Cpath%20d=%22M0%2041.5H100M0%2058.5H100%22%20fill=%22none%22%20stroke=%22%23C9573A%22%20stroke-width=%229%22/%3E%3C/svg%3E) center / contain no-repeat !important; }
[data-theme="light"] .orb { background-image: url(data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%20100%20100%22%3E%3Ccircle%20cx=%2250%22%20cy=%2250%22%20r=%2236%22%20fill=%22none%22%20stroke=%22%23181510%22%20stroke-width=%229%22%20stroke-dasharray=%2282.9%2030.2%22%20stroke-dashoffset=%2298%22/%3E%3Cpath%20d=%22M0%2041.5H100M0%2058.5H100%22%20fill=%22none%22%20stroke=%22%23C9573A%22%20stroke-width=%229%22/%3E%3C/svg%3E) !important; }

/* Standalone lockup helper for hero/marketing use (inline the adaptive SVG). */
.nr-lockup { display: inline-flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; }
.nr-lockup svg { display: block; width: 34px; height: 34px; overflow: visible; }
.nr-lockup .nr-word { font-weight: 800; font-size: 20px; letter-spacing: 1.5px; line-height: 1; }
