/* Хамовники palette: warm paper, cream surfaces and the existing Bordeaux accent. */
html[data-deco-theme="light"] {
  color-scheme: light;
  --deco-paper: #f5f2ed;
  --deco-surface: #fffdf8;
  --deco-ink: #25211c;
  --deco-muted: #60584d;
  --deco-line: #d5cabb;
  --deco-gold: #6b512e;
}

body[data-detail-selected] .deco-theme-toggle {
  flex: none;
  border: 0;
  color: inherit;
  background: transparent;
  padding: 0;
}

body[data-detail-selected] .deco-theme-toggle svg {
  width: 22px;
  height: 22px;
  fill: #84251c;
  stroke: none;
}

html[data-deco-theme="dark"] body[data-detail-selected] .deco-theme-toggle svg {
  fill: none;
  stroke: #f5f2ed;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

/* Match the Khamovniki contact button in both header states. */
html[data-deco-theme] body[data-detail-selected] .lab-header .lhd-contact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px !important;
  background: var(--atlas-red) !important;
  color: #fff !important;
  font: 400 16px/1.2 "Golos Text", Arial, sans-serif !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

html[data-deco-theme] body[data-detail-selected] .lab-header .lhd-contact:is(:hover, :focus-visible, [aria-expanded="true"]) {
  background: var(--atlas-red-hover) !important;
  color: #fff !important;
}

body[data-detail-selected] .lab-header .lhd-contact::after { content: none; }
body[data-detail-selected] .lab-header .lhd-contact > svg { display: none; }

@media (max-width: 760px) {
  html[data-deco-theme] body[data-detail-selected] .lab-header .lhd-contact {
    padding: 8px 10px !important;
    font-size: 13px !important;
  }
}

@media (max-width: 380px) {
  body[data-detail-selected] .lhd-top { gap: 4px; padding-inline: 6px; }
  body[data-detail-selected] .lhd-tools .header-icon { width: 32px; min-width: 32px; }
}

html[data-deco-theme="light"] body[data-detail-selected] {
  --canvas: var(--deco-paper);
  --white: var(--deco-ink);
  --muted: var(--deco-muted);
  --line: var(--deco-line);
  --gold: var(--deco-gold);
  --bordeaux-soft-ink: var(--deco-ink);
  background: var(--deco-paper);
  color: var(--deco-ink);
}

/* Keep text on photography white, including the transparent header at the top. */
html[data-deco-theme="light"] body[data-detail-selected] :is(#hero, #genplan, #viewing, .lab-header) {
  --white: #f5f2ed;
  --muted: #e0d9cf;
  --gold: #c9ad7c;
  color: #f5f2ed;
}

html[data-deco-theme="light"] body[data-detail-selected] .lab-header:is([data-solid="true"], [data-preview-surface="page"], .open) {
  background: var(--deco-paper);
  color: var(--deco-ink);
  box-shadow: 0 1px 0 var(--deco-line);
  text-shadow: none;
}

html[data-deco-theme="light"] body[data-detail-selected] .lab-header:is([data-solid="true"], [data-preview-surface="page"], .open)
  :is(.lhd-deco, .lhd-atlas, .lhd-atlas small, .lhd-menu, .header-icon, .lhd-sections a) {
  color: var(--deco-ink) !important;
}

html[data-deco-theme="light"] body[data-detail-selected] .lab-header:is([data-solid="true"], [data-preview-surface="page"], .open) .lhd-sections {
  background: var(--deco-paper);
  border-color: var(--deco-line);
}

html[data-deco-theme="light"] body[data-detail-selected] :is(
  .about-v, #expert, .exv-stage, .exv-card, #location, #plans,
  #purchase, #construction, .bordeaux-build-pair, #articles,
  #materials, #questions, #related, #related .rcard
) {
  background-color: var(--deco-paper) !important;
  color: var(--deco-ink);
}

html[data-deco-theme="light"] body[data-detail-selected] :is(
  #materials .material-doc, #articles .arx-card,
  #location .location-categories, #location .location-layout
) {
  background: var(--deco-surface) !important;
  border-color: var(--deco-line);
  color: var(--deco-ink);
}

html[data-deco-theme="light"] body[data-detail-selected] :is(
  #about-title, #exv-title, .exv-name, #location-title, #buy5-title, #cbx5-title,
  #arx-title, #materials h2, #fqx-title, #related-related-title, .av-panel h3,
  #articles .arx-card h3, #materials .material-doc strong,
  #materials .material-arrow, #questions summary, #related .cc-rooms a span:last-child
) { color: var(--deco-ink) !important; }

html[data-deco-theme="light"] body[data-detail-selected] :is(
  #about-title span, .av-passport dd, .exv-body h3, #location-title span,
  #buy5-title span, #cbx5-title span, #arx-title span, #materials h2 span, #fqx-title span,
  #articles .arx-read, #articles .arx-all
) { color: var(--deco-gold) !important; }

html[data-deco-theme="light"] body[data-detail-selected] :is(
  .av-panel p, .av-passport dt, .exv-lead, .exv-body p, #location .location-heading p,
  #articles .arx-card p, #materials .material-doc small,
  #questions .fqx-a p, #related .cc-location, #related .cc-metro,
  #related .cr-station, #related .cr-walk, #related .cc-rooms a span:first-child, #related .cc-missing
) { color: var(--deco-muted) !important; }

html[data-deco-theme="light"] body[data-detail-selected] :is(
  .av-tabs, .av-passport, .av-passport div, .fqx-q, #articles .arx-grid,
  #articles .arx-card, #related .cc-rooms, #related .cc-rooms a
) { border-color: var(--deco-line) !important; }

html[data-deco-theme="light"] body[data-detail-selected] :is(
  .av-tabs button:not([aria-selected="true"]), .build-months button:not([aria-selected="true"]),
  #related .filters button:not([aria-selected="true"]), #related .rail-controls button,
  #location .location-categories button:not([aria-pressed="true"]), .deco-more
) {
  border-color: var(--deco-line);
  color: var(--deco-ink) !important;
}

html[data-deco-theme="light"] body[data-detail-selected] #location :is(.lab-place, .lab-place b, .location-yandex) {
  color: var(--deco-ink) !important;
}

html[data-deco-theme="light"] body[data-detail-selected] #location .lab-place small {
  color: var(--deco-muted);
}

html[data-deco-theme="light"] body[data-detail-selected] #construction .build-months button[aria-selected="true"] {
  background: #84251c;
  border-color: #84251c;
  color: #f5f2ed;
}

html[data-deco-theme="light"] body[data-detail-selected][data-card-choice][data-card-directions][data-card-overlay] #related .cc-offers {
  background: var(--atlas-sand, #c9ad7c) !important;
  border-color: #93764b !important;
  color: var(--deco-ink) !important;
}

html[data-deco-theme="light"] body[data-detail-selected][data-card-choice][data-card-directions][data-card-overlay] #related .cc-offers:is(:hover, :focus-visible) {
  background: #d9c49d !important;
  color: var(--deco-ink) !important;
}

html[data-deco-theme="light"] body[data-detail-selected] #related .cr-station svg {
  color: var(--atlas-red, #84251c) !important;
}

html[data-deco-theme="light"] body[data-detail-selected] #location .lab-place[aria-pressed="true"] span {
  color: var(--deco-gold);
}

html[data-deco-theme="light"] body[data-detail-selected] #related .cc-media .cc-tools button {
  color: #f5f2ed !important;
}

html[data-deco-theme="light"] body[data-detail-selected] #related .cc-fallback :is(p, span, strong, small) {
  color: var(--deco-muted) !important;
}

body[data-detail-selected] :is(.ba-footer, #viewing.buy5-visit) {
  color-scheme: dark;
  --canvas: #080808;
  --white: #f5f2ed;
  --muted: #c4c0b8;
  --line: #38352f;
  --gold: #c9ad7c;
  background-color: #080808;
  color: #f5f2ed;
}

@media (max-width: 422px) {
  html:has(link[rel="canonical"][href="https://blackatlas.ru/level-yuzhnoportovaya/"]) body[data-detail-selected] .lab-header .lhd-top {
    gap: 4px;
    padding-inline: 6px;
  }
  html:has(link[rel="canonical"][href="https://blackatlas.ru/level-yuzhnoportovaya/"]) body[data-detail-selected] .lab-header .lhd-tools .header-icon {
    width: 34px;
    min-width: 34px;
  }
  html[data-deco-theme]:has(link[rel="canonical"][href="https://blackatlas.ru/level-yuzhnoportovaya/"]) body[data-detail-selected] .lab-header .lhd-contact[data-demo-pill] {
    padding-inline: 7px !important;
    gap: 5px !important;
  }
  html:has(link[rel="canonical"][href="https://blackatlas.ru/level-yuzhnoportovaya/"]) body[data-detail-selected] .lab-header .lhd-contact .demo-pill-icon {
    flex-basis: 32px !important;
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
  }
}

@media (max-width: 365px) {
  html:has(link[rel="canonical"][href="https://blackatlas.ru/level-yuzhnoportovaya/"]) body[data-detail-selected] .lab-header .lhd-top {
    gap: 3px;
    padding-inline: 4px;
  }
  html:has(link[rel="canonical"][href="https://blackatlas.ru/level-yuzhnoportovaya/"]) body[data-detail-selected] .lab-header .lhd-menu {
    width: 32px;
    min-width: 32px;
  }
  html:has(link[rel="canonical"][href="https://blackatlas.ru/level-yuzhnoportovaya/"]) body[data-detail-selected] .lab-header .lhd-tools .header-icon {
    width: 32px;
    min-width: 32px;
  }
  html[data-deco-theme]:has(link[rel="canonical"][href="https://blackatlas.ru/level-yuzhnoportovaya/"]) body[data-detail-selected] .lab-header .lhd-contact[data-demo-pill] {
    padding-inline: 4px !important;
    gap: 4px !important;
    margin-left: 2px;
    font-size: 12px !important;
  }
  html:has(link[rel="canonical"][href="https://blackatlas.ru/level-yuzhnoportovaya/"]) body[data-detail-selected] .lab-header .lhd-contact .demo-pill-icon {
    flex-basis: 26px !important;
    width: 26px !important;
    min-width: 26px !important;
    height: 26px !important;
  }
}
