/* ==========================================================================
   DS GARDEN MAGAZINE v18 — ПОЛНОЕ УДАЛЕНИЕ БЕЛЫХ ФОНОВ
   ========================================================================== */

/* =========================================================
   LAYERS
========================================================= */
@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;
}
}

/* =========================================================
   RESET (базовый фон для body)
========================================================= */
@layer reset {
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  overflow-x: hidden;
  background: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  animation: fadeIn var(--transition-slow);
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

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

/* =========================================================
   HELIX & FRAMEWORK CLEAN — ПОЛНОЕ ОБНУЛЕНИЕ ФОНОВ
   (кроме body и html, чтобы не сломать основной фон)
   ========================================================= */
@layer helix {
  /* 1. Универсальный сброс фона для ВСЕХ элементов, кроме body и html */
  *:not(body):not(html) {
    background-color: transparent !important;
  }

  /* 2. Дополнительная страховка для основных обёрток Joomla/Helix */
  #sp-main-body, .site-content, .body-innerwrapper,
  #sp-component, .com-content-article, .item-page,
  .article-details, .sp-single-article,
  .container, .container-fluid, .row, [class*="col-"],
  .sppb-row, .sppb-addon-content,
  .moduletable, .sp-module, .card, .card-body,
  .article-content, .entry-content, [itemprop="articleBody"],
  .blog-items, .blog-item, .page-header {
    background-color: transparent !important;
    background-image: none !important;
  }

  /* 3. Отключаем Bootstrap-переменные, которые могут подставлять белый фон */
  :root {
    --bs-body-bg: transparent !important;
    --bs-light: transparent !important;
    --bs-white: var(--bg-main) !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 {
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);
}

.article-content h1,
.entry-content h1,
.com-content-article h1 {
  position: relative;
  max-width: 18ch;
  margin: 1.6rem auto 3rem;
  text-align: center;
  font-size: clamp(2rem, 4vw, 3.1rem);
  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;
}

h2 {
  max-width: 68ch;
  margin: 3rem auto 1.2rem;
  padding: .6rem 0 .6rem 1rem;
  border-left: 5px solid var(--primary-green);
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  background: linear-gradient(90deg, rgba(239,246,231,.7), transparent);
}

h3 {
  max-width: 68ch;
  margin: 2.4rem auto 1rem;
  padding-left: .9rem;
  border-left: 3px solid var(--primary-green);
  font-size: 1.15rem;
}
}

/* =========================================================
   СПИСКИ
========================================================= */
@layer theme {
ul, 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 {
img {
  margin: 2rem auto;
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  transition: box-shadow var(--transition-fast);
}
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 {
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); /* этот фон перекрывает transparent */
}

[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);
}
}

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

@media (max-width: 480px) {
  :root {
    --mob-edge: 12px;
  }
  .ds-article-container,
  #sp-component,
  .com-content-article,
  .item-page {
    padding: 8px var(--mob-edge) 32px !important;
  }
  #sp-header, #sp-footer, .container {
    padding-left: var(--mob-edge) !important;
    padding-right: var(--mob-edge) !important;
  }
  h1, .article-content h1 {
    font-size: 1.5rem !important;
  }
  h2 {
    font-size: 1.35rem !important;
  }
  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;
  }
}
}
/* =========================================================
   СТИЛЬНЫЙ ЖУРНАЛЬНЫЙ ЗАГОЛОВОК H1 (замена линий на декоративные элементы)
   ========================================================= */
.article-content h1,
.entry-content h1,
.com-content-article h1 {
  /* Отключаем старые псевдоэлементы с линиями */
  &::before,
  &::after {
    content: none !important;
  }

  /* Основные стили */
  max-width: 85%;
  margin: 2rem auto 2.8rem;
  font-family: 'Playfair Display', 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3.6rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-wrap: balance;
  color: var(--dark-green);
  text-align: center;
  position: relative;
  padding-bottom: 1.8rem;
}

/* Верхний декоративный знак */
.article-content h1::before,
.entry-content h1::before,
.com-content-article h1::before {
  content: "✽";
  display: block;
  font-size: 1.6rem;
  font-weight: normal;
  color: var(--primary-green);
  margin-bottom: 0.75rem;
  line-height: 1;
  letter-spacing: 0;
}

/* Нижняя градиентная полоса */
.article-content h1::after,
.entry-content h1::after,
.com-content-article h1::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(120px, 40%);
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary-green), var(--accent-warm), var(--primary-green), transparent);
  border-radius: 2px;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
  .article-content h1,
  .entry-content h1,
  .com-content-article h1 {
    max-width: 92%;
    margin: 1rem auto 2rem;
    padding-bottom: 1.2rem;
    font-size: clamp(1.6rem, 6vw, 2.2rem);
  }
  .article-content h1::before {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
  }
  .article-content h1::after {
    width: 70px;
  }
}