/* Responsive and interaction finishing layer. Content stays admin-controlled. */

:where(.site-header, main, .site-footer) *,
:where(.site-header, main, .site-footer) *::before,
:where(.site-header, main, .site-footer) *::after {
  box-sizing: border-box;
}

:where(main, .site-footer) :is(h1, h2, h3, h4, p, a, span) {
  overflow-wrap: break-word;
}

.footer-logo {
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.footer-logo img {
  height: 54px;
  max-width: 190px;
  filter: grayscale(1) brightness(0) invert(1);
}

.footer-social-link {
  width: 44px;
  height: 44px;
}

.footer-social-link--vk,
.footer-social-link--max,
.footer-social-link--generic,
.footer-social-link--calendar {
  color: #fff;
}

.footer-social-link--generic svg,
.footer-social-link--calendar svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.prices-row__button,
.doctor-card__button,
.doctors-catalog-card__button,
.service-price-row__button,
.promotion-card__button,
.promotion-catalog-card__button,
.service-hero-button {
  min-height: 44px;
}

.btn-book,
.home-hero-btn {
  min-height: 44px;
}

.home-hero-btn {
  min-height: 50px;
}

.smd-home .home-hero-btn,
.contact-banner__button {
  min-height: 44px;
}

.footer-documents__links a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
}

.service-price-row__name,
.prices-row__name,
.promotion-card__title,
.promotion-catalog-card__title {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 768px) {
  .smd-home .home-hero-btn {
    min-height: 50px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .smd-home .contact-banner__button {
    min-height: 44px;
  }

  .site-header-actions .btn-book {
    min-height: 44px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .promotions-viewport,
  .promotions-track {
    width: 100%;
    max-width: 100%;
  }

  .smd-home .promotion-card,
  .promotion-card {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    min-height: 250px;
    padding: 18px;
  }

  .smd-home .promotion-card__content,
  .promotion-card__content {
    width: 100%;
    max-width: 100%;
    padding-right: 0;
  }

  .smd-home .promotion-card__title,
  .promotion-card__title {
    max-width: 100%;
    font-size: clamp(17px, 5.2vw, 21px);
    line-height: 1.22;
  }

  .smd-home .promotion-card__description,
  .promotion-card__description {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .smd-home .promotion-card__visual,
  .promotion-card__visual {
    right: 8px;
    bottom: 8px;
    width: 96px;
    height: 96px;
    opacity: .2;
  }

  .smd-home .promotion-card__button,
  .promotion-card__button {
    min-height: 44px;
    padding: 10px 18px;
    font-size: 13px;
  }

  .prices-row__button,
  .doctor-card__button,
  .doctors-catalog-card__button,
  .service-price-row__button,
  .promotion-catalog-card__button {
    min-height: 44px;
  }

  .service-price-row__button,
  .service-price-row__button:visited {
    width: 128px;
    min-width: 128px;
    max-width: 128px;
    padding: 8px 9px;
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
  }

  .prices-row__right,
  .service-price-row__right,
  .promotion-catalog-card__body,
  .doctor-content,
  .service-editorial__content {
    min-width: 0;
  }

  .services-loyalty,
  .services-loyalty__card,
  .services-map {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .service-analysis-link {
    min-height: 230px;
    padding: 28px 16px;
  }

  .service-analysis-link h3 {
    font-size: clamp(23px, 7vw, 30px);
    overflow-wrap: anywhere;
  }

  .service-analysis-link a {
    min-height: 48px;
    padding: 12px 14px;
    white-space: normal;
  }

  .footer-main {
    padding-bottom: 30px;
  }

  .footer-grid {
    gap: 24px;
  }

  .footer-documents {
    display: block;
    margin-top: 24px;
  }

  .footer-documents__title {
    margin-bottom: 12px;
  }

  .footer-documents__links {
    display: flex;
    width: calc(100% + 32px);
    margin-right: -16px;
    margin-left: -16px;
    padding: 0 16px 8px;
    align-items: stretch;
    flex-flow: row nowrap;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .footer-documents__links a {
    min-width: min(260px, 78vw);
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 10px;
    line-height: 1.35;
    scroll-snap-align: start;
  }

  .footer-bottom {
    padding-top: 14px;
  }

  .smd-contact-fab__toggle {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 340px) {
  .site-header-actions .btn-book {
    min-width: 0;
    padding-right: 9px;
    padding-left: 9px;
    font-size: 10px;
  }

  .service-price-row__button,
  .service-price-row__button:visited {
    width: 116px;
    min-width: 116px;
    max-width: 116px;
    font-size: 10.5px;
  }
}

/* Helpful 404: preserves a real 404 status while giving people clear exits. */
.smd-not-found {
  padding: clamp(54px, 9vw, 112px) 0;
  background: linear-gradient(145deg, #f3faef 0%, #fffaf4 100%);
}

.smd-not-found__card {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid rgba(63, 137, 20, .16);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(19, 59, 50, .1);
  text-align: center;
}

.smd-not-found__code {
  display: block;
  margin-bottom: 8px;
  color: #3f8914;
  font-size: clamp(44px, 10vw, 88px);
  font-weight: 800;
  line-height: 1;
}

.smd-not-found h1 {
  margin: 0 0 14px;
  color: #173f36;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.12;
}

.smd-not-found p {
  max-width: 650px;
  margin: 0 auto 24px;
  color: #536b66;
  font-size: 17px;
  line-height: 1.55;
}

.smd-not-found__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.smd-not-found__link {
  display: inline-flex;
  min-height: 46px;
  padding: 11px 18px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(63, 137, 20, .24);
  border-radius: 999px;
  background: #f3faef;
  color: #245f0c;
  font-weight: 700;
  text-decoration: none;
}

.smd-not-found__link--primary {
  border-color: #b57124;
  background: #b57124;
  color: #fff;
}

.smd-not-found__link:hover,
.smd-not-found__link:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(181, 113, 36, .18);
}

.article-contact-cta__button {
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

/* Touch targets for every booking route must remain at least 44px high. */
.service-doctor-card__button,
.doctor-price-card__button,
.promotion-single__button,
.article-content__body a.button {
  display: inline-flex;
  min-height: 44px;
  padding-top: 10px;
  padding-bottom: 10px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

@media (max-width: 480px) {
  .smd-not-found {
    padding: 34px 0;
  }

  .smd-not-found__card {
    padding: 26px 18px;
    border-radius: 18px;
  }

  .smd-not-found p {
    font-size: 15px;
  }

  .smd-not-found__link {
    width: 100%;
  }
}

/* Mobile service cards: consistent media, readable labels, no three-column squeeze. */
@media (max-width: 480px) {
  .smd-home .departments-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .smd-home .department-card {
    display: grid;
    min-height: 0;
    grid-template-rows: auto minmax(58px, auto);
    aspect-ratio: auto;
    overflow: hidden;
    border: 1px solid rgba(63, 137, 20, .1);
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(19, 59, 50, .08);
  }

  .smd-home .department-thumb {
    width: 100%;
    min-height: 0;
    aspect-ratio: 4 / 3;
    flex: none;
    border-radius: 14px 14px 0 0;
  }

  .smd-home .department-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

  .smd-home .department-title {
    min-height: 58px;
    padding: 10px 11px;
    align-items: center;
    overflow-wrap: normal;
    font-size: 13px;
    line-height: 1.25;
    text-wrap: pretty;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .smd-home .departments-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
}

/* Tablet promotion cards: text and media share the surface instead of floating apart. */
@media (max-width: 768px) {
  .smd-home .promotion-card {
    display: grid;
    min-height: 248px;
    padding: 0;
    grid-template-columns: minmax(0, 1.25fr) minmax(190px, .75fr);
    align-items: stretch;
    gap: 0;
    background: linear-gradient(135deg, #f4fbf0 0%, #fff9f3 100%);
  }

  .smd-home .promotion-card__content {
    width: auto;
    max-width: none;
    padding: 24px;
    align-self: center;
  }

  .smd-home .promotion-card__special {
    min-height: 36px;
    margin: 4px 8px 0 0;
    padding: 7px 13px;
    border: 1px solid rgba(63, 137, 20, .22);
    background: rgba(63, 137, 20, .1);
    color: #2f7010;
    font-size: 14px;
    line-height: 1;
    vertical-align: middle;
  }

  .smd-home .promotion-card__button {
    min-height: 44px;
    margin-top: 4px;
    padding: 10px 20px;
    vertical-align: middle;
  }

  .smd-home .promotion-card__visual {
    position: relative;
    inset: auto;
    width: 100%;
    height: 100%;
    min-height: 248px;
    overflow: hidden;
    border-radius: 0 18px 18px 0;
    opacity: 1;
  }

  .smd-home .promotion-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    animation: none;
  }
}

/* Phone promotion cards: compact copy followed by a full-width, meaningful image. */
@media (max-width: 600px) {
  .smd-home .promotion-card {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 132px;
    border-radius: 18px;
  }

  .smd-home .promotion-card__content {
    padding: 18px;
  }

  .smd-home .promotion-card__title {
    margin-bottom: 7px;
    font-size: clamp(18px, 5.2vw, 21px);
    line-height: 1.2;
    text-wrap: balance;
  }

  .smd-home .promotion-card__description {
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.42;
    -webkit-line-clamp: 3;
  }

  .smd-home .promotion-card__prices {
    margin-bottom: 8px;
  }

  .smd-home .promotion-card__special {
    margin-bottom: 0;
  }

  .smd-home .promotion-card__visual {
    min-height: 132px;
    border-radius: 0 0 18px 18px;
  }
}

@media (max-width: 340px) {
  .smd-home .departments-grid {
    gap: 10px;
  }

  .smd-home .department-title {
    min-height: 60px;
    padding: 9px;
    font-size: 12px;
  }

  .smd-home .promotion-card {
    grid-template-rows: auto 116px;
  }

  .smd-home .promotion-card__content {
    padding: 16px;
  }

  .smd-home .promotion-card__visual {
    min-height: 116px;
  }
}
