/* Shared layout hardening for Osnova. Loaded last. */

.wrap {
  min-width: 0;
}

html, body {
  overflow-x: clip;
}

header.site nav,
.brand {
  min-width: 0;
}

.hero .wrap {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
}

.hero .wrap > * {
  min-width: 0;
  max-width: 100%;
}

.hero h1,
.hero h1 .u,
.hero .eyebrow,
.hero-meta,
.dir-card,
.dir-card .trigger,
.dir-card .result,
.pain-grid li,
.check-item,
.journey-col li {
  white-space: normal;
  overflow-wrap: break-word;
  max-width: 100%;
}

.hero h1 {
  max-width: 18ch;
}

@media (min-width: 1100px) {
  .hero h1 {
    text-wrap: balance;
  }
}

.hero-cta {
  flex-wrap: wrap;
}

.hero-cta .btn,
.dir-cta,
.check .btn {
  white-space: normal;
  max-width: 100%;
}

.hero-photo,
.hero-photo img {
  min-width: 0;
  max-width: 100%;
}

.hero-photo img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.proof,
.proof > div,
.dir-choice,
.dir-card,
.pain-grid,
.check-grid,
.check-item,
.finale form,
.finale form .row,
.form-field {
  min-width: 0;
}

.finale form input,
.finale form button {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.reviews-head p {
  margin: 0;
  color: var(--muted);
  max-width: 42ch;
}

.reviews-cta.start {
  margin-top: 0;
  justify-content: flex-start;
}

@media (max-width: 1099px) {
  .hero .wrap,
  .live .wrap,
  .finale .wrap,
  .reviews-grid,
  .contacts-grid,
  .results-top {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .hero h1 {
    max-width: none;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .hero-photo {
    order: 2;
    width: 100%;
    max-width: 380px;
    margin-inline: auto;
  }

  .dir-choice,
  .pain-grid,
  .check-grid,
  .skill-grid,
  .format-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .dir-cta {
    justify-self: start;
    white-space: normal;
  }

  .journey {
    grid-template-columns: minmax(0, 1fr);
  }

  .live-points {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .gallery-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(280px, 42vw) minmax(170px, 24vw) minmax(170px, 24vw);
    aspect-ratio: auto;
    min-height: 0;
  }

  .gallery-grid .gallery-item:nth-child(1) {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .gallery-grid .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

@media (max-width: 768px) {
  .hero-cta {
    flex-direction: column;
  }

  .hero-cta .btn,
  .dir-cta,
  .check .btn,
  .reviews-cta .btn,
  .contacts-info .btn,
  .finale form button {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }

  .finale form .row,
  .proof {
    grid-template-columns: minmax(0, 1fr);
  }

  .finale form input,
  .finale form button {
    font-size: 16px;
  }

  .proof > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .dir-choice,
  .format-grid,
  .skill-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .finale form select,
  .finale form textarea {
    font-size: 16px;
    max-width: 100%;
  }

  .gallery-grid {
    grid-template-rows: minmax(220px, 58vw) minmax(140px, 36vw) minmax(140px, 36vw);
    aspect-ratio: auto;
    min-height: 0;
  }

  .gallery-grid .gallery-item img {
    height: 100%;
  }

  .live-points {
    grid-template-columns: minmax(0, 1fr);
  }
}
