/* ==========================================================================
   DS GARDEN MAGAZINE v19 — ИСПРАВЛЕНИЕ ШРИФТОВ И ФУТЕРА
   ========================================================================== */

@layer reset, helix, theme, editorial, mobile, print;

/* =========================================================
   ROOT (переменные)
========================================================= */
@layer theme {
:root {
  --primary-green: #bfdbaa;
  --secondary-green: #5f7a4a;
  --dark-green: #324a32;
  --bg-main: #fcf8f1;
  --bg-soft: #f5efe4;
  --bg-table: #f6f0e6;
  --text-primary: #2c2a29;
  --text-secondary: #5f5b56;
  --border-light: #e6ddd0;
  --accent-red: #d97757;
  --accent-warm: #c9a14a;
  --accent-pink: #d98c9b;
  --accent-good: #89a96f;
  --accent-peach: #e0a878;
  --accent-mint: #7faa6b;
  --accent-blue: #7b9bb6;
  --accent-orange: #d98841;
  --accent-purple: #b588b0;
  --accent-gold: #deb887;
  --radius-sm: 10px;
  --radius-md: 18px;
  --shadow-soft: 0 8px 30px rgba(44,42,41,.04);
  --shadow-hover: 0 12px 40px rgba(44,42,41,.08);
  --font-serif: Georgia, "Times New Roman", serif;
  --font-sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --transition-fast: 0.2s ease;
  --transition-slow: 0.6s ease;
  --table-header-bg: #2c4a2c;
}

/* Убираем тёмный/чёрный фон Helix */
body, html, #sp-header, #sp-footer, .body-innerwrapper, .offcanvas-menu {
  background-color: var(--bg-main) !important;
  color: var(--text-primary) !important;
}
}

/* =========================================================
   RESET
========================================================= */
@layer reset {
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  overflow-x: hidden;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
}

/* =========================================================
   HELIX & FRAMEWORK CLEAN — ПОЛНОЕ УДАЛЕНИЕ ФОНОВ
========================================================= */
@layer helix {
  /* ВСЕ элементы внутри статьи — прозрачные */
  .com-content-article *, 
  .item-page *, 
  .article-content *, 
  .entry-content *,
  #sp-component *,
  .sp-single-article * {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
  }
  
  /* Особенно параграфы и их обёртки */
  .com-content-article p, 
  .item-page p, 
  .article-content p,
  .entry-content p,
  .com-content-article div, 
  .item-page div, 
  .article-content div,
  .entry-content div {
    background: transparent !important;
    background-color: transparent !important;
  }

  /* Восстанавливаем фон ТОЛЬКО у необходимого */
  .ds-table-wrap, .table-responsive { background: var(--bg-table) !important; }
  th { background: var(--table-header-bg) !important; }
  [class^="ds-"]:not(.ds-divider), [class*=" ds-"]:not(.ds-divider) { background: var(--bg-soft) !important; }
  button, .btn, .ds-button, input[type="submit"] { background: var(--primary-green) !important; }
  .tags a, .item-tags a, .ds-tags a { background: var(--bg-soft) !important; }
  input, select, textarea { background: #fff !important; }

  /* ✅ ИСПРАВЛЕНИЕ ФУТЕРА: принудительно светлый */
  #sp-footer {
    background-color: var(--bg-main) !important;
    color: var(--text-primary) !important;
    border-top: 1px solid var(--border-light);
  }
  #sp-footer a { color: var(--dark-green) !important; }

  :root {
    --bs-body-bg: var(--bg-main) !important;
    --bs-light: transparent !important;
  }
}

/* =========================================================
   ОСНОВНОЙ КОНТЕЙНЕР СТАТЬИ
========================================================= */
@layer theme {
.ds-article-container,
#sp-component,
.com-content-article,
.item-page,
.article-details,
.sp-single-article {
  max-width: 940px;
  margin-left: auto;
  margin-right: auto;
  padding: 18px 28px 72px;
}

#sp-component > .container,
#sp-component > .row,
#sp-main-body > .container {
  max-width: 100%;
  padding-left: 0;
  padding-right: 0;
  margin-left: 0;
  margin-right: 0;
}

.com-content-article [itemprop="articleBody"],
.article-body,
.ds-article-content {
  max-width: 100%;
  margin: 0 auto;
}
}

/* =========================================================
   ТИПОГРАФИКА
========================================================= */
@layer theme {
.article-content p, .item-page p, .entry-content p,
.com-content-article p {
  max-width: 68ch;
  margin: 0 auto 1.4rem;
  line-height: 1.92;
}

.lead,
.article-content p.lead,
.entry-content p.lead {
  font-size: clamp(1.1rem, 2.2vw, 1.25rem);
  line-height: 1.5;
  color: var(--secondary-green);
  font-weight: 500;
  margin-bottom: 1.8rem;
  max-width: 72ch;
}

.dropcap::first-letter {
  font-size: 3.5rem;
  font-family: var(--font-serif);
  float: left;
  line-height: 0.85;
  margin-right: 0.6rem;
  color: var(--dark-green);
  font-weight: 500;
}

hr, .separator {
  max-width: 120px;
  margin: 2.5rem auto;
  border: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary-green), transparent);
}
}

/* =========================================================
   ССЫЛКИ И АНИМАЦИИ
========================================================= */
@layer theme {
a {
  color: var(--dark-green);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: all var(--transition-fast);
}
a:hover {
  color: var(--secondary-green);
  text-underline-offset: 5px;
}

button, .btn, .ds-button, input[type="submit"] {
  transition: all var(--transition-fast);
}
button:active, .btn:active, .ds-button:active {
  transform: scale(0.97);
}

a:focus-visible, button:focus-visible, .btn:focus-visible, input:focus-visible {
  outline: 2px solid var(--secondary-green);
  outline-offset: 2px;
  border-radius: 4px;
}
}

/* =========================================================
   ЗАГОЛОВКИ (ИСПРАВЛЕНИЕ ГИГАНТСКОГО ШРИФТА)
========================================================= */
@layer theme {
h1, h2, h3, h4, h5, h6 {
  color: var(--dark-green);
  font-family: var(--font-serif);
}

/* Убираем растягивающий calc() и ставим фиксированные размеры */
h1 { font-size: 2.2rem !important; }
h2 { font-size: 1.6rem !important; }
/* ✅ H3: нормальный размер, без гигантства */
h3 { font-size: 1.25rem !important; }

.article-content h1,
.entry-content h1,
.com-content-article h1 {
  position: relative;
  max-width: 18ch;
  margin: 1.6rem auto 3rem;
  text-align: center;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.article-content h1::before,
.article-content h1::after,
.entry-content h1::before,
.entry-content h1::after,
.com-content-article h1::before,
.com-content-article h1::after {
  content: "";
  display: block;
  width: clamp(80px, 18vw, 160px);
  height: 1px;
  margin: 0 auto;
  background: linear-gradient(90deg, transparent, #9fbe8a, transparent);
}

.article-content h1::before,
.entry-content h1::before,
.com-content-article h1::before { margin-bottom: 16px; }

.article-content h1::after,
.entry-content h1::after,
.com-content-article h1::after { margin-top: 18px; }

.article-content h2, .item-page h2, .entry-content h2 {
  max-width: 68ch;
  margin: 3rem auto 1.2rem;
  padding: .6rem 0 .6rem 1rem;
  border-left: 5px solid var(--primary-green);
  background: linear-gradient(90deg, rgba(239,246,231,.7), transparent);
}

/* ✅ H3: стили как были, но размер фиксированный */
.article-content h3, .item-page h3, .entry-content h3,
.com-content-article h3, h3 {
  max-width: 68ch;
  margin: 2.4rem auto 1rem;
  padding-left: .9rem;
  border-left: 3px solid var(--primary-green);
}
}

/* =========================================================
   СПИСКИ
========================================================= */
@layer theme {
.article-content ul, .article-content ol,
.item-page ul, .item-page ol,
.entry-content ul, .entry-content ol {
  max-width: 68ch;
  margin: 1rem auto 1.5rem;
  padding-left: 1.3rem;
}
li { margin-bottom: .6rem; }
ul ul, ol ol, ul ol, ol ul {
  margin: 0.5rem 0 0.5rem 1rem;
}
}

/* =========================================================
   ИЗОБРАЖЕНИЯ И ПОДПИСИ
========================================================= */
@layer theme {
.article-content img, .item-page img, .entry-content img {
  margin: 2rem auto;
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  transition: box-shadow var(--transition-fast);
}
.article-content img:hover, .item-page img:hover, .entry-content img:hover {
  box-shadow: var(--shadow-hover);
}

figcaption, .wp-caption-text, .img-caption {
  max-width: 68ch;
  margin: -1rem auto 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
}
}

/* =========================================================
   ТАБЛИЦЫ
========================================================= */
@layer theme {
.table-responsive, .ds-table-wrap {
  overflow-x: auto;
  margin: 2rem auto;
  background: var(--bg-table);
  border-radius: 10px;
}
table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  padding: 12px;
  background: var(--table-header-bg);
  color: #fff;
}
td {
  padding: 10px;
  border-bottom: 1px solid #e5dccf;
}
}

/* =========================================================
   ЦИТАТЫ
========================================================= */
@layer theme {
.article-content blockquote, .item-page blockquote, .entry-content blockquote {
  max-width: 68ch;
  margin: 2rem auto;
  padding-left: 1rem;
  border-left: 4px solid var(--primary-green);
  font-style: italic;
  color: var(--text-secondary);
}
blockquote footer, .ds-quote-author {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-style: normal;
  color: var(--dark-green);
}
}

/* =========================================================
   КНОПКИ
========================================================= */
@layer theme {
button, .btn, .ds-button, input[type="submit"] {
  padding: .9rem 1.4rem;
  border-radius: 999px;
  border: 0;
  background: var(--primary-green);
  font-weight: 700;
  cursor: pointer;
}
button:hover, .btn:hover, .ds-button:hover, input[type="submit"]:hover {
  background: var(--secondary-green);
  color: white;
}
}

/* =========================================================
   МЕТА-ДАННЫЕ И ТЕГИ
========================================================= */
@layer theme {
.article-info, .createdate, .modified, .published, .item-author, .ds-meta {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  max-width: 68ch;
  margin-left: auto;
  margin-right: auto;
}
.tags, .item-tags, .ds-tags {
  max-width: 68ch;
  margin: 1rem auto 1.5rem;
}
.tags a, .item-tags a, .ds-tags a {
  display: inline-block;
  background: var(--bg-soft);
  padding: 0.2rem 0.8rem;
  border-radius: 30px;
  font-size: 0.7rem;
  text-decoration: none;
  margin-right: 0.5rem;
  margin-bottom: 0.3rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.tags a:hover, .item-tags a:hover, .ds-tags a:hover {
  background: var(--primary-green);
  color: var(--dark-green);
}
}

/* =========================================================
   РЕДАКЦИОННЫЕ ВРЕЗКИ
========================================================= */
@layer editorial {
[class^="ds-"], [class*=" ds-"] {
  position: relative;
  max-width: 68ch;
  margin: 2rem auto;
  padding: 1rem 1.2rem 1rem 1.8rem;
  border-radius: 0 14px 14px 0;
  background: var(--bg-soft);
}

[class^="ds-"]::before, [class*=" ds-"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  border-radius: 3px 0 0 3px;
}

.ds-note::before, .ds-story::before, .ds-season::before,
.ds-buy::before, .ds-tools::before { background: var(--primary-green); }
.ds-warning::before { background: var(--accent-red); }
.ds-tip::before { background: var(--accent-warm); }
.ds-good::before { background: var(--accent-good); }
.ds-grandma::before { background: var(--accent-peach); }
.ds-fast::before { background: var(--accent-gold); }
.ds-budget::before { background: var(--accent-mint); }
.ds-calendar::before, .ds-moon::before { background: var(--accent-blue); }
.ds-recipe::before { background: var(--accent-orange); }
.ds-steps::before { background: var(--dark-green); }
.ds-save::before { background: var(--accent-purple); }

.ds-divider {
  max-width: 68ch;
  margin: 2rem auto;
  text-align: center;
  border: 0;
  position: relative;
  border-top: 1px solid var(--border-light);
  background: transparent;
}
.ds-divider::before {
  content: "✽ ✽ ✽";
  display: inline-block;
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.5rem;
  color: var(--text-secondary);
  background: var(--bg-main);
  padding: 0 1rem;
  position: relative;
  top: -0.6rem;
}
}

/* =========================================================
   СКРОЛЛБАР
========================================================= */
@layer theme {
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: var(--secondary-green); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--dark-green); }

html {
  scrollbar-width: thin;
  scrollbar-color: var(--secondary-green) var(--bg-soft);
}
}

/* =========================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
========================================================= */
@layer mobile {
@media (max-width: 768px) {
  :root { --mob-edge: 14px; }
  
  .ds-article-container, #sp-component, .com-content-article,
  .item-page, .article-details, .sp-single-article {
    padding: 8px var(--mob-edge) 40px;
  }
  #sp-header, #sp-footer, .container {
    padding-left: var(--mob-edge);
    padding-right: var(--mob-edge);
  }
  .row, .row-fluid { margin: 0; }
  
  .article-content p, .item-page p, .entry-content p,
  .article-content h1, .item-page h1, .entry-content h1,
  .article-content h2, .item-page h2, .entry-content h2,
  .article-content h3, .item-page h3, .entry-content h3,
  .article-content ul, .article-content ol, .item-page ul, .item-page ol,
  .article-content blockquote, .item-page blockquote,
  [class^="ds-"], [class*=" ds-"] {
    max-width: 100%;
  }
  
  body, p {
    font-size: 1rem;
    line-height: 1.55;
    margin-bottom: 1rem;
  }
  .lead {
    font-size: 1.125rem;
    line-height: 1.5;
    margin-bottom: 1.4rem;
  }
  .dropcap::first-letter {
    font-size: 2.4rem;
    margin-right: 0.35rem;
    line-height: 0.85;
  }
  h1, .article-content h1 {
    font-size: 1.25rem;
    line-height: 1.2;
    margin: 0.5rem 0 1.2rem;
  }
  h1::before, h1::after { width: 70px; }
  h2 {
    font-size: 1.45rem;
    line-height: 1.3;
    margin: 1.6rem 0 0.8rem;
    padding: 0.4rem 0 0.4rem 0.7rem;
    border-left-width: 4px;
  }
  h3 {
    font-size: 1.15rem;
    line-height: 1.35;
    margin: 1.4rem 0 0.7rem;
    padding-left: 0.7rem;
    border-left-width: 2px;
  }
  ul, ol, blockquote {
    margin: 0.8rem 0 1.2rem;
    padding-left: 1.1rem;
    line-height: 1.5;
  }
  hr, .separator, .ds-divider { margin: 1.4rem auto; }
  .ds-divider::before { font-size: 0.7rem; top: -0.55rem; }
  [class^="ds-"], [class*=" ds-"] {
    margin: 1rem 0;
    padding: 0.8rem 0.9rem 0.8rem 1.3rem;
    font-size: 1rem;
    line-height: 1.55;
    border-radius: 0 12px 12px 0;
  }
  .table-responsive, .ds-table-wrap { margin: 1.2rem 0; border-radius: 8px; }
  table { font-size: 0.85rem; min-width: auto; }
  th, td { padding: 6px 7px; }
  .article-content img, .item-page img, .entry-content img {
    margin: 1rem auto;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  }
  figcaption { font-size: 0.8rem; margin-top: -0.5rem; margin-bottom: 1rem; }
  .article-info, .createdate, .item-author { font-size: 0.8rem; line-height: 1.4; }
  .tags a { padding: 0.2rem 0.7rem; font-size: 0.8rem; }
  .ds-button, .btn.ds-button {
    display: block; width: 100%; text-align: center; padding: 0.75rem 1rem; font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  :root { --mob-edge: 12px; }
  .ds-article-container, #sp-component, .com-content-article, .item-page {
    padding: 8px var(--mob-edge) 32px;
  }
  #sp-header, #sp-footer, .container {
    padding-left: var(--mob-edge);
    padding-right: var(--mob-edge);
  }
  h1, .article-content h1 { font-size: 1.15rem; }
  h2 { font-size: 1.35rem; }
  blockquote { padding-left: 0.6rem; }
}
}

/* =========================================================
   REDUCED MOTION
========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  body { animation: none; }
}

/* =========================================================
   ПЕЧАТНАЯ ВЕРСИЯ
========================================================= */
@layer print {
@media print {
  body { background: #fff; color: #000; }
  a[href^="http"]::after { content: " (" attr(href) ")"; }
  a[href^="#"]::after, a[href^="/"]::after { content: ""; }
  button, form, .btn, .ds-button { display: none; }
  h1::before, h1::after { display: none; }
  img { box-shadow: none; }
  .ds-divider::before { background: transparent; }
  hr, .separator { background: #ccc; }
}
}