:root[data-theme=light] {
  --mode-bg: #f4f3ef;
  --mode-ink: #231d28;
  --mode-active: #674b9a;
  --mode-line: #67577555;
}
:root[data-theme=dark] {
  color-scheme: dark;
  --mode-bg: #211c28;
  --mode-ink: #f2edf4;
  --mode-active: #d4b8ff;
  --mode-line: #c7b6d34d;
}

html[data-theme] body .frame-top {
  --frame-fg: var(--mode-ink);
  --frame-active: var(--mode-active);
  --frame-line: var(--mode-line);
  background: color-mix(in srgb, var(--mode-bg) 95%, transparent);
  box-shadow: inset 0 0 0 1px var(--mode-line);
}
html[data-theme] .frame-top .menu-toggle:is(:hover,:focus-visible) { color: var(--mode-bg); }
html[data-theme] .frame-top .scroll-meter::before {
  background: color-mix(in srgb, var(--mode-active) 13%, transparent);
  border-color: var(--mode-line);
  box-shadow: inset 0 -2px var(--mode-line);
}
html[data-theme] body[data-art-chrome] {
  --frame-fg: var(--mode-ink);
  --frame-active: var(--mode-active);
  --frame-line: var(--mode-line);
  --frame-glass: transparent;
}
html[data-theme] body[data-art-chrome] .frame-top {
  background: transparent;
  box-shadow: none;
  border-bottom-color: var(--mode-line);
}
html[data-theme] body[data-art-chrome] .frame-rail {
  background: transparent;
  color: var(--mode-ink);
}
html[data-theme] body[data-art-chrome] .frame-top .scroll-meter::before {
  background: transparent;
  border-right-color: color-mix(in srgb, var(--mode-active) 50%, transparent);
  box-shadow: inset 0 -2px var(--mode-active);
}
[data-theme=dark] body[data-art-chrome] :is(.frame-top a, .frame-top .access-link) {
  text-shadow: 0 1px 6px #090612d9;
}
[data-theme=light] body[data-art-chrome] :is(.frame-top a, .frame-top .access-link) {
  text-shadow: 0 1px 6px #faf8f4eb;
}
[data-theme=dark] body[data-art-chrome] :is(.rail-logo, .audio-toggle, .menu-toggle:not(:hover,:focus-visible) span) {
  filter: drop-shadow(0 1px 4px #090612c9);
}
[data-theme=light] body[data-art-chrome] :is(.rail-logo, .audio-toggle, .menu-toggle:not(:hover,:focus-visible) span) {
  filter: drop-shadow(0 1px 4px #faf8f4e0);
}
[data-theme=light][data-plate-frame] .arrival-stage:has(.hero[data-dust]) {
  background-color: var(--mode-bg);
}
[data-theme=dark][data-plate-frame] .arrival-stage:has(.hero[data-dust]) {
  background-color: var(--mode-bg);
}
[data-theme=light][data-plate-frame] :is(.arrival-stage::after, .project-stage::after) {
  color: #231d28cc;
  text-shadow: 0 1px 3px #faf8f4e6;
}
[data-theme=light][data-plate-frame] :is(.arrival-stage::before, .project-stage::before) {
  border-color: #231d2836;
  box-shadow: 0 32px 96px #1e152c42, 0 0 60px #ffffff45;
}
[data-theme=light] .project-stage {
  background: radial-gradient(ellipse at center, #ede8f3, #ddd4e6 80%);
}
.access-link {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-inline: clamp(14px, 1.35vw, 22px);
  font-family: inherit;
  text-transform: inherit;
  transition: color .22s ease;
}
.access-link::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--mode-active, #d4b8ff) 16%, transparent));
  box-shadow: inset 0 -2px color-mix(in srgb, var(--mode-active, #d4b8ff) 70%, transparent);
  opacity: 0;
  transition: opacity .25s ease;
}
.access-link:is(:hover,:focus-visible) {
  color: var(--frame-active, #d4b8ff);
}
.access-link:is(:hover,:focus-visible)::before { opacity: 1; }
.access-link:focus-visible { outline-offset: -3px; }
.theme-disc {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
  width: 2.35em;
  height: 1.28em;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #d4b8ffa6;
  background:
    radial-gradient(circle at 68% 34%, #ffffff 0 1px, transparent 1.45px),
    radial-gradient(circle at 80% 64%, #7bffca 0 .9px, transparent 1.45px),
    radial-gradient(circle at 57% 72%, #e7d8ff 0 .8px, transparent 1.35px),
    linear-gradient(115deg, #161028 0%, #2d1f4d 58%, #4d3373 100%);
  box-shadow: inset 0 1px 3px #090512cc, 0 0 6px #b5a5e126;
  transition: border-color .25s ease, box-shadow .25s ease, transform .22s var(--ease-settle);
}
[data-theme=light] .theme-disc {
  border-color: #674b9a73;
  background:
    radial-gradient(circle at 28% 72%, #ffffffd9 0 22%, transparent 56%),
    linear-gradient(115deg, #7fb9ff 0%, #c6e0ff 46%, #ffe0ad 82%, #ffb668 100%);
  box-shadow: inset 0 1px 2px #3b285c2b, 0 0 6px #ffbe7333;
}
.theme-disc::before {
  content: "";
  position: absolute;
  inset: -40% -30%;
  pointer-events: none;
  background: linear-gradient(108deg, transparent 34%, #ffffff66 50%, transparent 66%);
  transform: translateX(-115%);
}
.theme-disc::after {
  content: "";
  position: absolute;
  top: 50%;
  left: .15em;
  width: .86em;
  height: .86em;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #ffffff 0%, #f1e6ff 42%, #c19eff 76%, #7c58c9 100%);
  box-shadow: 0 0 8px #d4b8ffe6, inset -1px -1px 2px #4026788c;
  transform: translate(0, -50%);
  transition: transform .34s var(--ease-settle), left .34s var(--ease-settle), box-shadow .25s ease, background .25s ease;
}
[data-theme=light] .theme-disc::after {
  left: calc(100% - 1.01em);
  background: radial-gradient(circle at 34% 30%, #ffffff 0%, #fff4c9 44%, #ffc05c 82%, #dc7c24 100%);
  box-shadow: 0 0 8px #ffba4ee6, inset -1px -1px 2px #ad561259;
  transform: translate(0, -50%);
}
.access-link:is(:hover,:focus-visible) .theme-disc {
  border-color: #f0e4ff;
  box-shadow: inset 0 1px 3px #090512cc, 0 0 16px #d4b8ff99;
}
[data-theme=light] .access-link:is(:hover,:focus-visible) .theme-disc {
  border-color: #674b9acc;
  box-shadow: inset 0 1px 2px #3b285c2b, 0 0 16px #ffae4780;
}
.access-link:is(:hover,:focus-visible) .theme-disc::after {
  transform: translate(.38em, -50%) scale(1.08);
  background: radial-gradient(circle at 32% 30%, #ffffff 0%, #fff2d6 45%, #e7c0ff 82%, #9a74e0 100%);
  box-shadow: 0 0 11px #ffe7b8f0, inset -1px -1px 2px #40267873;
}
[data-theme=light] .access-link:is(:hover,:focus-visible) .theme-disc::after {
  transform: translate(-.38em, -50%) scale(1.08);
  box-shadow: 0 0 11px #ffb443f2, inset -1px -1px 2px #ad561259;
}
.access-link:active .theme-disc { transform: scale(.93); }
@media (prefers-reduced-motion: no-preference) {
  .theme-disc::before { animation: theme-glint 7.5s ease-in-out infinite; }
  .access-link:is(:hover,:focus-visible) .theme-disc::before { animation: none; transform: translateX(115%); transition: transform .55s var(--ease-enter); }
  @keyframes theme-glint {
    0%, 78% { transform: translateX(-115%); opacity: 0; }
    83% { opacity: 1; }
    96%, 100% { transform: translateX(115%); opacity: 0; }
  }
}
@media (max-width: 640px) {
  .access-link { padding-inline: 11px; }
}
@media (max-width: 540px) {
  .access-link { min-width: 54px; padding-inline: 8px; }
  .theme-disc { width: 38px; height: 21px; }
  .theme-disc::after { left: 3px; width: 14px; height: 14px; }
  [data-theme=light] .theme-disc::after { left: calc(100% - 17px); }
  .access-link:is(:hover,:focus-visible) .theme-disc::after { transform: translate(5px, -50%) scale(1.06); }
  [data-theme=light] .access-link:is(:hover,:focus-visible) .theme-disc::after { transform: translate(-5px, -50%) scale(1.06); }
  .theme-label { display: none; }
}
@media (max-width: 360px) {
  #chapter-nav:has([data-anchor="aim"]) { gap: 4px; }
  #chapter-nav:has([data-anchor="aim"]) a { font-size: 8.5px; letter-spacing: 0; }
}

body { background: var(--mode-bg, var(--paper)); color: var(--mode-ink, var(--ink)); }
[data-theme=dark] :is(.arrival-stage, .intro) { background-color: var(--mode-bg); }
[data-theme=dark] .intro {
  --intro-ink: #f4eff8;
  --intro-muted: #c2b6ce;
  --intro-faint: #9588a4;
  --intro-line: #c7b6d32e;
  --intro-line-strong: #c7b6d35a;
  --intro-accent: #d4b8ff;
  --intro-signal: #7bffca;
  --intro-wash: #d4b8ff1a;
  --intro-wash-ink: #ffffff;
}
[data-theme=dark] .folder-backdrop { background: radial-gradient(ellipse 84% 76% at 50% 48%, #2e2046 0%, #160f23 66%, #09060f 100%); }
[data-theme=light] .folder-backdrop { background: radial-gradient(ellipse 84% 76% at 50% 48%, #291f3b 0%, #1a1328 66%, #110c1c 100%); }
[data-theme=dark] .intro-info { border-color: var(--intro-line); }
[data-theme=dark] .collection-section { background: #3b314d; }
[data-theme=dark] .stage-watermark { -webkit-text-stroke-color: #d4b8ff1a; }
[data-theme=dark] .theme-plea {
  border-color: #d4b8ff38;
  background: linear-gradient(155deg, #1b1429cc 0%, #2a203e9c 100%);
  box-shadow: 0 24px 54px -26px #070410b0, inset 0 1px 0 #d4b8ff29;
}
[data-theme=dark] .theme-plea:hover,
[data-theme=dark] .theme-plea:focus-within {
  border-color: #d4b8ff6b;
  box-shadow: 0 28px 58px -24px #070410cc, inset 0 1px 0 #d4b8ff40;
}
[data-theme=dark] .theme-plea-head { border-bottom-color: #d4b8ff26; }
[data-theme=dark] .theme-plea-kicker i { background: #7bffca; box-shadow: 0 0 0 3px #7bffca2b, 0 0 8px #7bffca99; }
[data-theme=dark] .theme-plea-mode { border-color: #d4b8ff33; color: #e8dbf8; }
[data-theme=dark] .theme-plea-mode .mode-dark { display: inline; }
[data-theme=dark] .theme-plea-mode .mode-light { display: none; }
[data-theme=dark] .theme-plea-copy { color: #dfd4ea; }
[data-theme=dark] .theme-plea-btn { border-color: #f4effa; background: #f4effa; color: #1b1526; }
[data-theme=dark] .theme-plea-btn:is(:hover,:focus-visible) { box-shadow: 0 12px 28px -10px #d4b8ff85; }
.theme-plea-btn:is(:hover,:focus-visible) .theme-disc {
  border-color: #f0e4ff;
  box-shadow: inset 0 1px 3px #090512cc, 0 0 14px #d4b8ff99;
}
[data-theme=light] .theme-plea-btn:is(:hover,:focus-visible) .theme-disc {
  border-color: #ffcf87cc;
  box-shadow: inset 0 1px 2px #3b285c2b, 0 0 14px #ffae4799;
}
.theme-plea-btn:is(:hover,:focus-visible) .theme-disc::after {
  transform: translate(.38em, -50%) scale(1.08);
}
[data-theme=light] .theme-plea-btn:is(:hover,:focus-visible) .theme-disc::after {
  transform: translate(-.38em, -50%) scale(1.08);
}
.access-link.is-beckoning { color: var(--frame-active, #d4b8ff); }
.access-link.is-beckoning::before { opacity: 1; }
.access-link.is-beckoning .theme-disc {
  border-color: #f0e4ff;
  box-shadow: inset 0 1px 3px #090512cc, 0 0 16px #d4b8ffb8;
  transform: scale(1.08);
}
[data-theme=light] .access-link.is-beckoning .theme-disc {
  border-color: #674b9acc;
  box-shadow: inset 0 1px 2px #3b285c2b, 0 0 16px #ffae47a6;
}
[data-theme=dark] .interior { --ink: var(--mode-ink); --paper: var(--mode-bg); }
[data-theme=dark] .interior .filter { border-color: var(--mode-line); }
[data-theme=dark] .gallery-status { color: #cec2d8; }
[data-theme=dark] .about-hero { --paper: #211c28; --ink: #f2edf4; --dusk: #40374b; }
[data-theme=dark] .about-intro { color: var(--mode-ink); background: linear-gradient(#40374b, #312838 55%, #19171c); }
[data-theme=dark] .about-portrait::before {
  background:
    radial-gradient(ellipse 44% 32% at 24% 15%, color-mix(in srgb, var(--spire) 20%, transparent), transparent 72%),
    radial-gradient(ellipse 58% 62% at 54% 48%, rgba(212, 184, 255, .14), transparent 74%);
}
[data-theme=dark] .about-portrait::after {
  background:
    radial-gradient(ellipse 52% 48% at 44% 58%, color-mix(in srgb, var(--spire) 26%, transparent), transparent 72%),
    radial-gradient(ellipse 68% 46% at 50% 62%, rgba(9, 6, 15, .58), transparent 74%);
}
[data-theme=dark] .about-portrait img {
  filter: drop-shadow(0 26px 40px rgba(9, 6, 15, .58)) drop-shadow(0 0 24px color-mix(in srgb, var(--spire) 16%, transparent));
}
[data-theme=dark] .about-falls { opacity: .22; }
[data-theme=dark] .about-hero-type .section-code { border-color: var(--mode-line); }
[data-theme=dark] body[data-tone=light] {
  --frame-fg: var(--mode-ink);
  --frame-line: var(--mode-line);
  --frame-glass: #211c28e0;
}
[data-theme=light] body[data-tone=dark-page] .frame-rail {
  color: var(--mode-ink);
  background: #f4f3efe6;
}
[data-theme=dark] .collection-section .read-link:hover { background: var(--mode-ink); color: var(--mode-bg); }

[data-theme=light] :is(.atlas-page, .nav-dialog) {
  --nav-paper: #2c2431;
  --nav-lilac: #715789;
  --nav-muted: #605367;
  --nav-line: #c7bbc9;
  --survey-mint: #326747;
  color-scheme: light;
  background: radial-gradient(ellipse at 66% 10%, #e6dfe9, transparent 44rem), var(--mode-bg);
}
[data-theme=light] :is(.survey-intro p, .projects-intro p, .project-card-summary, .article-prose) { color: #4d4352; }
[data-theme=light] :is(.survey-entry, .nav-list-link)::before { background: #ddcfe7; }
[data-theme=light] .survey-index .filter[aria-pressed=true],
[data-theme=light] .survey-index .filter:is(:hover,:focus-visible) { color: white; }
[data-theme=light] .survey-figure figcaption { color: var(--nav-muted); }
[data-theme=light] .project-card {
  background: linear-gradient(165deg, #ffffff 0%, #f7f4f9 100%);
  box-shadow: 0 8px 24px -16px #3a2b4a33;
}
[data-theme=light] .project-card:is(:hover,:focus-visible) {
  border-color: var(--survey-mint);
  box-shadow: 0 18px 36px -18px #2e203e40, 0 0 0 1px color-mix(in srgb, var(--survey-mint) 25%, transparent);
}
[data-theme=light] .project-card-media::after {
  background: linear-gradient(180deg, #120d1a38 0%, transparent 32%, transparent 72%, #0e0a1438 100%);
}
[data-theme=light] .project-card:is(:hover,:focus-visible) .project-card-launch { color: #ffffff; }
[data-theme=light] .project-card-tags li {
  background: #efeaf3;
  color: #4f425a;
}
[data-theme=light] .nav-dialog :focus-visible { outline-color: #705591; }
[data-theme=light] #footer { background: var(--mode-bg); color: var(--mode-ink); }
[data-theme=light] #footer :is(.section-code, .footer-bottom, .footer-grid h2) { color: #5c5165; border-color: var(--mode-line); }
[data-theme=light] #footer .mz7x {
  --mz7x-ink: var(--mode-ink);
  --mz7x-accent: var(--mode-active);
  --mz7x-faint: #756a7a;
  --mz7x-hair: var(--mode-line);
  border-color: var(--mode-line);
}

.appearance {
  --daylight: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: #120d1d;
  color: #261e30;
}
[data-theme=dark] .appearance { --daylight: 0; }
[data-theme=dark] .appearance:not([data-room-tone]), .appearance[data-room-tone=dark] { color: #f2edf4; }
.appearance::backdrop { background: #120d1d; backdrop-filter: none; }
.appearance-page {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: radial-gradient(ellipse at 50% 43%,
    color-mix(in srgb, #faf7f2 calc(var(--daylight) * 100%), #2c2044),
    color-mix(in srgb, #e5dde9 calc(var(--daylight) * 100%), #0d0917));
}
.appearance-back { font: 500 .875rem/1.4 var(--ui); }
.appearance-back { display: flex; gap: .6em; align-items: center; justify-self: start; min-height: 44px; }
.appearance-back span { font-size: 1.2em; }
.appearance-back:hover { text-decoration: underline; text-underline-offset: .2em; }
.appearance-stage { display: grid; align-content: center; justify-items: center; gap: clamp(22px,5vh,48px); }
.room-switch {
  width: min(86vw, 720px, max(190px, (100dvh - 200px) * 1.8));
  position: relative;
  isolation: isolate;
  border-radius: 999px;
  padding: 0;
  background: linear-gradient(165deg, #4b3a69, #261c38 45%, #110c1c);
  box-shadow: inset 0 2px 2px #c8b6ff3d, inset 0 -4px 7px #0009, 0 30px 66px -24px #0c0718aa;
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.room-switch:active { cursor: grabbing; }
.room-switch::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(165deg, #fff, #f4eff6 42%, #ddd3e3);
  border-radius: inherit;
  box-shadow: inset 0 2px 2px #fff, inset 0 -4px 7px #5d4c7340, -12px -12px 36px #fffb;
  opacity: var(--daylight);
}
.room-switch:focus-visible { outline: 2px solid currentColor; outline-offset: 8px; }
.room-well {
  position: relative;
  display: block;
  aspect-ratio: 216 / 112;
  margin: 3.6%;
  overflow: hidden;
  border-radius: inherit;
  background: center / cover url(../pixel-switch/light.webp);
}
[data-theme=dark] .room-well { background-image: url(../pixel-switch/dark.webp); }
.room-well canvas { display: block; width: 100%; height: 100%; }
.room-well::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 2px 5px #0007; }
.appearance-mode { font: 600 .85rem/1.4 var(--ui); letter-spacing: .2em; text-transform: uppercase; }
