/* assets/css/components/rich-content.css
   Компонент для текстовых страниц (services/page/blog): типографика, изображения, таблицы, FAQ.
   Скоуп: только внутри .page-shell и .rich-content
*/

/* ===== Page shell (общий контейнер страницы) ===== */
.page-shell{
  padding: 28px 0 56px;
}
@media (max-width: 680px){
  .page-shell{ padding: 18px 0 40px; }
}

.page-shell .page-head{
  max-width: 980px;
}

.page-shell .page-head h1{
  margin: 0 0 10px;
  font-size: clamp(26px, 3.1vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--green-900, #23411E);
}

.page-shell .page-lead{
  margin: 0;
  max-width: 980px;
  font-size: 16px;
  line-height: 1.55;
  color: rgba(31,41,55,.78);
}

/* ===== Rich content typography ===== */
.rich-content{
  max-width: 980px;
  margin-top: 18px;
  font-size: 16px;
  line-height: 1.72;
  color: var(--text, #1F2937);
}
@media (min-width: 980px){
  .rich-content{ font-size: 17px; }
}

.rich-content > :first-child{ margin-top: 0; }
.rich-content > :last-child{ margin-bottom: 0; }

.rich-content p{ margin: 0 0 14px; }

.rich-content a{
  color: #2E6B2F;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.rich-content a:hover{ color: #1F5A26; }

.rich-content h2{
  margin: 28px 0 12px;
  font-size: clamp(20px, 2.1vw, 28px);
  line-height: 1.2;
  color: var(--green-900, #23411E);
}

.rich-content h3{
  margin: 22px 0 10px;
  font-size: clamp(18px, 1.7vw, 22px);
  line-height: 1.25;
  color: var(--green-900, #23411E);
}

.rich-content h4{
  margin: 18px 0 8px;
  font-size: 16px;
  line-height: 1.25;
  color: rgba(31,41,55,.86);
}

.rich-content hr{
  border: 0;
  height: 1px;
  background: rgba(31,41,55,.10);
  margin: 22px 0;
}

/* списки */
.rich-content ul,
.rich-content ol{
  margin: 0 0 16px;
  padding-left: 1.2em;
}
.rich-content li{ margin: 6px 0; }

/* цитата */
.rich-content blockquote{
  margin: 18px 0;
  padding: 14px 16px;
  background: rgba(148,179,82,.10);
  border: 1px solid rgba(148,179,82,.22);
  border-left: 4px solid rgba(215,161,0,.85);
  border-radius: 14px;
  color: rgba(31,41,55,.90);
}

/* изображения */
.rich-content img{
  display: block;
  width: 50%;
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  background: rgba(31,41,55,.04);
  box-shadow: 0 10px 30px rgba(17,24,39,.08);
  margin: 16px 0;
}

.rich-content figure{ margin: 16px 0; }
.rich-content figcaption,
.rich-content .img-caption{
  margin-top: -8px;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(31,41,55,.62);
}

/* обложка статьи (blog) */
.rich-cover{
  width: 100%;
  max-width: 980px;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(17,24,39,.10);
  margin: 0 0 18px;
}

/* таблицы */
.rich-content table{
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  margin: 16px 0;
  background: #fff;
  border: 1px solid rgba(31,41,55,.10);
  border-radius: 14px;
  overflow: hidden;
}
.rich-content th,
.rich-content td{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(31,41,55,.08);
  text-align: left;
  vertical-align: top;
}
.rich-content th{
  font-weight: 800;
  color: rgba(31,41,55,.86);
  background: rgba(148,179,82,.08);
}
.rich-content tr:last-child td{ border-bottom: 0; }

/* мобильный скролл для таблиц */
@media (max-width: 680px){
  .rich-content table{
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* code/pre */
.rich-content code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .92em;
  background: rgba(31,41,55,.06);
  border: 1px solid rgba(31,41,55,.10);
  padding: 2px 6px;
  border-radius: 8px;
}

.rich-content pre,
.page-pre{
  margin: 16px 0;
  padding: 14px 16px;
  background: rgba(31,41,55,.06);
  border: 1px solid rgba(31,41,55,.10);
  border-radius: 14px;
  overflow: auto;
  line-height: 1.5;
}

/* FAQ / details */
.rich-content details{
  margin: 10px 0;
  padding: 12px 14px;
  border: 1px solid rgba(31,41,55,.10);
  border-radius: 14px;
  background: #fff;
}
.rich-content summary{
  cursor: pointer;
  font-weight: 800;
  color: rgba(31,41,55,.86);
}
.rich-content details[open]{
  box-shadow: 0 10px 24px rgba(17,24,39,.08);
}

/* полезные блоки для автора (можно использовать в text_html) */
.rich-content .callout{
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(31,41,55,.10);
  background: rgba(255,255,255,.85);
}
.rich-content .callout--tip{ border-color: rgba(148,179,82,.28); background: rgba(148,179,82,.10); }
.rich-content .callout--warn{ border-color: rgba(215,161,0,.35); background: rgba(215,161,0,.10); }

/* двухколоночный блок (если понадобится) */
.rich-content .cols{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}
@media (max-width: 860px){
  .rich-content .cols{ grid-template-columns: 1fr; }
}


/* ===== service-page: универсальная система для страниц услуг ===== */

.rich-content .service-page{
  max-width: 100%;
}

.rich-content .service-page h2{
  text-align: left;
}

.rich-content .service-page__intro{
  max-width: 980px;
  margin-bottom: 14px;
}

.rich-content .service-gallery{
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
  gap: 14px;
  margin: 20px 0 14px;
  align-items: start;
}

.rich-content .service-gallery__main,
.rich-content .service-gallery__shot{
  position: relative;
  display: block;
  overflow: hidden;
  text-decoration: none !important;
  border-radius: 18px;
  background: #eef2eb;
  box-shadow: 0 10px 26px rgba(0,0,0,.08);
}

.rich-content .service-gallery__main{
  aspect-ratio: 4 / 4.9;
  min-height: 0;
  align-self: start;
}

.rich-content .service-gallery__side{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-self: start;
  align-content: start;
}

.rich-content .service-gallery__shot{
  aspect-ratio: 4 / 3;
  min-height: 0;
  align-self: start;
}

.rich-content .service-gallery__main img,
.rich-content .service-gallery__shot img{
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  min-height: 100% !important;
  margin: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  object-fit: cover;
  background: transparent !important;
  transition: transform .35s ease;
}

.rich-content .service-gallery__main:hover img,
.rich-content .service-gallery__shot:hover img{
  transform: scale(1.03);
}

.rich-content .service-gallery__badge{
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(21,34,18,.78);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
  backdrop-filter: blur(3px);
}

.rich-content .service-gallery__shot span{
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  display: block;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(21,34,18,.72);
  color: #fff;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.rich-content .service-note{
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(27,31,35,.72);
}

.rich-content .service-alert,
.rich-content .service-cta{
  margin: 18px 0 24px;
  padding: 16px 18px;
  border: 1px solid rgba(57,94,44,.18);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(57,94,44,.06) 0%, #ffffff 100%);
}

.rich-content .service-section{
  margin-top: 28px;
}

.rich-content .service-cards{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.rich-content .service-card,
.rich-content .service-checkitem,
.rich-content .service-faq__item{
  padding: 16px 16px 14px;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,.07);
  background: #fff;
  box-shadow: 0 8px 22px rgba(0,0,0,.05);
}

.rich-content .service-card h3,
.rich-content .service-checkitem h3,
.rich-content .service-faq__item h3{
  margin-top: 0;
  margin-bottom: 10px;
}

.rich-content .service-price{
  margin: 8px 0 10px;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 800;
  color: #274620;
}

.rich-content .service-cols{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.rich-content .service-checklist{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.rich-content .service-faq{
  margin-top: 28px;
}

.rich-content .service-faq__item + .service-faq__item{
  margin-top: 12px;
}

.rich-content .service-page ul,
.rich-content .service-page ol{
  padding-left: 22px;
}

.rich-content .service-page li + li{
  margin-top: 6px;
}

.rich-content .service-gallery a,
.rich-content .service-gallery a:hover,
.rich-content .service-gallery a:focus{
  text-decoration: none !important;
}

/* ===== service-page--delivery: особая галерея страницы доставки ===== */
/* слева 1 большое фото, справа 4 горизонтальные карточки друг под другом,
   при этом правая колонка не выходит ниже общего блока галереи */

.rich-content .service-page--delivery .service-gallery{
  grid-template-columns: minmax(0, 1.36fr) minmax(0, .94fr);
  align-items: stretch;
}

.rich-content .service-page--delivery .service-gallery__main{
  aspect-ratio: 4 / 4.9;
  min-height: 0;
  height: 100%;
  align-self: stretch;
}

.rich-content .service-page--delivery .service-gallery__side{
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 14px;
  min-height: 0;
  height: 100%;
  align-self: stretch;
  align-content: stretch;
}

.rich-content .service-page--delivery .service-gallery__shot{
  aspect-ratio: auto;
  min-height: 0;
  height: 100%;
  align-self: stretch;
}

.rich-content .service-page--delivery .service-gallery__shot span{
  left: 8px;
  right: 8px;
  bottom: 8px;
  padding: 7px 9px;
  font-size: 11px;
  line-height: 1.15;
  border-radius: 10px;
}

@media (max-width: 980px){
  .rich-content .service-cards{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rich-content .service-page--delivery .service-gallery{
    grid-template-columns: minmax(0, 1.22fr) minmax(0, .9fr);
    gap: 12px;
  }

  .rich-content .service-page--delivery .service-gallery__side{
    gap: 12px;
  }
}

@media (max-width: 860px){
  .rich-content .service-gallery{
    grid-template-columns: 1fr;
  }

  .rich-content .service-gallery__main{
    aspect-ratio: 16 / 10;
  }

  .rich-content .service-cols,
  .rich-content .service-checklist{
    grid-template-columns: 1fr;
  }

  .rich-content .service-page--delivery .service-gallery{
    grid-template-columns: 1fr;
    align-items: start;
  }

  .rich-content .service-page--delivery .service-gallery__main{
    aspect-ratio: 4 / 3;
    height: auto;
    align-self: start;
  }

  .rich-content .service-page--delivery .service-gallery__side{
    grid-template-rows: none;
    height: auto;
    min-height: 0;
    gap: 10px;
    align-self: start;
  }

  .rich-content .service-page--delivery .service-gallery__shot{
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 0;
  }
}

@media (max-width: 640px){
  .rich-content .service-gallery{
    gap: 10px;
    margin-top: 16px;
  }

  .rich-content .service-gallery__side{
    gap: 10px;
  }

  .rich-content .service-gallery__main{
    aspect-ratio: 4 / 3;
    border-radius: 14px;
  }

  .rich-content .service-gallery__shot{
    border-radius: 14px;
  }

  .rich-content .service-gallery__badge{
    left: 10px;
    right: 10px;
    bottom: 10px;
    justify-content: center;
    text-align: center;
    font-size: 12px;
  }

  .rich-content .service-gallery__shot span{
    left: 8px;
    right: 8px;
    bottom: 8px;
    font-size: 11px;
    border-radius: 10px;
  }

  .rich-content .service-cards{
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .rich-content .service-alert,
  .rich-content .service-cta,
  .rich-content .service-card,
  .rich-content .service-checkitem,
  .rich-content .service-faq__item{
    border-radius: 14px;
  }

  .rich-content .service-price{
    font-size: 24px;
  }
}

/* ===== service-card с фоновыми картинками через data-bg ===== */

.rich-content .service-card[data-bg]{
  position: relative;
  overflow: hidden;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background:
    linear-gradient(180deg, rgba(18, 28, 14, .18) 0%, rgba(18, 28, 14, .72) 100%),
    var(--card-bg) center center / cover no-repeat;
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 10px 26px rgba(0,0,0,.12);
}

.rich-content .service-card[data-bg]::before{
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.04) 0%, rgba(0,0,0,.18) 100%);
  pointer-events: none;
}

.rich-content .service-card[data-bg] > *{
  position: relative;
  z-index: 1;
}

.rich-content .service-card[data-bg] h3,
.rich-content .service-card[data-bg] p{
  color: #fff;
}

.rich-content .service-card[data-bg] .service-price{
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.28);
}

.rich-content .service-card[data-bg] a{
  color: #fff;
}

.rich-content .service-card[data-bg] p:last-child{
  margin-bottom: 0;
}

@media (max-width: 680px){
  .rich-content .service-card[data-bg]{
    min-height: 210px;
  }
}