/* ============================================================
   ЦЕХ Блог — адаптивная светлая и мягкая тёмная тема
   ============================================================ */
html {
  transition: background-color .22s ease, color .22s ease;
}

/* Мягкий тёмный (по умолчанию для тёмных устройств) */
html[data-theme="dark"] {
  --bg: #141417;
  --text: #ececf0;
  --muted: #9b9ba7;
  --hair: rgba(255, 255, 255, .13);
  --hair-soft: rgba(255, 255, 255, .07);
  --lozenge: rgba(255, 255, 255, .07);
  --card-bg: #1c1c21;
  --form-bg: #18181c;
  --soft: #c9c9d1;
  --dim: #6f6f7b;
}

/* Светлая тема (для светлых устройств или по переключателю) */
html[data-theme="light"] {
  --bg: #f8f7f4;
  --text: #1b1b1f;
  --muted: #5c5c66;
  --hair: rgba(27, 27, 31, .14);
  --hair-soft: rgba(27, 27, 31, .08);
  --lozenge: rgba(27, 27, 31, .06);
  --card-bg: #ffffff;
  --form-bg: #f0eee8;
  --soft: #3a3a42;
  --dim: #787882;
  --dim2: #5c5c66;
  --dim3: #5c5c66;
}

html[data-theme="light"] body {
  background: var(--bg);
  color: var(--text);
}

html[data-theme="light"] .hdr,
html[data-theme="light"] header.hdr {
  background: rgba(248, 247, 244, .9);
  border-bottom-color: var(--hair-soft);
}

html[data-theme="light"] .hdr .brand img,
html[data-theme="light"] footer .ft-brand img,
html[data-theme="light"] .mnav .brand img {
  filter: invert(1) brightness(.15);
}

html[data-theme="light"] .mnav {
  background: var(--bg);
  color: var(--text);
}

html[data-theme="light"] .burger span {
  background: var(--text);
}

html[data-theme="light"] .post-card:hover {
  border-color: rgba(27, 27, 31, .35);
}

html[data-theme="light"] .btn-ghost {
  color: var(--text);
  border-color: var(--hair);
}

html[data-theme="light"] .btn-ghost:hover {
  background: rgba(27, 27, 31, .06);
}

html[data-theme="light"] .art-body table th {
  background: rgba(27, 27, 31, .05);
}

html[data-theme="light"] .art-body table td,
html[data-theme="light"] .art-body table th {
  border-color: var(--hair);
}

html[data-theme="light"] .callout {
  background: var(--card-bg);
  border-color: var(--hair);
}

html[data-theme="light"] .how {
  background: var(--card-bg);
  border-color: var(--hair);
}

html[data-theme="light"] .faq-item {
  border-color: var(--hair);
}

/* Адаптация интерактивных виджетов под светлую тему */
html[data-theme="light"] .tsekh-widget {
  background: #ffffff !important;
  border-color: rgba(27, 27, 31, .14) !important;
  color: #1b1b1f !important;
  box-shadow: 0 8px 28px rgba(20, 20, 25, .06);
}

html[data-theme="light"] .tsekh-widget button:not(.btn-primary),
html[data-theme="light"] .tsekh-widget input[type="number"] {
  color: #1b1b1f !important;
  border-color: rgba(27, 27, 31, .2) !important;
  background: #f5f4f0 !important;
}

html[data-theme="light"] .tsekh-widget a {
  color: #1b1b1f !important;
}

html[data-theme="light"] .tsekh-widget > div[style*="rgba(255,255,255,.04)"],
html[data-theme="light"] .tsekh-widget #wm-res,
html[data-theme="light"] .tsekh-widget #wa-verdict {
  background: #f5f4f0 !important;
  border-color: rgba(27, 27, 31, .12) !important;
}

html[data-theme="light"] .tsekh-widget #wa-score {
  color: #c8191e !important;
}

/* Кнопка-переключатель темы */
.tsekh-theme-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: var(--card-bg);
  color: var(--text);
  font-family: var(--body, sans-serif);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  transition: transform .18s ease, border-color .18s ease, background-color .2s ease;
}

.tsekh-theme-toggle:hover {
  transform: translateY(-2px);
}

@media (max-width: 600px) {
  .tsekh-theme-toggle {
    right: 12px;
    bottom: 12px;
    padding: 8px 12px;
    font-size: 11px;
  }
}
