.credentials,
.comfort {
  --section-inset: clamp(50px, calc(15.625cqw - 70px), 100px);
  --section-gutter: 40px;
  --section-gap: clamp(20px, calc(5.2083cqw - 10px), 40px);
  padding-block: var(--section-inset);
  font-size: 18px;
  line-height: 1.4;
}

.next-section__inner {
  width: min(calc(100% - 2 * var(--section-gutter)), 1620px);
  margin-inline: auto;
}

.credentials {
  --credentials-texture: url("../images/credentials/texture.webp");
  color: #f4f7fa;
  background: linear-gradient(#0d0d0de8, #0d0d0de8), var(--credentials-texture) center / 100% 100% no-repeat #0d0d0d;
  scroll-margin-block-start: 20px;
}

.credentials__intro { max-width: 823px; }
.credentials__intro h2 { max-width: 669px; }
.credentials__intro h2 span { color: var(--red); }
:root:lang(uk) .credentials__intro h2 { max-width: 704px; }
:root:lang(uk) .credentials__intro h2 span { display: block; }
.credentials__intro > p,
.comfort__intro > p { margin-block-start: 16px; }

.credentials__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-block-start: var(--section-gap);
  border-block-start: 1px solid #8593a380;
  border-inline-start: 1px solid #8593a380;
}

.credential {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-height: 336px;
  min-width: 0;
  padding: 19px;
  border-block-end: 1px solid #8593a380;
  border-inline-end: 1px solid #8593a380;
  background: linear-gradient(var(--credential-shade, transparent), var(--credential-shade, transparent)),
    linear-gradient(#1a1a1ae8, #1a1a1ae8),
    var(--credentials-texture) center / 100% 100% no-repeat #1a1a1a;
}

.credential:is(:nth-child(1), :nth-child(3), :nth-child(6), :nth-child(8)) {
  --credential-shade: #0005;
}

.credential__kind { font: 700 14px/1.4 Manrope, sans-serif; }
.credential__title {
  display: flex;
  align-items: center;
  min-height: 89px;
  margin: 13px 0 0;
  color: var(--red);
  font: 700 var(--credential-title-size, 24px)/1.2 var(--display-font);
}
.credential__details {
  display: grid;
  gap: 13px;
  font-size: 14px;
}

.credential__document {
  display: grid;
  place-items: center;
  min-height: 60px;
  padding: 10px;
  border: 1px solid #f4f7fa;
  border-radius: 6px;
  background: transparent;
  color: var(--red);
  font: var(--credential-button-weight, 600) var(--credential-button-size, 18px)/1.4 Manrope, sans-serif;
  text-align: center;
}

.credential-gallery {
  width: min(920px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #f4f7fa3b;
  border-radius: 6px;
  color: #f4f7fa;
  background: #181818;
}
.credential-gallery::backdrop { background: #000c; }
.credential-gallery__header {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px 8px 18px;
  border-block-end: 1px solid #f4f7fa33;
  background: inherit;
}
.credential-gallery__header h2 { font-size: clamp(16px, 3vw, 22px); }
.credential-gallery__close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: inherit;
  background: transparent;
  font-size: 28px;
  cursor: pointer;
}
.credential-gallery__close:hover { background: #ffffff1a; }
.credential-gallery__documents {
  display: grid;
  gap: 22px;
  margin: 0;
  padding: 12px 12px 22px;
  list-style: none;
  text-align: center;
}
.credential-gallery__count {
  margin-block-end: 8px;
  color: #d6d6d6;
  font-size: 14px;
}
.credential-gallery__image {
  display: grid;
  justify-items: center;
  gap: 8px;
}
.credential-gallery__image img {
  max-height: 68dvh;
  object-fit: contain;
}
.credential-gallery__image span {
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: .18em;
}
.credential-gallery__image:focus-visible { outline-offset: 0; }

.comfort {
  color: #fff;
  background: #7e0d18 url("../images/comfort/training.webp") center / cover no-repeat;
}

.comfort__content { width: clamp(390px, calc(17.5cqw + 264px), 488px); margin-inline-start: auto; }
.comfort__intro h2 { font-size: 48px; line-height: 1.1; }
.comfort__list {
  display: grid;
  gap: 20px;
  margin-block-start: max(30px, var(--section-gap));
}

.comfort-card {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 20px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px #c42e3366;
  background: #fff;
  color: #353b41;
  text-align: center;
}
.comfort-card h3 { margin: 0; font: 700 24px/1.2 var(--display-font); }
.comfort-card img { width: 56px; height: 56px; }

@media (width >= 1280px) {
  .comfort__content { width: clamp(488px, calc(41.875cqw - 48px), 555px); }
}

@media (width >= 1440px) {
  .credentials, .comfort { --section-gutter: clamp(40px, calc(22.9167cqw - 290px), 150px); }
  .comfort__content { width: clamp(555px, calc(22.5cqw + 231px), 663px); }
}

@media (width < 1200px) {
  .credentials {
    --credential-title-size: 20px;
    --credential-button-size: 14px;
    --credential-button-weight: 700;
  }
}

@media (width < 900px) {
  .credentials__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comfort__content { width: 100%; }
  .comfort-card h3 { line-height: 1.1; }
}

@media (width < 700px) {
  .credentials, .comfort { --section-gutter: 20px; }
  .credentials { --section-inset: 40px; }
  :root:lang(uk) .credentials__intro h2 {
    font-size: clamp(19px, calc((100cqw - 2 * var(--section-gutter)) / 14.4), 36px);
  }
  .credentials__grid { grid-template-columns: 1fr; }
  .comfort {
    --section-inset: clamp(40px, calc(8.333cqw + 10px), 50px);
    background-image: linear-gradient(#0006, #0006), url("../images/comfort/training.webp");
    background-position: center, 36.5% center;
  }
  .comfort__intro h2 { font-size: clamp(24px, calc(20cqw - 48px), 48px); }
}

@media (width < 400px) {
  .comfort__intro h2 { line-height: 1.2; }
}
