/**
 * Переключатель темы + тёмная палитра поверх Minima 2.x (GitHub Pages).
 * Светлая — дефолтные стили main.css; тёмная и «система» задаются здесь.
 */

/* Плавающая кнопка темы (если когда-нибудь уберёте --embed) */
.theme-switcher:not(.theme-switcher--embed) {
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 100;
}

.theme-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(253, 253, 253, 0.95);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 12px;
}

.theme-switcher__label {
  margin-right: 4px;
  color: #666;
  user-select: none;
}

.theme-switcher__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  padding: 0 6px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: #555;
}

.theme-switcher__btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #111;
}

.theme-switcher__btn[aria-pressed="true"] {
  border-color: #2a7ae2;
  box-shadow: inset 0 0 0 1px #2a7ae2;
  color: #111;
}

.theme-switcher__btn:focus-visible {
  outline: 2px solid #2a7ae2;
  outline-offset: 2px;
}

/* ── Тёмная тема (явная или по системе) ── */
html[data-theme="dark"] .theme-switcher,
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .theme-switcher {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(40, 40, 40, 0.95);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
  }
}

html[data-theme="dark"] .theme-switcher__label,
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .theme-switcher__label {
    color: #aaa;
  }
}

html[data-theme="dark"] .theme-switcher__btn,
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .theme-switcher__btn {
    border-color: rgba(255, 255, 255, 0.2);
    color: #ccc;
  }
}

html[data-theme="dark"] .theme-switcher__btn:hover,
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .theme-switcher__btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
  }
}

html[data-theme="dark"] .theme-switcher__btn[aria-pressed="true"],
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .theme-switcher__btn[aria-pressed="true"] {
    border-color: #79a9f5;
    box-shadow: inset 0 0 0 1px #79a9f5;
    color: #fff;
  }
}

html[data-theme="dark"] body,
html[data-theme="dark"] .site-header,
html[data-theme="dark"] .site-footer {
  background-color: #1e1e1e;
  color: #e4e4e4;
  border-color: #3a3a3a;
}

html[data-theme="dark"] .site-header {
  border-top-color: #2a7ae2;
  border-bottom-color: #3a3a3a;
}

html[data-theme="dark"] .site-title,
html[data-theme="dark"] .site-title:visited {
  color: #f0f0f0 !important;
}

html[data-theme="dark"] .site-nav .page-link {
  color: #e4e4e4;
}

html[data-theme="dark"] .site-nav .menu-icon > svg {
  fill: #e0e0e0;
}

@media screen and (max-width: 600px) {
  html[data-theme="dark"] .site-nav {
    background-color: #2a2a2a;
    border-color: #444;
  }
}

html[data-theme="dark"] a,
html[data-theme="dark"] .post-link {
  color: #8ab4ff;
}

html[data-theme="dark"] a:visited {
  color: #b39ddb;
}

html[data-theme="dark"] .post-meta,
html[data-theme="dark"] .footer-col,
html[data-theme="dark"] .rss-subscribe {
  color: #aaa;
}

html[data-theme="dark"] .footer-heading {
  color: #eee;
}

html[data-theme="dark"] code,
html[data-theme="dark"] .highlighter-rouge {
  background: #2d2d2d !important;
  color: #e8e8e8;
}

html[data-theme="dark"] .highlight {
  background: #2d2d2d !important;
}

html[data-theme="dark"] .highlight pre {
  background: transparent !important;
  border: none;
}

html[data-theme="dark"] blockquote {
  color: #bbb;
  border-left-color: #555;
}

html[data-theme="dark"] table {
  color: inherit;
}

html[data-theme="dark"] table th,
html[data-theme="dark"] table td {
  border-color: #444;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) body,
  html:not([data-theme]) .site-header,
  html:not([data-theme]) .site-footer {
    background-color: #1e1e1e;
    color: #e4e4e4;
    border-color: #3a3a3a;
  }

  html:not([data-theme]) .site-header {
    border-top-color: #2a7ae2;
    border-bottom-color: #3a3a3a;
  }

  html:not([data-theme]) .site-title,
  html:not([data-theme]) .site-title:visited {
    color: #f0f0f0 !important;
  }

  html:not([data-theme]) .site-nav .page-link {
    color: #e4e4e4;
  }

  html:not([data-theme]) .site-nav .menu-icon > svg {
    fill: #e0e0e0;
  }

  @media screen and (max-width: 600px) {
    html:not([data-theme]) .site-nav {
      background-color: #2a2a2a;
      border-color: #444;
    }
  }

  html:not([data-theme]) a,
  html:not([data-theme]) .post-link {
    color: #8ab4ff;
  }

  html:not([data-theme]) a:visited {
    color: #b39ddb;
  }

  html:not([data-theme]) .post-meta,
  html:not([data-theme]) .footer-col,
  html:not([data-theme]) .rss-subscribe {
    color: #aaa;
  }

  html:not([data-theme]) .footer-heading {
    color: #eee;
  }

  html:not([data-theme]) code,
  html:not([data-theme]) .highlighter-rouge {
    background: #2d2d2d !important;
    color: #e8e8e8;
  }

  html:not([data-theme]) .highlight {
    background: #2d2d2d !important;
  }

  html:not([data-theme]) .highlight pre {
    background: transparent !important;
  }

  html:not([data-theme]) blockquote {
    color: #bbb;
    border-left-color: #555;
  }

  html:not([data-theme]) table th,
  html:not([data-theme]) table td {
    border-color: #444;
  }
}

/* Явно светлая тема при тёмной ОС */
html[data-theme="light"] body,
html[data-theme="light"] .site-header,
html[data-theme="light"] .site-footer {
  background-color: #fdfdfd !important;
  color: #111 !important;
}

html[data-theme="light"] .site-header {
  border-top-color: #424242 !important;
  border-bottom-color: #e8e8e8 !important;
}

html[data-theme="light"] .site-title,
html[data-theme="light"] .site-title:visited {
  color: #424242 !important;
}

html[data-theme="light"] .site-nav .page-link {
  color: #111 !important;
}

html[data-theme="light"] .site-nav .menu-icon > svg {
  fill: #424242 !important;
}

@media screen and (max-width: 600px) {
  html[data-theme="light"] .site-nav {
    background-color: #fdfdfd !important;
    border-color: #e8e8e8 !important;
  }
}

html[data-theme="light"] a,
html[data-theme="light"] .post-link {
  color: #2a7ae2 !important;
}

html[data-theme="light"] a:visited {
  color: #1756a9 !important;
}

html[data-theme="light"] .post-meta,
html[data-theme="light"] .footer-col,
html[data-theme="light"] .rss-subscribe {
  color: #828282 !important;
}

html[data-theme="light"] .footer-heading {
  color: #111 !important;
}

html[data-theme="light"] code,
html[data-theme="light"] .highlighter-rouge {
  background: #eef !important;
  color: #111 !important;
}

html[data-theme="light"] .highlight {
  background: #eef !important;
}

/* ── Тёмная тема: блоки из site.scss (сайдбар, превью, слоган) ── */
html[data-theme="dark"] .site-tagline,
html[data-theme="dark"] .site-sidebar__title,
html[data-theme="dark"] .site-sidebar__year-summary {
  color: #aaa !important;
}

html[data-theme="dark"] .site-sidebar__year-inner {
  border-left-color: #444 !important;
}

html[data-theme="dark"] .site-sidebar__all,
html[data-theme="dark"] .site-sidebar__archive-link {
  color: #e4e4e4 !important;
}

html[data-theme="dark"] .site-sidebar__theme {
  border-top-color: #3a3a3a !important;
}

html[data-theme="dark"] .post-preview-card {
  background: rgba(138, 180, 255, 0.08) !important;
  border-left-color: rgba(138, 180, 255, 0.45) !important;
}

html[data-theme="dark"] .post-teaser {
  color: #ccc !important;
}

html[data-theme="dark"] .post-categories {
  color: #999 !important;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .site-tagline,
  html:not([data-theme]) .site-sidebar__title,
  html:not([data-theme]) .site-sidebar__year-summary {
    color: #aaa !important;
  }

  html:not([data-theme]) .site-sidebar__year-inner {
    border-left-color: #444 !important;
  }

  html:not([data-theme]) .site-sidebar__all,
  html:not([data-theme]) .site-sidebar__archive-link {
    color: #e4e4e4 !important;
  }

  html:not([data-theme]) .site-sidebar__theme {
    border-top-color: #3a3a3a !important;
  }

  html:not([data-theme]) .post-preview-card {
    background: rgba(138, 180, 255, 0.08) !important;
    border-left-color: rgba(138, 180, 255, 0.45) !important;
  }

  html:not([data-theme]) .post-teaser {
    color: #ccc !important;
  }

  html:not([data-theme]) .post-categories {
    color: #999 !important;
  }
}

html[data-theme="light"] .site-sidebar__year-summary {
  color: #111 !important;
}
