/* Pages built by the builder (WP-8: the homepage and the 12 service pages), on the tokens of css/base.css. The other page types have their own css/page-<type>.css, loaded only on their pages (functions.php, kompresorii_page_type()). Class names use the k- prefix; breakpoints max-width 1199px, 1023px and 767px. */

/* ==========================================================================
   Builder pages (WP-8): the homepage and the 12 service pages (front-page.php, inc/builder.php).
   Boards: Main, A-desktop-2 (1440), A-mobile, A-mobile-2 (390), Usluga, Usluga-2, Usluga-mobile, Usluga-mobile-2.
   The first screen, prices, catalogue, rental terms, reviews and FAQ are components (css/components.css); the quiz is
   css/quiz.css. This section draws the parts between them: about + «Наши преимущества», «Комплектация», «Как
   заказать» and stray text rows, plus the lists with icons they share.
   ========================================================================== */

/* ---------- Lists with icons (stored lists; inc/builder.php adds the class and the icons) ---------- */

.k-icon-list {
  margin: 12px 0 16px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.k-icon-list > li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  font-size: 17px;
  line-height: 26px;
}

.k-icon-list > li > .k-ui-icon {
  flex: none;
  margin-top: 2px;
  color: var(--k-blue);
}

.k-icon-list > li > .k-ui-icon--check {
  width: 22px;
  height: 22px;
}

.k-icon-list__text {
  min-width: 0;
}

/* A lead-in line right before a list sits closer to it (Usluga: «Среди доступных вариантов:»). */
.page-text p:not([class*="k-"]):has(+ .k-icon-list) {
  margin-bottom: 12px;
}

/* ---------- About + «Наши преимущества» ---------- */

.k-about {
  padding: 72px 0;
  background: var(--k-band);
}

.k-about__grid {
  display: grid;
  grid-template-columns: minmax(0, 672fr) minmax(0, 480fr);
  gap: 48px;
  align-items: start;
}

.k-about--home .k-about__grid {
  grid-template-columns: minmax(0, 744fr) minmax(0, 408fr);
}

/* Only the card: it keeps the card column's width. */
.k-about__card:only-child {
  grid-column: 2;
}

.k-about__text + .k-about__text {
  margin-top: 16px;
}

.k-about__text h2:not([class*="k-"]) {
  margin: 48px 0 20px;
}

.k-about__text > h2:first-child {
  margin-top: 0;
}

.k-about__text + .k-about__text > :is(h2, h3):first-child {
  margin-top: 48px;
}

/* Usluga: the service pages' long texts keep a reading measure. */
.k-about--service .k-about__text > :is(p, ul, ol, blockquote) {
  max-width: 620px;
}

.k-about__card {
  padding: 32px;
  border: 1px solid var(--k-hairline);
  border-radius: var(--k-radius-card);
  background: var(--k-white);
}

.k-about__title {
  margin: 0;
  font-size: 24px;
  line-height: 30px;
  letter-spacing: normal;
}

.k-about__lead {
  margin-top: 12px;
}

.k-about__list {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.k-about__title + .k-about__list,
.k-about__lead + .k-about__list {
  margin-top: 20px;
}

.k-about__card > .k-about__list:first-child {
  margin-top: 0;
}

.k-about__item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--k-hairline);
  font-size: 17px;
  line-height: 1.55;
}

.k-about__item:first-child {
  padding-top: 0;
  border-top: 0;
}

.k-about__item:last-child {
  padding-bottom: 0;
}

.k-about__item > .k-ui-icon {
  flex: none;
  margin-top: 1px;
  color: var(--k-blue);
}

.k-about__item-text {
  min-width: 0;
}

.k-about__note {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--k-hairline);
  font-size: 15px;
  line-height: 1.5;
}

/* The stored note keeps its line breaks at the card's line height (not the taller one of numbered lines). */
.k-about .k-about__note p:not([class*="k-"]) {
  line-height: inherit;
}

.k-about__note + .k-about__note {
  margin-top: 16px;
  padding-top: 0;
  border-top: 0;
}

/* ---------- «Комплектация» (after the rental terms, on the same white band) ---------- */

.k-rental--joined {
  padding-bottom: 0;
}

.k-kit {
  padding: 48px 0 72px;
  background: var(--k-white);
}

.k-kit__grid {
  display: grid;
  grid-template-columns: minmax(0, 486fr) minmax(0, 666fr);
  gap: 48px;
  align-items: start;
}

.k-kit--no-picture .k-kit__grid {
  grid-template-columns: minmax(0, 1fr);
}

.k-kit__figure {
  margin: 0;
}

.k-kit__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 486 / 364;
  object-fit: cover;
  border-radius: var(--k-radius-card);
}

.k-kit__caption {
  margin-top: 10px;
  font-size: 14px;
  line-height: 20px;
  color: var(--k-muted);
}

.k-kit__title {
  margin: 0;
}

.k-kit__contents,
.k-kit__title + .k-kit__text {
  margin-top: 20px;
}

.k-kit__body > :first-child {
  margin-top: 0;
}

.k-kit__included {
  margin-top: 36px;
}

.k-kit__text + .k-kit__text {
  margin-top: 36px;
}

.k-kit .page-text h2:not([class*="k-"]) {
  margin: 36px 0 20px;
}

.k-kit .page-text > h2:first-child {
  margin-top: 0;
}

/* The kit list: icon lines, two columns of them when the items are short (Main, Usluga). */
.k-kit .k-icon-list--contents {
  margin: 20px 0;
  gap: 12px;
}

.k-kit .k-icon-list--columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
}

/* The wide boards centre the icon on its item (a two-line item has it beside both lines, Usluga); phones put it at the
   top (below). */
.k-kit .k-icon-list--contents > li {
  align-items: center;
}

.k-kit .k-icon-list--contents > li > .k-ui-icon {
  margin-top: 0;
}

/* «В стоимость … включено»: check marks, then the delivery line in the secondary size (Main). */
.k-kit__text .k-icon-list ~ p:not([class*="k-"]) {
  margin-top: 20px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--k-muted);
}

/* ---------- «Как заказать» (after the quiz, on the same pale band) ---------- */

.k-howto {
  padding: 72px 0;
  background: var(--k-band);
}

/* The quiz above ends with 72 px; the board puts the heading 56 px under its panel. */
.k-howto--joined {
  margin-top: -16px;
  padding-top: 0;
}

.k-howto__text h2:not([class*="k-"]) {
  margin: 0 0 24px;
}

.k-howto__steps {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: k-step;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.k-howto__steps > li {
  position: relative;
  margin: 0;
  padding-top: 56px;
  counter-increment: k-step;
  font-size: 16px;
  line-height: 1.5;
}

.k-howto__steps > li::before {
  content: counter(k-step);
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--k-blue);
  color: var(--k-white);
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
}

.k-howto__steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 20px;
  left: 52px;
  right: 0;
  height: 1px;
  background: var(--k-footer-text);
}

.k-howto__actions {
  margin-top: 36px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}

/* ---------- Text rows that match no slot ---------- */

.k-textrow {
  padding: 56px 0;
  background: var(--k-white);
}

/* ---------- 1024–1199: the wide layouts, fluid ---------- */

@media (max-width: 1199px) {
  .k-about__grid,
  .k-kit__grid {
    gap: 40px;
  }
}

/* ---------- 768–1023: one column for the about block, the steps two by two ---------- */

@media (max-width: 1023px) {
  .k-about {
    padding: 56px 0;
  }

  .k-about__grid,
  .k-about--home .k-about__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .k-about__card:only-child {
    grid-column: auto;
  }

  .k-kit {
    padding: 40px 0 56px;
  }

  .k-kit__grid {
    gap: 32px;
  }

  .k-kit .k-icon-list--columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .k-howto {
    padding-bottom: 56px;
  }

  .k-howto__steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px 24px;
  }

  /* The second step ends its row: no line runs into the edge. */
  .k-howto__steps > li:nth-child(2n)::after {
    display: none;
  }
}

/* ---------- Phones (A-mobile, A-mobile-2, Usluga-mobile, Usluga-mobile-2) ---------- */

@media (max-width: 767px) {
  .k-icon-list {
    margin: 10px 0 12px;
    gap: 8px;
  }

  .k-icon-list > li {
    font-size: 16px;
    line-height: 24px;
  }

  .k-icon-list > li > .k-ui-icon--check {
    width: 20px;
    height: 20px;
  }

  .page-text p:not([class*="k-"]):has(+ .k-icon-list) {
    margin-bottom: 10px;
  }

  /* About: the texts, then the card (16 px under them on the homepage, 20 px on the service pages). */
  .k-about {
    padding: 24px 0 28px;
  }

  .k-about__grid {
    gap: 20px;
  }

  .k-about--home .k-about__grid {
    gap: 16px;
  }

  .k-about__text + .k-about__text {
    margin-top: 12px;
  }

  .k-about__text h2:not([class*="k-"]) {
    margin: 28px 0 12px;
  }

  .k-about__text > h2:first-child {
    margin-top: 0;
  }

  .k-about__text + .k-about__text > :is(h2, h3):first-child {
    margin-top: 28px;
  }

  .k-about__text p:not([class*="k-"]) {
    margin-bottom: 12px;
  }

  .k-about__text > p:last-child {
    margin-bottom: 0;
  }

  .k-about__card {
    padding: 16px;
  }

  .k-about__title {
    font-size: 22px;
    line-height: 28px;
  }

  .k-about__list,
  .k-about__title + .k-about__list,
  .k-about__lead + .k-about__list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .k-about__item,
  .k-about__item:first-child,
  .k-about__item:last-child {
    gap: 12px;
    padding: 0;
    border-top: 0;
    font-size: 16px;
    line-height: 24px;
  }

  .k-about__item > .k-ui-icon {
    margin-top: 0;
  }

  .k-about__note {
    margin-top: 16px;
    padding-top: 16px;
    font-size: 15px;
    line-height: 22px;
  }

  /* «Комплектация»: one white card — heading, picture, list; the included part under a hairline (A-mobile-2). */
  .k-rental--joined {
    padding-bottom: 0;
  }

  .k-kit {
    padding: 16px 0 28px;
  }

  .k-kit__grid {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--k-hairline);
    border-radius: var(--k-radius-card);
    background: var(--k-white);
  }

  .k-kit__body {
    display: contents;
  }

  .k-kit__body > .k-kit__title {
    order: 1;
  }

  .k-kit__figure {
    order: 2;
  }

  .k-kit__contents {
    order: 3;
  }

  .k-kit__included {
    order: 4;
    margin: 4px -16px -16px;
    padding: 16px;
    border-top: 1px solid var(--k-hairline);
  }

  .k-kit__body > .k-kit__included:first-child {
    margin-top: -16px;
    border-top: 0;
  }

  .k-kit__contents,
  .k-kit__body > :first-child {
    margin-top: 0;
  }

  .k-kit__caption {
    margin-top: 8px;
  }

  .k-kit__title,
  .k-kit .page-text h2:not([class*="k-"]) {
    font-size: 20px;
    line-height: 25px;
    letter-spacing: normal;
  }

  .k-kit .page-text h2:not([class*="k-"]) {
    margin: 24px 0 12px;
  }

  .k-kit .page-text > h2:first-child {
    margin-top: 0;
  }

  .k-kit__title + .k-kit__text {
    margin-top: 12px;
  }

  .k-kit__text + .k-kit__text {
    margin-top: 24px;
  }

  .k-kit .k-icon-list--contents,
  .k-kit .k-icon-list--columns {
    margin: 10px 0 12px;
    display: flex;
    gap: 8px;
  }

  .k-kit .page-text > .k-icon-list:first-child {
    margin-top: 0;
  }

  .k-kit .k-icon-list--contents > li {
    align-items: flex-start;
    gap: 10px;
  }

  .k-kit .k-icon-list--check {
    margin-top: 12px;
  }

  .k-kit .k-icon-list--check > li {
    gap: 10px;
  }

  .k-kit .k-icon-list > li > .k-ui-icon,
  .k-kit .k-icon-list > li > .k-ui-icon--check {
    width: 24px;
    height: 24px;
    margin-top: 0;
  }

  .k-kit__text .k-icon-list ~ p:not([class*="k-"]) {
    margin-top: 12px;
    line-height: 22px;
  }

  /* «Как заказать»: a white card 16 px under the quiz panel, the steps one under another. */
  .k-howto {
    padding: 24px 0 28px;
  }

  .k-howto--joined {
    margin-top: -12px;
    padding-top: 0;
  }

  .k-howto__card {
    padding: 16px;
    border: 1px solid var(--k-hairline);
    border-radius: var(--k-radius-card);
    background: var(--k-white);
  }

  .k-howto__text h2:not([class*="k-"]) {
    margin: 0 0 12px;
    font-size: 20px;
    line-height: 25px;
    letter-spacing: normal;
  }

  .k-howto__steps {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .k-howto__steps > li {
    min-height: 40px;
    padding: 0 0 0 52px;
    font-size: 15px;
    line-height: 22px;
  }

  .k-howto__steps > li::before {
    font-size: 17px;
  }

  .k-howto__steps > li:not(:last-child)::after {
    display: none;
  }

  .k-howto__actions {
    margin-top: 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .k-howto__cta {
    width: 100%;
  }

  .k-howto__phone {
    justify-content: center;
  }

  .k-howto__phone .k-ui-icon {
    display: none;
  }

  .k-textrow {
    padding: 24px 0 28px;
  }
}

/* ---------- Narrow phones (320–359) ---------- */

@media (max-width: 359px) {
  .k-howto__cta {
    padding: 0 12px;
    font-size: 16px;
  }
}

