/* Follow the OS preference continuously, without a stored override or page reload. */
:root { color-scheme: light; --appearance-surface: #ffffff; --appearance-focus: #1762a4; }
/* Switch foreground/background pairs together; do not animate through low contrast colors. */
:root .button { transition: transform .2s; }
:root .lab-tabs button { transition: box-shadow .25s; }
:root :focus-visible { outline: 3px solid var(--appearance-focus); outline-offset: 4px; }
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #eef0e8;
    --muted: #bbc4b9;
    --blue: #b3d7b8;
    --line: #4e5a50;
    --paper: #151d19;
    --soft: #202a23;
    --mint: #25392e;
    --peach: #3a2d26;
    --lavender: #302c40;
    --sky: #253440;
    --appearance-surface: #202b25;
    --appearance-focus: #9bd4ff;
  }
  :root body { color: var(--ink); background: var(--paper); }
  :root .site-header { background: #151d19f2; border-color: var(--line); }
  :root #primary-nav { background-color: var(--paper); }
  :root .button { background: #b3d7b8; color: #17271c; }
  :root .button:hover { background: #c9e6cd; color: #17271c; }
  :root .button-light { background: #eef0e8; color: #17271c; }
  :root .button-light:hover { background: #d6e5d6; }
  :root .button-outline { background: transparent; color: var(--ink); border-color: #91a696; }
  :root .button-outline:hover { background: #34463a; }
  :root .skip-link { background: var(--appearance-surface); color: var(--ink); }
  :root .concept-label, :root .card-number { background: #202b25ed; color: var(--ink); border-color: var(--line); }
  :root .macro-preview, :root .fitness-feature, :root .experience-card, :root .example-frame,
  :root .contact-card select, :root #draft-preview { background: var(--appearance-surface); color: var(--ink); border-color: var(--line); }
  :root .contact-card { border-color: var(--line); }
  :root .contact-card select { border-color: #8ca391; }
  :root .macro-preview > .tiny-label, :root .fitness-feature-label .tiny-label { color: #d0bee9; }
  :root .card-category, :root .footer-grid a, :root .family-description, :root .experience-index,
  :root .inline-note, :root .walkthrough-disclosure, :root .walkthrough-explanation > p:not(.eyebrow),
  :root .example-content .tiny-label, :root .story-row > div, :root #draft-preview { color: var(--muted); }
  :root .closing-band { background: #203b2c; }
  :root .closing-band .eyebrow { color: #d8dfcc; }
  :root .unavailable-note { background: #392f20; }
  :root .unavailable-note p { color: #e1d2b7; }
  :root .download-status { color: #b3d7b8; }
  :root .step-progress button { background: var(--appearance-surface); color: var(--muted); border-color: var(--line); }
  :root .step-progress button > span { background: #35453a; }
  :root .step-progress button[aria-current] { background: #294237; color: #c5e8ce; border-color: #a8cdb4; }
  :root .step-progress button[aria-current] > span { background: #b3d7b8; color: #17271c; }
  :root .example-message { background: #293a33; }
  :root .status-dot { background: #e1bb76; }

  /* The recovered Astro component selectors carry scope attributes. Match their specificity
     using a root ID-independent attribute scope, without changing the original stylesheets. */
  :root :is(.team-section, .founder-section, .founder-note, main) .team-embedded { background: var(--appearance-surface); }
  :root .team-section .team-introduction, :root .team-section .team-role,
  :root .team-section .team-credential, :root .team-section .team-biography,
  :root .team-section .team-placement-note, :root .team-section .team-philosophy-label,
  :root .team-section .team-philosophy-context, :root .team-section .team-photo figcaption,
  :root .team-section .team-footnote > p { color: var(--muted); }
  :root .team-section .team-status { color: #e1c68c; }
  :root .team-section .team-philosophy-statement { color: #b8d9f1; }
  :root .team-section .team-sources a { color: #a4d6ff; }
  :root .team-section .team-expand-icon { border-color: #82998a; }
  :root #main .founder-role, :root #main .founder-context, :root #main .founder-label { color: var(--muted); }
  :root #main .founder-statement { color: #b8d9f1; }
  :root #main .gathering-hero h1 span { color: #edb496; }
  :root #main .home-invitation, :root #main .gathering-art p { color: var(--muted); }
  :root #main .home-team > summary, :root #main .home-experiments > summary { color: #bed8b9; }
  :root #main .visual-pets { background: #283e30; }
  :root #main .home-connection-label, :root #main .home-discovery-link,
  :root #main .home-connection .home-connection-copy, :root #main .home-connection-links a > span,
  :root #main .home-connection .home-connection-foot p { color: var(--muted); }
  :root #main .home-connection-links strong, :root #main .home-connection-foot a { color: #b3d7b8; }
  :root #main p[data-astro-cid-cdqaexcb]:not(.eyebrow) { color: var(--muted); }

  :root #main .pet-showcase-heading h2 span { color: #a4d6be; }
  :root #main .pet-showcase-heading p:not(.eyebrow), :root #main .pet-link-note,
  :root #main figcaption[data-astro-cid-l2nlg2vi] p, :root #main .pet-capture-note,
  :root #main .pet-proof-grid p:not(.eyebrow), :root #main .pet-demo-boundary { color: var(--muted); }
  :root #main .pet-demo-link { background: #b3d7b8; color: #17271c; }
  :root #main .pet-screen-tabs button { background: #25372d; color: #d5e5d8; border-color: #7d9383; }
  :root #main .pet-screen-tabs button[aria-selected=true] { background: #b3d7b8; color: #17271c; border-color: #b3d7b8; }
  :root #main .pet-screen-gallery figure { background: var(--appearance-surface); border-color: var(--line); }
  :root #main .pet-screen-chrome { background: #293b30; color: #d0e0d3; }
  :root #main .pet-demo-boundary summary { color: #d0e0d3; }
  :root #main .real-luna-hero .family-hero-copy, :root #main .real-luna-hero .family-description,
  :root #main .real-luna-hero .luna-photo-caption { color: var(--ink); }
  :root #main .real-luna-hero:after { background: #151d19f2; }
  :root #main .real-luna-hero .button { background: #b3d7b8; color: #17271c; }

  /* Portfolio sample demos only; external Kitchen and Pet World apps are unchanged. */
  :root .demo-lab { --demo-accent: #b6ddc4; --demo-wash: #23382c; }
  :root .demo-lab[data-active=macro] { --demo-accent: #d3bdf4; --demo-wash: #332d43; }
  :root .demo-lab[data-active=kitchen] { --demo-accent: #f0c2a5; --demo-wash: #3c2d25; }
  :root .dynamic-hero .eyebrow, :root .lab-local, :root .demo-intro > div > p:not(.eyebrow),
  :root .macro-panel .demo-intro > div > p:not(.eyebrow), :root .kitchen-panel .demo-intro > div > p:not(.eyebrow),
  :root .demo-profile span, :root .demo-profile small, :root .rank-subtitle, :root .demo-reason,
  :root .sponsor-note, :root .context-readiness > div:first-child > span, :root .five-ws,
  :root .context-readiness > p, :root .demo-evidence, :root .lab-footnote, :root .macro-stages,
  :root .portion-control > span, :root .sample-math, :root .local-journal ul, :root .local-journal > p,
  :root .kitchen-memory > p, :root .chat-person strong > span { color: var(--muted); }
  :root .lab-tabs, :root .sample-pill, :root .demo-noscript { background: #29352e; color: #cbd4c8; }
  :root .lab-tabs button { color: #cbd4c8; }
  :root .lab-tabs button[aria-selected=true] { background: #3a4940; color: var(--demo-accent); }
  :root .demo-panel { border-color: var(--line); }
  :root .demo-workspace { background: var(--appearance-surface); border-color: var(--line); }
  :root .demo-lab label { color: #e0e8dc; }
  :root .demo-lab select { background: #26372d; color: var(--ink); border-color: #8ca391; }
  :root .five-ws b { color: #b6ddc4; }
  :root .macro-meal-photo > span, :root .calorie-total > span, :root .macro-nutrients > div > span { color: #d6c7e8; }
  :root .macro-results { background: #352f43; }
  :root .macro-stages li[aria-current], :root .portion-control output, :root .calorie-total strong { color: #d3bdf4; }
  :root .macro-stages li[aria-current] { border-color: #d3bdf4; }
  :root .demo-workspace .button { background: var(--demo-accent); color: #17221b; }
  :root .kitchen-people span, :root .kitchen-memory .tiny-label, :root .kitchen-plan > p { color: #dfc9b9; }
  :root .scenario-picker button { background: #302b25; color: #f0c2a5; border-color: #aa8d78; }
  :root .scenario-picker button[aria-pressed=true] { background: #514033; border-color: #e6b593; }
  :root .chat-user, :root .kitchen-plan { background: #3c3229; }
  :root .chat-user > span { color: #e0bfa6; }
  :root .memory-tags > span { background: #3c3229; color: #e2d0bf; }
}
