/* Единые поля и сетка локальной версии «Дома Слова». */
:root {
  --ds-content-width: 1200px;
  --ds-side-gutter: 24px;
}

/* Главная: основные секции начинаются на одной вертикали. */
body.home .ds-help-layout {
  width: min(calc(100% - 2 * var(--ds-side-gutter)), var(--ds-content-width));
  margin-inline: auto !important;
  gap: 28px;
}
body.home .ds-help-layout > .columns {
  padding-left: 0 !important;
  padding-right: 0 !important;
}
body.home .ds-help-layout .ds-centers-summary { margin-left: 0; }
body.home .ds-values__grid { max-width: var(--ds-content-width); }
body.home .ds-home-contact-layout {
  width: min(calc(100% - 2 * var(--ds-side-gutter)), var(--ds-content-width));
  margin-inline: auto !important;
}
body.home .ds-home-contact-layout > .columns {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Внутренние страницы: старая тема не даёт ряду сужаться меньше 768px. */
body:not(.home):not(.ds-layout-standalone) #layout > .row:not(.full-width) {
  box-sizing: border-box;
  width: min(calc(100% - 2 * var(--ds-side-gutter)), var(--ds-content-width)) !important;
  max-width: var(--ds-content-width) !important;
  min-width: 0 !important;
  margin-inline: auto !important;
}
body.ds-inner-redesign #layout > .row.boxed {
  padding-inline: 0 !important;
}
body.ds-inner-redesign #layout #main-content,
body.ds-inner-redesign #layout #main-content .wpb-content-wrapper {
  min-width: 0;
  max-width: 100%;
}
body.ds-inner-redesign #main-content .dfd-heading-module-wrap .inline-block,
body.ds-inner-redesign #main-content .dfd-heading-module-wrap .dfd-heading-module {
  display: block;
  width: 100%;
  max-width: 100%;
}
body.ds-inner-redesign #main-content .dfd-heading-module-wrap .dfd-title {
  white-space: normal !important;
  overflow-wrap: break-word;
}

/* Текст совпадает по левому краю с заголовком. */
body.ds-inner-redesign #layout #main-content {
  padding-left: 0 !important;
  padding-right: 0 !important;
}
body.ds-inner-redesign #main-content p,
body.ds-inner-redesign #main-content li { max-width: 82ch; }
body.ds-inner-redesign #main-content .dfd-spacer-module { max-height: 48px !important; }

/* «О нас»: общий вводный текст и фотографии без повторяющихся подписей. */
body.dfd-page-class-o-nas-pomoshch-zavisimym-lyudyam .ds-about-overview,
body.dfd-page-class-o-nas-pomoshch-zavisimym-lyudyam .ds-about-mission {
  width: min(100%, var(--ds-content-width));
  margin-inline: auto;
}
body.dfd-page-class-o-nas-pomoshch-zavisimym-lyudyam .ds-about-overview__intro {
  max-width: 72ch !important;
  margin: 0 0 28px;
  color: #3e5147;
  font-size: clamp(18px, 1.65vw, 22px);
  line-height: 1.55;
}
body.dfd-page-class-o-nas-pomoshch-zavisimym-lyudyam .ds-about-mission h2 {
  margin: 0 0 22px;
  color: #263f34;
}
body.dfd-page-class-o-nas-pomoshch-zavisimym-lyudyam .ds-about-mission p {
  max-width: 76ch;
  margin: 0 0 18px;
  line-height: 1.7;
}
body.dfd-page-class-o-nas-pomoshch-zavisimym-lyudyam .ds-about-mission blockquote {
  max-width: 76ch;
  margin: 28px 0;
}
body.dfd-page-class-o-nas-pomoshch-zavisimym-lyudyam .ds-about-mission blockquote p {
  margin: 0;
}
body.dfd-page-class-o-nas-pomoshch-zavisimym-lyudyam .ds-about-mission__reference {
  font-size: .9em;
  color: #66766d;
}
body.dfd-page-class-o-nas-pomoshch-zavisimym-lyudyam .ds-about-gallery {
  --ds-gallery-photo-height: 320px;
  margin: 34px 0 42px;
}
body.dfd-page-class-o-nas-pomoshch-zavisimym-lyudyam .ds-about-gallery__rail {
  position: relative;
  display: flex;
  gap: 14px;
  width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 4px 2px 16px;
  scroll-snap-type: none;
  scroll-padding-inline: 2px;
  scrollbar-width: thin;
  scrollbar-color: #7e9c89 #e6ede8;
  -webkit-overflow-scrolling: touch;
  touch-action: auto;
  overscroll-behavior-inline: contain;
  cursor: grab;
}
body.dfd-page-class-o-nas-pomoshch-zavisimym-lyudyam .ds-about-gallery__rail.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}
body.dfd-page-class-o-nas-pomoshch-zavisimym-lyudyam .ds-about-gallery__photo {
  display: block !important;
  flex: 0 0 auto;
  aspect-ratio: var(--ds-photo-ratio, 1.7778);
  width: min(calc(var(--ds-gallery-photo-height) * var(--ds-photo-ratio, 1.7778)), calc(100vw - 36px));
  height: var(--ds-gallery-photo-height);
  min-width: 0;
  margin: 0;
  padding: 0 !important;
  overflow: hidden;
  border: 0 !important;
  border-radius: 0 !important;
  background: #e6ede8 !important;
  box-shadow: 0 6px 20px rgba(27, 48, 36, .12);
  cursor: zoom-in;
  scroll-snap-align: start;
}
body.dfd-page-class-o-nas-pomoshch-zavisimym-lyudyam .ds-about-gallery__photo img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center !important;
}
dialog.ds-about-lightbox[open] {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483647 !important;
  display: flex !important;
  flex-direction: column;
  box-sizing: border-box;
  width: 100vw !important;
  height: 100dvh !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 14px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #0b120e !important;
  color: #fff !important;
}
dialog.ds-about-lightbox::backdrop { background: rgba(5, 12, 8, .9); }
body.ds-about-lightbox-open { overflow: hidden !important; }
dialog.ds-about-lightbox .ds-about-lightbox__close {
  align-self: flex-end;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
}
dialog.ds-about-lightbox .ds-about-lightbox__view {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
}
dialog.ds-about-lightbox .ds-about-lightbox__image {
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
}
/* «Концепция служения»: пять принципов в двух читабельных колонках. */
body.dfd-page-class-koncepcija-sluzhenija .ds-principles-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
  width: 100%;
  margin: 0 auto;
}
body.dfd-page-class-koncepcija-sluzhenija .ds-principles-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}
body.dfd-page-class-koncepcija-sluzhenija .ds-principle {
  box-sizing: border-box;
  min-width: 0;
  padding: clamp(24px, 3vw, 36px);
  background: #f6f8f5;
  border: 1px solid #dbe6dd;
}
body.dfd-page-class-koncepcija-sluzhenija .ds-principle h3 {
  margin: 0 0 20px !important;
  color: #263f34;
  font-size: clamp(22px, 2.2vw, 29px);
  text-align: left !important;
}
body.dfd-page-class-koncepcija-sluzhenija .ds-principle p {
  max-width: none !important;
  margin: 0 0 16px !important;
}
body.dfd-page-class-koncepcija-sluzhenija .ds-principle > :last-child,
body.dfd-page-class-koncepcija-sluzhenija .ds-principle blockquote p {
  margin-bottom: 0 !important;
}
body.dfd-page-class-koncepcija-sluzhenija .ds-principle blockquote {
  box-sizing: border-box;
  max-width: none;
  margin: 22px 0 0 !important;
  padding: 18px 22px !important;
  border-left: 3px solid #48765e;
  background: #e9f1eb;
  color: #294737;
}
/* Самостоятельные страницы используют ту же ширину, что и общий подвал. */
body.ds-layout-standalone .shell,
body.ds-layout-standalone .qa-shell,
body.ds-layout-standalone .qa-header__inner {
  width: min(calc(100% - 2 * var(--ds-side-gutter)), var(--ds-content-width));
  max-width: var(--ds-content-width);
  margin-inline: auto;
}

@media (max-width: 900px) {
  body.home .ds-help-layout { grid-template-columns: minmax(0, 1fr); }
  body.home .ds-home-contact-layout {
    width: calc(100vw - 2 * var(--ds-side-gutter));
    margin-left: calc(50% - 50vw + var(--ds-side-gutter)) !important;
    margin-right: 0 !important;
  }
}

@media (max-width: 799px) {
  body.ds-inner-redesign { --ds-side-gutter: 18px; }
  body.dfd-page-class-koncepcija-sluzhenija .ds-principles-grid { grid-template-columns: 1fr; gap: 16px; }
  body.dfd-page-class-koncepcija-sluzhenija .ds-principles-column { gap: 16px; }
}

@media (max-width: 600px) {
  body.dfd-page-class-o-nas-pomoshch-zavisimym-lyudyam .ds-about-gallery { --ds-gallery-photo-height: 220px; }
  :root { --ds-side-gutter: 18px; }
  body.home .ds-help-layout { gap: 18px; }
  body.home .ds-home-contact-layout { gap: 18px; }
  body.ds-layout-standalone .shell,
  body.ds-layout-standalone .qa-shell,
  body.ds-layout-standalone .qa-header__inner { width: calc(100% - 2 * var(--ds-side-gutter)); }
  body.ds-inner-redesign #main-content .dfd-spacer-module { max-height: 32px !important; }
}
