/* Reading, personal shelves and contribution forms share the dark paper palette. */
html[data-color-mode="dark"] .guide-v5 :is(
 .case-passport h1,.case-opening p,.chapter h2,.related-cases-heading h2,
 .related-case h3,.shelf-heading h1,.shelf-empty h2,.signin-body h2,
 .contribute-page,.contribute-heading h1,.contribute-field label,.contribute-aside h2
){color:var(--ink)}

html[data-color-mode="dark"] .guide-v5 :is(
 .case-breadcrumb,.case-breadcrumb .back,.case-facts dt,.contents-label,
 .chapter-kicker,.chapter-number,.case-contents a,.tools-note>span,
 .chapter .tools-note p,.prompt-chapter .prompt-instruction,.document-toolbar>span,
 .document-end,.chapter .availability-note,.source-note p,.case-footer,
 .related-cases-heading p,.related-case-category,.related-case-connection,
 .account-meta,.demo-profile,.shelf-count,.shelf-heading p,.shelf-filters button,
 .shelf-filters button span,.shelf-order,.shelf-empty-label,.shelf-empty p,
 .shelf-footer,.shelf-modes button,.signin-kicker,.signin-body>p,.signin-later,
 .signin-pending>span,.signin-demo-note,.try-kicker,.try-undo-hint,
 .contribute-meta,.contribute-heading>p,.contribute-field label small,
 .contribute-index,.contribute-field-note,.contribute-status,.contribute-aside>p,
 .contribute-local-note p,.contribute-footer
){color:var(--muted)}

html[data-color-mode="dark"] .guide-v5 :is(.chapter p,.chapter li,.case-facts){color:#c9d1c9}
html[data-color-mode="dark"] .guide-v5 .outcome p{color:#d7dfd3}
html[data-color-mode="dark"] .guide-v5 .try-section p{color:var(--muted)}

html[data-color-mode="dark"] .guide-v5 :is(
 .chapter,.chapter.outcome,.tools-note,.document-toolbar,.source-note,.case-footer,
 .related-cases,.shelf-toolbar,.shelf-empty,.shelf-footer,.shelf-modes,
 .signin-demo-note,.try-section,.contribute-layout,.contribute-extras,
 .contribute-footer,.contribute-aside
){border-color:var(--line)}

html[data-color-mode="dark"] .guide-v5 :is(
 .case-passport .category-label,.passport-action,.source-note>a,.case-footer a,
 .prompt-instruction span,.related-case-connection>span,.related-case-open,
 .shelf-catalog-link,.shelf-footer a,.shelf-modes a,.signout,.editorial-action,
 .signin-demo-note b,.contribute-back,.contribute-extras summary,
 .contribute-save,.contribute-next,.contribute-footer a
){color:var(--dark-accent)}
html[data-color-mode="dark"] .guide-v5 :is(
 .passport-action,.shelf-catalog-link,.editorial-action,.contribute-save,.try-command
){border-color:#667d70}
html[data-color-mode="dark"] .guide-v5 :is(.passport-action:hover,.case-contents a:hover,.case-contents a.current){color:var(--ink)}
html[data-color-mode="dark"] .guide-v5 .contents-tick{background:#58675d}
html[data-color-mode="dark"] .guide-v5 .case-contents a.current .contents-tick{background:var(--dark-accent)}
html[data-color-mode="dark"] .guide-v5 .difficulty i{background:#465148}
html[data-color-mode="dark"] .guide-v5 .difficulty .filled{background:var(--dark-accent)}
html[data-color-mode="dark"] .guide-v5 .case-steps li::marker{color:var(--muted)}
html[data-color-mode="dark"] .guide-v5 .case-passport header::before{opacity:.45}

/* Keep serif rhythm and the small category-colour edge: this is still a document. */
html[data-color-mode="dark"] .guide-v5 .prompt-document{
 background:#242b26;border-color:#3c473e;box-shadow:0 12px 36px -24px #0009;
}
html[data-color-mode="dark"] .guide-v5 .document-text{color:#e0e5dc}
html[data-color-mode="dark"] .guide-v5 .document-text mark{
 color:#f0f2e9;background:color-mix(in srgb,var(--tone-soft) 17%,#242b26);box-shadow:none;
}
html[data-color-mode="dark"] .guide-v5 .document-end>span:first-child{background:#68766a}
html[data-color-mode="dark"] .guide-v5 .document-copy,
html[data-color-mode="dark"] .guide-v5 .mobile-copy .document-copy{
 color:var(--ink);background:transparent;border-color:#687d6d;
}
html[data-color-mode="dark"] .guide-v5 .document-copy:hover{color:var(--dark-accent);border-color:var(--dark-accent)}
html[data-color-mode="dark"] .guide-v5 .mobile-copy{
 background:#202723f5;border-color:var(--line);
}
html[data-color-mode="dark"] .guide-v5 .copy-status[data-error="true"]{
 background:var(--dark-elevated);border-color:#856053;color:#f0bda8;
}
html[data-color-mode="dark"] .guide-v5 .health-note{
 background:color-mix(in srgb,var(--tone-soft) 12%,var(--dark-surface));
 border-color:var(--dark-accent);color:var(--ink);
}

html[data-color-mode="dark"] .guide-v5 .bookmark-detail{color:var(--ink)}
html[data-color-mode="dark"] .guide-v5 .bookmark-detail .bookmark-icon{color:var(--ink);stroke:currentColor;fill:none}
html[data-color-mode="dark"] .guide-v5 .bookmark-detail .bookmark-click-burst{color:var(--ink)}
html[data-color-mode="dark"] .guide-v5 .bookmark-detail[aria-pressed="true"] .bookmark-icon{fill:currentColor}
html[data-color-mode="dark"] .guide-v5 .bookmark-detail:hover{color:var(--dark-accent);background:transparent}

html[data-color-mode="dark"] .guide-v5 .try-command{color:var(--ink)}
html[data-color-mode="dark"] .guide-v5 .try-command i{border-color:#607265}
html[data-color-mode="dark"] .guide-v5 .try-command svg{stroke:var(--dark-accent)}
html[data-color-mode="dark"] .guide-v5 .try-command:hover i{background:var(--dark-elevated)}
html[data-color-mode="dark"] .guide-v5 .try-command[aria-pressed="true"] i{background:#b3cdb9;border-color:#b3cdb9}
html[data-color-mode="dark"] .guide-v5 .try-command[aria-pressed="true"] svg{stroke:#203b2b}

html[data-color-mode="dark"] .guide-v5 .related-case{
 background:var(--dark-surface);border-color:var(--line);color:var(--ink);
}
html[data-color-mode="dark"] .guide-v5 .related-case-open>span{border-color:#58695b;color:var(--ink)}
@media(hover:hover){
 html[data-color-mode="dark"] .guide-v5 .related-case:hover{background:var(--dark-elevated);border-color:#657764}
 html[data-color-mode="dark"] .guide-v5 .related-case:hover .related-case-open>span{color:#203328}
}

/* The saved cards retain the same pastel surfaces and black bookmarks as the catalogue. */
html[data-color-mode="dark"] .guide-v5 .account-entry{border-color:var(--line)}
html[data-color-mode="dark"] .guide-v5 .account-nav{color:var(--ink)}
html[data-color-mode="dark"] .guide-v5 .account-nav .bookmark-icon{color:var(--ink);stroke:currentColor;fill:none}
html[data-color-mode="dark"] .guide-v5 .account-nav[aria-current] .bookmark-icon{fill:currentColor}
html[data-color-mode="dark"] .guide-v5 .account-nav-count{color:var(--muted)}
html[data-color-mode="dark"] .guide-v5 :is(.shelf-filters button[aria-pressed="true"],.shelf-modes button[aria-pressed="true"]){color:var(--ink)}
html[data-color-mode="dark"] .guide-v5 :is(.shelf-filters button[aria-pressed="true"],.shelf-modes button[aria-pressed="true"])::after{background:var(--dark-accent)}
html[data-color-mode="dark"] .guide-v5 .editorial-action>span{background:#34483b;color:#d6e7d4}
html[data-color-mode="dark"] .guide-v5 .editorial-action:hover>span{background:#435e4b}

html[data-color-mode="dark"] .guide-v5 .account-dialog{
 color:var(--ink);background:var(--dark-surface);border-color:#48564a;box-shadow:0 24px 100px #0008;
}
html[data-color-mode="dark"] .guide-v5 .account-dialog::backdrop{background:#0d1411b3}
html[data-color-mode="dark"] .guide-v5 .dialog-close{background:var(--dark-elevated);color:var(--ink)}
html[data-color-mode="dark"] .guide-v5 .signin-decoration{background:linear-gradient(110deg,#2c3b30,var(--dark-surface) 80%)}
html[data-color-mode="dark"] .guide-v5 .signin-pending{
 background:color-mix(in srgb,var(--tone-soft) 10%,var(--dark-surface));color:var(--ink);
}
html[data-color-mode="dark"] .guide-v5 .account-notice{
 background:#303e33;color:#f1f4ec;border:1px solid #617664;box-shadow:0 8px 28px #0005;
}
html[data-color-mode="dark"] .guide-v5 .account-notice button{color:#d5e8c9}
html[data-color-mode="dark"] .guide-v5 .account-notice .notice-close{color:var(--muted)}
html[data-color-mode="dark"] .guide-v5 .account-prototype-note{
 background:#171b1aed;border-color:var(--line);color:var(--muted);
}
html[data-color-mode="dark"] .guide-v5 .account-prototype-note :is(a,button,span){color:var(--muted)}
html[data-color-mode="dark"] .guide-v5 .account-prototype-note i{border-color:var(--line)}

html[data-color-mode="dark"] .guide-v5 .contribute-field :is(input,textarea){
 background:var(--dark-surface);color:var(--ink);border-color:#455147;
}
html[data-color-mode="dark"] .guide-v5 .contribute-field :is(input,textarea)::placeholder{color:#94a294}
html[data-color-mode="dark"] .guide-v5 .contribute-field :is(input,textarea):focus{
 border-color:var(--dark-accent);box-shadow:0 0 0 3px #a6cbc81f;
}
html[data-color-mode="dark"] .guide-v5 .contribute-save-mark{color:#293f2f}
html[data-color-mode="dark"] .guide-v5 .contribute-aside-kicker{color:var(--muted)!important}
html[data-color-mode="dark"] .guide-v5 .contribute-note-line{background:#667b61}
html[data-color-mode="dark"] .guide-v5 .contribute-status.is-error{color:#ecb092}

html[data-color-mode="dark"] .guide-v5 :is(
 .document-copy,.document-text,.bookmark-detail,.account-nav,.editorial-action,.shelf-filters button,
 .shelf-modes button,.signout,.dialog-close,.signin-later,.try-command,.related-case,
 .contribute-save,.contribute-extras summary,.contribute-back,.contribute-footer a
):focus-visible{outline-color:var(--dark-accent)}
