/* Bergsson dark theme. Same forest/sage identity, lit from within: a deep green-black ground,
   raised surfaces one tone step up, cream ink and a lighter sage accent. Applied when
   theme.js sets data-theme="dark" (saved choice, otherwise the system preference). */
:root[data-theme=dark]{
 --dk-ground:#111915;--dk-surface:#18221d;--dk-raised:#1f2b25;--dk-raised-2:#25332b;--dk-line:#2e3d35;
 --dk-ink:#e8eee7;--dk-body:#c8d3ca;--dk-muted:#9db0a2;--dk-accent:#9fd2ae;--dk-accent-strong:#c2e6cc;
 --dk-soft:#243a2d;--dk-selected:#2c4636;--dk-warm:#2c2a20;--dk-button:#3e7a57;
 --forest:#9fd2ae;--ink:#e8eee7;--body:#c8d3ca;--muted:#9db0a2;--line:#2e3d35;--paper:#111915;--wash:#18221d;
 color-scheme:dark;
}
:root[data-theme=dark] .launch-home{--home-ink:#e8eee7;--home-body:#c8d3ca;--home-muted:#9db0a2;--home-card:#1a251f;--home-soft:#223428}
:root[data-theme=dark] ::selection{background:#3e7a57;color:#fff}
:root[data-theme=dark] body{background:var(--dk-ground)!important;color:var(--dk-body)}
:root[data-theme=dark] body:not(.launch-home){background:radial-gradient(ellipse at 65% 0,#1c2a2280,transparent 800px),var(--dk-ground)!important}
:root[data-theme=dark] :is(h1,h2,h3,h4,h5,h6){color:var(--dk-ink)}
:root[data-theme=dark] :focus-visible{outline-color:var(--dk-accent)}
:root[data-theme=dark] :is(input,select,textarea){background:var(--dk-raised)!important;color:var(--dk-ink)!important;border-color:var(--dk-line)!important}
:root[data-theme=dark] :is(input,textarea)::placeholder{color:#8fa394!important}
:root[data-theme=dark] audio{color-scheme:dark}
:root[data-theme=dark] hr{border-color:var(--dk-line)}
:root[data-theme=dark] :is(code,kbd){background:var(--dk-raised-2);color:var(--dk-accent-strong)}
:root[data-theme=dark] pre{background:#0c120f!important;color:var(--dk-body)!important;border-color:var(--dk-line)!important}

/* Theme toggle */
.theme-toggle{display:inline-grid;place-items:center;width:44px;height:44px;flex-shrink:0;border:0;border-radius:50%;background:#ffffffb3;color:#2a4a36;cursor:pointer;transition:background 160ms ease}
.theme-toggle svg{width:20px;height:20px}
body:not(.launch-home) .theme-toggle{background:#edf2e7;margin-left:6px}
:root[data-theme=dark] .theme-toggle{background:var(--dk-raised-2)!important;color:var(--dk-accent-strong)}
@media(hover:hover) and (pointer:fine){.theme-toggle:hover{background:#e3ebdb}:root[data-theme=dark] .theme-toggle:hover{background:var(--dk-selected)!important}}
.launch-header .theme-toggle{margin-left:auto}.launch-header .theme-toggle+.home-account{margin-left:0}

/* Home */
:root[data-theme=dark] .launch-home::before{background:radial-gradient(60% 45% at 50% 30%,#1d2b23 0%,#141e19 55%,transparent 100%),var(--dk-ground)}
:root[data-theme=dark] .launch-brand>span,:root[data-theme=dark] .launch-copy h1 span{color:#8fb59a}
:root[data-theme=dark] .launch-copy h1{color:var(--dk-ink)}
:root[data-theme=dark] .logo-face{filter:brightness(1.9) saturate(.8) drop-shadow(1px 1px 0 #31452f) drop-shadow(6px 10px 12px #0008)}
:root[data-theme=dark] .launch-brand img,:root[data-theme=dark] .footer-brand img,:root[data-theme=dark] .portal-brand-logo{filter:brightness(2.4) saturate(.6)}
:root[data-theme=dark] .logo-depth.depth-one{background:#08100c}:root[data-theme=dark] .logo-depth.depth-two{background:#3c5a44}
:root[data-theme=dark] .logo-halo{border-color:#9fd2ae26;box-shadow:none}:root[data-theme=dark] .logo-ground{background:radial-gradient(ellipse,#00000080,transparent 70%)}
:root[data-theme=dark] .logo-grid{background-image:linear-gradient(#9fd2ae10 1px,transparent 1px),linear-gradient(90deg,#9fd2ae10 1px,transparent 1px)}
:root[data-theme=dark] :is(.launch-search,.saved-shortcut,.home-account,.launch-shortcuts a,#recent-guides a){background:var(--dk-raised)!important;border-color:transparent!important;color:var(--dk-ink)!important;box-shadow:none}
:root[data-theme=dark] .launch-search{box-shadow:0 18px 40px -22px #000c!important}
:root[data-theme=dark] .launch-search input{color:var(--dk-ink)!important;background:transparent!important}
:root[data-theme=dark] :is(.launch-search button,.launch-search>svg){color:#fff}
:root[data-theme=dark] .launch-search>svg{color:var(--dk-muted)}
:root[data-theme=dark] .launch-search button{background:var(--dk-button)}
:root[data-theme=dark] #home-saved-count{background:var(--dk-selected);color:var(--dk-ink)}
:root[data-theme=dark] .launch-dock{background:#18221dd9!important;border-color:#ffffff12!important;box-shadow:0 12px 42px #0009,inset 0 1px 0 #ffffff0d!important}
:root[data-theme=dark] .launch-dock a{color:var(--dk-muted)}:root[data-theme=dark] .launch-dock a[aria-current]{background:var(--dk-selected);color:var(--dk-ink);box-shadow:none}
:root[data-theme=dark] :is(.desk-card,.home-learning-link,.method-steps){background:var(--home-card)!important}
:root[data-theme=dark] .course-desk{background:var(--dk-soft)!important}
:root[data-theme=dark] :is(.desk-icon,.desk-meta-icon svg){background:var(--dk-raised-2);color:var(--dk-accent)}
:root[data-theme=dark] .desk-meta-icon svg{background:none}
:root[data-theme=dark] .method-steps a{background:var(--dk-soft);color:var(--dk-accent-strong)}
:root[data-theme=dark] :is(.desk-card>a,.evidence-routes a,.desk-heading>a,.footer-links a,.launch-footer a,.launch-footer button,.desk-scroll){color:var(--dk-body)}
:root[data-theme=dark] .footer-links span,:root[data-theme=dark] .footer-brand strong{color:var(--dk-ink)}
:root[data-theme=dark] .desk-card progress{background:#2c3a31}:root[data-theme=dark] .desk-card progress::-webkit-progress-bar{background:#2c3a31}:root[data-theme=dark] .desk-card progress::-webkit-progress-value{background:var(--dk-accent)}:root[data-theme=dark] .desk-card progress::-moz-progress-bar{background:var(--dk-accent)}
@media(hover:hover) and (pointer:fine){:root[data-theme=dark] :is(.desk-card,.home-learning-link):hover{background:var(--dk-raised)!important}:root[data-theme=dark] :is(.launch-shortcuts a,.evidence-routes a,#recent-guides a):hover{background:var(--dk-raised-2)!important}:root[data-theme=dark] .launch-dock a:hover{background:var(--dk-raised-2)}:root[data-theme=dark] .footer-links a:hover{color:var(--dk-accent-strong)}}

/* Shared chrome on inner pages */
:root[data-theme=dark] body :is(.masthead,.reader-masthead){background:#18221df2!important;border-color:#ffffff10!important;color:var(--dk-ink)}
:root[data-theme=dark] :is(.masthead .wordmark,.reader-masthead .reader-brand){color:var(--dk-ink)}
:root[data-theme=dark] .masthead .wordmark>span{color:#8fb59a}
:root[data-theme=dark] body :is(.masthead,.reader-masthead) .site-links a{color:var(--dk-body)}
:root[data-theme=dark] body :is(.masthead,.reader-masthead) .site-links a[aria-current]{background:var(--dk-selected);color:var(--dk-ink)}
@media(hover:hover) and (pointer:fine){:root[data-theme=dark] body :is(.masthead,.reader-masthead) .site-links a:hover{background:var(--dk-raised-2);color:var(--dk-ink)}}
:root[data-theme=dark] :is(.library-footer,.reader-footer){color:var(--dk-muted)}
:root[data-theme=dark] body:not(.launch-home) a{color:var(--dk-accent)}
:root[data-theme=dark] body:not(.launch-home) :is(.site-links a,.catalogue-entry h2 a,.open-guide,.learning-route>a,.artefact-contents nav a,.course-outline a,.related-artefacts a){color:inherit}
:root[data-theme=dark] :is(.solid-button,.action-primary,#search-button,.catalogue-search-row button,button[type=submit]){background:var(--dk-button)!important;color:#fff!important;border-color:transparent!important}
:root[data-theme=dark] :is(.plain-button,.action-secondary,.entry-controls button,[data-save],#mark-read,#copy-guide-link,#reset-catalogue,.close-dialog){background:var(--dk-raised-2)!important;color:var(--dk-ink)!important;border-color:var(--dk-line)!important}
:root[data-theme=dark] :is(p,li,dd,td,small,figcaption,label,legend,summary){color:inherit}

/* Catalogue */
:root[data-theme=dark] :is(.catalogue-sidebar,.artefact-contents,.course-outline){background:var(--dk-surface)!important;border-color:transparent!important}
:root[data-theme=dark] :is(.category-options button,.artefact-contents nav a,.course-outline ol a,.course-outline .field-nav,.course-outline .quiz-nav){color:var(--dk-body)!important}
:root[data-theme=dark] :is(.category-options button[aria-pressed=true],.artefact-contents nav a[aria-current=location],.course-outline [aria-current]){background:var(--dk-selected)!important;color:var(--dk-ink)!important}
:root[data-theme=dark] .category-options button>span{color:var(--dk-muted)!important}
:root[data-theme=dark] .catalogue-search-row{background:var(--dk-raised)!important;border-color:var(--dk-line)!important}
:root[data-theme=dark] .catalogue-search-row input{background:transparent!important;border:0!important}
:root[data-theme=dark] .catalogue-views,:root[data-theme=dark] .board-tabs{background:var(--dk-surface)!important}
:root[data-theme=dark] :is(.catalogue-views button,.board-tabs>button){color:var(--dk-body)!important;background:transparent}
:root[data-theme=dark] :is(.catalogue-views button[aria-pressed=true],.board-tabs>button[aria-pressed=true]){background:var(--dk-raised-2)!important;color:var(--dk-ink)!important}
:root[data-theme=dark] .catalogue-sort select{background:var(--dk-raised)!important}
:root[data-theme=dark] :is(.catalogue-entry,.catalogue-entry.reference){background:var(--dk-surface)!important}
:root[data-theme=dark] .catalogue-entry p{color:var(--dk-body)}
:root[data-theme=dark] :is(.entry-context,.artefact-heading .entry-context){color:#a7c79b!important}
:root[data-theme=dark] .entry-answer{background:var(--dk-raised)!important;color:var(--dk-body)!important}
:root[data-theme=dark] .entry-answer>span{color:var(--dk-ink)}
:root[data-theme=dark] .audio-availability{background:var(--dk-raised-2);color:var(--dk-body)}
:root[data-theme=dark] .entry-controls .open-guide{background:var(--dk-soft)!important;color:var(--dk-accent-strong)!important}

/* Artefact guides */
:root[data-theme=dark] .artefact-content{background:var(--dk-surface)!important}
:root[data-theme=dark] :is(.artefact-heading p,.artefact-section p,.artefact-section li){color:var(--dk-body)}
:root[data-theme=dark] .artefact-audio,:root[data-theme=dark] .listen-bar{background:var(--dk-soft)!important;color:var(--dk-body)}
:root[data-theme=dark] .evidence-summary>div{background:var(--dk-raised)!important;color:var(--dk-body)}
:root[data-theme=dark] .evidence-summary>div+div{background:var(--dk-warm)!important}
:root[data-theme=dark] .related-artefacts li{background:var(--dk-raised)!important}
:root[data-theme=dark] :is(.ss-example,.guide-completion,.artefact-section table,.artefact-section th,.artefact-section td){border-color:var(--dk-line)!important}
:root[data-theme=dark] :is(.ss-example,.artefact-location,.field-list>div,.tool-card,.walkthrough li){background:var(--dk-raised)!important}

/* Course */
:root[data-theme=dark] .course-workspace{background:var(--dk-surface)!important}
:root[data-theme=dark] .course-workspace h1{color:var(--dk-ink)}
:root[data-theme=dark] :is(.course-facts>span,.learning-route>a,.lesson-note,.full-reference summary){background:var(--dk-raised)!important;border-color:transparent!important;color:var(--dk-body)!important}
:root[data-theme=dark] .full-reference{border-color:var(--dk-line)!important}
:root[data-theme=dark] :is(.course-facts strong,.learning-route strong){color:var(--dk-ink)!important}
:root[data-theme=dark] .answer-option{background:var(--dk-raised)!important;border-color:var(--dk-line)!important;color:var(--dk-body)!important}

/* Community, tools, quizzes, accounts, dialogs */
:root[data-theme=dark] :is(.community-board,.community-post,.tool-entry,.review-item,.owner-access,.member-card,.level-card,.quiz-shell,.account-card,.member-panel){background:var(--dk-surface)!important;border-color:var(--dk-line)!important;color:var(--dk-body)}
:root[data-theme=dark] :is(.posting-guide,.tools-back,.board-search,.quiz-modes label,.member-note){background:var(--dk-raised)!important;border-color:transparent!important;color:var(--dk-body)}
:root[data-theme=dark] .badge-emblem{background:var(--dk-soft)!important;color:var(--dk-accent)!important;box-shadow:none!important}
:root[data-theme=dark] dialog{background:var(--dk-surface);color:var(--dk-body);border-color:var(--dk-line)}
:root[data-theme=dark] dialog::backdrop{background:#000a}

/* Reader documents */
:root[data-theme=dark] :is(.doc-section,.reader-end,.callout,.note,.warning,.content-wrap table){background:var(--dk-surface)!important;color:var(--dk-body)!important;border-color:var(--dk-line)!important}

/* Quizzes, accounts and ethics */
:root[data-theme=dark] .member-notice{background:var(--dk-raised)!important;color:var(--dk-body)!important;border-color:transparent!important}
:root[data-theme=dark] .member-kicker{color:#a7c79b!important}
:root[data-theme=dark] :is(.ethics-example,.scope-agreement){background:var(--dk-raised)!important;color:var(--dk-body)!important;border-color:var(--dk-line)!important}
:root[data-theme=dark] :is(.ethics-example,.scope-agreement) :is(strong,p,b,em){color:inherit!important}
:root[data-theme=dark] :is(.listen-bar,.listen-controls,.artefact-audio) :is(span,small,label,p){color:var(--dk-body)!important}
:root[data-theme=dark] :is(.listen-bar,.listen-controls,.artefact-audio,.audio-panel) button{background:var(--dk-raised-2)!important;color:var(--dk-ink)!important;border-color:var(--dk-line)!important}
:root[data-theme=dark] progress{accent-color:var(--dk-accent);background:#2c3a31}

/* Reader documents (field references) are built on their own :root variables. */
:root[data-theme=dark]{--green:#9fd2ae;--green-mid:#8cc79c;--green-light:#b7e3c3;--bg:#111915;--bg2:#18221d;--bg3:#1f2b25;--surface:#25332b;--border:#2e3d35;--border2:#3b5045;--text:#e8eee7;--text2:#c8d3ca;--text3:#9db0a2;--accent:#9fd2ae;--code-bg:#0f1713;--code-text:#b7e3c3}
:root[data-theme=dark] :is(th,td){background:var(--dk-surface)!important;color:var(--dk-body)!important;border-color:var(--dk-line)!important}
:root[data-theme=dark] th{background:var(--dk-raised)!important;color:var(--dk-ink)!important}
:root[data-theme=dark] :is(.sidebar,.path-box,.code-block,.code-header,.code-caption,.tc-tag,.progress-bar){background:var(--dk-surface)!important;color:var(--dk-body)!important;border-color:var(--dk-line)!important}
:root[data-theme=dark] .code-block{background:#0c120f!important}
:root[data-theme=dark] :is(.sidebar-link){color:var(--dk-body)!important}
:root[data-theme=dark] .sidebar-link.active{background:var(--dk-selected)!important;color:var(--dk-ink)!important}
:root[data-theme=dark] :is(.sidebar-num,.hero-eyebrow,.meta-label,.stat-label,.footer-left,.footer-right,.tc-num){color:var(--dk-muted)!important}
:root[data-theme=dark] :is(.meta-value,.stat-num,.subsection-title,.def-term,.tc-title,.callout-label){color:var(--dk-ink)!important}
:root[data-theme=dark] :is(.def-desc,.tc-body,.content-wrap p,.content-wrap li,.content-wrap em,.content-wrap strong){color:var(--dk-body)!important}
:root[data-theme=dark] .content-wrap :is(.callout,.note,.warning,.tc-card,.def-list,.stat,.meta) {background:var(--dk-raised)!important}
:root[data-theme=dark] .content-wrap :is(td a,p a){color:var(--dk-accent)!important}
:root[data-theme=dark] .code-block :is(.cm){color:#8fa394!important}:root[data-theme=dark] .code-block :is(.kw){color:#c9a4f2!important}:root[data-theme=dark] .code-block :is(.st){color:#e6c98a!important}:root[data-theme=dark] .code-block :is(.fn){color:#8fd0e8!important}:root[data-theme=dark] .code-block :is(.pth){color:#b7e3c3!important}
:root[data-theme=dark] .sev-critical{background:#4a1f1a!important;color:#ffb4a6!important}:root[data-theme=dark] .sev-high{background:#47331a!important;color:#ffd08a!important}:root[data-theme=dark] .sev-medium{background:#3d3b1c!important;color:#efe08a!important}
:root[data-theme=dark] .back-top{background:var(--dk-raised-2)!important;color:var(--dk-ink)!important;border-color:var(--dk-line)!important}
:root[data-theme=dark] .section-num-tag{color:var(--dk-accent)!important;background:transparent!important}
:root[data-theme=dark] #clear-recent{color:var(--dk-body)}