/* Automatic dark theme. Loaded after styles.css and guides.css; light mode is untouched. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --cream: #0c1613;
    --ink: #e9f1e9;
    --green: #2f6b52;
    --muted: #b7c9bc;
    --line: #2b4339;
    --white: #12231d;
    --mint: #1b332b;
    --focus: #e6b96e;
  }
  html, body { background: #0c1613; color: #e9f1e9; }
  h1, h2, h3, h4, strong, th, summary { color: #e9f1e9; }
  p, li, dd, figcaption { color: #b7c9bc; }
  a { color: inherit; }
  .skip { background: #12231d; color: #e9f1e9; }
  .header { background: #0c1613f2; border-bottom-color: #2b4339; }
  .brand small, .kicker, .eyebrow, .light { color: #a9c9a8; }
  nav { background: #0c1613; }
  nav a { color: #e9f1e9; }
  .menu span { background: #e9f1e9; }
  .nav-backdrop { background: #000b; }
  .btn-primary { background: #2f6b52; color: #fff; }
  .btn-primary:hover { background: #3c8063; }
  .btn-outline { border-color: #587566; color: #e9f1e9; }
  .btn-outline:hover { background: #1b332b; }
  .btn-light { background: #d9e7d1; color: #173b30; }
  :focus-visible { outline-color: #e6b96e; }
  .hero { background: #08231e; }
  .hero-copy > p { color: #dbe7dc; }
  .hero .btn-outline { border-color: #6f8f7e; color: #f1f7f1; }
  .hero .btn-outline:hover { background: #173a30; }
  .hero .hero-note { color: #c2d3c6; }
  .cover-card { background: #12231d; border-color: #2b4339; }
  .cover-image { background: #172d25; }
  .tag { background: #12231de6; color: #cfe3c8; }
  .text-link { color: #a9c9a8; }
  .card-copy p, .footnote { color: #b7c9bc; }
  .filter-group { background: #12231d; }
  .filter-group button { color: #d7e5d6; border-color: #355044; }
  .filter-group button[aria-pressed="true"] { background: #203a30; border-color: #4c7a63; color: #fff; }
  .studio-section { background: #0f1f1a; color: #e9f1e9; }
  .studio-panel { background: #12231d; border-color: #2b4339; color: #e9f1e9; }
  .preview { background: #0f1b17; border-color: #2b4339; }
  .preview-caption { color: #b7c9bc; }
  .view-switch { background: #12231d; border-color: #2b4339; }
  .view-switch button { background: transparent; color: #e9f1e9; border-color: transparent; }
  .view-switch button[aria-pressed="true"] { background: #203a30; border-color: #4c7a63; }
  .control-title, .control-title strong, label, .swatch-row { color: #cfe0d2; }
  input, select, textarea { background: #0f1b17; color: #e9f1e9; border-color: #355044; }
  .swatch { border-color: #12231d; }
  .panel-bottom { border-color: #2b4339; }
  .warning { background: #3a2c1d; color: #f1d9b3; }
  .compare-section { background: #0f1f1a; }
  .comparison { background: #12231d; border-color: #2b4339; }
  th, td { border-color: #2b4339; }
  thead th { background: #172d25; color: #e9f1e9; }
  tbody th { color: #e9f1e9; }
  td { color: #b7c9bc; }
  .pro { background: #12231d; color: #e9f1e9; }
  .pro-copy p, .pro-copy small { color: #b7c9bc; }
  .faq-items, .faq-items details, .faq-items summary, .guide-evidence { border-color: #2b4339; }
  .learning-grid a { background: #12231d; border-color: #2b4339; color: #e9f1e9; }
  .learning-grid a:hover { background: #1b332b; }
  .learning-grid a span { color: #a9c9a8; }
  .learning-grid a small { color: #b7c9bc; }
  footer { background: #08120f; color: #e9f1e9; }
  .footer-grid p, .footer-bottom { color: #b7c9bc; }
  .footer-grid .text-link, .footer-brand .dot { color: #a9c9a8; }
  .footer-bottom { border-color: #2b4339; }
  dialog { background: #12231d; color: #e9f1e9; border-color: #2b4339; }
  dialog::backdrop { background: #000b; }
  .dialog-summary, .privacy-banner { background: #1b332b; color: #d7e5d6; }
  .brief-preview { border-color: #2b4339; }
  .brief-preview pre { background: #0f1b17; color: #e9f1e9; }
  .close { background: #203a30; color: #e9f1e9; }
  .guide-nav { background: #0c1613; border-color: #2b4339; }
  .guide-nav a:last-child { color: #a9c9a8; }
  .guide-main { color: #e9f1e9; }
  .guide-main nav { color: #b7c9bc; }
  .guide-lead { color: #d7e5d6; }
  .guide-footer { background: #08120f; color: #b7c9bc; }
  .guide-links a { color: #a9c9a8; }
  .agent-main { color: #e9f1e9; }
  .endpoint-table { background: #12231d; border-color: #2b4339; }
  .endpoint-table caption { background: #172d25; color: #b7c9bc; border-color: #2b4339; }
  .endpoint-table th, .endpoint-table td { border-color: #2b4339; }
  .endpoint-table thead th { background: #203a30; color: #d7e5d6; }
  .endpoint-table tbody th { color: #e9f1e9; }
  .endpoint-table a { color: #a9c9a8; }
  .agent-prompt, .agent-fallback { background: #0f1b17; border-color: #355044; color: #e9f1e9; }
  .agent-main code { background: #1b332b; border-color: #355044; color: #e9f1e9; }
}

@media (prefers-contrast: more) {
  p, li, dd, td, .card-copy p, .footnote { color: #2f4038; }
  .btn-outline { border-width: 2px; }
  a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline-width: 4px; }
}

@media (prefers-color-scheme: dark) and (prefers-contrast: more) {
  p, li, dd, td, .card-copy p, .footnote { color: #ffffff; }
}
