@media (max-width: 1320px) {
  .screening-tests {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  :root {
    --mobile-header-height: 64px;
  }

  body {
    padding-top: var(--mobile-header-height);
  }

  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto;
    width: min(1180px, calc(100% - 28px));
    min-height: var(--mobile-header-height);
    align-items: center;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    max-width: min(220px, 58vw);
  }

  .brand-text {
    display: none;
  }

  .brand-logo-main {
    width: min(168px, 100%);
    max-height: 46px;
    object-fit: contain;
  }

  .nav-toggle {
    display: block;
    justify-self: end;
    grid-column: 2;
    grid-row: 1;
  }

  .main-nav,
  .header-actions {
    display: none;
  }

  body.nav-open .header-inner {
    align-items: center;
    min-height: var(--mobile-header-height);
  }

  .nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 878;
    border: 0;
    background: rgba(36, 30, 24, 0.42);
    backdrop-filter: blur(3px);
  }

  .nav-backdrop[hidden] {
    display: none;
  }

  .mobile-nav-portal {
    position: fixed;
    inset: 0;
    z-index: 879;
    pointer-events: none;
  }

  body.nav-open .mobile-nav-portal {
    pointer-events: auto;
  }

  body.nav-open .mobile-nav-portal .main-nav {
    position: fixed;
    top: var(--mobile-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 880;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 8px 0 calc(132px + env(safe-area-inset-bottom, 0px));
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background:
      linear-gradient(180deg, rgba(255, 251, 245, 0.99), rgba(247, 239, 225, 0.97));
    border-top: 1px solid rgba(174, 139, 102, 0.16);
    box-shadow: 0 18px 42px rgba(74, 58, 35, 0.14);
  }

  body.nav-open .mobile-nav-portal .header-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 881;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 251, 245, 0.99);
    border-top: 1px solid rgba(174, 139, 102, 0.18);
    box-shadow: 0 -10px 28px rgba(74, 58, 35, 0.1);
  }

  body.nav-open .mobile-nav-portal .header-actions .button-primary {
    width: 100%;
    justify-content: center;
  }

  body.nav-open .mobile-nav-portal .header-utility {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .nav-item {
    display: grid;
    grid-template-columns: 1fr 44px;
    align-items: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    border-bottom: 1px solid rgba(174, 139, 102, 0.14);
  }

  .nav-item:last-child {
    border-bottom: 0;
  }

  .nav-link {
    min-height: 52px;
    padding: 14px 18px;
    font-size: 17px;
  }

  .nav-link::after {
    display: none;
  }

  .nav-dropdown-link::before {
    display: none;
  }

  .nav-dropdown-link {
    padding-left: 14px;
  }

  .nav-link .nav-arrow {
    display: none;
  }

  .mobile-nav-accordion {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-right: 8px;
    justify-self: end;
    align-self: center;
    border: 1px solid rgba(185, 144, 89, 0.28);
    border-radius: 50%;
    background: var(--paper);
    color: var(--teal);
    cursor: pointer;
    z-index: 2;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-accordion:active {
    transform: scale(0.96);
    background: rgba(255, 250, 241, 0.92);
  }

  .mobile-nav-accordion .nav-arrow {
    transition: transform var(--azimut-transition);
  }

  .nav-item.dropdown-open .mobile-nav-accordion .nav-arrow {
    transform: rotate(180deg);
  }

  .nav-dropdown {
    position: static;
    grid-column: 1 / -1;
    min-width: 0;
    max-width: none;
    max-height: 0;
    padding: 0 10px;
    border: 0;
    border-top: 1px solid transparent;
    border-radius: 0 0 12px 12px;
    background:
      radial-gradient(circle at 12% 10%, rgba(213, 185, 139, 0.18), transparent 34%),
      rgba(255, 250, 241, 0.98);
    box-shadow: none;
    opacity: 1;
    overflow: hidden;
    pointer-events: none;
    transform: none;
    visibility: visible;
    transition: max-height 300ms cubic-bezier(.2,.8,.2,1), padding 300ms cubic-bezier(.2,.8,.2,1), border-color 300ms cubic-bezier(.2,.8,.2,1);
  }

  .nav-dropdown::before,
  .nav-dropdown::after {
    display: none;
  }

  .nav-item:hover > .nav-dropdown,
  .nav-item:focus-within > .nav-dropdown {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
    transform: none;
  }

  .nav-item.dropdown-open > .nav-dropdown {
    max-height: 720px;
    padding-top: 8px;
    padding-bottom: 10px;
    border-color: rgba(219, 232, 232, 0.9);
    overflow: visible;
    pointer-events: auto;
  }

  .nav-item.dropdown-open {
    background: rgba(255, 250, 241, 0.55);
  }

  .nav-dropdown-link {
    min-height: 44px;
    padding: 10px 14px;
  }

  .nav-dropdown-link:hover,
  .nav-dropdown-link:focus-visible {
    transform: none;
  }

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

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

  .hero-headline-row {
    grid-template-columns: minmax(0, 1fr) minmax(230px, 280px);
    gap: 42px;
  }

  .hero-copy h1 {
    font-size: clamp(42px, 5vw, 58px);
  }

  .hero-visual .compass-card {
    width: min(250px, 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-dropdown,
  .nav-link,
  .nav-link::after,
  .nav-arrow,
  .mobile-nav-accordion .nav-arrow,
  .nav-dropdown-link {
    transition: none !important;
  }
}

@media (max-width: 860px) {
  html,
  body {
    overflow-x: hidden;
    overscroll-behavior-x: none;
    touch-action: pan-y;
  }

  input[type="range"] {
    touch-action: auto;
  }

  .container,
  .narrow {
    width: min(100% - 28px, 1180px);
  }

  .hero {
    padding-top: 48px;
  }

  .banner-carousel-viewport {
    aspect-ratio: 16 / 9;
    min-height: 200px;
    max-height: none;
  }

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

  .hero-grid,
  .split-layout,
  .reverse,
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    max-width: 100%;
  }

  .hero-visual {
    min-height: auto;
    order: 0;
    transform: translateY(0);
  }

  .hero-content h1 {
    font-size: 41px;
  }

  .card-grid,
  .feature-grid,
  .two-col,
  .three-col,
  .four-col,
  .price-mini-grid,
  .price-card-grid,
  .condition-grid,
  .order-panel {
    grid-template-columns: 1fr;
  }

  .screening-tests {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .specialists-section {
    padding: 46px 0;
  }

  .specialists-section .doctor-card {
    min-height: 0;
    width: min(100%, 340px);
    aspect-ratio: 4 / 5;
    justify-self: center;
    overflow: hidden;
  }

  .specialists-section .doctor-photo {
    width: 100%;
    height: 100%;
    margin: 0;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center 18%;
  }

  .specialists-section .card-grid {
    justify-items: center;
  }

  .order-actions {
    justify-content: flex-start;
  }

  .service-row {
    grid-template-columns: 1fr;
  }

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

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

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

  .steps li {
    min-height: 124px;
  }

  .price-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .footer-shell {
    grid-template-columns: minmax(140px, 0.85fr) 1.15fr;
    row-gap: 28px;
    column-gap: 0;
    padding: 44px 0 36px;
  }

  .footer-brand-panel {
    padding: 0 28px 0 0;
    border-left: none;
    margin: 0;
    grid-column: 1;
    grid-row: 1;
  }

  .footer-info {
    padding: 0 0 0 28px;
    grid-column: 2;
    grid-row: 1;
    border-left: 1px solid rgba(174, 139, 102, 0.28);
  }

  .footer-column[aria-label="Документы"] {
    grid-column: 1;
    grid-row: 2;
    padding: 28px 28px 0 0;
    border-left: none;
    border-top: 1px solid rgba(174, 139, 102, 0.24);
  }

  .footer-column[aria-label="Разделы"] {
    grid-column: 2;
    grid-row: 2;
    padding: 28px 0 0 28px;
    border-left: 1px solid rgba(174, 139, 102, 0.28);
    border-top: 1px solid rgba(174, 139, 102, 0.24);
  }

  .footer-brand-stack {
    width: min(140px, 100%);
  }

  .section-heading,
  .hero-content,
  .page-hero .container,
  .info-card,
  .feature-card,
  .service-group-card,
  .price-card,
  .doctor-card,
  .article-card,
  .review-card,
  .contact-form,
  .hero-form {
    text-align: left;
  }

  .mini-card:hover,
  .info-card:hover,
  .feature-card:hover,
  .article-card:hover,
  .doctor-card:hover,
  .service-group-card:hover,
  .price-card:hover,
  .price-mini-card:hover,
  .review-card:hover,
  .photo-frame:hover {
    transform: none;
  }

  .doctor-card:hover .doctor-photo,
  .article-card:hover .article-image,
  .photo-frame:hover img,
  .photo-stack:hover img {
    transform: none;
  }

  .azimut-mini-player:hover,
  .azimut-player:hover,
  .player-btn:hover {
    transform: none;
  }

}

.scroll-top-btn {
  position: fixed;
  left: 14px;
  right: auto;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 72;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(174, 139, 102, 0.34);
  border-radius: 50%;
  background: rgba(255, 251, 245, 0.96);
  color: #765f42;
  box-shadow: 0 12px 28px rgba(74, 58, 35, 0.16);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: transform var(--azimut-transition), opacity var(--azimut-transition);
}

.scroll-top-btn[hidden] {
  display: none;
}

.scroll-top-btn:not([hidden]):hover,
.scroll-top-btn:not([hidden]):focus-visible {
  transform: translateY(-2px);
}

@media (min-width: 861px) {
  .scroll-top-btn {
    display: none !important;
  }
}

/* Мобильный док: слева «наверх» + плеер, справа чат — без наложений */
@media (max-width: 860px) {
  body:has(.azimut-mini-player) .azimut-mini-player {
    left: 14px;
    right: auto;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    z-index: 71;
  }

  body:has(.azimut-mini-player.is-collapsed) .azimut-mini-player {
    width: 64px;
    height: 64px;
  }

  body:has(.azimut-mini-player:not(.is-collapsed)) .azimut-mini-player {
    width: min(340px, calc(100vw - 88px));
    max-width: calc(100vw - 88px);
  }

  body:has(.azimut-mini-player.is-collapsed) .ai-chatbot {
    bottom: calc(132px + env(safe-area-inset-bottom, 0px));
  }

  body:has(.azimut-mini-player:not(.is-collapsed)) .ai-chatbot {
    bottom: calc(196px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 560px) {
  :root {
    --mobile-header-height: 56px;
  }

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

  .header-inner {
    gap: 10px;
  }

  .brand {
    max-width: 156px;
  }

  .brand-logo-wide,
  .brand-logo-main {
    width: min(100%, 148px);
    max-height: 40px;
  }

  .banner-rotator {
    min-height: 250px;
  }

  .demo-banner {
    grid-template-columns: 1fr;
    align-content: center;
    justify-items: start;
    gap: 14px;
    padding: 22px 20px 26px;
  }

  .banner-photo {
    width: min(100%, 200px);
    max-width: none;
    border-radius: 16px;
  }

  .banner-icon {
    width: 70px;
    height: 70px;
    border-radius: 18px;
  }

  .brand-logo-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  h1,
  .hero-content h1 {
    font-size: 34px;
  }

  h2 {
    font-size: 28px;
  }

  .section,
  .page-hero {
    padding: 54px 0;
  }

  .hero-actions,
  .button {
    width: 100%;
  }

  .hero-form {
    grid-template-columns: 1fr;
  }

  .button {
    padding-left: 12px;
    padding-right: 12px;
  }

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

  .compass-card {
    width: min(310px, 88vw);
  }

  .route-line {
    height: 4px;
  }

  .route-line::after {
    right: -8px;
    border-top-width: 7px;
    border-bottom-width: 7px;
    border-left-width: 14px;
  }

  .mini-card,
  .info-card,
  .feature-card,
  .article-card,
  .doctor-card,
  .service-card,
  .review-card,
  .info-panel,
  .contact-form {
    padding: 18px;
  }

  .doctor-photo {
    width: calc(100% + 36px);
    height: 210px;
    margin: -18px -18px 18px;
    background-size: 200% 200%;
  }

  .specialists-section .doctor-photo {
    width: 100%;
    height: 100%;
    margin: 0;
    background-size: cover;
    background-position: center 18%;
  }

  .article-image {
    width: calc(100% + 36px);
    height: 160px;
    margin: -18px -18px 18px;
  }

  .photo-frame img,
  .photo-stack img {
    height: 260px;
    object-fit: cover;
    object-position: center;
  }
}

@media (max-width: 860px) {
  .hero-headline-row,
  .accordion-columns {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding-top: 0;
  }

  .hero-visual {
    order: 0;
    min-height: auto;
  }

  .hero-proof-list {
    margin-top: 8px;
  }

  .premium-accordion summary {
    min-height: 64px;
    padding: 16px;
    font-size: 18px;
  }

  .accordion-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .accordion-content {
    padding: 0 16px 18px;
  }

  .appointment-dialog {
    width: min(100%, 540px);
  }
}

@media (max-width: 560px) {
  .hero {
    padding: 42px 0 44px;
  }

  .hero-copy h1 {
    font-size: 34px;
  }

  .hero-copy .lead {
    font-size: 17px;
  }

  .footer-shell {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 36px 0 28px;
    border-radius: 0;
    row-gap: 0;
  }

  .footer-brand-panel,
  .footer-info,
  .footer-column {
    padding: 24px 0;
    border-left: 0;
    border-top: 1px solid rgba(174, 139, 102, 0.24);
  }

  .footer-brand-panel {
    padding-top: 0;
    border-top: 0;
    margin: 0;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .footer-brand-stack {
    width: min(148px, 72vw);
    margin: 0 auto;
    align-items: center;
    transform: none;
  }

  .footer-brand-stack p,
  .footer-logo-watermark {
    margin-inline: auto;
  }

  .footer-info {
    grid-column: auto;
    grid-row: auto;
  }

  .footer-column:nth-of-type(1),
  .footer-column:nth-of-type(2) {
    grid-column: auto;
    grid-row: auto;
  }

  .footer-contact {
    margin-bottom: 20px;
  }

  .premium-accordion-section .section-heading {
    margin-bottom: 22px;
  }

  .premium-accordion summary {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    padding: 14px;
    font-size: 16px;
  }

  .order-panel {
    padding: 20px;
    border-radius: 16px;
  }

  .hero-grid-premium {
    padding: 18px;
    border-radius: 20px;
  }

  .condition-card {
    min-height: 0;
    padding: 18px;
  }

  .condition-icon {
    width: 62px;
    height: 62px;
    margin-bottom: 14px;
    border-radius: 14px;
  }

  .service-price-item summary {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 18px 48px 18px 18px;
  }

  .service-price-item summary small {
    width: fit-content;
  }

  .service-price-grid {
    grid-template-columns: 1fr;
    padding: 0 14px 16px;
  }

  .service-price-card {
    min-height: 0;
    padding: 16px;
  }

  .order-actions,
  .order-actions .button {
    width: 100%;
  }

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

  .tests-toolbar-row {
    flex-direction: column;
  }

  .tests-filter-dropdown,
  .tests-filter-dropdown--wide {
    flex: 1 1 auto;
  }

  .test-form {
    padding: 18px 0 0;
  }

  .test-question {
    padding: 14px;
  }

  .test-options {
    grid-template-columns: 1fr;
  }

  .premium-accordion summary::after {
    width: 30px;
    height: 30px;
  }

  .price-note-card {
    padding: 14px;
  }

  .appointment-modal {
    padding: 12px;
    align-items: end;
  }

  .appointment-dialog {
    max-height: calc(100dvh - 24px);
    padding: 22px 16px 16px;
    border-radius: 18px 18px 0 0;
  }

  .modal-close {
    right: 12px;
    top: 12px;
  }
}
