/* Deep-night tokens: original light declarations keep their exact fallbacks. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #d7e1db;
  --forest: #bad79f;
  --muted: #a5b5ac;
  --paper: #101915;
  --line: #3e5149;
  --lime: #bad79f;
  --night-ink: #d7e1db;
  --night-body: #c8d2cb;
  --night-muted: #a5b5ac;
  --night-accent: #bad79f;
  --night-header: #101915;
  --night-surface: #17231d;
  --night-soft: #203229;
  --night-warm: #292820;
  --night-solid: #254332;
  --night-hover: #2c4938;
  --night-line: #3e5149;
  --night-focus: #c4dda9;
  --night-art: linear-gradient(135deg, #243b2d, #1c2d25);
}
/* Script disabled/blocked: still respect the operating system, with no dead UI. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --ink: #d7e1db;
    --forest: #bad79f;
    --muted: #a5b5ac;
    --paper: #101915;
    --line: #3e5149;
    --lime: #bad79f;
    --night-ink: #d7e1db;
    --night-body: #c8d2cb;
    --night-muted: #a5b5ac;
    --night-accent: #bad79f;
    --night-header: #101915;
    --night-surface: #17231d;
    --night-soft: #203229;
    --night-warm: #292820;
    --night-solid: #254332;
    --night-hover: #2c4938;
    --night-line: #3e5149;
    --night-focus: #c4dda9;
    --night-art: linear-gradient(135deg, #243b2d, #1c2d25);
  }
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.theme-picker { display: none; position: relative; flex: none; }
:root[data-theme-ready="true"] .theme-picker { display: block; }
.theme-picker summary {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #738777;
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  list-style: none;
}
.theme-picker summary::-webkit-details-marker { display: none; }
.theme-picker summary:hover,
.theme-picker[open] summary { background: var(--night-soft, #e7efdf); }
.theme-options {
  position: absolute;
  z-index: 30;
  top: calc(100% + 10px);
  right: 0;
  width: 180px;
  padding: 8px;
  border: 1px solid #738777;
  border-radius: 14px;
  background: var(--night-surface, #f7f8f4);
  color: var(--ink);
  box-shadow: 0 12px 32px rgb(0 0 0 / 16%);
}
.theme-options p { margin: 4px 10px 6px; color: var(--muted); font-size: 12px; }
.theme-options button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.theme-options button:hover { background: var(--night-soft, #e7efdf); }
.theme-options button[aria-pressed="true"] {
  background: var(--night-soft, #e7efdf);
  font-weight: 700;
}
.theme-options button span { visibility: hidden; }
.theme-options button[aria-pressed="true"] span { visibility: visible; }
.article-content :not(pre) > code {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--night-soft, #edf0e8);
  overflow-wrap: anywhere;
}
.article-content a { color: var(--forest); text-underline-offset: 3px; }
.article-content hr { border: 0; border-top: 1px solid var(--line); margin-block: 32px; }
/* No inversion, opacity or brightness filters on photographs, screenshots or QR. */
@media (max-width: 800px) {
  .nav-shell > .brand { max-width: calc(100% - 60px); }
  .theme-picker { order: 2; margin-left: auto; margin-bottom: 12px; }
  .home-page .theme-picker { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-picker *, .theme-picker *::before, .theme-picker *::after { transition: none; }
}
