/* RankX themes. Night is the default dark world (DESIGN.md). Day is the high-legibility light
   world for people who read better on a light ground: near-black ink, every text pair at 7:1 or
   more (WCAG AAA), control borders at 3:1 or more, the same state roles and the same layout.
   The chosen theme is <html data-theme="night|day">, set by the server from the rx_theme cookie
   (layouts/app, layouts/auth) and flipped by theme.js. Every stylesheet reads these tokens. */

:root {
  --rx-ground: #141414;
  --rx-card: #181818;
  --rx-raised: #1e1e1e;
  --rx-hover: #1c1c1c;
  --rx-rule: #222222;
  --rx-line: #2c2c2c;
  --rx-line-strong: #3a3a3a;
  --rx-btn-edge: transparent;
  --rx-ink: #ececec;
  --rx-ink-strong: #ffffff;
  --rx-lede: #cfcfcf;
  --rx-ink-2: #a3a3a3;
  --rx-tick: #8f8f8f;
  --rx-green: #2b7d4b;
  --rx-green-hover: #308a53;
  --rx-green-ink: #5fc283;
  --rx-ready-ink: #7fd39b;
  --rx-green-tint: #1a2b20;
  --rx-blue-ink: #8cc4f2;
  --rx-blue-bg: #182634;
  --rx-amber-ink: #f0b35a;
  --rx-amber-bg: #2e2416;
  --rx-red-ink: #f08a8a;
  --rx-red-tint: #2e1a1a;
  --rx-danger: #8f2f2f;
  --rx-danger-hover: #a33737;
  --rx-on-action: #ffffff;
  --rx-header: #000000;
  --rx-header-edge: transparent;
  --rx-ladder: #24452f;
  --rx-bar-up: #3d6b4c;
  --rx-bar-down: #7a4444;
  --rx-bar-grey: #4a4a4a;
  --rx-badge: #262626;
  --rx-rival: #b2b2b2;
  --rx-rival-strong: #d6d6d6;
  --rx-out: #5c5c5c;
  --rx-heat-1: #2f6b45;
  --rx-heat-2: #1f3b2a;
  --rx-heat-3: #232323;
  /* stacked-bar ramp for other sites, most visible first (The Muted Rival Rule) */
  --rx-ramp-1: #d6d6d6;
  --rx-ramp-2: #b2b2b2;
  --rx-ramp-3: #909090;
  --rx-ramp-4: #727272;
  --rx-ramp-5: #5c5c5c;
  --rx-ramp-6: #4a4a4a;
  --rx-cast: rgba(0, 0, 0, .5);
  --rx-scrim: rgba(0, 0, 0, .55);
  --rx-halo: rgba(95, 194, 131, .18);
  --rx-pulse: rgba(140, 196, 242, .14);
  --rx-best: rgba(95, 194, 131, .12);
  --rx-blue-fill: rgba(140, 196, 242, .12);
  --rx-zone-1: rgba(95, 194, 131, .16);
  --rx-zone-2: rgba(95, 194, 131, .08);
  --rx-zone-3: rgba(255, 255, 255, .035);
  --rx-note-line: rgba(163, 163, 163, .6);
  --rx-dot-match: rgba(95, 194, 131, .75);
  --rx-dot-off: rgba(240, 179, 90, .8);
  --rx-diagonal: #5a5a5a;
  color-scheme: dark;
}

:root[data-theme="day"] {
  --rx-ground: #eceee9;
  --rx-card: #ffffff;
  --rx-raised: #eef0ec;
  --rx-hover: #f1f3ef;
  --rx-rule: #e1e5df;
  --rx-line: #d2d7d0;
  --rx-line-strong: #7d847e;
  --rx-btn-edge: #7d847e;
  --rx-ink: #121512;
  --rx-ink-strong: #000000;
  --rx-lede: #262b27;
  --rx-ink-2: #3d433e;
  --rx-tick: #59605a;
  --rx-green: #1b6339;
  --rx-green-hover: #154f2d;
  --rx-green-ink: #14592f;
  --rx-ready-ink: #14592f;
  --rx-green-tint: #e1f1e6;
  --rx-blue-ink: #0d4a80;
  --rx-blue-bg: #e2edf8;
  --rx-amber-ink: #6a4200;
  --rx-amber-bg: #faeed3;
  --rx-red-ink: #921c1c;
  --rx-red-tint: #fae3e2;
  --rx-danger: #921c1c;
  --rx-danger-hover: #7a1616;
  --rx-on-action: #ffffff;
  --rx-header: #ffffff;
  --rx-header-edge: #d2d7d0;
  --rx-ladder: #8fc3a0;
  --rx-bar-up: #7fb08f;
  --rx-bar-down: #d39595;
  --rx-bar-grey: #8d948e;
  --rx-badge: #e6e9e4;
  --rx-rival: #4f5650;
  --rx-rival-strong: #2a2f2b;
  --rx-out: #646b65;
  --rx-heat-1: #1b6339;
  --rx-heat-2: #b9dcc4;
  --rx-heat-3: #e8ebe6;
  --rx-ramp-1: #2f3430;
  --rx-ramp-2: #4d534e;
  --rx-ramp-3: #6b716c;
  --rx-ramp-4: #8a908b;
  --rx-ramp-5: #a9aea9;
  --rx-ramp-6: #c4c8c4;
  --rx-cast: rgba(18, 24, 18, .16);
  --rx-scrim: rgba(18, 22, 18, .42);
  --rx-halo: rgba(27, 99, 57, .22);
  --rx-pulse: rgba(13, 74, 128, .16);
  --rx-best: rgba(27, 99, 57, .10);
  --rx-blue-fill: rgba(13, 74, 128, .10);
  --rx-zone-1: rgba(27, 99, 57, .14);
  --rx-zone-2: rgba(27, 99, 57, .07);
  --rx-zone-3: rgba(0, 0, 0, .035);
  --rx-note-line: rgba(61, 67, 62, .55);
  --rx-dot-match: rgba(27, 99, 57, .85);
  --rx-dot-off: rgba(176, 109, 0, .9);
  --rx-diagonal: #8d948e;
  color-scheme: light;
}

/* ---------- The CoreUI shell in Day (the body drops c-dark-theme) ---------- */
[data-theme="day"] body,
[data-theme="day"] .c-app { background-color: var(--rx-ground); color: var(--rx-ink); --color: var(--rx-ink); }
[data-theme="day"] .c-header { background: var(--rx-header); border-block-end: 1px solid var(--rx-header-edge); }
[data-theme="day"] .c-header .c-header-nav .c-header-nav-link { color: var(--rx-ink-2); }
[data-theme="day"] .c-header .c-header-nav .c-header-nav-link:hover,
[data-theme="day"] .c-header .c-header-nav .c-header-nav-link:focus { color: var(--rx-ink); }
[data-theme="day"] .c-footer { background: var(--rx-ground); color: var(--rx-ink-2); border-block-start: 1px solid var(--rx-line); }
[data-theme="day"] .c-footer a { color: var(--rx-green-ink); }

/* Secondary and quiet buttons carry a visible edge in Day, where a pale fill alone would vanish */
[data-theme="day"] .st-btn:not(.st-btn-primary):not(.st-btn-danger) { border-color: var(--rx-btn-edge); }

/* The logo pair: the dark-ground file in Night, the light-ground file in Day */
.rx-logo-day { display: none !important; }
[data-theme="day"] .rx-logo-night { display: none !important; }
[data-theme="day"] .rx-logo-day { display: block !important; }

/* ---------- Day / Night switch (header) ---------- */
.rx-theme {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--rx-line-strong); border-radius: 6px; background: transparent; color: var(--rx-ink);
  font: 600 .9375rem/1 Raleway, Vazirmatn, Tajawal, system-ui, sans-serif; white-space: nowrap; cursor: pointer;
  transition: background-color .2s cubic-bezier(.16, 1, .3, 1), border-color .2s cubic-bezier(.16, 1, .3, 1);
}
.rx-theme:hover { background: var(--rx-raised); }
.rx-theme:active { transform: translateY(1px); }
.rx-theme:focus { outline: none; }
.rx-theme:focus-visible { outline: 2px solid var(--rx-green-ink); outline-offset: 2px; }
.rx-theme svg { width: 18px; height: 18px; flex: none; }
/* the button names the theme it switches to */
.rx-theme > span { display: inline-flex; align-items: center; gap: 8px; }
.rx-theme > .is-to-night { display: none; }
[data-theme="day"] .rx-theme > .is-to-day { display: none; }
[data-theme="day"] .rx-theme > .is-to-night { display: inline-flex; }
@media (max-width: 860px) {
  .rx-theme { padding: 0 10px; }
  .rx-theme-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
