/* Loaded only by the sound, research and company pages. Legal pages keep their original presentation. */
:root {
  color-scheme: light;
  --theme-surface: #f0f3f8;
  --theme-control: #69768a;
  --theme-focus: #699ef3;
}
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  flex: 0 0 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--theme-control);
  background: transparent;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}
.theme-toggle:hover { background: var(--theme-surface); color: var(--ink); }
.theme-toggle:focus-visible { outline: 2px solid var(--theme-focus); outline-offset: 4px; }
.theme-icon { grid-area: 1 / 1; pointer-events: none; }
.theme-icon-sun { display: none; }

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #10151e;
  --ink: #e8edf6;
  --muted: #a6b2c6;
  --subtle: #a6b2c6;
  --line: #293444;
  --hairline: #293444;
  --pink: #e8b4d0;
  --blue: #a6c7ff;
  --lavender: #b3c3e8;
  --soft-pink: #e8b4d0;
  --theme-surface: #1c2635;
  --theme-control: #b6c4da;
  --theme-focus: #aacbff;
  background: var(--paper);
}
html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }
html[data-theme="dark"] ::selection { color: #f3f6fc; background: #40577c; }
html[data-theme="dark"] :is(button, a, input, [tabindex]):focus-visible { outline-color: var(--theme-focus); }
html[data-theme="dark"] :is(a, button):hover { color: var(--blue); }
html[data-theme="dark"] .header { background: #10151ef2; border-bottom-color: #2a3548; }
html[data-theme="dark"] .nav a { color: #adbad0; }
html[data-theme="dark"] .nav a:is(:hover, [aria-current="page"]) { color: #edf3ff; }
html[data-theme="dark"] .languages { border-left-color: var(--line); }
html[data-theme="dark"] .languages button { color: #a8b5ca; }
html[data-theme="dark"] .languages button[aria-pressed="true"] { color: var(--ink); }
html[data-theme="dark"] .skip { background: var(--theme-surface); color: var(--ink); }
html[data-theme="dark"] .theme-toggle { border-color: #3b4b62; }
html[data-theme="dark"] .theme-toggle:hover { color: #f2d6a8; border-color: #66738b; }

/* Sound library and scheduler. Album artwork retains its original colors. */
html[data-theme="dark"] .filter { color: #aab8cd; }
html[data-theme="dark"] .filter:hover { background: #1b2534; color: #e3edff; }
html[data-theme="dark"] .filter.active { background: #293950; color: #e5efff; }
html[data-theme="dark"] .tool-divider { border-left-color: #40516a; }
html[data-theme="dark"] .icon-button:hover { background: #253247; color: #d8e7ff; }
html[data-theme="dark"] .sound-card { background: #243146; border-color: #ffffff20; box-shadow: 0 20px 35px -20px #0009; }
html[data-theme="dark"] .sound-card.playing { box-shadow: 0 0 0 2px var(--genre), 0 16px 40px -15px #000b; }
html[data-theme="dark"] .sound-card:after { background: linear-gradient(180deg, #09111e38, transparent 35%, #0b1429c7); }
html[data-theme="dark"] .sound-card:is(:hover, :focus-visible) { color: #fff; }
html[data-theme="dark"] :is(.cover-genre, .cover-info, .cover-play) { color: #fff; }
html[data-theme="dark"] :is(.tiny-label, .hero-hint, .hero-bottom, .brain-label, .demo-disclosure) { color: #a7b5cc; }
html[data-theme="dark"] .hero-subtitle { color: #bac6db; }
html[data-theme="dark"] .title-dot { color: #b4c7ed; }
html[data-theme="dark"] .hero-bottom a { color: #bfcee5; }
html[data-theme="dark"] .muted { color: #7e90ab; }
html[data-theme="dark"] .design-button { background: linear-gradient(125deg, #bdceed, #d9c7e5); color: #172438; box-shadow: 0 6px 30px #abc8f80b; }
html[data-theme="dark"] .design-button:hover { color: #111d30; background: linear-gradient(125deg, #d0e0fa, #e6d5ee); }
html[data-theme="dark"] .button-spark { color: #566b92; }
html[data-theme="dark"] .design-transition { background: radial-gradient(ellipse at 40% 50%, #71527720, transparent 60%), #10151efa; }
html[data-theme="dark"] :is(.back-button, .text-button, .plan-card .plan-genre, .demo-toggle) { color: #acbad0; }
html[data-theme="dark"] .plan-card .plan-play { background: #142034dd; color: #f0f5ff; }
html[data-theme="dark"] .plan-track { border-top-color: #3d4c63; }
html[data-theme="dark"] .stage { color: #a5b4cc; }
html[data-theme="dark"] .stage i { background: #536681; }
html[data-theme="dark"] .stage.active { color: #d0e1ff; }
html[data-theme="dark"] .stage.active i { background: #abcaff; box-shadow: 0 0 0 6px #8eb9ff20; }
html[data-theme="dark"] .play-small { border-color: #6e829e; }
html[data-theme="dark"] .studio-caption>p { color: #b1bfd5; }
html[data-theme="dark"] .store-links a { border-color: #41516b; color: #d6e2f6; background: #17202e; }
html[data-theme="dark"] .store-links a:hover { border-color: #839fc7; color: #f0f5ff; }
html[data-theme="dark"] .store-links .dashboard-link { color: #172438; background: #bdcfee; border-color: #bdcfee; }
html[data-theme="dark"] .store-links .dashboard-link:hover { background: #d3e2fa; color: #172438; }
html[data-theme="dark"] .brain-pulse { mix-blend-mode: screen; }
html[data-theme="dark"] .brain-halo { background: radial-gradient(ellipse at 30% 50%, #cd8bbd1a, transparent 60%), radial-gradient(ellipse at 70% 60%, #75aefa26, transparent 65%); }
html[data-theme="dark"] .orbital { border-color: #7b9ac136; }
html[data-theme="dark"] .hero.completed #demo-timer { color: #aacbff; }

/* Research typography, evidence cards and scroll surfaces. */
html[data-theme="dark"] .rp-page { --rp-line: #2d3a4e; --rp-muted: #b1bfd4; }
html[data-theme="dark"] :is(.rp-eyebrow, .rp-metric p, .rp-proof-label, .rp-metric-note, .rp-unit, .rp-scroll-note) { color: #acbbd2; }
html[data-theme="dark"] .rp-metric-main .rp-metric-value { color: #c4d9fc; }
html[data-theme="dark"] :is(.rp-metric-small .rp-metric-value, .rp-proof-value) { color: #bdd0ef; }
html[data-theme="dark"] :is(.rp-percent, .rp-plus, .rp-year) { color: #a6c5f3; }
html[data-theme="dark"] .rp-badge { color: #c3d7f5; background: #23334b; }
html[data-theme="dark"] .rp-author { color: #b4c3db; border-color: #3a4b64; }
html[data-theme="dark"] .rp-paper h3 { color: #dce7f7; }
html[data-theme="dark"] .rp-paper>p { color: #afbdd3; }
html[data-theme="dark"] .rp-paper-dot { background: #5b708e; }
html[data-theme="dark"] .rp-paper.is-current .rp-paper-dot { background: #b8d2fb; }
html[data-theme="dark"] .rp-sound-link { color: #b9cdeb; }
html[data-theme="dark"] .rp-sound-link:hover { color: #e0ecff; }
html[data-theme="dark"] .rp-brain-aura { background: radial-gradient(ellipse at 28% 50%, #ce91bd1f, transparent 60%), radial-gradient(ellipse at 72% 50%, #85b5f62b, transparent 60%); }
html[data-theme="dark"] :is(.rp-reading, .company-story) { scrollbar-color: #4a5b75 transparent; }
html[data-theme="dark"] :is(.rp-reading, .company-story)::-webkit-scrollbar-thumb { background: #4a5b75; }

/* Founder portrait stays photographic; only the transparent ink is reversed. */
html[data-theme="dark"] .company-portrait-frame { background: #252d3b; }
html[data-theme="dark"] .company-signature img { filter: invert(1); mix-blend-mode: normal; }
html[data-theme="dark"] :is(.company-heading-note, .company-person p, .company-portrait-foot, .company-scroll-cue, .company-statement, .company-entry-summary, .company-entry-more ul, .company-contact-block p, .company-loading) { color: #afbdd2; }
html[data-theme="dark"] :is(.company-intro>.tiny-label, .company-intro-lead, .company-history-heading h3) { color: #c0cde1; }
html[data-theme="dark"] :is(.company-slash, .signature-replay, .company-entry-more summary) { color: #9fb0ca; }
html[data-theme="dark"] .company-timeline-entry { border-left-color: #35445d; }
html[data-theme="dark"] .company-timeline-entry:last-child { border-left-color: transparent; }
html[data-theme="dark"] .company-timeline-entry:before { background: #87a3cc; }
html[data-theme="dark"] .company-timeline-entry:is(:hover, :focus-within):before { background: #b8d2fc; box-shadow: 0 0 0 4px #213149; }
html[data-theme="dark"] .company-entry-date { color: #a7c8f7; }
html[data-theme="dark"] .company-entry-more summary:hover { color: #d2e3ff; }
html[data-theme="dark"] .company-entry-more li::marker { color: #7e97bb; }
html[data-theme="dark"] :is(.company-research-link, .company-error-retry) { color: #b9d0f2; border-bottom-color: #526a8c; }
html[data-theme="dark"] .company-scroll-progress { background: #2e3a4e; }

/* Footer and audio controls remain readable over every page. */
html[data-theme="dark"] :is(.policy-links, .copyright) { color: #a9b7cc; }
html[data-theme="dark"] .player { background: #17202ef5; border-color: #3b4b63; box-shadow: 0 12px 50px #0006; }
html[data-theme="dark"] :is(.player-info>#player-meta, .player-progress>div) { color: #aebdd3; }
html[data-theme="dark"] .player-play { border-color: #637a9b; color: #e6efff; }
html[data-theme="dark"] .player-play:hover { background: #293b55; }
html[data-theme="dark"] .player input { accent-color: #b4cefa; }
html[data-theme="dark"] .toast { background: #d3def0; color: #1a273c; box-shadow: 0 6px 25px #0004; }

@media (min-width: 701px) and (max-width: 900px) {
  .header { gap: 18px; }
  .brand { font-size: 12px; }
  .nav { gap: 14px; }
  .nav a { font-size: 11px; }
  .header-end { gap: 12px; }
  .languages { gap: 10px; padding-left: 16px; }
}
@media (max-width: 700px) {
  .header-end { gap: 12px; flex-shrink: 0; }
  .brand { flex-shrink: 0; }
  html[data-theme="dark"] .nav { background: #141c29fa; border-bottom-color: #34425b; }
}
/* Follow OS by default; an explicit full-motion choice takes precedence. */
@media(prefers-reduced-motion:reduce){html:not([data-motion="full"]) .theme-toggle{ transition: none; }
}
html[data-motion="reduced"] .theme-toggle{ transition: none; }
