:root { color-scheme: light; }
/* Only deliberate theme changes fade; page loads retain their instant palette.
   Keep the cursor and page-entry animations on their own transition timings. */
@media (prefers-reduced-motion: no-preference) {
  html.theme-transitioning,
  html.theme-transitioning body,
  html.theme-transitioning body :not(.cursor):not(.cursor *):not(.fade-in-item):not(.site-controls):not(.site-controls *),
  html.theme-transitioning dialog::backdrop {
    transition: background-color 650ms cubic-bezier(.4, 0, .2, 1),
      color 500ms cubic-bezier(.4, 0, .2, 1),
      border-color 600ms cubic-bezier(.4, 0, .2, 1),
      box-shadow 650ms ease, fill 500ms ease, stroke 500ms ease !important;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --theme-bg: #171819;
  --theme-surface: #1e2021;
  --theme-soft: #252729;
  --theme-text: #e3e2df;
  --theme-muted: #b5b4b0;
  --theme-faint: #989995;
  --theme-line: #353739;
  --theme-rule: #575a5c;
  --theme-selected: #30271f;
  --theme-selected-line: #60452e;
  --theme-backdrop: rgb(12 13 14 / 68%);
  --bk-ink: #e3e2df;
  --bk-muted: #b5b4b0;
  --bk-faint: #989995;
  --bk-hairline: #353739;
  --bk-rule: #575a5c;
}
html[data-theme] { background: var(--theme-bg, #fff); }
html[data-theme] body { background-color: var(--theme-bg, #fff); color: var(--theme-text, #202020); }
.theme-toggle svg {
  transition: opacity 180ms ease, transform 250ms ease;
}
.theme-toggle .theme-sun { opacity: 0; transform: rotate(-45deg) scale(.8); }
.theme-toggle .theme-moon { opacity: 1; transform: none; }
[data-theme="dark"] .theme-toggle .theme-moon { opacity: 0; transform: rotate(45deg) scale(.8); }
[data-theme="dark"] .theme-toggle .theme-sun { opacity: 1; transform: none; }
[data-theme="dark"] .command-menu::backdrop,
[data-theme="dark"] .bk-detail::backdrop { background: var(--theme-backdrop); }
[data-theme="dark"] .shortcuts-overlay { background: var(--theme-backdrop); }
[data-theme="dark"] .command-result[aria-selected="true"] { background: var(--theme-selected); border-color: var(--theme-selected-line); }
[data-theme="dark"] .command-menu .command-search:focus { border-bottom-color: #87603e; }
[data-theme="dark"] .command-preview-label, [data-theme="dark"] .command-arrow { color: #d6a078; }
[data-theme="dark"] .command-preview blockquote { border-left-color: #60452e; }
[data-theme="dark"] .search-destination { outline-color: #a86b3c; }
[data-theme="dark"] .cursor-glyph { color: #ffc38e; }
[data-theme="dark"] .cursor-mark { stroke: #ffb278; }
[data-theme="dark"] .cursor[data-mode="lens"] .cursor-mark { filter: drop-shadow(0 0 1px rgba(0,0,0,.65)); }
[data-theme="dark"] .ascii-art-root {
  --ascii-bg: #171819; --ascii-fg: #e3e2df; --ascii-muted: #b5b4b0;
  --ascii-panel: #1e2021; --ascii-panel-soft: #252729; --ascii-border: #353739;
}
[data-theme="dark"] .lightbox { background: rgb(12 13 14 / 88%); }
[data-theme="dark"] .ascii-art-root .canvas-resize-handle { background: var(--theme-soft); }
[data-theme="dark"] .ascii-art-root :is(.upload-area, .control-group, input, select) { border-color: var(--theme-line); }
[data-theme="dark"] .project-description { color: var(--theme-muted); }
[data-theme="dark"] .project-card { border-color: var(--theme-line); }
[data-theme="dark"] .project-status.active { color: #6ed997; }
[data-theme="dark"] .project-status.planned { color: #f3bd66; }
[data-theme="dark"] .project-status.inactive { color: #f98b8b; }
[data-theme="dark"] .project-status.wishlist { color: #bb9bf5; }
[data-theme="dark"] .writing-content :is(code, pre, th) { background-color: var(--theme-soft); }
@media (max-width: 400px) {
  .nav-menu { max-width: calc(100vw - 65px); flex-wrap: wrap; }
}
