/* Shared intrinsic-content layer.
   Native spacing is expressed as padding/gaps while editorial content and
   repeated records stay in flow. Stateful controls never own section height. */
:where(.site-header, main, .site-footer) :where(h1, h2, h3, p, a, span, button, summary, strong, small, em) {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

[data-carousel-controls][hidden],
.slider-nav--equipment[hidden] { display: none !important; }
html:not(.js) body .slider-nav--equipment { display: none !important; }

/* Shared footer: same visual groups, count/text-independent rows. */
body > .site-footer,
body > .site-footer > .footer-grid {
  height: auto !important;
  min-height: 0 !important;
}
body > .site-footer > .footer-grid {
  position: relative !important;
  display: grid !important;
  grid-template-columns: 215px 120px 120px minmax(220px, 1fr) 315px;
  grid-template-areas:
    "contact primary secondary info management"
    "brand social social payment warning";
  gap: 54px 38px;
  padding-top: 60px;
  padding-bottom: 72px;
}
body > .site-footer :where(.footer-column, .footer-social, .footer-payment, .footer-warning, .brand--footer) {
  position: relative !important;
  inset: auto !important;
  width: auto !important;
  height: auto !important;
}
body > .site-footer .footer-column { align-self: start; }
body > .site-footer .footer-contact { grid-area: contact; }
body > .site-footer .footer-nav-primary { grid-area: primary; }
body > .site-footer .footer-column--second-nav { grid-area: secondary; margin-top: 35px; }
body > .site-footer .footer-info { grid-area: info; }
body > .site-footer .footer-management { grid-area: management; }
body > .site-footer .footer-social { grid-area: social; }
body > .site-footer .footer-payment { grid-area: payment; }
body > .site-footer .footer-warning { grid-area: warning; align-self: start; }
body > .site-footer .brand--footer { grid-area: brand; min-height: 82px; }
body > .site-footer .footer-management .button { width: 100% !important; }

/* Shared flow owners. */
body main > section.has-empty-collection [data-carousel-controls],
body main > section.has-empty-collection .slider-nav--equipment { display: none !important; }
html:not(.js) [data-carousel-track] { transform: none !important; }
html:not(.js) :is(.video-strip, .work-carousel, .certificate-carousel, .equipment-grid, .about-values__viewport, .doctor-grid, .about-gallery__carousel) {
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: visible !important;
}

/* Home/service carousel section shells. */
body[data-page="home"] main > :is(.cases, .equipment) > .page-shell,
body[data-page="services"] main > :is(.cases, .licenses) > .page-shell {
  height: auto !important;
}
body[data-page="home"] main > :is(.cases, .equipment) .section-heading,
body[data-page="services"] main > :is(.cases, .licenses) .section-heading--figma {
  position: relative !important;
  inset: auto !important;
  height: auto !important;
}
body[data-page="home"] main > :is(.cases, .equipment) .section-heading h2 {
  position: relative !important;
  inset: auto !important;
  width: min(100%, 950px) !important;
  margin-top: 0 !important;
}
body[data-page="services"] main > :is(.cases, .licenses) .section-heading--figma h2 {
  position: relative !important;
  inset: auto !important;
  width: min(100%, 950px) !important;
  margin-top: 70px !important;
}
body[data-page="home"] main > .cases .work-carousel,
body[data-page="services"] main > .cases .work-carousel,
body[data-page="services"] main > .licenses .certificate-carousel {
  position: relative !important;
  inset: auto !important;
  height: auto !important;
  margin-top: 72px;
}
body[data-page="services"] main > .licenses .section-intro {
  position: relative !important;
  inset: auto !important;
  width: min(100%, 650px) !important;
  margin-top: 70px !important;
}
body[data-page="home"] main > .equipment .equipment-grid {
  position: relative !important;
  inset: auto !important;
  margin-top: 72px;
}
body[data-page="home"] main > .equipment .slider-nav--equipment,
body[data-page="home"] main > .equipment .equipment-cta {
  position: relative !important;
  inset: auto !important;
  margin-top: 30px;
}
body[data-page="home"] main > .equipment .slider-nav--equipment,
body[data-page="home"] main > .equipment .equipment-cta {
  transform: none !important;
}
body[data-page="home"] main > .equipment .slider-nav--equipment {
  width: max-content;
  margin-inline: auto;
}
body[data-page="home"] main > .equipment .equipment-cta,
body[data-page="home"] .doctors .section-action {
  width: min(340px, 100%) !important;
  max-width: 100%;
  margin-inline: auto;
}
body[data-page="home"]:not([data-route="about"]) .hero--home .hero__eyebrow {
  width: 100%;
  max-width: 100%;
  white-space: normal;
}

/* Service fixed shells become intrinsic pairs. */
body[data-page="services"] main > section.rating { padding: 0; }
body[data-page="services"] main > :is(.cases, .licenses, .contacts--home, .service-rating--home) {
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}
body[data-page="services"] .service-rating--home .rating-grid,
body[data-page="services"] .service-rating--home .rating-card {
  height: auto !important;
  min-height: 0 !important;
}
body[data-page="services"] .service-rating--home .rating-grid,
body:is([data-page="home"], [data-page="services"]) .rating-grid {
  grid-template-rows: none !important;
  grid-auto-rows: auto !important;
}
body[data-page="services"] .service-rating--home .rating-card {
  display: grid !important;
  grid-template-columns: 56px minmax(0, 1fr) max-content;
  grid-template-rows: auto auto auto;
  gap: 15px 20px;
  padding: 30px;
}
body[data-page="services"] .service-rating--home .rating-card > :where(img, span, strong, small) {
  position: relative !important;
  inset: auto !important;
}
body[data-page="services"] .service-rating--home .rating-card > img { grid-row: 1 / 4; }
body[data-page="services"] .service-rating--home .rating-card > span:not(.stars) { grid-column: 2; }
body[data-page="services"] .service-rating--home .rating-card > strong { grid-column: 3; }
body[data-page="services"] .service-rating--home .rating-card > :is(.stars, small) { grid-column: 2 / 4; }
body[data-page="services"] .contacts--home .contacts-card,
body[data-page="services"] .contacts--home .contacts-card__info {
  height: auto !important;
  min-height: 0 !important;
}
body main .contacts-card,
body main .contacts-card__info {
  height: auto !important;
  min-height: 0 !important;
}
body main .contacts-card { align-items: stretch; }
body main .contacts-card__info > :where(.brand, .contacts-card__label, p, a, .contacts-card__social-label, .social-list, .button) {
  position: relative !important;
  inset: auto !important;
}
body[data-page="services"] .contacts--home .contacts-card__info {
  display: flex;
  flex-direction: column;
}
body[data-page="services"] .contacts--home .contacts-card__info > :where(.brand, p, a, .contacts-card__label, .contacts-card__social-label, .social-list) {
  position: relative !important;
  inset: auto !important;
}

/* The home and service routes render the same address card component. */
body:is([data-page="home"], [data-page="services"]) main .contacts-card { column-gap: 20px; }
body:is([data-page="home"], [data-page="services"]) main .contacts-card .contacts-card__info {
  display: flex;
  height: auto;
  flex-direction: column;
}
body:is([data-page="home"], [data-page="services"]) main .contacts-card .contacts-card__info .brand { flex: 0 0 82px; }
body:is([data-page="home"], [data-page="services"]) main .contacts-card .contacts-card__label { margin-top: 46px; }
body:is([data-page="home"], [data-page="services"]) main .contacts-card .contacts-card__info > p { width: auto; margin-top: 19px; }
body:is([data-page="home"], [data-page="services"]) main .contacts-card .contacts-card__info > a:not(.brand):not(.button) { margin-top: 22px; }
body:is([data-page="home"], [data-page="services"]) main .contacts-card .contacts-card__social-label { margin-top: 41px; }
body:is([data-page="home"], [data-page="services"]) main .contacts-card .contacts-card__info .social-list { margin-top: 18px; }
body:is([data-page="home"], [data-page="services"]) main .contacts-card .contacts-card__info .button { flex: 0 0 60px; margin-top: auto; }
body:is([data-page="home"], [data-page="services"]) main .contacts-card .contacts-card__info .button { width: 100%; }

body[data-page="services"] main > .doctors--home,
body[data-page="services"] main > .doctors--home > .page-shell {
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}
body[data-page="services"] main > .doctors--home > .page-shell { padding-bottom: 60px; }
body[data-page="services"] .doctors--home .doctor-grid {
  position: relative;
  inset: auto;
  grid-template-rows: none;
  grid-auto-rows: minmax(345px, auto);
}
body[data-page="services"] .doctors--home .doctor-card { height: auto; min-height: 345px; }
body[data-page="services"] .doctors--home .doctor-card__bio {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

@media (max-width: 1359px) {
  body > .site-footer > .footer-grid {
    width: calc(100% - 64px);
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-areas:
      "contact primary secondary info"
      "brand social management management"
      "brand payment warning warning";
    padding-top: 50px;
    padding-bottom: 50px;
  }

  body[data-page="home"] main > :is(.cases, .equipment) > .page-shell {
    padding-top: 0;
  }
  body[data-page="home"] main > :is(.cases, .equipment) .section-heading {
    padding-top: 78px;
  }
  body[data-page="home"] main > .cases .section-heading h2 { min-height: 50px; }
  body[data-page="home"] main > .cases .work-carousel { margin-top: 57px; }
  :is(body[data-page="home"]:not([data-route="about"]), body[data-route="about"]) main > .cases > .page-shell {
    padding-top: 0;
    padding-bottom: 152px;
  }
  body[data-page="home"] main > .equipment .section-heading h2 { min-height: 100px; }
  body[data-page="home"] main > .equipment .equipment-grid { margin-top: 32px; }
  body[data-page="home"] main > .equipment .equipment-cta {
    display: flex;
    position: relative !important;
    inset: auto !important;
    margin-inline: auto !important;
    margin-top: 28px;
  }
  body[data-page="home"] main > .equipment > .page-shell { padding-bottom: 60px; }
}

@media (min-width: 768px) and (max-width: 1199px) {
  body[data-page="home"] main > .equipment .slider-nav--equipment {
    position: relative !important;
    inset: auto !important;
    margin-top: 20px;
  }
  body[data-page="home"] main > .equipment .equipment-cta { margin-top: 30px; }
  body[data-page="home"] main > .equipment > .page-shell { padding-bottom: 60px; }
}

@media (min-width: 1360px) {
  body[data-page="services"] main > .contacts--home { padding-bottom: 0 !important; }
  body[data-page="services"] main > .contacts--home { min-height: 847px !important; }
  body[data-page="services"] main > .licenses > .page-shell {
    display: grid;
    grid-template-columns: minmax(0, 456px) minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 25px 100px;
  }
  body[data-page="services"] main > .licenses .section-heading--figma { grid-column: 1; grid-row: 1; }
  body[data-page="services"] main > .licenses .section-intro { grid-column: 1; grid-row: 2; margin-top: 0 !important; }
  body[data-page="services"] main > .licenses .certificate-carousel { grid-column: 2; grid-row: 1 / 3; margin-top: 35px; }
  :is(body[data-page="home"]:not([data-route="about"]), body[data-route="about"]) main > .cases > .page-shell {
    padding-top: 0;
    padding-bottom: 136px;
  }
  :is(body[data-page="home"]:not([data-route="about"]), body[data-route="about"]) main > .cases .work-carousel { margin-top: 50px; }
  :is(body[data-page="home"]:not([data-route="about"]), body[data-route="about"]) main > .cases .work-card__image { height: 534px; }
  body[data-page="services"] main > .cases > .page-shell { padding-bottom: 78px; }
  body[data-page="services"] main > .service-rating--home > .page-shell { padding-bottom: 140.25px; }
  body[data-page="services"] main > .licenses > .page-shell { padding-bottom: 120px; }
  body[data-page="services"] main > .cases .work-card__image { height: 534px; }
  body[data-page="services"] main > .promotions--home { margin-top: 60px; }
  body[data-page="home"] main > .cases > .page-shell {
    padding-top: 0;
    padding-bottom: 136px;
  }
  body[data-page="home"] main > :is(.cases, .equipment) .section-heading { padding-top: 95px; }
  body[data-page="home"] main > .cases .work-carousel { margin-top: 50px; }
  body[data-page="home"] main > .equipment > .page-shell {
    padding-top: 0;
    padding-bottom: 100px;
  }
  body[data-page="home"] main > .equipment .equipment-grid { margin-top: 50px; }
  body[data-page="home"] main > .equipment .equipment-cta {
    position: absolute !important;
    top: 139px !important;
    right: 0 !important;
    bottom: auto !important;
    left: auto !important;
    width: 360px !important;
    margin: 0;
  }
}

@media (max-width: 767px) {
  body > .site-footer > .footer-grid {
    width: calc(100% - 40px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "brand brand"
      "contact social"
      "primary info"
      "secondary info"
      "management management"
      "payment payment"
      "warning warning";
    gap: 30px 20px;
    padding-top: 36px;
    padding-bottom: 40px;
  }

  body:is([data-page="home"], [data-page="services"]) main .contacts-card__info {
    min-height: 482px !important;
  }
  /* The service address card shares the mobile contact composition with Home.
     Its broader flow reset has a more specific selector, so restore the
     reference floor here rather than letting the action move 19px upward. */
  body[data-page="services"] .contacts--home .contacts-card__info {
    min-height: 482px !important;
  }
  body > .site-footer .footer-column--second-nav { margin-top: 0; }
  body > .site-footer .footer-warning { width: 100% !important; }
  body > .site-footer .footer-info .footer-label { max-width: 100%; white-space: normal !important; }
  body > .site-footer .brand--footer {
    width: 160px !important;
    justify-self: start;
    -webkit-mask-position: left top;
    mask-position: left top;
    -webkit-mask-size: 160px 64px;
    mask-size: 160px 64px;
  }

  body[data-page="home"] main > :is(.cases, .equipment) .section-heading { padding-top: 58px; }
  body[data-page="home"] main > :is(.cases, .equipment) .section-heading h2 { margin-top: 0 !important; }
  body[data-page="services"] main > :is(.cases, .licenses) .section-heading--figma h2 { margin-top: 45px !important; }
  body[data-page="home"] main > .cases .work-carousel,
  body[data-page="services"] main > .cases .work-carousel,
  body[data-page="services"] main > .licenses .certificate-carousel,
  body[data-page="home"] main > .equipment .equipment-grid { margin-top: 25px; }
  body[data-page="home"] main > .cases > .page-shell { padding-top: 0; padding-bottom: 88px; }
  body[data-page="home"] main > .cases .work-carousel { margin-top: 43px; }
  body[data-page="home"] main > .equipment > .page-shell { padding-top: 0; padding-bottom: 0; }
  body[data-page="home"] main > .equipment .equipment-grid { margin-top: 30px; }

  body[data-page="services"] .doctors--home .doctor-grid {
    display: grid;
    grid-template-columns: none;
    grid-template-rows: repeat(2, max-content);
    grid-auto-flow: column;
    grid-auto-columns: 100%;
    gap: 10px;
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
  }
  body[data-page="services"] .doctors--home .doctor-card {
    display: grid;
    min-height: calc(var(--doctor-mobile-photo-height) + 340px);
    grid-template-columns: 1fr;
    grid-template-rows: var(--doctor-mobile-photo-height) minmax(340px, auto);
    margin-bottom: 0;
    scroll-snap-align: start;
  }
  /* The phone rail exposes every record. Each portrait therefore owns an
     explicit phone crop instead of falling back to the desktop image box. */
  body[data-page] .doctors .doctor-card--shaban .doctor-card__photo img,
  body[data-page] .doctors .doctor-card--sizova .doctor-card__photo img {
    position: absolute;
    right: auto;
    bottom: auto;
    left: 50%;
    width: auto;
    max-width: none;
    height: clamp(500px, calc(4.4vw + 481px), 515px);
    object-fit: fill;
    transform: translateX(-50%);
  }
  body[data-page] .doctors .doctor-card--shaban .doctor-card__photo img { top: -4px; }
  body[data-page] .doctors .doctor-card--sizova .doctor-card__photo img { top: -36px; }
  body[data-page="services"] .doctors--home .section-action {
    position: relative;
    inset: auto;
    display: flex;
    margin: 35px auto 0;
  }
  body[data-page="services"] main > .doctors--home > .page-shell { padding-bottom: 0; }
  body[data-page="services"] main > .service-rating--home > .page-shell { padding-bottom: 195px; }
  body[data-page="services"] main > .licenses > .page-shell { padding-bottom: 32px; }
  body[data-page="services"] main > .licenses .section-intro { margin-top: 10px !important; }
  body[data-page="services"] main > .contacts--home,
  body[data-page="services"] main > .contacts--home > .page-shell { min-height: 0 !important; }
  body[data-page="services"] main > .contacts--home > .page-shell {
    height: auto !important;
    /* The section heading is part of the normal flow on phones, so it
       supplies the 120px composition itself instead of leaving a blank band. */
    padding-top: 0;
    padding-bottom: 61px;
  }
  body[data-page="services"] main > .contacts--home .contacts-card {
    position: relative !important;
    inset: auto !important;
  }

  :is(body[data-page="home"]:not([data-route="about"]), body[data-route="about"]) main > .cases > .page-shell { padding-top: 0; padding-bottom: 88px; }
  :is(body[data-page="home"]:not([data-route="about"]), body[data-route="about"]) main > .cases .work-card__image { height: 440px; }
  :is(body[data-page="home"]:not([data-route="about"]), body[data-route="about"]) main > .equipment > .page-shell { padding-bottom: 0; }
  :is(body[data-page="home"]:not([data-route="about"]), body[data-route="about"]) main > .equipment .slider-nav--equipment {
    position: relative !important;
    inset: auto !important;
    margin-top: 30px;
    transform: none !important;
  }
  :is(body[data-page="home"]:not([data-route="about"]), body[data-route="about"]) main > .equipment .equipment-cta {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    margin-top: 48px;
  }
  body[data-page="services"] main > .contacts--home { min-height: 0 !important; }

  body > .site-footer > .footer-grid { padding-bottom: 35px; }
}
