/* ЖК «12» — оформление отдельных публикаций /news/... */
/* v2: реальные контейнеры темы jk12; файл подключается только на /news/... через functions.php. */
#page-content > .page__background > .__container {
  --jn-accent: var(--main-color, #d3583a);
  --jn-dark-accent: var(--second-color, #9b3820);
  --jn-ink: #24211f;
  --jn-text: #494440;
  --jn-muted: #746b65;
  --jn-paper: #f7f3f0;
  --jn-line: #e9e1db;
  --jn-reading: 800px;
  --jn-radius: 22px;
  box-sizing: border-box;
  width: min(1120px, calc(100% - 40px));
  max-width: 1120px;
  min-width: 0;
  margin-inline: auto;
  padding: clamp(24px, 4vw, 56px) 0 clamp(56px, 7vw, 100px);
  color: var(--jn-text);
  font-family: Gilroy, Montserrat, Arial, sans-serif;
  font-size: clamp(17px, 1.5vw, 19px);
  line-height: 1.7;
  text-align: left;
  overflow-wrap: anywhere;
}

/* Короткая ширина строки для текста, широкая — для фотографий. */
#page-content > .page__background > .__container > :is(p, h2, h3, h4, h5, h6, ul, ol, blockquote, .wp-block-quote, .wp-block-pullquote, .wp-block-table, .wp-block-separator, .wp-block-buttons, .wp-block-group, pre, dl) {
  box-sizing: border-box;
  width: 100%;
/*   max-width: var(--jn-reading); */
  margin-inline: auto;
  min-width: 0;
}

/* Шапка статьи: тёплый фон, геометрия архитектурного фасада. */
#page-content > .page__background > .__container > h1.page-title {
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  min-height: 0;
  margin: 0 0 clamp(32px, 5vw, 64px) !important;
  padding: clamp(28px, 0px, 64px) clamp(22px, 0px, 76px) clamp(35px, 0px, 74px); 
  border: 1px solid #eadfd7;
  border-radius: clamp(20px, 3vw, 32px);
  background: linear-gradient(120deg, #f8f2ed 0%, #f5ebe4 100%);
  color: var(--jn-ink, #24211f);
  font-size: 64px !important;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -.035em;
  text-align: left;
  text-wrap: balance;
  overflow: hidden;
}
/* #page-content > .page__background > .__container > h1.page-title::before {
  content: "";
  display: block;
  width: 52px;
  height: 5px;
  border-radius: 5px;
  background: var(--jn-accent, #d3583a);
  margin: 0 0 clamp(20px, 3vw, 32px);
} */
#page-content > .page__background > .__container > h1.page-title::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -40px;
  bottom: -100px;
  width: min(42%, 320px);
  height: 310px;
  border: 1px solid rgba(155, 56, 32, .11);
  border-radius: 130px 130px 0 0;
  box-shadow: 0 0 0 24px rgba(155, 56, 32, .045), 0 0 0 48px rgba(155, 56, 32, .035);
  transform: rotate(-18deg);
  pointer-events: none;
}

/* Заголовки. !important нужен для размеров Gutenberg. */
#page-content > .page__background > .__container > :is(h2, h3, h4, h5, h6) {
  color: var(--jn-ink);
  font-weight: 750;
  line-height: 1.23;
  letter-spacing: -.025em;
  text-align: left;
  text-transform: none;
  text-wrap: balance;
  scroll-margin-top: 120px;
}
#page-content > .page__background > .__container > :is(h2, h3, h4, h5, h6) :is(strong,b) {
  font-weight: inherit;
}
#page-content > .page__background > .__container > h2 {
  position: relative;
  margin-block: clamp(38px, 5vw, 64px) 20px !important;
  padding: 0 0 0 21px;
  font-size: clamp(26px, 3vw, 37px) !important;
  border-left: 4px solid var(--jn-accent);
  border-radius: 3px 0 0 3px;
}
#page-content > .page__background > .__container > h3 {
  margin-block: 34px 15px !important;
  font-size: clamp(22px, 2.2vw, 27px) !important;
}
#page-content > .page__background > .__container > :is(h4,h5,h6) {
  margin-block: 26px 12px !important;
  font-size: clamp(19px, 2vw, 23px) !important;
}
#page-content > .page__background > .__container > h1.page-title + :is(h2,h3) {
  margin-top: 0 !important;
}

/* Основной текст. */
#page-content > .page__background > .__container > p {
  margin-block: 0 20px;
  font-size: inherit;
  line-height: 1.75;
}
#page-content > .page__background > .__container > h1.page-title + p:not(:empty),
#page-content > .page__background > .__container > h1.page-title + h2 + p:not(:empty) {
  color: var(--jn-ink);
  font-size: clamp(19px, 1.9vw, 23px);
  line-height: 1.6;
  font-weight: 500;
  margin-bottom: 30px;
}
#page-content > .page__background > .__container > p:empty {
  display: none !important;
}
#page-content > .page__background > .__container :is(p,li) strong {
  color: var(--jn-ink);
  font-weight: 700;
}

/* Списки — спокойные информационные карточки, без ложных галочек. */
#page-content > .page__background > .__container > :is(ul,ol) {
  margin-block: 16px 30px;
  padding: clamp(17px, 3vw, 27px) clamp(18px, 3vw, 30px) clamp(17px, 3vw, 27px) clamp(39px, 5vw, 58px);
  border: 1px solid var(--jn-line);
  border-radius: var(--jn-radius);
  background: var(--jn-paper);
  list-style-position: outside;
  text-align: left;
}
#page-content > .page__background > .__container > ul { list-style-type: disc; }
#page-content > .page__background > .__container > ol { list-style-type: decimal; }
#page-content > .page__background > .__container > :is(ul,ol) > li {
  display: list-item;
  margin: 0;
  padding: 9px 0 9px 5px;
  line-height: 1.6;
}
#page-content > .page__background > .__container > :is(ul,ol) > li + li {
  border-top: 1px solid var(--jn-line);
}
#page-content > .page__background > .__container > :is(ul,ol) > li:first-child { padding-top: 0; }
#page-content > .page__background > .__container > :is(ul,ol) > li:last-child { padding-bottom: 0; }
#page-content > .page__background > .__container > :is(ul,ol) > li::marker {
/*   color: var(--jn-dark-accent);
  font-weight: 750; */
  display: none;
}
#page-content > .page__background > .__container li > :is(ul,ol) { margin-block: 10px 0; padding-inline-start: 24px; }

/* Галереи Gutenberg: переопределяем штатные flex-ширины. */
#page-content > .page__background > .__container > .wp-block-gallery.has-nested-images {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 22px) !important;
  align-items: start;
  width: 100%;
  max-width: 100%;
  margin: clamp(26px, 4vw, 48px) auto !important;
  padding: 0;
}
#page-content > .page__background > .__container > .wp-block-gallery.has-nested-images:has(> figure:only-of-type),
#page-content > .page__background > .__container > .wp-block-gallery.columns-1 { grid-template-columns: minmax(0, 1fr); }
#page-content > .page__background > .__container > .wp-block-gallery:is(.columns-3,.columns-4,.columns-5,.columns-6,.columns-7,.columns-8) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#page-content > .page__background > .__container > .wp-block-gallery.has-nested-images > figure.wp-block-image {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  margin: 0 !important;
  padding: 0;
  height: auto !important;
  flex: none !important;
  overflow: hidden;
  border-radius: var(--jn-radius);
  background: #f2efec;
}
#page-content > .page__background > .__container > .wp-block-gallery figure.wp-block-image > :is(a,div) {
  display: block;
  width: 100%;
  height: auto;
}
#page-content > .page__background > .__container > .wp-block-gallery figure.wp-block-image img {
  display: block;
  width: 100% !important;
  max-width: 100%;
  height: auto !important;
  aspect-ratio: 3 / 2;
  object-fit: contain !important;
  border-radius: var(--jn-radius);
  margin: 0;
}
#page-content > .page__background > .__container > .wp-block-gallery > figcaption { grid-column: 1 / -1; }

/* Одиночные фотографии и подписи. */
#page-content > .page__background > .__container > .wp-block-image {
  width: fit-content;
  max-width: 100%;
  margin: 32px auto;
}
#page-content > .page__background > .__container > .wp-block-image img,
#page-content > .page__background > .__container > p img:not(.emoji):not(.wp-smiley) {
  max-width: 100%;
  height: auto;
  border-radius: var(--jn-radius);
}
#page-content > .page__background > .__container :is(.wp-block-gallery,.wp-block-image) figcaption {
  position: static !important;
  inset: auto !important;
  width: auto !important;
  max-height: none !important;
  margin: 0;
  padding: 10px 14px;
  background: transparent !important;
  color: var(--jn-muted) !important;
  font-size: 14px;
  line-height: 1.45;
  text-shadow: none !important;
  text-align: center;
}

/* Ссылки, цитаты, таблицы и другие типовые блоки. */
#page-content > .page__background > .__container :is(p,li,blockquote,figcaption,td,th) a:not(.wp-element-button) {
  color: var(--jn-dark-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
#page-content > .page__background > .__container a:focus-visible { outline: 2px solid var(--jn-dark-accent); outline-offset: 4px; }
#page-content > .page__background > .__container > :is(blockquote,.wp-block-quote,.wp-block-pullquote) {
  margin-block: 32px;
  padding: 24px 28px;
  border: 0;
  border-left: 4px solid var(--jn-accent);
  border-radius: 0 var(--jn-radius) var(--jn-radius) 0;
  background: #f8eee8;
  color: var(--jn-ink);
  font-size: clamp(19px, 2vw, 23px);
}
#page-content > .page__background > .__container > :is(blockquote,.wp-block-quote) p:last-child { margin-bottom: 0; }
#page-content > .page__background > .__container > .wp-block-table {
  margin-block: 30px;
  overflow-x: auto;
  border: 1px solid var(--jn-line);
  border-radius: 15px;
}
#page-content > .page__background > .__container .wp-block-table table { width: 100%; border-collapse: collapse; font-size: 16px; }
#page-content > .page__background > .__container .wp-block-table :is(th,td) { padding: 12px 16px; border: 1px solid var(--jn-line); text-align: left; }
#page-content > .page__background > .__container .wp-block-table th { background: var(--jn-paper); color: var(--jn-ink); }
#page-content > .page__background > .__container > .wp-block-separator { border: 0; border-top: 1px solid var(--jn-line); margin-block: 38px; opacity: 1; }
#page-content > .page__background > .__container .wp-block-button__link { background: var(--jn-accent); color: #fff; border-radius: 12px; padding: 13px 22px; font-weight: 700; }
#page-content > .page__background > .__container .wp-block-button__link:hover { background: var(--jn-dark-accent); }
#page-content > .page__background > .__container > pre { overflow-x: auto; }

/* Смартфоны. */
@media (max-width: 767px) {
  #page-content > .page__background > .__container {
    width: calc(100% - 32px);
    padding-block: 20px 50px;
    --jn-radius: 16px;
    font-size: 17px;
  }
  #page-content > .page__background > .__container > h1.page-title { padding: 28px 22px 34px; font-size: clamp(30px, 7.5vw, 44px) !important; }
  #page-content > .page__background > .__container > h1.page-title::after { opacity: .6; }
  #page-content > .page__background > .__container > h2 { padding-left: 13px; margin-block: 35px 17px !important; }
  #page-content > .page__background > .__container > h3 { margin-top: 27px !important; }
  #page-content > .page__background > .__container > h1.page-title + :is(h2,h3) { margin-top: 0 !important; }
  #page-content > .page__background > .__container > :is(ul,ol) { padding: 17px 17px 17px 37px; }
  #page-content > .page__background > .__container > .wp-block-gallery.has-nested-images { grid-template-columns: minmax(0, 1fr); gap: 12px !important; }
  #page-content > .page__background > .__container > .wp-block-gallery figure.wp-block-image img { aspect-ratio: auto; }
  #page-content > .page__background > .__container > :is(blockquote,.wp-block-quote,.wp-block-pullquote) { padding: 18px 20px; }
}
/* Убираем стандартные маркеры списков */
#page-content .__container ul.wp-block-list,
#page-content .__container ul.wp-block-list li {
    list-style: none !important;
}

#page-content .__container ul.wp-block-list li::marker {
    content: none !important;
}


/* ==========================================
   ЖК 12 — адаптивная сетка фотогалерей
   ========================================== */

   #page-content > .page__background > .__container
   > .wp-block-gallery.has-nested-images {
       display: grid !important;
       grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
       gap: 16px !important;
       align-items: start;
   }
   
   /* По умолчанию две фотографии в ряд */
   
   #page-content .__container
   .wp-block-gallery.has-nested-images > figure.wp-block-image {
       grid-column: span 3;
       width: 100% !important;
       max-width: 100% !important;
       min-width: 0;
       margin: 0 !important;
   }
   
   /* При нечётном количестве — последние три в одном ряду */
   
   #page-content .__container
   .wp-block-gallery.has-nested-images:has(> figure:nth-of-type(3)):has(> figure:nth-of-type(odd):last-of-type)
   > figure.wp-block-image:nth-last-of-type(-n+3) {
       grid-column: span 2;
   }
   
   /* Если в галерее всего одна фотография */
   
   #page-content .__container
   .wp-block-gallery.has-nested-images
   > figure.wp-block-image:only-of-type {
       grid-column: 1 / -1;
       max-width: 900px !important;
       justify-self: center;
   }
   
   /* Оформление фотографий */
   
   #page-content .__container
   .wp-block-gallery figure.wp-block-image img {
       display: block;
       width: 100% !important;
       height: auto !important;
       aspect-ratio: 3 / 2;
       object-fit: contain !important;
       border-radius: 18px;
   }
   
   /* Одиночные изображения вне галерей */
   
   #page-content > .page__background > .__container
   > .wp-block-image {
       width: fit-content;
       max-width: min(100%, 900px);
       margin: 32px auto !important;
   }
   
   /* Мобильная версия */
   
   @media (max-width: 600px) {
   
       #page-content > .page__background > .__container
       > .wp-block-gallery.has-nested-images {
           grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
           gap: 10px !important;
       }
   
       #page-content .__container
       .wp-block-gallery.has-nested-images
       > figure.wp-block-image {
           grid-column: span 1 !important;
       }
   
       #page-content .__container
       .wp-block-gallery.has-nested-images
       > figure.wp-block-image:nth-of-type(odd):last-of-type {
           grid-column: 1 / -1 !important;
           max-width: 100% !important;
       }
   
       #page-content .__container
       .wp-block-gallery figure.wp-block-image img {
           border-radius: 12px;
           aspect-ratio: auto;
       }
   }