/* ==========================================================================
   arena-pixel-art: light theme, on <html data-theme="light"> (js/theme-toggle.js sets it from the visitor's choice).
   Pages stay dark by default. In light the content turns to parchment: the page, page heads, frames, cards, boards,
   chips, search. A section of <main> marked .band--dark is a picture and keeps the dark theme whole (an arena
   scene, a closing band); so do the footer and the phone menu. A gold rule dresses each seam between the two.
   Gold, pink and teal darken to stay legible on parchment. A site's own classes get their light rules next to
   their dark ones, under the same selector as here: :root[data-theme="light"] main > :not(.band--dark).
   ========================================================================== */

:root[data-theme="light"] {
  color-scheme: light;
  --l-page: #ebe8de;              /* parchment, a shade lighter than --c-cream so muted text keeps 4.5:1 */
  --l-panel: #f5f3ec;             /* frames, side panels, forms */
  --l-card: #fffefc;              /* cards, inputs, tables */
  --l-ink: var(--c-ink);
  --l-muted: rgba(28, 28, 28, 0.72);
  --l-subtle: rgba(28, 28, 28, 0.64);
  --l-gold: #7a571c;              /* gold text on parchment (the cream board's #8a6424 is 4.2:1 there) */
  --l-pink: #971a7d;              /* --c-chip-pink-text */
  --l-teal: #05646d;
}

/* The switch: an icon button in the bar, a text button in the phone menu. Hidden until theme-toggle.js runs, so
   it never shows as a dead button. Pressed (light on), it turns gold. */
.nav__theme {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  border: 0;
  background: none;
  cursor: pointer;
}

.nav__theme[hidden] {
  display: none;
}

.nav__menu .nav__theme {
  width: 100%;
  padding: 12px;
  text-align: left;
}

.nav__theme[aria-pressed="true"] {
  color: var(--c-gold);
}

/* The light zone: inside it, the dark-surface tokens mean ink on parchment. */
:root[data-theme="light"] main > :not(.band--dark) {
  --c-text-on-dark: var(--l-ink);
  --c-text-on-dark-muted: var(--l-muted);
  --c-text-on-dark-subtle: var(--l-subtle);
  --line-white-10: rgba(28, 28, 28, 0.12);
  --line-white-15: rgba(28, 28, 28, 0.18);
  --c-gold: var(--l-gold);
  --c-pink: var(--l-pink);
  --c-hextech: var(--l-teal);
  color: var(--l-ink);
}

/* ---------- Surfaces ---------- */
:root[data-theme="light"] body,
:root[data-theme="light"] main > :not(.band--dark):is(.page-hero, .section--dark, .article-page) {
  background: var(--l-page);
}

/* The grunge texture is drawn for dark grounds (a dodge blend); on parchment it only greys the page. */
:root[data-theme="light"] main > :not(.band--dark) .grunge,
:root[data-theme="light"] main > :not(.band--dark):is(.page-hero, .section--dark) > .grunge {
  display: none;
}

/* Seams between a dark band and parchment: the theme's gold rule. A nav before a band (breadcrumbs) isn't a section. */
:root[data-theme="light"] main > .band--dark:not(:last-child) {
  border-bottom: 2px solid;
  border-image: var(--gold-rule) 1;
}

:root[data-theme="light"] main > :not(.band--dark, nav) + .band--dark,
:root[data-theme="light"] main:not(:has(> .band--dark:last-child)) + .footer {
  border-top: 2px solid;
  border-image: var(--gold-rule) 1;
}

:root[data-theme="light"] main > :not(.band--dark) .article-frame {
  background: var(--l-panel);
}

:root[data-theme="light"] main > :not(.band--dark) .article-frame__guides span {
  background: rgba(28, 28, 28, 0.05);
}

:root[data-theme="light"] main > :not(.band--dark) .card {
  background: var(--l-card);
  color: var(--l-ink);
}

:root[data-theme="light"] main > :not(.band--dark) .card:hover {
  border-color: rgba(28, 28, 28, 0.3);
}

/* ---------- Text the theme writes in white ---------- */
:root[data-theme="light"] main > :not(.band--dark) :is(.page-hero__title, .article__title, .prose strong, .prose :is(h1, h2, h3, h4)) {
  color: var(--l-ink);
  text-shadow: none;
}

:root[data-theme="light"] main > :not(.band--dark) :is(.page-hero__lead, .article__sub, .prose, .prose td, .prose figcaption, .card__excerpt, .card__meta .date, .empty) {
  color: var(--l-muted);
}

:root[data-theme="light"] main > :not(.band--dark) .prose :is(h4, h5, h6) {
  color: var(--l-subtle);
}

:root[data-theme="light"] main > :not(.band--dark) :is(.prose li::marker, .card__meta .slash) {
  color: rgba(28, 28, 28, 0.4);
}

:root[data-theme="light"] main > :not(.band--dark) .prose a {
  text-decoration-color: rgba(122, 87, 28, 0.45);
}

:root[data-theme="light"] main > :not(.band--dark) .prose code {
  border-color: rgba(28, 28, 28, 0.12);
  background: rgba(28, 28, 28, 0.05);
  color: var(--l-ink);
}

:root[data-theme="light"] main > :not(.band--dark) .prose :is(th, td) {
  border-bottom-color: rgba(28, 28, 28, 0.14);
}

/* The pink button keeps its pink: its dark text needs the light ground. */
:root[data-theme="light"] main > :not(.band--dark) .btn--pink {
  --c-pink: #ee67d1;
}

/* ---------- Chips, filters, search ---------- */
:root[data-theme="light"] main > :not(.band--dark) .chip--neutral {
  background: var(--l-card);
  border-color: rgba(28, 28, 28, 0.22);
  color: var(--l-muted);
}

:root[data-theme="light"] main > :not(.band--dark) .chip--pink {
  background: var(--l-card);
  border-color: rgba(151, 26, 125, 0.45);
}

:root[data-theme="light"] main > :not(.band--dark) .filter {
  border-color: rgba(28, 28, 28, 0.22);
  color: var(--l-ink);
}

:root[data-theme="light"] main > :not(.band--dark) .filter:hover {
  background: rgba(28, 28, 28, 0.06);
}

:root[data-theme="light"] main > :not(.band--dark) :is(.filter.is-active, .filter[aria-current="page"]) {
  background: rgba(28, 28, 28, 0.12);
}

:root[data-theme="light"] main > :not(.band--dark) .search {
  background: var(--l-card);
}

:root[data-theme="light"] main > :not(.band--dark) .search:focus-within {
  border-color: rgba(28, 28, 28, 0.5);
}

:root[data-theme="light"] main > :not(.band--dark) .search input {
  color: var(--l-ink);
}

:root[data-theme="light"] main > :not(.band--dark) .search input::placeholder {
  color: var(--l-subtle);
}

/* ---------- Boards: the theme's cream board, its default before .board--dark ---------- */
:root[data-theme="light"] main > :not(.band--dark) .board--dark {
  --board-ink: var(--l-ink);
  --board-muted: rgba(28, 28, 28, 0.66);
  --board-line: rgba(28, 28, 28, 0.14);
  --board-zebra: rgba(28, 28, 28, 0.04);
  --board-hover: rgba(28, 28, 28, 0.07);
  --board-value: var(--l-gold);
  --board-wr-bg: rgba(201, 167, 113, 0.22);
  --board-wr-edge: #c9a771;
}

:root[data-theme="light"] main > :not(.band--dark) .board--dark .board__status--verified {
  color: var(--l-teal);
}

:root[data-theme="light"] main > :not(.band--dark) .board--dark .board__status--pending {
  color: #6e4f1a;
}

/* ---------- Navigation over parchment ---------- */
/* The bar sits over the page's first section: ink on parchment, white when that section is a dark band. */
:root[data-theme="light"] body:not(:has(main > .band--dark:first-of-type)) .nav :is(.nav__brand, .nav__links .nav__link, .nav__actions .nav__link:not(.nav__theme), .nav__burger) {
  color: var(--l-ink);
}

:root[data-theme="light"] body:not(:has(main > .band--dark:first-of-type)) .nav :is(.nav__links, .nav__actions) .nav__link:is(.is-current, :hover) {
  color: var(--l-gold);
}

:root[data-theme="light"] body:not(:has(main > .band--dark:first-of-type)) .nav__sep {
  background: rgba(28, 28, 28, 0.2);
}

/* The phone menu stays dark; opaque, so parchment text doesn't show through it. */
:root[data-theme="light"] .nav__menu {
  background: var(--c-dark);
}
