/* Responsive refinements */

@media (max-width: 1200px) {
  .site-nav__actions .button--primary {
    font-size: 14px;
    line-height: 1.1;
    padding-block: 10px;
    padding-inline: 12px;
    white-space: nowrap;
    text-align: center;
  }
}

@media (max-width: 1024px) {
  :root {
    --header-h: 74px;
  }

  .site-header {
    z-index: 80;
  }

  .site-header__inner {
    position: relative;
    z-index: 80;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    min-width: 0;
  }

  .site-header__brand {
    position: relative;
    z-index: 65;
    min-width: 0;
  }

  .brand {
    min-width: 0;
    max-width: 100%;
  }

  .brand__mark {
    width: 46px;
    height: auto;
  }

  .site-header__nav {
    justify-self: end;
    min-width: 0;
  }

  .site-nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
  }

  .site-nav__toggle {
    display: inline-flex;
  }

  .site-nav__menu {
    position: fixed;
    top: var(--header-stack-height);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 14px;
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-height: min(
      calc(100vh - var(--header-stack-height) - 8px),
      calc(100dvh - var(--header-stack-height) - 8px)
    );
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background: rgba(250, 251, 253, 0.94);
    border-bottom: 1px solid rgba(20, 31, 46, 0.12);
    backdrop-filter: blur(26px) saturate(1.25);
    box-shadow: 0 28px 80px rgba(20, 31, 46, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    transition:
      opacity 180ms ease,
      transform 180ms ease,
      visibility 180ms ease;
    z-index: 60;
  }

  .site-nav.is-open .site-nav__menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  .site-nav__toggle {
    position: relative;
    z-index: 65;
  }

  .site-nav__list {
    flex-direction: column;
    align-items: stretch;
    border-radius: var(--radius-lg);
    padding: 8px;
    width: 100%;
    margin-right: 0;
  }

  .site-nav__item + .site-nav__item::before {
    display: none;
  }

  .site-nav__link {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 12px;
  }

  .site-nav__actions {
    justify-content: stretch;
    flex-direction: column;
    flex-wrap: nowrap;
    width: 100%;
    margin-left: 0;
    gap: 10px;
  }

  .site-nav__action {
    flex: none;
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .hero__media-card .media-card__image {
    height: 520px;
  }

  .hero::before {
    top: 14%;
    font-size: clamp(64px, 10vw, 110px);
    letter-spacing: 0.16em;
    -webkit-text-stroke: 1px rgba(12, 78, 99, 0.16);
    filter: blur(0.12px) drop-shadow(0 14px 30px rgba(20, 160, 178, 0.12));
  }

  .hero::after {
    inset: 6% -18% auto -18%;
  }

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

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

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

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

  .cta-card {
    grid-template-columns: 1fr;
  }

  .cta-card__aside {
    justify-content: stretch;
  }

  .site-footer__grid {
    grid-template-columns: 1fr;
  }

  /* Герой v6: текст → фото → кнопки; сітка як у .doctor-philosophy (container + row-gap) */
  .hero.hero--v6 {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(10px, 2.6vw, 18px);
    box-sizing: border-box;
    /* Видима область під липкою шапкою: внутрішній ряд + padding 12px зверху/знизу */
    height: calc(100svh - var(--header-h) - 24px);
    max-height: calc(100svh - var(--header-h) - 24px);
    min-height: 0;
    overflow-x: clip;
    overflow-y: hidden;
    background: var(--bg);
  }

  @supports (height: 100dvh) {
    .hero.hero--v6 {
      height: calc(100dvh - var(--header-h) - 24px);
      max-height: calc(100dvh - var(--header-h) - 24px);
    }
  }

  .hero.hero--v6::before {
    content: none;
  }

  .hero.hero--v6::after {
    display: none;
  }

  .hero.hero--v6 .hero__intro {
    margin-top: 0;
    flex: 0 0 auto;
    padding-top: clamp(16px, 4.2vw, 28px);
    padding-bottom: 0;
    background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    border-radius: 0;
    box-sizing: border-box;
  }

  .hero.hero--v6 .hero__bottom {
    flex: 0 0 auto;
    padding-top: 0;
    padding-bottom: max(18px, env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 55%);
    display: block;
    box-sizing: border-box;
    border-radius: 0;
  }

  /* Ширина як у .container — задає клас на .hero__bg-wrap */
  .hero.hero--v6 .hero__bg-wrap {
    z-index: 0;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-self: stretch;
  }

  .hero.hero--v6 .hero__bg-media {
    position: relative;
    inset: auto;
    width: 100%;
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    display: block;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
      0 26px 80px rgba(8, 42, 58, 0.12),
      0 14px 34px rgba(17, 166, 184, 0.06);
    box-sizing: border-box;
    /* Висоту задає flex-гніздо між текстом і CTA, без aspect-ratio — щоб улізти в 100svh */
    isolation: isolate;
  }

  .hero.hero--v6 .hero__bg-media::before {
    content: "MAGICONE";
    position: absolute;
    top: clamp(6px, 2.5vw, 14px);
    left: 50%;
    z-index: 3;
    transform: translateX(-50%) translateY(2px);
    font-family: var(--font-heading);
    font-weight: 800;
    letter-spacing: 0.18em;
    font-size: clamp(34px, 9.5vw, 52px);
    line-height: 0.85;
    text-transform: uppercase;
    background: linear-gradient(
      180deg,
      rgba(56, 60, 66, 0.16),
      rgba(110, 114, 120, 0.06)
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-stroke: 0 transparent;
    opacity: 0.48;
    filter: blur(0.32px);
    mask-image: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.92) 0%,
      rgba(0, 0, 0, 0.55) 55%,
      rgba(0, 0, 0, 0.2) 100%
    );
    -webkit-mask-image: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.92) 0%,
      rgba(0, 0, 0, 0.55) 55%,
      rgba(0, 0, 0, 0.2) 100%
    );
    mix-blend-mode: multiply;
    pointer-events: none;
  }

  /* Легке розмиття низу фото (ноги / підлога) — лише мобільний герой */
  .hero.hero--v6 .hero__bg-media::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 48%;
    z-index: 2;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(
      180deg,
      rgba(249, 251, 253, 0) 0%,
      rgba(249, 251, 253, 0.1) 36%,
      rgba(249, 251, 253, 0.32) 100%
    );
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    mask-image: linear-gradient(
      180deg,
      transparent 0%,
      rgba(0, 0, 0, 0.22) 14%,
      rgba(0, 0, 0, 0.92) 100%
    );
    -webkit-mask-image: linear-gradient(
      180deg,
      transparent 0%,
      rgba(0, 0, 0, 0.22) 14%,
      rgba(0, 0, 0, 0.92) 100%
    );
  }

  .hero.hero--v6 .hero__bg-img {
    width: 100%;
    height: 100%;
    min-width: 0;
    display: block;
    object-fit: cover;
    object-position: 50% 36%;
  }

  .hero.hero--v6 .hero__bg-shade {
    border-radius: inherit;
    background-image: linear-gradient(
      180deg,
      rgba(22, 26, 30, 0.1) 0%,
      transparent 36%,
      transparent 62%,
      rgba(249, 250, 251, 0.2) 100%
    );
    background-size: cover;
    background-position: 0 0;
  }

  .hero.hero--v6 .hero__content {
    align-self: stretch;
    text-align: left;
    max-width: none;
    margin-inline: 0;
  }

  .hero.hero--v6 .hero__title {
    margin-top: 0;
    color: var(--text);
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    -webkit-text-fill-color: unset;
    text-shadow: none;
    filter: none;
    font-size: clamp(22px, 5.4vw, 28px);
    line-height: 1.12;
    text-align: center;
  }

  .hero.hero--v6 .hero__title-accent {
    display: inline;
    color: var(--text-h2);
    -webkit-text-stroke: 0;
    text-shadow: none;
    font-size: inherit;
    letter-spacing: 0.06em;
  }

  .hero.hero--v6 .hero__title-accent::after {
    margin-inline: 0;
    margin-top: 10px;
    max-width: 100%;
    background: linear-gradient(
      90deg,
      rgba(72, 98, 102, 0),
      rgba(20, 160, 178, 0.45),
      rgba(72, 98, 102, 0)
    );
  }

  .hero.hero--v6 .hero__lead {
    text-shadow: none;
    text-align: left;
    margin-inline: 0;
    margin-top: clamp(12px, 3.2vw, 24px);
    line-height: 1.65;
  }

  .hero.hero--v6 .hero__lead--desktop {
    display: none;
  }

  .hero.hero--v6 .hero__lead--mobile {
    display: block;
  }

  .hero.hero--v6 .hero__cta {
    margin-top: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    justify-content: flex-start;
  }

  .hero.hero--v6 .hero__cta .button {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 860px) {
  :root {
    --header-h: 72px;
  }

  .section {
    padding: 70px 0;
  }

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

  .doctor__actions .button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* Contact forms: submit button should span full width on mobile */
  .contact-form__footer,
  .contacts-page__submit {
    align-items: stretch;
  }

  .contact-form .button--primary,
  .contacts-page__submit .button--primary {
    width: 100%;
  }

  .section.contact-form {
    padding-bottom: 0;
  }

  .hero::before {
    top: 16%;
    font-size: clamp(56px, 12vw, 92px);
    letter-spacing: 0.14em;
    opacity: 0.92;
    filter: blur(0.14px) drop-shadow(0 12px 26px rgba(20, 160, 178, 0.1));
  }

  .hero::after {
    inset: 4% -22% auto -22%;
    opacity: 0.92;
  }

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

  .checkup-intro__inner {
    min-height: 0;
  }

  .checkup-intro__content {
    max-width: none;
  }

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

  /* FAQ background panel size */
  .section.faq .container::before {
    top: 8px;
    left: 12px;
    right: 12px;
    bottom: -8px;
  }

  /* Doctors carousel */
  .doctors-carousel {
    height: auto;
    min-height: 460px;
    margin-top: 70px;
  }

  .doctors__bg-title {
    font-size: clamp(38px, 8vw, 70px);
  }

  .doctors-card {
    width: 200px;
    height: 280px;
  }

  .doctors-carousel__track {
    height: 300px;
  }

  .doctors-card.right-2,
  .doctors-card.left-2 {
    transform: translate(-50%, -50%) translateX(250px) scale(0.8)
      translateZ(-300px);
  }

  .doctors-card.left-2 {
    transform: translate(-50%, -50%) translateX(-250px) scale(0.8)
      translateZ(-300px);
  }

  .doctors-card.right-1,
  .doctors-card.left-1 {
    transform: translate(-50%, -50%) translateX(120px) scale(0.9)
      translateZ(-100px);
  }

  .doctors-card.left-1 {
    transform: translate(-50%, -50%) translateX(-120px) scale(0.9)
      translateZ(-100px);
  }

  .doctors-nav {
    width: 38px;
    height: 38px;
  }

  .doctors-nav--left {
    left: 10px;
  }

  .doctors-nav--right {
    right: 10px;
  }

  .doctors-member__name {
    font-size: clamp(24px, 4vw, 34px);
  }
}

@media (max-width: 560px) {
  :root {
    --header-h: 64px;
  }

  .hero__lead {
    font-size: 15px;
    line-height: 1.3;
    margin-top: 4px;
  }

  .brand__mark {
    width: 40px;
    height: auto;
  }

  .hero.hero--v6 {
    padding: 0;
  }

  /* Hero watermark/glow */
  .hero::before {
    top: 5%;
    font-size: clamp(46px, 13vw, 78px);
    letter-spacing: 0.12em;
    -webkit-text-stroke: 1px rgba(12, 78, 99, 0.14);
    opacity: 0.88;
    filter: blur(0.18px) drop-shadow(0 10px 22px rgba(20, 160, 178, 0.08));
    mask-image: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.85),
      rgba(0, 0, 0, 0.25)
    );
    -webkit-mask-image: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.85),
      rgba(0, 0, 0, 0.25)
    );
  }

  .hero::after {
    inset: 0% -28% auto -28%;
    opacity: 0.86;
  }

  .hero.hero--v6 .hero__bg-media::before {
    font-size: clamp(28px, 9vw, 44px);
    opacity: 0.4;
    top: clamp(4px, 2vw, 10px);
  }

  .media-card__image {
    height: 420px;
  }

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

  .checkup-intro {
    padding: 54px 0;
  }

  .checkup-intro__title {
    font-size: clamp(24px, 6vw, 30px);
  }

  /* Checkup cards: 1 колонка на мобільному */
  .checkup__list {
    grid-template-columns: 1fr;
  }

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

  .site-footer__grid {
    grid-template-columns: 1fr;
  }

  .doctors-carousel {
    height: auto;
    min-height: 420px;
    margin-top: 50px;
  }

  .doctors-card {
    width: 170px;
    height: 240px;
  }

  .doctors-carousel__track {
    height: 270px;
  }

  .doctors-card.right-2,
  .doctors-card.left-2 {
    transform: translate(-50%, -50%) translateX(180px) scale(0.8)
      translateZ(-300px);
  }

  .doctors-card.left-2 {
    transform: translate(-50%, -50%) translateX(-180px) scale(0.8)
      translateZ(-300px);
  }

  .doctors-card.right-1,
  .doctors-card.left-1 {
    transform: translate(-50%, -50%) translateX(80px) scale(0.9)
      translateZ(-100px);
  }

  .doctors-card.left-1 {
    transform: translate(-50%, -50%) translateX(-80px) scale(0.9)
      translateZ(-100px);
  }

  .doctors-nav {
    width: 34px;
    height: 34px;
  }

  .doctors-member__role {
    font-size: 12px;
    letter-spacing: 0.08em;
  }

  /* FAQ background panel size */
  .section.faq .container::before {
    top: 6px;
    left: 10px;
    right: 10px;
    bottom: -8px;
  }
}
