/* Fluid / “Tilda auto-layout” layer — load last.
   Continuous clamp scaling + max-width containers; no fixed desktop rails. */

:root {
  --pad: clamp(20px, 4.8vw, 70px);
  --section-y: clamp(56px, 7.2vw, 100px);
  --gap: clamp(14px, 1.8vw, 25px);
  --radius: clamp(16px, 1.7vw, 25px);
  --fs-label: clamp(15px, 0.4vw + 14px, 18px);
  --fs-body: clamp(16px, 0.35vw + 15px, 20px);
  --fs-h3: clamp(20px, 1.1vw + 16px, 31px);
  --fs-h2: clamp(30px, 2.4vw + 18px, 50px);
  --fs-h1: clamp(34px, 3.2vw + 18px, 64px);
  --fs-quote: clamp(24px, 1.6vw + 16px, 35px);
  --touch: 48px;
  /* Space below socials → page end. Floating .site-nav sits at bottom:28px
     with ~80px height; 140px clearance ≈ home visual gap (~30–40px above nav). */
  --footer-nav-clearance: 72px;
}

/* Desktop floating rail visible — match homepage socials→nav breathing room. */
@media (min-width: 901px) {
  html:not(.is-nav-burger) {
    --footer-nav-clearance: 140px;
  }
}

html {
  overflow-x: clip;
}

body {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

img,
svg,
video {
  max-width: 100%;
}

/* ---------- Shared rhythm ---------- */
.section {
  padding: var(--section-y) var(--pad);
  overflow-x: clip;
}

.section-label {
  font-size: var(--fs-label);
}

.button {
  min-height: clamp(52px, 4.5vw, 64px);
  padding: 0 clamp(20px, 2.4vw, 35px);
  font-size: clamp(15px, 0.35vw + 14px, 20px);
  white-space: normal;
  text-align: center;
}

.button--dark {
  min-width: 0;
  width: min(100%, 560px);
}

/* ---------- HOME: hero ---------- */
.hero {
  height: auto;
  min-height: clamp(560px, 72vw, 800px);
  aspect-ratio: auto;
}

@media (max-width: 900px) {
  .hero {
    height: 70vh;
    min-height: 70vh;
    height: 70dvh;
    min-height: 70dvh;
    aspect-ratio: auto;
  }
}

.hero__content {
  left: var(--pad);
  right: var(--pad);
  /* Match interior .page-hero__content (solutions rhythm). */
  top: clamp(120px, 14vw, 184px);
  width: auto;
  max-width: min(648px, 100%);
}

.hero h1 {
  font-size: var(--fs-h1);
}

.hero__content > p {
  width: auto;
  max-width: min(420px, 100%);
  font-size: var(--fs-body);
}

.hero__buttons {
  flex-wrap: wrap;
  gap: clamp(10px, 1.5vw, 20px);
}

/* ---------- HOME: about ---------- */
.about {
  min-height: 0;
}

.about__intro,
.about__intro > p {
  width: auto;
  max-width: 100%;
}

.about h2,
.stats h2,
.projects h2,
.production h2,
.price h2,
.reviews h2,
.contact h2 {
  font-size: var(--fs-h2);
}

.about__intro > p,
.stats__intro > p,
.production__content > p,
.price__lead > p,
.reviews__intro > p:not(.section-label),
.contact__copy > div:first-child > p {
  font-size: var(--fs-body);
}

/* Quote shape is locked; .about__quote-fit is scaled by quote-fit.js. */
.about__quote-fit {
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: 0;
  box-sizing: border-box;
}

.about__quote {
  width: 858px;
  max-width: none;
  margin: 0;
  font-size: 35px;
}

.about__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(24px, 3vw, 45px);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.about__photos {
  display: flex;
  flex: 1 1 auto;
  gap: var(--gap);
  min-width: 0;
  max-width: 100%;
}

.about__photo {
  width: min(100%, 306px);
  max-width: 306px;
  flex: 0 1 306px;
  height: auto;
  aspect-ratio: 306 / 147;
  min-width: 0;
  /* Frame owns the clip — never let fluid imgs rules reshape the crop. */
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  /* Force uniform 4-corner clip (overflow+radius alone can fail to mask absolute imgs). */
  clip-path: inset(0 round var(--radius));
  -webkit-clip-path: inset(0 round var(--radius));
  background: #eee;
  isolation: isolate;
  transform: translateZ(0);
}

/* Zoom crop into Figma composite cards (grey pad + captions baked in).
   Do NOT use inset:0 / 100% — that letterboxes the photo inside the asset. */
.about__photo img {
  position: absolute !important;
  inset: auto !important;
  left: -6.34% !important;
  top: -8.19% !important;
  right: auto !important;
  bottom: auto !important;
  width: 113% !important;
  height: 157% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center;
  border-radius: 0 !important;
}

.about__photo + .about__photo img {
  left: -6.55% !important;
  top: -7.93% !important;
  width: 113.27% !important;
  height: 157.71% !important;
}

/* Restore Figma list: sand • via styles.css ::before, max-content cols.
   Don’t shrink into equal 1fr chips (that wrapped “Честная стоимость”).
   If photos + facts won’t fit, .about__bottom flex-wrap drops facts to next row. */
.about__facts {
  display: grid;
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  grid-template-columns: repeat(2, max-content);
  gap: 6px 60px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.about__facts li {
  white-space: nowrap;
}

/* ---------- HOME: life / stats ---------- */
.stats {
  min-height: 0;
}

.stats__intro,
.stats__intro > p,
.stats__grid {
  width: auto;
  max-width: 100%;
}

.life__intro,
.life__intro h2 {
  width: auto;
  max-width: 100%;
}

.life-grid,
.life__grid {
  display: grid;
  gap: clamp(28px, 4vw, 70px);
}

/* ---------- HOME: projects carousel ---------- */
.projects h2 {
  width: auto;
  max-width: 100%;
  margin-inline: auto;
}

.projects__arrows {
  width: min(100%, 1300px);
  max-width: 100%;
}

/* Absolute overlay: left+right insets — never width:100% (pushes next arrow past edge). */
.projects__controls {
  left: var(--pad);
  right: var(--pad);
  width: auto;
  max-width: none;
  box-sizing: border-box;
}

.project {
  width: clamp(260px, 42vw, 527px);
  flex: 0 0 auto;
  max-width: min(527px, 85vw);
}

.project__media {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: auto;
  aspect-ratio: 527 / 600;
  border-radius: var(--radius);
  background: #eee;
}

/* Absolute crop images must fill the frame, not shrink to intrinsic ratio. */
.project__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center;
}

.project--1 .project__media img { object-position: 38% center; }
.project--2 .project__media img { object-position: left center; }
.project--3 .project__media img { object-position: center bottom; }
.project--4 .project__media img { object-position: 72% center; }
.project--5 .project__media img { object-position: 32% center; }
.project--6 .project__media img { object-position: 58% center; }

.project h3 {
  height: auto;
  font-size: var(--fs-h3);
}

.project p {
  font-size: var(--fs-body);
}

/* ---------- HOME: production ---------- */
.production__body {
  display: grid;
  grid-template-columns: minmax(0, 638fr) minmax(0, 637fr);
  gap: 25px;
  align-items: start;
}

.production__image,
.production__media,
.production__content {
  width: 100%;
  max-width: 100%;
}

.production__image,
.production__media {
  height: auto;
  aspect-ratio: 638 / 652;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.production__media img,
.production__media > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center;
}

.production__image {
  max-width: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.production__content > p {
  width: auto;
  max-width: min(416px, 100%);
}

.production__cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 25px;
  width: 100%;
}

.production__cards article {
  box-sizing: border-box;
  height: auto;
  min-height: 0;
  min-width: 0;
  aspect-ratio: auto;
  /* Figma Key Feature: pt15 pr5 pb20 pl15 */
  padding: 15px 5px 20px 15px;
  overflow: visible;
  border-radius: var(--radius);
}

.production__cards h3 {
  font-size: clamp(18px, 1vw + 14px, 25px);
  max-width: 100%;
  /* Titles wrap only at spaces — "anywhere" was forcing early breaks. */
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.production__cards p {
  font-size: clamp(15px, 0.4vw + 13px, 20px);
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
}

.factory {
  height: auto !important;
  min-height: clamp(360px, 48vw, 560px);
}

.factory--statement {
  height: auto !important;
  min-height: clamp(380px, 50vw, 520px);
}

.factory img {
  max-width: none;
}

.factory--statement > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  object-fit: cover;
  object-position: center;
}

/* ---------- HOME: price ---------- */
.price__panel {
  height: auto;
  min-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.price__content {
  width: auto;
  max-width: 100%;
  margin: clamp(18px, 2vw, 25px) clamp(12px, 3vw, 70px) clamp(24px, 3vw, 40px) clamp(10px, 1.5vw, 16px);
}

.price__lead h2 {
  white-space: normal;
}

.price__lead > p,
.price__extra-copy {
  width: auto;
  max-width: min(680px, 100%);
}

.price__rows > div {
  height: auto;
  min-height: clamp(72px, 8vw, 101px);
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 15px;
  padding: clamp(16px, 2vw, 25px) 0;
}

.price__rows strong {
  font-size: clamp(28px, 3vw + 12px, 50px);
}

.price__rows h3 {
  font-size: clamp(16px, 0.8vw + 12px, 25px);
}

/* ---------- HOME: reviews ---------- */
.reviews {
  height: auto;
  min-height: 0;
}

.reviews__intro,
.reviews__intro > p:not(.section-label),
.reviews__right {
  width: auto;
  max-width: 100%;
}

.reviews__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr);
  gap: var(--gap);
  align-items: stretch;
}

.review--portrait {
  width: 100%;
  height: auto;
  min-height: clamp(420px, 55vw, 532px);
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.review--portrait > img {
  border-radius: var(--radius);
}

.review--portrait .review__copy {
  height: auto;
  margin: 15px;
  padding: clamp(14px, 1.5vw, 20px);
}

.review--wide,
.review--reverse {
  width: 100%;
  height: auto;
  min-height: 0;
  padding: clamp(12px, 1.2vw, 15px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: end;
}

.review--wide .review__copy,
.review--reverse .review__copy,
.review--wide > img,
.review--reverse > img {
  width: 100%;
  max-width: 100%;
  height: auto;
}

.review--wide > img,
.review--reverse > img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
}

.review header {
  flex-wrap: wrap;
  gap: 10px 14px;
}

.review header h3 {
  white-space: normal;
  font-size: clamp(18px, 1vw + 12px, 25px);
}

.review header img {
  width: min(153px, 40vw);
  height: auto;
}

.review p {
  font-size: clamp(14px, 0.4vw + 12px, 20px);
}

.review--reverse .button {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 0 20px;
}

/* ---------- HOME: contact + footer ---------- */
/* Desktop: do NOT zero .contact min-height — footer is position:absolute
   at top:654px inside .contact (overflow:hidden). Collapsing min-height
   clips the footer and squashes .contact__bg (object-fit:fill stretch). */
.contact__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 400px);
  gap: clamp(40px, 8vw, 120px);
  padding: clamp(72px, 10vw, 150px) var(--pad) 0;
  align-items: start;
}

.contact__copy,
.contact__copy > div:first-child > p,
.contact__points {
  width: auto;
  max-width: 100%;
}

.contact__copy {
  gap: clamp(40px, 8vw, 148px);
}

.contact__buttons {
  flex-wrap: wrap;
  gap: clamp(10px, 1.5vw, 20px);
}

.form {
  width: 100%;
  max-width: 400px;
  height: auto;
  min-height: 504px;
}

/* Absolute bg must keep cover-frame sizing — never height:auto from fluid imgs. */
.contact__bg {
  max-width: none !important;
  width: 100% !important;
  height: 100% !important;
  inset: 0;
  left: auto;
  top: auto;
  object-fit: cover !important;
  object-position: center;
}

.form__title,
.form label:not(.form__consent),
.form__consent,
.form .button {
  width: 100%;
  max-width: 100%;
}

.form input:not([type="checkbox"]) {
  width: 100%;
}

footer,
.contact > footer {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 92px);
  padding: clamp(72px, 10vw, 150px) var(--pad) var(--footer-nav-clearance);
}

footer h3 {
  font-size: clamp(18px, 1vw + 12px, 25px);
}

footer a,
footer p {
  font-size: var(--fs-body);
}

.contact__logo {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 1440 / 503;
  max-height: 503px;
}

/* ---------- Bullet lists (home) ---------- */
.price__extra-list,
.contact__points-list {
  width: 100%;
  max-width: min(520px, 100%);
}

/* ---------- INTERIOR PAGES ---------- */
.page-hero,
.page-hero--compact {
  min-height: clamp(520px, 70vw, 760px);
}

.page-hero__content {
  width: min(925px, calc(100% - 2 * var(--pad)));
  margin: 0 var(--pad) clamp(48px, 6vw, 86px);
}

.page-hero h1 {
  font-size: var(--fs-h1);
  max-width: 100%;
}

.page-hero__content > p {
  max-width: min(520px, 100%);
  font-size: var(--fs-body);
}

.page-hero__actions {
  flex-wrap: wrap;
  gap: clamp(10px, 1.5vw, 20px);
}

.page-section {
  padding: clamp(64px, 9vw, 130px) var(--pad);
}

.page-section__head {
  gap: clamp(24px, 3vw, 50px);
}

.page-section h2 {
  font-size: clamp(32px, 3.4vw + 12px, 64px);
  max-width: 100%;
}

.page-section__lead,
.page-section__sidecopy {
  max-width: min(510px, 100%);
  font-size: var(--fs-body);
}

.case-grid,
.solution-grid,
.trust-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.process-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: var(--gap);
}

.process-grid--four {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: var(--gap);
}

.page-band,
.page-cta {
  min-height: clamp(360px, 48vw, 505px);
  padding: clamp(40px, 5vw, 70px) var(--pad);
}

.page-band h2,
.page-cta h2 {
  font-size: clamp(32px, 3.5vw + 10px, 62px);
}

.page-band__copy,
.page-cta__copy {
  max-width: min(720px, 100%);
}

.page-footer__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(28px, 3vw, 50px);
  padding: clamp(56px, 7vw, 150px) var(--pad) var(--footer-nav-clearance);
}

@media (min-width: 901px) {
  /* Bottom gap comes from --footer-nav-clearance padding, not min-height math
     (tall grid content used to eat the old 500px spacer and collapse the gap). */
  .page-footer {
    min-height: 0;
  }

  .page-footer__grid {
    padding: 150px 70px var(--footer-nav-clearance);
  }

  /* CTA→footer join keeps 65px top; bottom matches home clearance. */
  .page-outro .page-footer__grid,
  .page-outro--about .page-footer__grid,
  .page-footer.page-outro--about .page-footer__grid {
    padding: 65px 70px var(--footer-nav-clearance);
  }
}

.page-footer__brand {
  font-size: clamp(48px, 12vw, 180px);
}

.contacts-layout,
.production-feature,
.about-story,
.case-story,
.case-hero__info {
  gap: var(--gap);
}

/* Map card: photo only in col 1, stretch to text-column height (never absolute over both cols) */
.map-frame {
  gap: 0 !important;
}
@media (min-width: 901px) {
  .map-frame > img {
    width: 100% !important;
    height: 0 !important;
    min-height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
  }
}
@media (max-width: 900px) {
  .map-frame > img {
    width: 100% !important;
    height: 340px !important;
    min-height: 0 !important;
    max-width: none !important;
    object-fit: cover !important;
  }
}

.contact-form,
.contact-details {
  width: 100%;
  max-width: 100%;
}

.contact-form input,
.contact-form label {
  width: 100%;
  max-width: 100%;
}

@media (min-width: 901px) {
  .page-hero__content {
    position: absolute !important;
    top: clamp(120px, 14vw, 184px) !important;
    width: min(900px, calc(100% - 2 * var(--pad))) !important;
    left: var(--pad) !important;
    margin: 0 !important;
  }

  .hero__content {
    top: clamp(120px, 14vw, 184px) !important;
  }

  .hero {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 4356 / 2577;
    min-height: 0;
    height: auto;
  }
}

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .production__body {
    gap: clamp(24px, 4vw, 48px);
  }

  .reviews__grid {
    grid-template-columns: 1fr;
  }

  .contact__inner {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .form {
    max-width: 100%;
  }

  footer,
  .contact > footer,
  .page-footer__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .process-grid--four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Mobile / small tablet ---------- */
@media (max-width: 900px) {
  /* Footer is in normal flow on small screens — allow natural height. */
  .contact {
    min-height: 0 !important;
  }

  .production__body {
    grid-template-columns: 1fr;
  }

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

  .about__bottom {
    flex-direction: column;
    align-items: stretch;
  }

  .about__photos {
    width: 100%;
  }

  .about__facts {
    width: max-content;
    max-width: 100%;
    grid-template-columns: repeat(2, max-content);
    gap: 10px 40px;
  }

  .about__photo {
    flex: 0 1 calc(50% - 8px);
    max-width: calc(50% - 8px);
  }

  .about__photo img {
    max-width: none !important;
  }

  .review--wide,
  .review--reverse {
    grid-template-columns: 1fr;
  }

  .review--wide > img,
  .review--reverse > img {
    order: -1;
    aspect-ratio: 16 / 10;
  }

  /* Interior editorial: stack, don’t squeeze 2-col on phone */
  .case-card,
  .solution-card,
  .trust-card,
  .life-card {
    grid-template-columns: 1fr !important;
    gap: 18px;
  }

  .case-card:nth-child(even) .case-card__image,
  .solution-card:nth-child(even) > img,
  .trust-card:nth-child(even) > img,
  .life-card:nth-child(even) > img {
    order: 0 !important;
  }

  .case-grid,
  .solution-grid,
  .trust-grid,
  .about-portrait,
  .about-story,
  .contacts-layout,
  .production-feature,
  .map-frame,
  .case-story,
  .case-gallery,
  .case-hero__info {
    grid-template-columns: 1fr !important;
  }

  .page-section__head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .page-hero__content {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: calc(100% - 2 * var(--pad)) !important;
    margin: 0 var(--pad) clamp(40px, 8vw, 70px) !important;
    padding-top: clamp(140px, 28vw, 220px);
  }

  .page-hero,
  .page-hero--compact {
    display: flex;
    align-items: flex-end;
    min-height: clamp(560px, 120vw, 840px);
    aspect-ratio: auto !important;
  }

  .process-grid,
  .process-grid--four {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .production__cards {
    grid-template-columns: 1fr;
  }

  .about__facts {
    width: 100%;
    max-width: 100%;
    grid-template-columns: max-content;
    gap: 10px;
  }

  .stats__grid,
  .life-grid,
  .life__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  footer,
  .contact > footer,
  .page-footer__grid {
    grid-template-columns: 1fr;
  }

  .hero__buttons .button,
  .page-hero__actions .button,
  .contact__buttons .button {
    width: 100%;
  }

  .project {
    width: min(83vw, 360px);
  }

  .site-menu {
    width: min(350px, calc(100vw - 72px));
  }

  .site-menu-toggle {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
  }
}

/* Safe areas */
@supports (padding: max(0px)) {
  .section,
  .page-section,
  .page-band,
  .page-cta,
  .contact__inner,
  footer,
  .page-footer__grid {
    padding-left: max(var(--pad), env(safe-area-inset-left));
    padding-right: max(var(--pad), env(safe-area-inset-right));
  }
}

/* ---------- Production desktop: fluid 638/637 split ---------- */
@media (min-width: 901px) {
  .production .production__body {
    display: grid !important;
    grid-template-columns: minmax(0, 638fr) minmax(0, 637fr) !important;
    gap: 25px !important;
    align-items: start !important;
  }

  .production .production__media,
  .production .production__content,
  .production .production__cards {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 0 !important;
  }

  .production .production__cards {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 25px !important;
  }

  .production .production__cards article {
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0;
    aspect-ratio: auto !important;
    padding: 15px 5px 20px 15px !important;
    overflow: visible;
  }

  .hero__content {
    width: min(648px, calc(100% - 2 * var(--pad))) !important;
    top: clamp(120px, 14vw, 184px) !important;
  }

  /* Absolute footer at top:654px — tall enough for top pad + columns + clearance. */
  .contact {
    min-height: calc(654px + 150px + 300px + var(--footer-nav-clearance)) !important;
  }
}

@media (min-width: 700px) and (max-width: 900px) {
  .production__cards {
    width: 100% !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .production__cards article {
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: auto !important;
    padding: 18px 20px 20px !important;
    overflow: visible;
  }
}

/* Scale the FRAME only — do not clamp absolute cover imgs (breaks 4-corner radius). */
.about__photo {
  max-width: 306px;
  overflow: hidden !important;
  border-radius: var(--radius) !important;
  clip-path: inset(0 round var(--radius)) !important;
  -webkit-clip-path: inset(0 round var(--radius)) !important;
}

.about__photos img,
.about__photo img {
  max-width: none !important;
  border-radius: 0 !important;
}

.project,
.project > img,
.project__media {
  max-width: 100%;
}

.project__media img {
  max-width: none !important;
}

.price__extra-copy {
  width: auto !important;
  max-width: 100% !important;
}

footer > div:nth-child(1) a,
footer > div:nth-child(2) a,
.footer__contact > p:first-of-type {
  white-space: normal !important;
}

/* Quote inline masks: fixed Figma 219×68 overlay over the text spacers. */
.about__quote-images {
  position: absolute !important;
  top: 60px;
  left: 291px !important;
  right: auto;
  width: 219px !important;
  height: 68px !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: fill;
  pointer-events: none;
}

@media (max-width: 900px) {
  .about__quote-fit {
    margin-left: 0;
    margin-right: 0;
  }

  .about__quote {
    width: 858px !important;
    max-width: none !important;
    margin: 0 !important;
    font-size: 35px !important;
  }

  .about__quote .about__quote-line {
    display: block;
    white-space: nowrap !important;
  }

  .about__quote-line--first {
    padding-left: 310px !important;
  }

  .about__quote-space {
    display: inline-block !important;
  }

  .about__quote-images {
    display: block !important;
  }

  /* Keep carousel arrows inside the padded content column. */
  .projects__controls {
    left: var(--pad) !important;
    right: var(--pad) !important;
    width: auto !important;
    max-width: none !important;
  }

  .reviews__grid {
    grid-template-columns: 1fr;
  }
}

/* Final cover-crop lock — beats img { max-width:100% } and any height:auto leaks.
   .about__photo img is excluded: it needs the oversized Figma zoom, not inset:0. */
.project__media img,
.project > img,
.production__media img,
.production__media > img,
.factory--statement > img,
.life-card figure img,
.review--portrait > img {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  border-radius: 0 !important;
}

.about__photo {
  position: relative !important;
  overflow: hidden !important;
  border-radius: var(--radius) !important;
  clip-path: inset(0 round var(--radius)) !important;
  -webkit-clip-path: inset(0 round var(--radius)) !important;
  width: min(100%, 306px) !important;
  max-width: 306px !important;
  height: auto !important;
  aspect-ratio: 306 / 147 !important;
}

/* Re-assert zoom after any later absolute-cover rules */
.about__photo img {
  position: absolute !important;
  inset: auto !important;
  left: -6.34% !important;
  top: -8.19% !important;
  right: auto !important;
  bottom: auto !important;
  width: 113% !important;
  height: 157% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  border-radius: 0 !important;
}

.about__photo + .about__photo img {
  left: -6.55% !important;
  top: -7.93% !important;
  width: 113.27% !important;
  height: 157.71% !important;
}

.life-card figure,
.review--portrait {
  position: relative;
  overflow: hidden;
}

.project--1 .project__media img { object-position: 38% center !important; }
.project--2 .project__media img { object-position: left center !important; }
.project--3 .project__media img { object-position: center bottom !important; }
.project--4 .project__media img { object-position: 72% center !important; }
.project--5 .project__media img { object-position: 32% center !important; }
.project--6 .project__media img { object-position: 58% center !important; }

.case-card,
.solution-card,
.trust-card,
.life-card {
  min-width: 0;
}

.case-card__body,
.solution-card > div,
.trust-card__body,
.life-card > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.case-card h3,
.solution-card h3,
.trust-card h3,
.life-card h3 {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.page-hero,
.page-hero--compact,
.hero {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.page-main,
main {
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
}

body {
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
}

/* Soften remaining absolute rails that cause mid-width overflow */
.projects h2,
.projects__arrows {
  width: auto !important;
  max-width: 100% !important;
}

.price__content {
  width: auto !important;
  max-width: 100% !important;
}

.about__intro,
.stats__intro,
.reviews__intro {
  width: auto !important;
  max-width: 100% !important;
}

@media (min-width: 901px) {
  .about__quote-fit {
    margin-left: auto;
    margin-right: 0;
  }

  .about__quote {
    width: 858px !important;
    max-width: none !important;
    margin: 0 !important;
    font-size: 35px !important;
  }
}

/* Homepage #production — fluid grid (no transform:scale).
   Columns shrink via minmax(0,1fr); type uses clamp so titles stay on one line. */
@media (min-width: 901px) {
  #production.section {
    display: block !important;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding: 50px var(--pad) !important;
    overflow-x: clip;
    height: auto;
    max-height: none;
    aspect-ratio: auto;
  }

  #production .production__frame {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 25px !important;
    transform: none;
  }

  #production .section-label {
    margin: 0 !important;
    width: 100% !important;
    font-family: var(--involve) !important;
    font-weight: 500 !important;
    font-size: var(--fs-label) !important;
    line-height: 1.35 !important;
    color: rgba(0, 0, 0, 0.5) !important;
  }

  #production .production__body {
    display: grid !important;
    grid-template-columns: minmax(0, 638fr) minmax(0, 637fr) !important;
    align-items: stretch !important;
    gap: 25px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  #production .production__media {
    box-sizing: border-box;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    flex: none !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
    border-radius: var(--radius) !important;
    overflow: hidden !important;
    position: relative !important;
    align-self: stretch !important;
    margin: 0 !important;
  }

  #production .production__media > img {
    position: absolute !important;
    inset: 0 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center !important;
  }

  #production .production__content {
    box-sizing: border-box;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #production .production__content h2 {
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
    font-family: var(--mont) !important;
    font-weight: 500 !important;
    font-size: clamp(28px, 3.47vw, 50px) !important;
    line-height: 1.08 !important;
    letter-spacing: -0.02em !important;
    white-space: nowrap !important;
  }

  #production .production__content > p {
    box-sizing: border-box;
    width: auto !important;
    max-width: min(416px, 100%) !important;
    margin: 20px 0 0 !important;
    padding: 0 !important;
    font: 400 var(--fs-body) / 1.35 var(--inter) !important;
    color: var(--muted) !important;
  }

  #production .production__cards {
    display: grid !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: clamp(28px, 3.5vw, 50px) 0 0 !important;
    padding: 0 !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: clamp(14px, 1.6vw, 25px) !important;
    justify-content: start !important;
  }

  #production .production__cards article {
    box-sizing: border-box;
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 15px 5px 20px 15px !important;
    border-radius: var(--radius) !important;
    background: #fff !important;
    overflow: hidden !important;
    container-type: inline-size;
  }

  #production .production__cards article > img {
    box-sizing: border-box;
    display: block;
    width: 40px !important;
    height: 40px !important;
    padding: 8px !important;
    border-radius: 15px !important;
    background: rgba(226, 186, 155, 0.1) !important;
    object-fit: contain !important;
  }

  #production .production__cards article:nth-child(3) > img {
    padding: 8px 11px !important;
  }

  /* Keep «Новое оборудование» on one line as cards shrink */
  #production .production__cards h3 {
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
    margin: 15px 0 0 !important;
    padding: 0 !important;
    font-family: var(--involve) !important;
    font-weight: 400 !important;
    /* ~8.7% of card width → ~25px at Figma 306px card; shrinks with card */
    font-size: clamp(13px, 8.7cqi, 25px) !important;
    line-height: 1.25 !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: clip !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    hyphens: none !important;
  }

  #production .production__cards p {
    margin: 5px 0 0 !important;
    max-width: 100% !important;
    font: 400 clamp(14px, 0.35vw + 12px, 20px) / 1.2 var(--inter) !important;
    color: var(--muted) !important;
    overflow-wrap: break-word;
    word-break: normal;
  }
}
