/* Дополнительный стиль для страниц с материалами. */

/* Обычный текст материала */
body.material-page .material-text {
  margin: 1em 4%;
  padding: 0 min(2ch, 4%);
  text-align: justify;
  overflow-wrap: anywhere;
}

body.material-page .material-text.center {
  text-align: center;
}

/* Статичный заголовок раздела с угловыми элементами */
body.material-page .section-title {
  max-width: calc(100% - 8%);
  margin: 2.2em auto 1.3em;
  padding: 0.55em 1.5em;
}

body.material-page .section-title::before,
body.material-page .section-title::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0.7em;
  border-top: 2px solid var(--red-bright);
  border-bottom: 2px solid var(--red-bright);
  pointer-events: none;
}

body.material-page .section-title::before {
  left: 0;
  border-left: 2px solid var(--red-bright);
}

body.material-page .section-title::after {
  right: 0;
  border-right: 2px solid var(--red-bright);
}

/* Второстепенный заголовок внутри текста */
body.material-page .text-title {
  width: calc(100% - 8%);
  margin: 0.8em 4%;
  padding: 0 min(2ch, 4%);
  color: var(--red-bright);
  font-size: clamp(1.1rem, 1.02rem + 0.3vw, 1.3rem);
  line-height: 1.3;
  text-align: left;
  text-transform: none;
  overflow-wrap: anywhere;
}

/* Длинный фрагмент текста */
body.material-page .text-quote {
  position: relative;
  margin: 2em 4%;
  padding: 1.6em min(4em, 10%);
  border-top: 2px solid var(--red-dark);
  border-bottom: 2px solid var(--red-dark);
  background: rgba(0, 0, 0, 0.48);
  font-style: normal;
  text-align: justify;
  overflow-wrap: anywhere;
}

body.material-page .text-quote::before,
body.material-page .text-quote::after {
  position: absolute;
  color: var(--red-bright);
  font-size: 3em;
  line-height: 1;
}

body.material-page .text-quote::before {
  content: "«";
  top: 0.08em;
  left: 0.18em;
}

body.material-page .text-quote::after {
  content: "»";
  right: 0.18em;
  bottom: 0.08em;
}

/* Короткая цитата или комментарий автора */
body.material-page .author-quote {
  margin: 1.5em 4%;
  padding: 1em 1.2em;
  border-left: 4px solid var(--red-bright);
  background: rgba(158, 38, 50, 0.12);
  color: var(--cream);
  font-style: normal;
  text-align: justify;
  overflow-wrap: anywhere;
}

body.material-page .text-quote p,
body.material-page .author-quote p {
  margin: 0;
  padding: 0;
}

body.material-page .text-quote p + p,
body.material-page .author-quote p + p {
  margin-top: 0.7em;
}

body.material-page .quote-source {
  display: block;
  margin-top: 0.8em;
  color: var(--cream-dim);
  font-style: normal;
  text-align: right;
}

/* Изображение */
body.material-page .material-figure {
  min-width: 0;
  margin: 0;
}

body.material-page .material-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 2em);
  max-height: calc(100dvh - 2em);
  margin: 0 auto;
  object-fit: contain;
}

/* Универсальный блок для одного, двух или трёх изображений */
body.material-page .material-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 1.5em;
  margin: 2em 4%;
}

body.material-page .material-images.inspiration-pair {
  grid-template-columns: var(--pair-columns);
  width: 92%;
  max-width: calc((100vh - 2em) * var(--pair-ratio) + 1.5em);
  max-width: calc((100dvh - 2em) * var(--pair-ratio) + 1.5em);
  margin: 2em auto;
}

body.material-page .inspiration-pair .material-image {
  width: 100%;
  max-height: none;
}

/* Ссылка на полноразмерное изображение */
body.material-page .material-image-link {
  display: block;
}

body.material-page .material-image-link:hover,
body.material-page .material-image-link:focus {
  background: transparent;
}

body.material-page .material-image-link:focus-visible {
  outline: 2px solid var(--red-bright);
  outline-offset: 3px;
}

@media (max-width: 600px) {
  body.material-page .material-images.inspiration-pair {
    grid-template-columns: minmax(0, 1fr);
    max-width: none;
  }

  body.material-page .inspiration-pair .material-image {
    width: auto;
    max-height: calc(100vh - 2em);
    max-height: calc(100dvh - 2em);
  }
}

/* Подпись под изображением */
body.material-page .material-caption {
  margin-top: 0.7em;
  color: var(--cream-dim);
  font-size: 0.9em;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
}
