/* Theme the existing Dresscode controls as pairs of foreground and surface. */
html[data-theme="dark"] body:has(#catalogElement, #main > #news, #main > #empty) #main > h1,
html[data-theme="dark"] #catalogElement :is(.changePrice, .changePrice .measure,
  .detail-deliveries-heading, .delivery-paysystems-heading, .delivery-paysystems-sub-heading,
  #delivery .wrap h3, #guarantee .wrap h3) {
  color: var(--dh-text, #eeefeb) !important;
}
html[data-theme="dark"] #catalogElement :is(#elementTools, #elementTools .fixContainer, #browse .propertyTable,
  #browse .propertyTable .propertyName, #browse .propertyTable .propertyValue, .detail-deliveries-loader) {
  background-color: var(--dh-card, #2c2f32) !important;
  border-color: var(--dh-border, #464a46);
  color: var(--dh-text, #eeefeb) !important;
}
html[data-theme="dark"] #catalogElement :is(#elementTools .priceVal, #elementTools .measure,
  .detail-deliveries-loader-text, #browse .reviewsBtnWrap .label, #browse .labelDotted) {
  color: var(--dh-text, #eeefeb) !important;
}
html[data-theme="dark"] #catalogElement #browse .reviewsBtnWrap span {
  color: var(--dh-text, #eeefeb) !important;
}

html[data-theme="dark"] #catalogElement :is(.detail-delivery-paysystems, .qtyBlock,
  .qtyBlockContainer .qty, .mobileButtonsContainer :is(.fastBack, .count_cost),
  #elementProperties .detailPropertiesTable td, .deliveries-tab-switcher) {
  background-color: var(--dh-card, #2c2f32) !important;
  border-color: var(--dh-border, #464a46);
  color: var(--dh-text, #eeefeb) !important;
}
html[data-theme="dark"] #catalogElement #elementProperties .detailPropertiesTable tr:nth-child(odd) td {
  background-color: #25282b !important;
}
html[data-theme="dark"] #catalogElement :is(#elementProperties .detailPropertiesTable,
  #delivery .wrap, #guarantee .wrap) a,
html[data-theme="dark"] #catalogElement #delivery .wrap a span {
  color: #ffbb78 !important;
}
html[data-theme="dark"] #catalogElement :is(.delivery-paysystems-description, .delivery-item-name) {
  color: var(--dh-muted, #babeb5) !important;
}
html[data-theme="dark"] #catalogElement .deliveries-tab-item.selected .deliveries-tab-switcher {
  background-color: #553a24 !important;
  color: #ffdab4 !important;
}
html[data-theme="dark"] #catalogElement .delivery-item-question {
  display: inline-grid;
  place-items: center;
  background: var(--dh-card, #2c2f32);
  border-color: #777d7e;
  color: var(--dh-text, #eeefeb);
  text-decoration: none;
}
html[data-theme="dark"] #catalogElement .delivery-item-question::before {
  content: "?";
  font-weight: 700;
}
html[data-theme="dark"] #catalogElement .delivery-paysystems-images img {
  box-sizing: border-box;
  max-width: 100%;
  height: auto;
  padding: 6px 8px;
  border-radius: 5px;
  background: #fff;
}
html[data-theme="dark"] #catalogElement .inStock {
  color: #a1d483 !important;
}
#catalogElement :is(.addCartContainer > .addCart, .delivery-item-buy),
#catalogElement .addCartContainer > .addCart span {
  color: #24170d !important;
}
#catalogElement :is(.addCartContainer > .addCart, .delivery-item-buy) {
  background-color: #ffad60;
}
#catalogElement .addCartContainer > .addCart img {
  filter: brightness(0.2);
}
html[data-theme="light"] #catalogElement .inStock { color: #46712c !important; }
html[data-theme="dark"] #catalogElement .deliveries-tab-switcher:focus-visible,
html[data-theme="dark"] #catalogElement .mainTool a:focus-visible,
.dh-interior-sets a:focus-visible {
  outline: 2px solid #d37a2b;
  outline-offset: 2px;
}

@media (max-width: 768px) {
  #catalogElement #elementContainer > #delivery { order: 10; }
  #catalogElement #elementContainer > #guarantee { order: 11; }
  #catalogElement .mobileButtonsContainer .qtyBlockContainer {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  #catalogElement .mobileButtonsContainer .qtyBlockContainer :is(.qty, .minus, .plus) {
    box-sizing: border-box;
  }
  #catalogElement #elementProperties .stats,
  #catalogElement #elementProperties .stats tbody {
    display: block;
    box-sizing: border-box;
    width: 100%;
    padding: 0;
  }
  #catalogElement #elementProperties .stats tr {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  }
  #catalogElement #elementProperties .stats td {
    display: block;
    min-width: 0;
    width: auto;
    padding: 8px 10px;
    overflow-wrap: anywhere;
  }
  #catalogElement #elementProperties .stats .cap td { grid-column: 1 / -1; }
  #catalogElement #elementProperties .stats td.right {
    grid-column: 2;
    padding: 0 10px;
  }
  html[data-theme="light"] #catalogElement #elementProperties > h2.heading { color: #24170d !important; }
  html[data-theme="dark"] #catalogElement #elementContainer :is(
    #delivery, #guarantee, #collection, #similar, #elementProperties,
    #description, #newReview, #complect, #storesContainer) > h2.heading {
    background-color: var(--dh-card, #2c2f32) !important;
    color: var(--dh-text, #eeefeb) !important;
    box-shadow: inset 0 0 0 1px var(--dh-border, #464a46);
  }
  html[data-theme="dark"] #catalogElement #elementContainer :is(
    #delivery, #guarantee, #collection, #similar, #elementProperties,
    #description, #newReview, #complect, #storesContainer) > h2.heading.active {
    background-color: #39322b !important;
    color: #ffdab4 !important;
  }
  html[data-theme="dark"] #catalogElement #elementContainer h2.heading::after {
    filter: invert(0.8);
  }
}

/* Preserve the photos and existing links; use shared contrast tokens for captions. */
.dh-interior-sets { color: var(--dh-text, #303237); }
.dh-interior-sets :is(.dh-set-card, .dh-detail-grid, .dh-set-product) { min-width: 0; }
.dh-interior-sets :is(.dh-set-title h3, .dh-set-product > span) { overflow-wrap: anywhere; }
.dh-interior-sets :is(.dh-set-card li span, .dh-set-product small, .dh-sets-note) {
  color: #555953;
}
html[data-theme="dark"] .dh-interior-sets :is(.dh-set-card li span, .dh-set-product small, .dh-sets-note, .dh-detail-grid p) {
  color: var(--dh-muted, #babeb5);
}
.dh-sets-heading > a { color: #8f4800; }
html[data-theme="dark"] .dh-sets-heading > a { color: #ffbb78; border-color: #ad7340; }
.dh-interior-sets .dh-set-image > span {
  background: #26282bed;
  color: #fff;
}
.dh-interior-sets .dh-set-image:hover > span { background: #34302c; }
.dh-set-detail > a:first-child {
  display: inline-block;
  padding-block: 8px;
  color: #8f4800;
}
.dh-set-detail .dh-showcase-cta {
  box-sizing: border-box;
  max-width: 100%;
  min-height: 44px;
  background-color: #ffad60;
  color: #24170d !important;
  text-align: center;
  white-space: normal;
}
html[data-theme="dark"] .dh-set-detail > a:first-child { color: #ffbb78; }
.dh-set-detail .dh-showcase-cta:hover,
.dh-set-detail .dh-showcase-cta:focus-visible { background-color: #ffc488; }

@media (max-width: 700px) {
  .dh-set-detail .dh-detail-hero {
    display: block;
    max-height: 480px;
    object-position: center;
  }
}

/* Shared fixes are scoped to non-catalog pages for this release. */
html[data-theme="dark"] #main > #news #newsContainer :is(.title, .description) .middle {
  color: var(--dh-text, #eeefeb);
}
html[data-theme="dark"] #main:has(> #news) #personalMenu a,
html[data-theme="dark"] #main > #empty :is(.emptyMenu a, .info p a) {
  color: var(--dh-text, #eeefeb) !important;
}
html[data-theme="dark"] #main:has(> #news) #personalMenu a:hover,
html[data-theme="dark"] #main > #empty a:not(.back):hover {
  color: #ffbb78 !important;
}
#main #news > #newsContainer { margin-inline: 0; }
#main #news #newsContainer a.more,
#main .dh-project-button,
body:has(.dh-factory-grid) #analog a {
  background-color: #ffad60 !important;
  color: #24170d !important;
}
body:has(.dh-factory-grid) .dh-factory-content :is(strong, .dh-factory-action) { color: #575b55; }
#main #empty a.back { color: #8f4800; }
html[data-theme="dark"] #main #empty a.back { color: #ffbb78; }
