:root {
  --secondary: #4f4f49;
  --intro-text: #44443f;
}
:root[data-theme="light"] { color-scheme: light; }

/* Explicit appearance wins over the operating system setting. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #191a18;
  --surface: #242522;
  --text: #e9e9e3;
  --muted: #aaa9a1;
  --line: #393a35;
  --secondary: #c2c2b9;
  --intro-text: #cecec6;
  --link: #91c4eb;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #191a18;
    --surface: #242522;
    --text: #e9e9e3;
    --muted: #aaa9a1;
    --line: #393a35;
    --secondary: #c2c2b9;
    --intro-text: #cecec6;
    --link: #91c4eb;
  }
}

.lede { color: var(--intro-text); }
.work-item__body p, .feature-list span, .quiet-page p { color: var(--secondary); }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted, #72726d);
  cursor: pointer;
  align-self: center;
}
.theme-toggle:hover { color: var(--text, #1b1b18); background: var(--surface, #f6f6f3); }
.theme-toggle__icon {
  display: block;
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url('/assets/remixicon/moon-line.svg') center / contain no-repeat;
  mask: url('/assets/remixicon/moon-line.svg') center / contain no-repeat;
}
:root[data-theme="dark"] .theme-toggle__icon {
  -webkit-mask-image: url('/assets/remixicon/sun-line.svg');
  mask-image: url('/assets/remixicon/sun-line.svg');
}
.theme-toggle:focus-visible { outline: 2px solid var(--link, #246fa8); outline-offset: 3px; }
.footer-row { align-items: center; }
.theme-footer { max-width: 720px; margin: 32px auto; padding: 0 24px; font-size: 14px; }
.footer-row, .nav, .nav__links { flex-wrap: wrap; }
.nav__brand { white-space: nowrap; }
@media (max-width: 640px) {
  .footer-row { align-items: flex-start; }
  .footer-row .theme-toggle { align-self: flex-start; margin-top: 8px; }
}

:root[data-theme="dark"] body[data-accent="dawnary"] { --link: #e5b77f; }
:root[data-theme="dark"] body[data-accent="filefacet"] { --link: #8cbfff; }
:root[data-theme="dark"] body[data-accent="assetly"] { --link: #bab3ff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body[data-accent="dawnary"] { --link: #e5b77f; }
  :root:not([data-theme="light"]) body[data-accent="filefacet"] { --link: #8cbfff; }
  :root:not([data-theme="light"]) body[data-accent="assetly"] { --link: #bab3ff; }
}

/* Legacy support and policy pages keep their document layout. */
:root[data-theme="dark"] body { background-color: var(--background); color: var(--text); }
:root[data-theme="dark"] .container { background: var(--surface); color: var(--text); box-shadow: none; }
:root[data-theme="dark"] .container :is(h1,h2,h3,p,li,strong),
:root[data-theme="dark"] .markdown-body { color: var(--text); }
:root[data-theme="dark"] :is(.contact-info, .highlight) { background: var(--background); }
:root[data-theme="dark"] .container a { color: var(--link) !important; }
:root[data-theme="dark"] .markdown-body :is(h1,h2,blockquote,hr) { border-color: var(--line); }
:root[data-theme="dark"] .markdown-body a { color: var(--link); }
