/* ============================================================
   NIGHT & DAY — the day atlas theme
   The daylight counterpart, not an inversion: the same survey
   chart carried out of the lamplight and laid on a drafting table.
   Warm ecru paper with faint foxing, sepia ink, lake-tile teal
   instrument lines, burnished amber illumination, deepened lacquer
   red for war. Same ornaments, same discipline, opposite hour.
   Activated by data-nx-theme="day" on <html> (toggle lives in the
   clock controls, injected by JS, persisted in localStorage).
   ============================================================ */

html[data-nx-theme="day"] {
  color-scheme: light;
  scrollbar-color: #c0b28d #f6f0e0;
  /* ground */
  --night: #f6f0e0;
  --night-2: #efe7d0;
  --night-3: #e7dcc0;
  /* ink & paper */
  --ink: #241f14;
  --ink-2: #4c4433;
  --paper: #f6f0e0;          /* halos flip back to light */
  --surface: #fbf7ea;
  --line: rgba(36, 31, 20, 0.16);
  --muted: #776d55;
  /* accents, deepened for daylight */
  --lapis: #1f7f9b;
  --cypress: #2e7d54;
  --pomegranate: #b23a2b;
  --copper: #a9662a;
  --gold: #b3831d;
  --turquoise: #0c7568;
  --shadow: 0 20px 50px rgba(78, 62, 30, 0.20);
}

/* base ground: paper, tinted margins, faint foxing instead of stars */
html[data-nx-theme="day"] body.chronicle-page {
  background:
    radial-gradient(1100px 720px at 85% -8%, rgba(12, 117, 104, 0.05), transparent 62%),
    radial-gradient(900px 640px at -8% 26%, rgba(179, 131, 29, 0.06), transparent 58%),
    var(--night);
}

html[data-nx-theme="day"] body.chronicle-page::before {
  background-image:
    radial-gradient(1.2px 1.2px at 22% 18%, rgba(122, 96, 44, 0.16) 48%, transparent 52%),
    radial-gradient(1px 1px at 68% 62%, rgba(122, 96, 44, 0.12) 48%, transparent 52%),
    radial-gradient(1.4px 1.4px at 84% 30%, rgba(122, 96, 44, 0.10) 48%, transparent 52%),
    radial-gradient(0.9px 0.9px at 40% 84%, rgba(122, 96, 44, 0.12) 48%, transparent 52%),
    radial-gradient(1px 1px at 8% 56%, rgba(122, 96, 44, 0.08) 48%, transparent 52%);
  opacity: 0.8;
}

html[data-nx-theme="day"] .chronicle-page ::-webkit-scrollbar-track { background: #f6f0e0; }
html[data-nx-theme="day"] .chronicle-page ::-webkit-scrollbar-thumb {
  background: #cdbf9a;
  border-color: #f6f0e0;
}
html[data-nx-theme="day"] .chronicle-page ::-webkit-scrollbar-thumb:hover { background: #b3a37a; }

html[data-nx-theme="day"] .chronicle-page code {
  color: #0a5f54;
  background: rgba(12, 117, 104, 0.08);
  border-color: rgba(12, 117, 104, 0.25);
}

/* topbar */
html[data-nx-theme="day"] .chronicle-page .ch-topbar { background: rgba(246, 240, 224, 0.86); }

/* clock: brass by daylight */
html[data-nx-theme="day"] .chronicle-page { --clock-bg: rgba(246, 240, 224, 0.92); }

html[data-nx-theme="day"] .chronicle-page .ch-clock {
  border-bottom-color: rgba(12, 117, 104, 0.35);
  box-shadow: 0 14px 40px rgba(78, 62, 30, 0.16);
}

html[data-nx-theme="day"] .chronicle-page .ch-lane-strip {
  background: linear-gradient(to right, transparent, rgba(36, 31, 20, 0.05) 10%, rgba(36, 31, 20, 0.05) 90%, transparent);
}

html[data-nx-theme="day"] .chronicle-page .ch-lane.is-expanded .ch-lane-strip {
  border-color: rgba(12, 117, 104, 0.35);
  box-shadow: 0 16px 40px rgba(78, 62, 30, 0.25);
}

html[data-nx-theme="day"] .chronicle-page .ch-tl-dot { box-shadow: 0 0 0 2px rgba(246, 240, 224, 0.9); }

html[data-nx-theme="day"] .chronicle-page .ch-chron select {
  color: #0a5f54;
  border-color: rgba(12, 117, 104, 0.45);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M1 1l3 3 3-3' fill='none' stroke='%230c7568' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
}

html[data-nx-theme="day"] .chronicle-page .ch-chron select:hover,
html[data-nx-theme="day"] .chronicle-page .ch-chron select:focus-visible {
  box-shadow: 0 0 0 2.5px rgba(12, 117, 104, 0.14);
}

html[data-nx-theme="day"] .chronicle-page .ch-merge-toggle {
  color: #6d4779;
  border-color: rgba(109, 71, 121, 0.45);
}

html[data-nx-theme="day"] .chronicle-page .ch-merge-toggle[aria-pressed="false"] {
  background: #7d5185;
  color: #fdf9ef;
  border-color: #7d5185;
}

html[data-nx-theme="day"] .chronicle-page [data-lane="rulers"] { --lane-color: #7d5185; }
html[data-nx-theme="day"] .chronicle-page .ch-tl-band[data-band="band-shia-state"] { --lane-color: #8a5525; }
html[data-nx-theme="day"] .chronicle-page { --lane-religion: #9a7014; }

html[data-nx-theme="day"] .chronicle-page .ch-ticks { border-top-color: rgba(36, 31, 20, 0.5); }
html[data-nx-theme="day"] .chronicle-page .ch-tick i { background: rgba(36, 31, 20, 0.4); }

html[data-nx-theme="day"] .chronicle-page .ch-needle {
  filter: drop-shadow(0 0 4px rgba(179, 131, 29, 0.5));
}

html[data-nx-theme="day"] .chronicle-page .ch-year-readout {
  color: #7c5a10;
  background: #fdf9ec;
  border-color: rgba(179, 131, 29, 0.65);
  box-shadow:
    0 0 0 3px rgba(179, 131, 29, 0.10),
    0 6px 16px rgba(78, 62, 30, 0.28);
}

html[data-nx-theme="day"] .chronicle-page .ch-clock-tip,
html[data-nx-theme="day"] .chronicle-page .ch-map-tip {
  background: #fffdf4;
  border-color: rgba(12, 117, 104, 0.4);
  box-shadow: 0 14px 30px rgba(78, 62, 30, 0.3);
}

/* hero: morning light on the drafting table */
html[data-nx-theme="day"] .chronicle-page .ch-hero::before {
  border-color: rgba(12, 117, 104, 0.14);
  box-shadow: inset 0 0 60px rgba(12, 117, 104, 0.05);
}

html[data-nx-theme="day"] .chronicle-page .ch-hero::after {
  border-color: rgba(179, 131, 29, 0.30);
}

html[data-nx-theme="day"] .chronicle-page .ch-hero .eyebrow::before,
html[data-nx-theme="day"] .chronicle-page .ch-hero .eyebrow::after {
  background: rgba(12, 117, 104, 0.45);
}

html[data-nx-theme="day"] .chronicle-page .ch-hero .lede { color: var(--ink-2); }

/* map: the daylight chart */
html[data-nx-theme="day"] #ch-geo-sea stop:first-child { stop-color: #d8e5e2; }
html[data-nx-theme="day"] #ch-geo-sea stop:last-child { stop-color: #c5d7d3; }

html[data-nx-theme="day"] .chronicle-page .ch-map {
  background: #f2ecdb;
  border-color: rgba(12, 117, 104, 0.35);
  box-shadow:
    0 0 0 1px rgba(246, 240, 224, 0.9),
    0 0 0 5px rgba(12, 117, 104, 0.06),
    var(--shadow);
}

html[data-nx-theme="day"] .chronicle-page .ch-map-gratline { stroke: rgba(12, 117, 104, 0.16); }

html[data-nx-theme="day"] .chronicle-page .ch-map-landmass {
  fill: #f3ecd8;
  stroke: #74959d;
}

html[data-nx-theme="day"] .chronicle-page .ch-map-sea-labels text { fill: #6a8f97; }

html[data-nx-theme="day"] .chronicle-page .ch-border.is-primary { fill: rgba(179, 131, 29, 0.14); }

html[data-nx-theme="day"] .chronicle-page .ch-snap.is-ghost:not(.is-on) .ch-border {
  stroke: rgba(76, 68, 51, 0.6);
}

html[data-nx-theme="day"] .chronicle-page .ch-modern-iran { fill: rgba(46, 125, 84, 0.14); }
html[data-nx-theme="day"] .chronicle-page .ch-modern-borders { stroke: rgba(36, 31, 20, 0.45); }

html[data-nx-theme="day"] .chronicle-page .ch-map-place circle {
  fill: #3f382a;
  stroke: #f6f0e0;
}

html[data-nx-theme="day"] .chronicle-page .ch-cap-star { stroke: #f6f0e0; }

html[data-nx-theme="day"] .chronicle-page .ch-map-place text {
  fill: #3a3325;
  stroke: rgba(246, 240, 224, 0.92);
}

html[data-nx-theme="day"] .chronicle-page .ch-map-scale line { stroke: rgba(36, 31, 20, 0.55); }

html[data-nx-theme="day"] .chronicle-page .ch-map-tool { background: rgba(251, 247, 234, 0.94); }

html[data-nx-theme="day"] .chronicle-page .ch-map figcaption { background: rgba(36, 31, 20, 0.04); }

html[data-nx-theme="day"] .chronicle-page .ch-now-title { color: #a03526; }

/* era story */
html[data-nx-theme="day"] .nx-num { -webkit-text-stroke-color: rgba(36, 31, 20, 0.09); }
html[data-nx-theme="day"] .chronicle-page .ch-era.is-current .nx-num {
  -webkit-text-stroke-color: rgba(179, 131, 29, 0.35);
}

html[data-nx-theme="day"] .chronicle-page .ch-era.is-current .ch-era-order {
  text-shadow: 0 0 14px rgba(12, 117, 104, 0.35);
}

html[data-nx-theme="day"] .chronicle-page .ch-era-transition { color: #146d5f; }

html[data-nx-theme="day"] .chronicle-page .ch-overview > p:first-child > em:only-child,
html[data-nx-theme="day"] .chronicle-page .ch-overview > p:last-of-type > em:only-child {
  color: #7c5c12;
  border-color: rgba(179, 131, 29, 0.5);
}

html[data-nx-theme="day"] .chronicle-page .ch-overview a,
html[data-nx-theme="day"] .chronicle-page .ch-end a {
  color: #0a6c60;
  text-decoration-color: rgba(10, 108, 96, 0.4);
}

html[data-nx-theme="day"] .chronicle-page .ch-overview a:hover,
html[data-nx-theme="day"] .chronicle-page .ch-end a:hover {
  color: #7c5a10;
  text-decoration-color: rgba(124, 90, 16, 0.5);
}

/* evidence ledger */
html[data-nx-theme="day"] .chronicle-page .ch-evidence { background: rgba(251, 247, 234, 0.75); }
html[data-nx-theme="day"] .chronicle-page .ch-evidence summary:hover { background: rgba(36, 31, 20, 0.04); }
html[data-nx-theme="day"] .chronicle-page .ch-evidence-bar { background: rgba(36, 31, 20, 0.1); }

html[data-nx-theme="day"] .chronicle-page .ch-claim-chip.ev-solid { background: rgba(46, 125, 84, 0.12); border-color: rgba(46, 125, 84, 0.55); color: #1d5e3c; }
html[data-nx-theme="day"] .chronicle-page .ch-claim-chip.ev-consensus { background: rgba(31, 127, 155, 0.12); border-color: rgba(31, 127, 155, 0.55); color: #135a70; }
html[data-nx-theme="day"] .chronicle-page .ch-claim-chip.ev-contested { background: rgba(178, 58, 43, 0.12); border-color: rgba(178, 58, 43, 0.55); color: #8f2b1e; }
html[data-nx-theme="day"] .chronicle-page .ch-claim-chip.ev-open { background: rgba(179, 131, 29, 0.14); border-color: rgba(179, 131, 29, 0.55); color: #7c5c12; }
html[data-nx-theme="day"] .chronicle-page .ch-claim-chip.ev-conf { background: rgba(36, 31, 20, 0.05); }

/* event stream */
html[data-nx-theme="day"] .chronicle-page .ch-card {
  background: linear-gradient(180deg, #fdfaf0, #f6efdd);
}

html[data-nx-theme="day"] .chronicle-page .ch-card-type { color: #14657e; }
html[data-nx-theme="day"] .chronicle-page .ch-card-year { color: #7c5a10; }
html[data-nx-theme="day"] .chronicle-page .ch-card-war .ch-card-type { color: #a03526; }

html[data-nx-theme="day"] .chronicle-page .ch-chip {
  background: rgba(31, 127, 155, 0.10);
  border-color: rgba(31, 127, 155, 0.35);
  color: #14556b;
}

html[data-nx-theme="day"] .chronicle-page .ch-chip-place {
  background: rgba(169, 102, 42, 0.10);
  border-color: rgba(169, 102, 42, 0.4);
  color: #7c4c1e;
}

html[data-nx-theme="day"] .chronicle-page .badge { background: rgba(36, 31, 20, 0.05); }

html[data-nx-theme="day"] .chronicle-page .badge-provisional,
html[data-nx-theme="day"] .chronicle-page .badge-queued {
  color: #7c5c12;
  background: rgba(179, 131, 29, 0.10);
  border-color: rgba(179, 131, 29, 0.5);
}

html[data-nx-theme="day"] .chronicle-page .badge-verified {
  color: #1d5e3c;
  background: rgba(46, 125, 84, 0.10);
  border-color: rgba(46, 125, 84, 0.5);
}

html[data-nx-theme="day"] .chronicle-page .badge-uncertainty {
  color: #7c5c12;
  border-color: rgba(179, 131, 29, 0.55);
}

html[data-nx-theme="day"] body.chronicle-page.ch-enhanced .ch-card.is-active {
  border-color: rgba(179, 131, 29, 0.55);
  box-shadow:
    0 0 0 1px rgba(179, 131, 29, 0.2),
    0 12px 34px rgba(78, 62, 30, 0.24),
    0 0 30px rgba(179, 131, 29, 0.10);
}

html[data-nx-theme="day"] body.chronicle-page.ch-enhanced .ch-card-war.is-active {
  box-shadow:
    0 0 0 1px rgba(178, 58, 43, 0.22),
    0 12px 34px rgba(78, 62, 30, 0.24),
    0 0 30px rgba(178, 58, 43, 0.10);
}

/* pocket map by day */
html[data-nx-theme="day"] .ch-atlas-sticky.nx-mini .ch-map {
  box-shadow:
    0 0 0 1px rgba(246, 240, 224, 0.9),
    0 0 0 4px rgba(179, 131, 29, 0.12),
    0 18px 44px rgba(78, 62, 30, 0.35);
}

html[data-nx-theme="day"] .nx-mini-toggle::after {
  color: #7c5a10;
  text-shadow: 0 0 6px rgba(246, 240, 224, 0.95);
}

html[data-nx-theme="day"] .ch-atlas-sticky.nx-mini.nx-open {
  border-color: rgba(12, 117, 104, 0.35);
  box-shadow: 0 30px 90px rgba(60, 48, 22, 0.45);
}

html[data-nx-theme="day"] .nx-mini-close {
  background: #fdf9ec;
  color: #7c5a10;
  box-shadow: 0 6px 18px rgba(78, 62, 30, 0.35);
}

html[data-nx-theme="day"] .nx-scrim {
  background: rgba(52, 42, 20, 0.42);
}

/* ---------------------------------------------- the theme toggle */

/* lives among the clock controls; inherits their round style */
.nx-theme-toggle { font-size: 0.8rem; }

/* a gentle crossfade while the hour changes (JS removes the class;
   never added when reduced motion is preferred) */
html.nx-theme-fade body,
html.nx-theme-fade body * {
  transition:
    background-color 450ms ease,
    color 450ms ease,
    border-color 450ms ease,
    fill 450ms ease,
    stroke 450ms ease,
    box-shadow 450ms ease !important;
}
