/*
 * Dealsmaster Editorial v5.7.2 — dark clarity layer
 *
 * Night mode should feel like ink, velvet and lamplight, never like text
 * floating over smoked glass.  This final layer keeps the atmospheric colour
 * and motion from v20 while giving every reading surface real visual weight.
 */

html[data-dm-theme="dark"] {
  --dm-theme-page: #0f1713;
  --dm-theme-panel: #1a2720;
  --dm-theme-panel-2: #213129;
  --dm-theme-panel-3: #2a3b31;
  --dm-theme-ink: #f7eee3;
  --dm-theme-muted: #d5c8b9;
  --dm-theme-line: rgba(247, 235, 219, .27);
  --dm-theme-link: #f1cf7a;
  --dm-theme-shadow: 0 26px 72px rgba(0, 0, 0, .42);
}

/* Never dim functional copy as a shortcut for hierarchy. */
html[data-dm-theme="dark"] :is(main, .dm-site-header, .dm-site-footer, .dm-nav-drawer, .dm-reading-sheet)
  :is(h1, h2, h3, h4, h5, h6, p, li, a, label, legend, summary, strong, em, small, figcaption, td, th, dt, dd) {
  opacity: 1;
  mix-blend-mode: normal;
}

html[data-dm-theme="dark"] :is(figcaption, .wp-element-caption, .dm-image-note, .dm-story-image figcaption) {
  color: #d5c8b9 !important;
  opacity: 1 !important;
}

html[data-dm-theme="dark"] :is(input, textarea)::placeholder {
  color: #bfb2a3 !important;
  opacity: 1 !important;
}

/* Masthead and navigation: opaque instruments with visible boundaries. */
html[data-dm-theme="dark"] .dm-site-header {
  --dm-shell-line: rgba(247, 235, 219, .25);
  border-bottom-color: var(--dm-shell-line);
  background-color: #101b16 !important;
}

html[data-dm-theme="dark"] .dm-site-header .dm-header-search .wp-block-search__inside-wrapper,
html[data-dm-theme="dark"] .dm-site-header .dm-nav-bar,
html[data-dm-theme="dark"] .dm-theme-toggle,
html[data-dm-theme="dark"] .dm-nav-mobile-toggle,
html[data-dm-theme="dark"] .dm-nav-drawer__search input,
html[data-dm-theme="dark"] .dm-reading-sheet header button {
  border-color: rgba(247, 235, 219, .27) !important;
  color: #f7eee3 !important;
  background-color: #1b2922 !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, .07), 0 10px 28px rgba(0, 0, 0, .24);
}

html[data-dm-theme="dark"] :is(.dm-nav-panel, .dm-nav-drawer__surface, .dm-reading-sheet, .dm-search-assist) {
  border-color: rgba(247, 235, 219, .27) !important;
  color: #f7eee3 !important;
  background-color: #17241d !important;
  box-shadow: 0 28px 78px rgba(0, 0, 0, .52) !important;
}

html[data-dm-theme="dark"] :is(
  .dm-nav-panel__aside,
  .dm-nav-panel__latest,
  .dm-nav-panel-aside,
  .dm-nav-drawer__shortcuts a,
  .dm-reading-sheet a[aria-current="location"]
) {
  border-color: rgba(247, 235, 219, .24) !important;
  background-color: #223229 !important;
}

html[data-dm-theme="dark"] .dm-context-trail {
  border-color: rgba(247, 235, 219, .24) !important;
  color: #d5c8b9 !important;
  background: #142019 !important;
  backdrop-filter: none;
}

html[data-dm-theme="dark"] .dm-context-trail__facets a {
  border-color: rgba(247, 235, 219, .24) !important;
  color: #f7eee3 !important;
  background: #223229 !important;
}

html[data-dm-theme="dark"] :is(.dm-nav-trigger, .dm-nav-direct, .dm-nav-trigger > span) {
  color: #f7eee3 !important;
}

html[data-dm-theme="dark"] .dm-site-header .dm-brand-tagline,
html[data-dm-theme="dark"] .dm-desk-story__byline,
html[data-dm-theme="dark"] .dm-finder-status {
  color: #d5c8b9 !important;
  opacity: 1 !important;
}

html[data-dm-theme="dark"] .dm-site-header :is(.dm-topline-story > a, .dm-atmosphere-edition) {
  border-color: rgba(247, 235, 219, .3) !important;
  background: #1b2922 !important;
}

html[data-dm-theme="dark"] .dm-site-header .dm-topline-story time {
  color: #d5c8b9 !important;
  opacity: 1 !important;
}

/* Homepage papers: tonal variation stays, transparency goes. */
html[data-dm-theme="dark"] :is(
  .dm-alive-hero__story,
  .dm-alive-hero__detail,
  .dm-alive-hero__note,
  .dm-lived-letter__copy,
  .dm-lived-letter__aside,
  .dm-field-note-card,
  .dm-library-card,
  .dm-my-rooms__shell,
  .dm-finder-form,
  .dm-experience-card__body,
  .dm-useful-intro
) {
  border-color: rgba(247, 235, 219, .27) !important;
  color: #f7eee3 !important;
  background-color: #1a2720 !important;
  box-shadow: 0 24px 66px rgba(0, 0, 0, .38) !important;
}

html[data-dm-theme="dark"] .dm-desk-story {
  border-color: rgba(247, 235, 219, .26) !important;
  background: linear-gradient(145deg, #1c2b23, #16221c) !important;
  box-shadow: 0 24px 66px rgba(0, 0, 0, .38) !important;
}

html[data-dm-theme="dark"] .dm-desk-story--lead {
  background: linear-gradient(145deg, #203027, #17231d 64%, #24291f) !important;
}

html[data-dm-theme="dark"] .dm-desk-stream__footer {
  border-top-color: rgba(247, 235, 219, .27) !important;
  color: #d5c8b9 !important;
}

html[data-dm-theme="dark"] .dm-desk-stream__footer a,
html[data-dm-theme="dark"] .dm-field-note-card figcaption > span {
  color: #f1cf7a !important;
  opacity: 1 !important;
}

html[data-dm-theme="dark"] .dm-atmosphere-portal__card {
  border-color: rgba(247, 235, 219, .26) !important;
  background: linear-gradient(145deg, #1b2a22, #142019) !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, .055), 0 18px 44px rgba(0, 0, 0, .3);
}

html[data-dm-theme="dark"] .dm-atmosphere-portal__card--gallery {
  background: linear-gradient(145deg, #2d232c, #1b1d20) !important;
}

html[data-dm-theme="dark"] .dm-atmosphere-portal__card--glow {
  background: linear-gradient(145deg, #32291d, #1c201a) !important;
}

html[data-dm-theme="dark"] .dm-atmosphere-portal__card--rhythm {
  background: linear-gradient(145deg, #252735, #19201d) !important;
}

html[data-dm-theme="dark"] .dm-atmosphere-portal__card--retreat {
  background: linear-gradient(145deg, #293127, #18221b) !important;
}

html[data-dm-theme="dark"] .dm-atmosphere-portal__card--outdoors {
  background: linear-gradient(145deg, #183326, #132019) !important;
}

html[data-dm-theme="dark"] :is(
  .dm-reset-lab__controls,
  .dm-reset-lab__result,
  .dm-project-list,
  .dm-my-rooms__board,
  .dm-my-rooms__empty
) {
  border-color: rgba(247, 235, 219, .27) !important;
  color: #f7eee3 !important;
  background: #1d2d25 !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, .055), 0 18px 46px rgba(0, 0, 0, .28);
}

html[data-dm-theme="dark"] :is(
  .dm-lived-letter__copy,
  .dm-lived-letter__aside,
  .dm-field-note-card,
  .dm-library-card,
  .dm-my-rooms__shell,
  .dm-experience-card__body,
  .dm-desk-story,
  .dm-atmosphere-portal__card,
  .dm-reset-lab__result
) :is(p, li, small, figcaption) {
  color: #d5c8b9 !important;
}

html[data-dm-theme="dark"] .dm-alive-hero__scene > span {
  color: #fffaf1 !important;
  opacity: 1 !important;
}

html[data-dm-theme="dark"] body.dm-human-warmth.home .dm-useful-edit .dm-useful-intro {
  border-color: rgba(247, 235, 219, .27) !important;
  color: #f7eee3 !important;
  background: #1a2720 !important;
  box-shadow: 0 24px 66px rgba(0, 0, 0, .38) !important;
}

html[data-dm-theme="dark"] body.dm-human-warmth.home .dm-edit-list > li {
  opacity: 1 !important;
}

html[data-dm-theme="dark"] .dm-reset-lab legend {
  color: #d5c8b9 !important;
  opacity: 1 !important;
}

html[data-dm-theme="dark"] .dm-trust {
  color: #f7eee3 !important;
  background: #13221a !important;
}

html[data-dm-theme="dark"] .dm-trust :is(h2, strong) { color: #fff6e9 !important; }
html[data-dm-theme="dark"] .dm-trust p { color: #d5c8b9 !important; }
html[data-dm-theme="dark"] .dm-trust :is(.dm-kicker, li > span, .dm-read-link) { color: #f1cf7a !important; }

html[data-dm-theme="dark"] :is(.dm-project-card, .dm-lived-letter__photo) {
  border-color: rgba(247, 235, 219, .27) !important;
  color: #f7eee3 !important;
  background: #1a2720 !important;
}

html[data-dm-theme="dark"] .dm-project-card h3 a { color: #f7eee3 !important; }

html[data-dm-theme="dark"] .dm-project-card :is(label, label span, .dm-project-progress),
html[data-dm-theme="dark"] .dm-lived-letter__photo figcaption {
  color: #d5c8b9 !important;
}

/* Article papers: each atmosphere keeps its hue, with full-density paper. */
html[data-dm-theme="dark"] body.dm-article-edition.dm-atmosphere {
  --dm-atm-paper: #1a2720;
  --dm-atm-soft: #293a30;
  --dm-atm-ink: #f7eee3;
  --dm-atm-muted: #d5c8b9;
  --dm-atm-on-deep: #fff6e9;
  --dm-atm-on-deep-muted: #ddd0c0;
  --dm-atm-line: rgba(247, 235, 219, .27);
  --dm-atm-opening-surface: #1a2720;
  --dm-atm-opening-ink: #f7eee3;
  --dm-atm-opening-muted: #d5c8b9;
  --dm-atm-opening-line: rgba(247, 235, 219, .27);
}

html[data-dm-theme="dark"] body.dm-atmosphere--air { --dm-atm-paper: #19282b; --dm-atm-soft: #293b40; }
html[data-dm-theme="dark"] body.dm-atmosphere--gallery { --dm-atm-paper: #282127; --dm-atm-soft: #3a2d37; }
html[data-dm-theme="dark"] body.dm-atmosphere--glow { --dm-atm-paper: #29231b; --dm-atm-soft: #3e3424; }
html[data-dm-theme="dark"] body.dm-atmosphere--studio { --dm-atm-paper: #19261f; --dm-atm-soft: #2d3a31; }
html[data-dm-theme="dark"] body.dm-atmosphere--rhythm { --dm-atm-paper: #22242c; --dm-atm-soft: #343642; }
html[data-dm-theme="dark"] body.dm-atmosphere--retreat { --dm-atm-paper: #222820; --dm-atm-soft: #343e2f; }
html[data-dm-theme="dark"] body.dm-atmosphere--outdoors { --dm-atm-paper: #172a1f; --dm-atm-soft: #294431; }

html[data-dm-theme="dark"] body.dm-article-edition :is(
  .dm-article-title-group,
  .dm-article-intro,
  .dm-edition-opening,
  .dm-guide-experience,
  .dm-guide-context,
  .dm-edition-chapter,
  .dm-edition-diagram,
  .dm-edition-board,
  .dm-saveable-plate__paper,
  .dm-callout,
  .dm-faq,
  .dm-sources,
  .dm-production-note,
  .dm-checklist,
  .dm-mid-route,
  .dm-article-lab,
  .dm-pin-guide,
  .dealsmaster-voice-card,
  .dm-story-route,
  .dmtp-visual,
  .dm-article-lab__result
) {
  border-color: var(--dm-atm-line) !important;
  color: var(--dm-atm-ink) !important;
  background-color: var(--dm-atm-paper) !important;
  box-shadow: 0 24px 66px rgba(0, 0, 0, .4) !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-guide-experience {
  --dm-guide-paper: #19271f !important;
  --dm-guide-paper-2: #22342a !important;
  --dm-guide-ink: #f7eee3 !important;
  --dm-guide-muted: #d5c8b9 !important;
  --dm-guide-line: rgba(247, 235, 219, .27) !important;
  background-color: var(--dm-guide-paper) !important;
}

html[data-dm-theme="dark"] body.dm-article-edition :is(
  .dm-reader-button,
  .dm-unit-control button,
  .dm-guide-quickbar a,
  .dm-guide-quickbar button,
  .dm-nav-drawer__close,
  .dm-reading-sheet header button
) {
  border-color: rgba(247, 235, 219, .27) !important;
  color: #f7eee3 !important;
  background: #293a30 !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-article-content :is(p, li, dd, figcaption, small, td) {
  color: var(--dm-atm-muted) !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-article-content :is(h1, h2, h3, h4, h5, h6, strong, dt, th, summary) {
  color: var(--dm-atm-ink) !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-article-content :is(
  .dm-kicker,
  .dm-edition-detail__eyebrow,
  .dm-edition-detail__label,
  .dm-gr__step-label,
  .dm-us__eyebrow
) {
  color: #f1cf7a !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-edition-chapter__tab span {
  color: var(--dm-atm-accent-strong, #f1cf7a) !important;
  opacity: 1 !important;
}

/* Bespoke and legacy guides occasionally carry translucent inline paper.
   These are the text-bearing plates that must remain solid in every system. */
html[data-dm-theme="dark"] body.dm-article-edition :is(
  .dm-ps__tool,
  .dm-ps__prompt-grid li,
  .dm-ps__light-cell,
  .dm-ps__table-wrap,
  .dm-ps__case,
  .dm-ps__safety,
  .dm-ps__safety-grid section,
  .dm-five-pet .pet-field-card,
  .dm-five-pet .pet-panel,
  .dm-five-pet .pet-answer,
  .dm-five-tv .tv-panel,
  .dm-five-tv .tv-answer,
  .dm-gr__detail,
  .dm-hp__passport,
  .dm-hp__map,
  .dm-hb__case,
  .dm-ns__audit,
  .dm-us__form,
  .dm-tu__sheet,
  .dm-art01 .dm-panel,
  .dm-art02 .dm-panel,
  .dm-art03 .dm-panel,
  .dm10-visual,
  .dm10-note,
  .dm10-limit,
  .dm10-table-scroll,
  .dm10-ledger
) {
  border-color: rgba(247, 235, 219, .27) !important;
  color: #f7eee3 !important;
  background-color: #1d2b24 !important;
  background-image: none !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, .055), 0 20px 54px rgba(0, 0, 0, .32) !important;
}

html[data-dm-theme="dark"] body.dm-article-edition :is(
  .dm-ps__tool,
  .dm-five-pet .pet-field-card,
  .dm-five-tv .tv-panel,
  .dm-gr__detail,
  .dm-hp__passport,
  .dm-hb__case,
  .dm-ns__audit,
  .dm-us__form,
  .dm-tu__sheet,
  .dm10-visual,
  .dm10-note,
  .dm10-limit,
  .dm10-ledger
) :is(p, li, dd, figcaption, small) {
  color: #d5c8b9 !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-ps :is(.dm-ps__meta li, .dm-ps__next a) {
  border-color: rgba(247, 235, 219, .27) !important;
  background: #24342b !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-hb .dm-hb__header {
  color: #f7eee3 !important;
  background:
    radial-gradient(circle at 86% 14%, rgba(143, 174, 153, .2), transparent 19rem),
    linear-gradient(132deg, #17231d, #24352b 62%, #344334) !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-hb .dm-hb__eyebrow {
  color: #f1cf7a !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-hb .dm-hb__dek {
  color: #d5c8b9 !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-hb .dm-hb__profile-art::after {
  content: "" !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm10-books .dm10-stress li::before,
html[data-dm-theme="dark"] body.dm-article-edition .dm10-vinyl .dm10-vinyl-chain span:not(:last-child)::after,
html[data-dm-theme="dark"] body.dm-article-edition .dm10-coffee-route .dm10-route-map li::before,
html[data-dm-theme="dark"] body.dm-article-edition .dm-hp__route li::before,
html[data-dm-theme="dark"] body.dm-article-edition .dm10-linen .dm10-loop li:not(:last-child)::after,
html[data-dm-theme="dark"] body.dm-article-edition .dm10-shower .dm10-shower-path div:not(:last-child)::after {
  color: #f1cf7a !important;
  opacity: 1 !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-ns__zone--touch::before {
  color: #a8d8bd !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-ns__zone--dry::before {
  color: #f1a48c !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-ns__zone--power::before {
  color: #f1cf7a !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-us .dm-us__triangle::after {
  border-color: rgba(247, 235, 219, .42) !important;
  color: #f1cf7a !important;
  background: #1a2720 !important;
  opacity: 1 !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm10-closet .dm10-plan::after {
  border: 1px solid rgba(247, 235, 219, .27) !important;
  color: #f7eee3 !important;
  background: #2f4236 !important;
  opacity: 1 !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-us__status--stop::before {
  color: #fff8ee !important;
  background: #742f27 !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-us__status--verify::before {
  color: #fff8ee !important;
  background: #665019 !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-us__status--explore::before {
  color: #fff8ee !important;
  background: #285039 !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-gr__room-plan div {
  border-color: rgba(247, 235, 219, .27) !important;
  color: #f7eee3 !important;
  background: #27372e !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-gr__room-plan .dm-gr__sofa {
  background: #374238 !important;
}

html[data-dm-theme="dark"] body.dm-article-edition .dm-gr__room-plan .dm-gr__clear {
  background: #234034 !important;
}

html[data-dm-theme="dark"] body.dm-article-edition :is(
  .dm-ps__diagram,
  .dm-provenance,
  .pet-provenance,
  .tv-provenance,
  .dm5-outcomes
) {
  border-color: rgba(247, 235, 219, .27) !important;
  color: #d5c8b9 !important;
  background: #1a2720 !important;
}

html[data-dm-theme="dark"] body.dm-article-edition :is(
  .dm-provenance,
  .pet-provenance,
  .tv-provenance,
  .dm5-outcomes
) strong {
  color: #f7eee3 !important;
}

html[data-dm-theme="dark"] :is(
  .dm-visual-journey__header > p,
  .dm-visual-journey .dm-story-meta,
  .dm-after-article p,
  .dm-image-dialog p
) {
  color: #d5c8b9 !important;
  opacity: 1 !important;
}

html[data-dm-theme="dark"] :is(.dm-reading-dock, .dm-image-dialog, .dm-image-study, .dm-image-dialog__close) {
  border-color: rgba(247, 235, 219, .3) !important;
  color: #f7eee3 !important;
  background: #17241d !important;
}

/* Directory and footer complete the route without fading at the edges. */
html[data-dm-theme="dark"] .dm-guide-directory .dm-finder-form,
html[data-dm-theme="dark"] .dm-guide-directory .dm-finder-footer,
html[data-dm-theme="dark"] :is(.dm-query-grid .wp-block-post, .wp-block-query .wp-block-post, .dm-empty-collection, .dm-empty-routes a) {
  border-color: rgba(247, 235, 219, .27) !important;
  color: #f7eee3 !important;
  background-color: #1a2720 !important;
}

html[data-dm-theme="dark"] .dm-site-footer {
  color: #f7eee3;
  border-top-color: rgba(247, 235, 219, .25) !important;
}

html[data-dm-theme="dark"] .dm-site-footer :is(.dm-footer-route, .dm-back-to-top, .dm-footer-snapshot) {
  border-color: rgba(247, 235, 219, .24) !important;
  color: #f7eee3 !important;
  background-color: #17271f !important;
}

html[data-dm-theme="dark"] .dm-site-footer :is(p, li, small, .dm-footer-note) {
  color: #d5c8b9 !important;
}

html[data-dm-theme="dark"] .dm-site-footer .dm-footer-grid a {
  color: #e8dccd !important;
  opacity: 1 !important;
}

html[data-dm-theme="dark"] .dm-rail-controls button:disabled {
  border-color: rgba(247, 235, 219, .18) !important;
  color: #9e9285 !important;
  background: #18231d !important;
  opacity: .52 !important;
  cursor: not-allowed;
}

@media (forced-colors: active) {
  html[data-dm-theme="dark"] :is(.dm-desk-story, .dm-atmosphere-portal__card, .dm-reset-lab__result) {
    border: 1px solid CanvasText !important;
  }
}

@media print {
  html[data-dm-theme="dark"] {
    --dm-theme-page: #fff;
    --dm-theme-panel: #fff;
    --dm-theme-ink: #111;
    --dm-theme-muted: #333;
  }
}
