/* =========================================
   ARTNEST TREASURES — DARK MODE
   html[data-theme="dark"] (set by js/theme.js, before first paint).

   Every section that sits on Warm Ivory in light mode moves onto ONE
   shared warm charcoal, so the page never looks patched together.
   Inside those sections the brand tokens are re-pointed: charcoal ink
   becomes ivory, the ivory page becomes the dark page, and forest green
   text is lifted so it stays readable. Sections that already carry a
   brand colour (Burnt Orange menu, stall and loader; Forest Green
   studio reels, Work in progress and footer; the dark Latest Work and
   My Art galleries) keep their brand colours unchanged.
   ========================================= */

:root[data-theme="dark"] {
  --dark-page: #171614;           /* the one dark background */
  --dark-ink: 238, 232, 220;      /* warm ivory text, as r, g, b */

  color-scheme: dark;
  --color-background-primary: var(--dark-page);
  --color-surface-canvas: var(--dark-page);
  --color-border-subtle: rgba(238, 232, 220, 0.16);
  --color-wireframe: #6E6253;
  --color-wireframe-soft: #463F36;
}

/* Light-ivory sections: header bar, home hero, In Veda's Words,
   Kind words, and the About page (whose coloured sections are restored
   below). The menu-open header keeps its own (orange) styling. */
:root[data-theme="dark"]:not(.menu-open) .site-header,
:root[data-theme="dark"] :is(.first-screen, .about, .kind-words, .studio) {
  --ink-rgb: var(--dark-ink);
  --paper-rgb: 23, 22, 20;
  --color-neutral-charcoal: rgb(var(--dark-ink));
  --color-brand-warm-ivory: var(--dark-page);
  --color-brand-forest-green: #8DBB98;          /* lifted for the dark page */
  --color-text-primary: rgb(var(--dark-ink));
  --color-button-secondary-text: rgb(var(--dark-ink));
  --color-button-secondary-border: rgba(238, 232, 220, 0.55);
  color: rgb(var(--dark-ink));
}

/* About page sections that already have a brand colour keep it */
:root[data-theme="dark"] .studio :is(.stall, .process) {
  --ink-rgb: 46, 46, 43;
  --paper-rgb: 248, 245, 236;
  --color-neutral-charcoal: #2E2E2B;
  --color-brand-warm-ivory: #F8F5EC;
  --color-brand-forest-green: #2F5D3A;
  --color-text-primary: #2E2E2B;
}

:root[data-theme="dark"] .studio .process {
  background: #2F5D3A;
  color: #F8F5EC;
}

/* the page itself */
:root[data-theme="dark"] body,
:root[data-theme="dark"] .studio {
  background-color: var(--dark-page);
}

/* header bar: a dark glass strip instead of ivory */
:root[data-theme="dark"]:not(.menu-open) .site-header {
  background-color: var(--dark-page);
  border-bottom-color: rgba(238, 232, 220, 0.1);
}

/* ---------- Artwork and images ---------- */

/* Pen & ink drawings drawn as ink only (transparent paper): the ink
   turns ivory so the drawing reads like chalk on the dark page */
:root[data-theme="dark"] .practice-photo--cutout img[src*="ink"] {
  filter: invert(1) sepia(0.12) brightness(0.96);
}

/* Monogram circles in Kind words keep brand green with ivory letters */
:root[data-theme="dark"] .kw-mono {
  background: #2F5D3A;
  color: #F8F5EC;
}

/* the frame mats behind the In Veda's Words pills keep their brand colours */
:root[data-theme="dark"] .about__thumb--mandala img { background: #2F5D3A; }

/* the hero mandala plate keeps its own charcoal, lifted a touch off the page */
:root[data-theme="dark"] .mandala--art .plate,
:root[data-theme="dark"] .mandala--art circle[fill="#2E2E2B"] {
  fill: #23221F;
}

/* About intro: the dark peepal leaf gets a soft ivory rim so it doesn't
   sink into the page */
:root[data-theme="dark"] .icv {
  filter: drop-shadow(0 0 1px rgba(238, 232, 220, 0.35));
}


/* ---------- Light / dark switch (top navigation) ---------- */

.theme-toggle {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(var(--ink-rgb, 46, 46, 43), 0.85);
  border-radius: 50%;
  background: transparent;
  color: var(--color-neutral-charcoal);
  cursor: pointer;
  transition: background-color 250ms ease, color 250ms ease, border-color 250ms ease;
}

.theme-toggle:hover {
  background: var(--color-neutral-charcoal);
  color: var(--color-brand-warm-ivory);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--color-brand-burnt-orange);
  outline-offset: 3px;
}

.theme-toggle svg {
  grid-area: 1 / 1;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 300ms ease, transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* light mode shows the moon (switch to dark); dark mode shows the sun */
.theme-toggle .sun { opacity: 0; transform: rotate(-60deg) scale(0.6); }
:root[data-theme="dark"] .theme-toggle .sun { opacity: 1; transform: none; }
:root[data-theme="dark"] .theme-toggle .moon { opacity: 0; transform: rotate(60deg) scale(0.6); }

/* over the open (orange) menu the switch steps aside, like the clock */
html.menu-open .theme-toggle {
  opacity: 0;
  visibility: hidden;
}

@media (max-width: 768px) {
  .theme-toggle { width: 40px; height: 40px; }
}

/* quick cross-fade when switching (js/theme.js, View Transitions) */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 260ms;
  animation-timing-function: ease;
}

/* ---------- Background layout templates: quieter in dark mode ---------- */
:root[data-theme="dark"] .mandala--template { opacity: 0.45; }
:root[data-theme="dark"] .hero-burst { opacity: 0.35; }
:root[data-theme="dark"] .intro-mandala { opacity: 0.05; }
:root[data-theme="dark"] .art-bg { opacity: 0.05; }
:root[data-theme="dark"] .show-alt .mandala--template { opacity: 0; }
