/* Shared layout and motion, loaded after the component styles. */
:root {
  --page-gutter: clamp(14px, 3.2vw, 40px);
  --header-height: 96px;
  --motion-ease: cubic-bezier(.2, .7, .2, 1);
}

html {
  scrollbar-gutter: stable;
  scroll-padding-top: calc(var(--header-height) + env(safe-area-inset-top, 0px) + 20px);
}
body {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.container { width: min(var(--container), calc(100% - 2 * var(--page-gutter))); }
.site-header { padding-top: env(safe-area-inset-top, 0px); }
h1, h2, h3, .price-name, .document-info, .booking-context { overflow-wrap: anywhere; }
button, a, summary, .checkbox-row { touch-action: manipulation; }
.button, .text-link { min-width: 0; }
.button > .icon, .text-link > .icon { flex-shrink: 0; }

/* Size cards by their readable content width, including between breakpoints. */
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.step-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.grid-3.step-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.step-list:not(ol) > .step-card::before { content: none; }
.split { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.split > *, .grid-3 > *, .step-list > *, .footer-grid > * { min-width: 0; }
.bento-card h2 { font-size: clamp(26px, 2.35vw, 34px); }
.step-card h3 { font-size: clamp(21px, 1.8vw, 24px); }
.contact-map-card iframe { max-width: 100%; }

/* The menu and dialog remain usable with browser chrome or a short viewport. */
.mobile-navigation {
  top: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  max-height: calc(100dvh - var(--header-height) - env(safe-area-inset-top, 0px));
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: max(32px, env(safe-area-inset-bottom, 0px));
  overscroll-behavior: contain;
}
.mobile-nav-links a { min-height: 48px; overflow-wrap: anywhere; }
.mobile-navigation .container > a { display: flex; align-items: center; min-height: 44px; }
.menu-toggle, .dialog-close { min-width: 44px; min-height: 44px; }
.booking-dialog {
  max-width: calc(100% - 24px);
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  scroll-padding-block: 24px;
  overscroll-behavior: contain;
}
.field input { font-size: 16px; }
.consent-row { min-height: 44px; align-items: center; }
.consent-row input { width: 22px; height: 22px; }
.mobile-action-bar {
  padding-left: max(18px, env(safe-area-inset-left, 0px));
  padding-right: max(18px, env(safe-area-inset-right, 0px));
}

@media (max-width: 1099px) {
  :root { --header-height: 80px; }
  .section-heading { flex-wrap: wrap; gap: 20px; }
  .section-heading-action { margin-top: 0; }
  .cta-band { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
}
@media (min-width: 600px) and (max-width: 999px) {
  .grid-3, .grid-3.step-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 > :last-child:nth-child(3) { grid-column: 1 / -1; }
}
@media (min-width: 768px) and (max-width: 999px) {
  .step-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact-location { grid-template-columns: 1fr; }
  .contact-location > .photo-card > img { aspect-ratio: 1.7; max-height: 480px; }
  .contact-map-card iframe { height: 480px; flex: none; }
  .doctor-profile-hero { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
  .doctor-profile-info { padding: 26px; }
  .doctor-profile-info h1 { font-size: clamp(32px, 4.2vw, 40px); }
}
@media (min-width: 768px) and (max-width: 899px) {
  .service-intro-grid { grid-template-columns: 1fr; gap: 24px; }
  .service-intro-copy { padding: 0; }
  .service-intro-copy h1 { max-width: 650px; font-size: 44px; }
  .service-intro-visual { min-height: 0; aspect-ratio: 1.9; }
  .service-intro-visual > .service-art { object-position: 50% 35%; }
}
@media (max-width: 767px) {
  :root { --header-height: 72px; }
  .section { padding-block: clamp(32px, 7vw, 48px); }
  .section-tight { padding-block: 20px; }
  .section-heading { margin-bottom: 24px; }
  .page-intro h1, .service-intro-copy h1 { font-size: clamp(32px, 7.8vw, 42px); }
  .page-intro .lead, .service-intro-copy .lead { font-size: 16px; }
  .bento-card:where(:not(.service-card)) { padding: clamp(22px, 4.5vw, 28px); }
  .bento-card h2 { font-size: clamp(25px, 5.8vw, 30px); }
  .step-card { padding: 24px; }
  .step-list { gap: 16px; }
  .step-card p { font-size: 15px; }
  .cta-band { grid-template-columns: 1fr; padding: clamp(24px, 5vw, 32px); }
  .cta-band h2 { font-size: clamp(29px, 6.7vw, 36px); }
  .cta-band-actions { align-items: stretch; }
  .cta-band-actions > .button { width: 100%; }
  .cta-band-actions > span, .cta-phone { align-self: flex-start; }
  .filter-chip, .anchor-nav > a, .document-actions a { min-height: 44px; }
  .document-actions { flex-wrap: wrap; gap: 4px 18px; }
  .document-actions .text-link { min-height: 44px; }
  .document-tabs a { display: inline-flex; align-items: center; min-height: 44px; }
  .footer-grid nav { gap: 4px; }
  .footer-grid nav a { display: flex; align-items: center; min-height: 44px; font-size: 14px; }
  .site-footer { padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
  .medical-note { font-size: 12px; }
}
@media (max-width: 479px) {
  .hero-proof-illustrated { align-items: flex-start; }
  .hero-proof-illustrated > div { padding-top: 6px; }
  .hero-actions > .button, .page-intro > .container > .inline-actions > .button { width: 100%; }
  .page-intro .inline-actions { gap: 16px; }
  .document-doctor-nav { grid-template-columns: 1fr; }
  .document-doctor-nav a { padding-block: 16px; }
  .doctor-profile-info { padding: 24px; }
  .booking-dialog { padding: 24px 22px; }
  .booking-dialog h2 { padding-right: 20px; font-size: 29px; }
}
@media (max-height: 500px) {
  .booking-dialog { padding: 24px; border-radius: 22px; }
  .booking-dialog .dialog-icon, .booking-dialog .eyebrow { display: none; }
  .booking-dialog h2 { font-size: 27px; margin: 0 42px 12px 0; }
  .dialog-lead { margin: 12px 0 16px; }
  .field { margin-bottom: 12px; }
  .dialog-call { margin-top: 16px; padding-top: 16px; }
  .mobile-navigation { padding-top: 12px; }
  .mobile-nav-links a { padding-block: 12px; }
}
@media (max-width: 319px) {
  .reviews-widget { width: 100%; max-width: 100%; margin-inline: 0; }
  .reviews-frame-host { overflow-x: auto; overscroll-behavior-x: contain; }
  .reviews-frame-host iframe { min-width: 300px; }
  .reviews-fallback-rating { flex-wrap: wrap; }
  .reviews-fallback-rating > div { flex-basis: 100%; }
  .brand img { width: 150px; }
  .hero-proof-illustrated .proof-art { width: 54px; height: 54px; flex-basis: 54px; }
}
@media (pointer: coarse) {
  .text-link, .doctor-profile-link, .doctor-education-source, .contact-map-card figcaption a { min-height: 44px; }
  .contact-card > a { display: inline-flex; align-items: center; min-height: 44px; }
}
@media (min-width: 1920px) {
  :root { --container: 1440px; }
}

/* Four short rows keep the next "С чем вам помочь?" section within reach. */
@media (max-width: 599px) {
  .home-services { grid-template-columns: 1fr; grid-auto-rows: 1fr; gap: 10px; }
  .home-service-card {
    display: grid;
    grid-template-columns: clamp(60px, 18vw, 92px) minmax(0, 1fr);
    grid-template-areas: "art title" "art summary" "art price";
    align-content: center;
    column-gap: clamp(12px, 3.3vw, 18px);
    padding: 14px;
    min-height: 0;
    border-radius: 20px;
  }
  .home-service-card::before { content: none; }
  .home-service-card > .service-art {
    grid-area: art; position: static; z-index: auto; align-self: center;
    width: 100%; height: auto; aspect-ratio: 4 / 5; border-radius: 12px;
    object-fit: cover; object-position: 50% 28%;
  }
  .home-service-card h3 {
    grid-area: title; min-height: 0; margin: 0; padding-right: 20px;
    font-size: clamp(18px, 4.7vw, 22px); line-height: 1.2;
  }
  .home-service-card > p { grid-area: summary; margin-top: 4px; font-size: 14px; line-height: 1.35; }
  .home-service-bottom { grid-area: price; display: block; margin: 8px 0 0; padding: 0; }
  .home-service-bottom > span:first-child { display: block; font-size: 18px; line-height: 1.15; }
  .home-service-bottom small { min-height: 0; max-width: none; margin-top: 3px; font-size: 13px; line-height: 1.3; }
  .home-service-bottom .round-arrow {
    display: flex; position: absolute; top: 15px; right: 12px;
    width: 19px; height: 19px; background: transparent;
  }
  .home-service-bottom .round-arrow .icon { width: 16px; height: 16px; }
}
/* Content is always visible; motion never gates reading or navigation. */
@media (prefers-reduced-motion: no-preference) {
  .hero-message, .page-intro > .container { animation: content-arrive 420ms var(--motion-ease) both; }
  .booking-dialog[open] { animation: dialog-arrive 180ms var(--motion-ease) both; }
  .booking-dialog[open]::backdrop { animation: backdrop-arrive 180ms ease both; }
  .mobile-navigation:not([hidden]) > .container { animation: content-arrive 180ms var(--motion-ease) both; }
  details[open] > :not(summary) { animation: detail-arrive 180ms ease both; }
  .booking-success:not([hidden]) .success-mark { animation: dialog-arrive 220ms var(--motion-ease) both; }
  .button { transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms var(--motion-ease); }
  .button:not(:disabled):active { transform: scale(.985); }
  .home-service-card, .scenario-card.scenario-card-illustrated, .trust-card, .all-services-bento, .doctor-photo {
    transition: background 180ms ease, border-color 180ms ease, transform 220ms var(--motion-ease), box-shadow 220ms var(--motion-ease);
  }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .home-service-card:hover, .scenario-card.scenario-card-illustrated:hover, .trust-card:hover, .all-services-bento:hover, .doctor-photo:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(55, 57, 63, .07);
  }
}
@media (hover: none), (prefers-reduced-motion: reduce) {
  .home-service-card:hover > .service-art { transform: none; }
  .text-link:hover .icon { transform: none; }
}
@keyframes content-arrive {
  from { opacity: .55; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes dialog-arrive {
  from { opacity: .4; transform: translateY(8px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes backdrop-arrive { from { opacity: 0; } to { opacity: 1; } }
@keyframes detail-arrive { from { opacity: .3; } to { opacity: 1; } }
@media print {
  .hero-message, .page-intro > .container { animation: none; transform: none; }
  .container { width: 100%; }
  .grid-3, .grid-3.step-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
