:root { color-scheme: dark; }
.theme-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.theme-toggle, .language-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 38px;
  min-height: 38px; flex: none; padding: 6px; border: 0; background: transparent; cursor: pointer;
  color: var(--muted, #b9b9b9); font: 600 12px system-ui, sans-serif;
}
:is(.theme-toggle,.language-toggle):is(:hover,:focus-visible) { color: var(--green); }
:is(.theme-toggle,.language-toggle):focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 5px; }
.theme-label, .theme-moon, [data-theme="light"] .theme-sun { display: none; }
[data-theme="light"] .theme-moon, #menu .theme-label { display: inline-block; }
#menu .site-preferences { display: flex; align-self: flex-end; gap: 10px; margin-bottom: 4px; }
header nav { align-items: center; }

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f8f5ec;
  --white: #181d19;
  --green: #17583b;
  --muted: #536057;
  --line: #cbd3c9;
  --theme-text: #2b352e;
  --theme-surface: #fffdf6;
  --theme-green-surface: #e7efe4;
  --theme-hover: #e3eadd;
  --theme-border: #9caa9d;
  --theme-soft-green: rgba(23,88,59,.13);
  --page: var(--bg);
  --panel: var(--theme-surface);
  --sidebar: #eeeade;
  --text: var(--white);
}

[data-theme="light"] body { color: var(--theme-text); }
[data-theme="light"] body::before { background: none; }
[data-theme="light"] body::after {
  background: repeating-linear-gradient(to bottom, #173b2306 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
[data-theme="light"] header:not(#top):not(.topbar) { background: rgba(248,245,236,.93); }
[data-theme="light"] :is(.brand,h1,h1 .g,.kicker b) { text-shadow: none; }
[data-theme="light"] :is(.brand-mark,.brand-live-mark,#mini) { filter: url(#theme-ascii); }
[data-theme="light"] .fx-bgglitch { mix-blend-mode: darken; }

/* The homepage keeps its cream surface through the hero, menu and scroll sections. */
[data-theme="light"].mini #top { background: linear-gradient(to bottom, var(--bg) 55%, #f8f5ec00); }
[data-theme="light"] #menu { background: rgba(248,245,236,.98); }
[data-theme="light"] #menu :is(nav a,nav summary,.socials a) { border-color: var(--line); text-shadow: none; filter: none; }
[data-theme="light"] #menu nav em { border-color: var(--theme-border); text-shadow: none; }
[data-theme="light"] :is(#menuBtn span,.cur,#foryou .dot) { box-shadow: none; }
[data-theme="light"] body .grid pre { filter: none; }
[data-theme="light"] body[data-mode="matrix"] #layerB { color: var(--green); }
[data-theme="light"] :is(#captions span,#foryou .tag b,#enterprise .tag b,#enterprise h2,#enterprise h2 .g,#enterprise .lede,#links h2,#links h2 .p,#links a.mail) { text-shadow: none; }
[data-theme="light"] #captions .row span.d { color: var(--green); }
[data-theme="light"] #foryou { background: linear-gradient(to bottom, #f8f5ec00, var(--bg) 180px); border-color: var(--line); }
[data-theme="light"] #foryou .soon { border-color: var(--theme-border); box-shadow: none; text-shadow: none; }
[data-theme="light"] :is(#foryou .lede,#foryou .create-account,#enterprise .workflow-copy .lede + .lede) { color: var(--theme-text); }
[data-theme="light"] :is(#foryou .sign-in,#enterprise .cta,.cta) { box-shadow: none; }
[data-theme="light"] :is(#foryou .sign-in,#enterprise .cta,.cta):hover { box-shadow: 0 0 18px var(--theme-soft-green); }
[data-theme="light"] :is(#enterprise .fine a,#links small a) { border-color: var(--theme-border); }
[data-theme="light"] #links { border-color: var(--line); }
[data-theme="light"] #links li a { border-color: var(--line); background: var(--theme-surface); filter: none; }
[data-theme="light"] #links li a:hover, [data-theme="light"] #links li a:focus-visible { border-color: var(--green); background: var(--theme-hover); filter: none; }
[data-theme="light"] #links small { color: var(--muted); }
[data-theme="light"] #home-chat { color-scheme: dark; }

/* Secondary pages use the same paper, ink and forest-green accents. */
[data-theme="light"] .tldr { background: var(--theme-green-surface); border-color: var(--line); }
[data-theme="light"] .cards a { color: var(--theme-text); background: var(--theme-surface); }
[data-theme="light"] .cards a:hover { border-color: var(--green); background: var(--theme-hover); }
[data-theme="light"] .account input { background: var(--theme-surface); }
[data-theme="light"] :is(.plan,.tool-access,.billing-switch,.enterprise-plan) { background: var(--theme-surface); border-color: var(--line); }
[data-theme="light"] .plan-featured { background: var(--theme-green-surface); border-color: var(--theme-border); }
[data-theme="light"] :is(.pricing-heading > p:not(.kicker),.billing legend,.billing-note,.plan > p:not(.plan-price),.pricing-note,.enterprise-plan p,.seat-row,.tool-access > p,.tool-catalog > p,.tool-groups ul) { color: var(--theme-text); }
[data-theme="light"] .billing-switch label { color: var(--theme-text); }
[data-theme="light"] .billing-switch input:checked + label { color: var(--bg); background: var(--green); }
[data-theme="light"] :is(.billing-switch label span,.plan-name span) { background: var(--theme-hover); color: var(--green); }
[data-theme="light"] :is(.plan ul,.plan-action,.seat-stepper button) { border-color: var(--theme-border); }
[data-theme="light"] :is(.plan-action:hover,.seat-stepper button:hover:enabled) { background: var(--theme-hover); }
[data-theme="light"] .seat-stepper button { background: var(--theme-surface); }
[data-theme="light"] .plan-primary { color: var(--bg); background: var(--green); border-color: var(--green); }
[data-theme="light"] .plan-primary:hover { background: #103f2a; }
[data-theme="light"] .plan li::before { color: var(--green); }

/* The full chat shares the page theme while its composer stays charcoal. */
[data-theme="light"] .workspace .primary:hover, [data-theme="light"] dialog .primary:hover { color: var(--bg); }
[data-theme="light"] .new-chat { background: var(--theme-surface); }
[data-theme="light"] .new-chat:hover { background: var(--theme-hover); }
[data-theme="light"] #composer {
  color-scheme: dark; background: #303030; color: #f4f4f4;
  --text: #f4f4f4; --sidebar: #171717; --muted: #b9b9b9;
}
[data-theme="light"] #composer .send:hover { background: var(--green); color: #fff; }

[data-theme="light"] :is(.exploded,.exploded-kicker,.exploded-more) { color: var(--muted); }
[data-theme="light"] :is(.exploded-more a,.exploded-toggle) { color: var(--green); }
[data-theme="light"] .exploded-toggle::after { background: var(--green); box-shadow: 0 0 9px var(--theme-soft-green); }
[data-theme="light"] .exploded-toggle:hover::after, [data-theme="light"] .exploded-toggle:focus-visible::after {
  box-shadow: 0 0 0 5px var(--theme-soft-green), 0 0 17px #17583b50;
}
[data-theme="light"] :is(.exploded-toggle,.exploded-diagram):focus-visible { outline-color: var(--green); }
[data-theme="light"] .part-label { color: var(--part-color-light); }
[data-theme="light"] .part-label text { stroke: var(--bg); }
[data-theme="light"] .part-leader { opacity: .68; }
[data-theme="light"] .part-child .part-leader { opacity: .45; }
[data-theme="light"] .part-label.is-active .part-leader { opacity: 1; }

/* Enterprise accents follow the section's blue palette. */
[data-theme="light"] #enterprise {
  --enterprise-accent: #173b65;
  --enterprise-rgb: 23,59,101;
}
[data-theme="light"] #enterprise .cta:hover,
[data-theme="light"] #enterprise .cta:focus-visible {
  box-shadow: 0 0 18px rgba(var(--enterprise-rgb),.13);
}
