/* Dusk is the default theme. The light paper theme is available with ?theme=paper.
   Idea: the Gold Coast sunset from Rick's photo. Plum and indigo sky with an ember glow;
   the data cards stay light, like paper sheets lit from the page, so the chart colors keep working. */

html[data-theme="dusk"] {
  color-scheme: dark;
  --paper: #1B1430;
  --ink: #F7F1E8;
  --ink-2: #D8CFDF;
  --rule: rgb(247 241 232 / .16);
  --rule-hover: rgb(247 241 232 / .34);
  --accent: #FF8A4C;
  --dot: rgb(247 241 232 / .09);
  --surface: rgb(247 241 232 / .08);
  --ok: #7BD9A8;
  --lift: 0 1px 0 rgb(255 255 255 / .04), 0 28px 60px -30px rgb(0 0 0 / .75);
}

html[data-theme="dusk"] body { background: #1B1430; }
html[data-theme="dusk"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(110% 62% at 92% -14%, rgb(255 138 76 / .40), transparent 62%),
    radial-gradient(85% 55% at -8% -6%, rgb(221 88 128 / .34), transparent 64%),
    radial-gradient(90% 60% at 50% 118%, rgb(72 98 214 / .30), transparent 62%),
    linear-gradient(180deg, #2B1A3D 0%, #1D1532 46%, #131028 100%);
}
/* A faint horizon line of warm light behind the first screen. */
html[data-theme="dusk"] .page::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 auto 0;
  height: 560px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0, rgb(255 170 110 / .07) 62%, transparent 100%);
}

/* Light sheets: cards and the mobile action bar keep the paper palette. */
html[data-theme="dusk"] .card,
html[data-theme="dusk"] #sticky {
  color-scheme: light;
  --paper: #F6F0E6;
  --surface: #FCF8F1;
  --ink: #141413;
  --ink-2: #5A5852;
  --rule: #E4DDCF;
  --rule-hover: #CBC3B3;
  --accent: #C8451B;
  --ok: #1E7B4F;
  color: var(--ink);
  border-color: rgb(255 255 255 / .5);
  box-shadow: var(--lift);
}
html[data-theme="dusk"] .card { --lift: 0 1px 0 rgb(255 255 255 / .5) inset, 0 30px 70px -32px rgb(0 0 0 / .8); }
html[data-theme="dusk"] .field input:not([aria-invalid="true"]) { border-color: #847866; }

/* On the dark sky the accent is lighter, so filled accent controls take dark text. */
html[data-theme="dusk"] .rail .cta {
  background: linear-gradient(180deg, #FF9558, #F26B32);
  color: #20100A;
  box-shadow: 0 18px 40px -18px rgb(255 122 61 / .7);
}
/* Crew tags are cream: a thin dark ring keeps them readable when they pass over a light card. */
html[data-theme="dusk"] .cursor-tag { box-shadow: 0 0 0 1px rgb(27 20 48 / .6); }
html[data-theme="dusk"] .rick .cursor-tag { color: #20100A; }
html[data-theme="dusk"] .selection { border-color: rgb(247 241 232 / .6); }
html[data-theme="dusk"] .draft { background: rgb(255 138 76 / .16); }
html[data-theme="dusk"] .photo { border-color: rgb(255 255 255 / .28); box-shadow: 0 16px 34px -18px rgb(0 0 0 / .8); }
html[data-theme="dusk"] .dm:hover { background: rgb(247 241 232 / .1); }

@media print {
  html[data-theme="dusk"] {
    color-scheme: light;
    --paper: #FFFFFF; --ink: #141413; --ink-2: #5A5852; --rule: #E4DDCF; --rule-hover: #CBC3B3;
    --accent: #C8451B; --surface: #FCF8F1; --ok: #1E7B4F;
  }
  html[data-theme="dusk"] body { background: #FFFFFF; }
  html[data-theme="dusk"] .rail .cta { background: var(--accent); color: white; box-shadow: none; }
  html[data-theme="dusk"] body::before,
  html[data-theme="dusk"] .page::after { display: none; }
}
