.mobile-nav-panel {
  display: contents;
}

.header-inner {
  min-width: 0;
}

.brand,
.language,
.header-cta {
  flex-shrink: 0;
}

.brand {
  order: 1;
}

.main-nav {
  order: 2;
  min-width: 0;
}

.header-actions {
  order: 3;
  display: flex;
  min-width: max-content;
  flex: 0 0 auto;
  align-items: center;
  gap: 16px;
  overflow: visible;
  visibility: visible;
  opacity: 1;
}

.header-actions > .language,
.header-inner > .language {
  display: inline-flex;
  min-width: max-content;
  flex: 0 0 auto;
  align-items: center;
  white-space: nowrap;
  visibility: visible;
  opacity: 1;
  transform: none;
}

.header-cta {
  order: 4;
}

@media (min-width: 1051px) and (max-width: 1320px) {
  .hospital-hero {
    height: auto;
    min-height: 660px;
    aspect-ratio: auto;
  }

  .hospital-hero-inner {
    height: auto;
    min-height: 660px;
  }
}

@media (max-width: 1320px) {
  .header-inner {
    position: relative;
    justify-content: space-between;
  }

  .nav-toggle {
    position: relative;
    z-index: 2;
    display: inline-flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-left: 0;
    padding: 0;
    border: 1px solid rgba(6, 29, 61, 0.18);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--navy);
    cursor: pointer;
  }

  .nav-toggle span {
    display: block;
    width: 19px;
    height: 1px;
    background: currentColor;
    transition: transform 180ms ease, opacity 180ms ease;
  }

  .site-header.menu-open .nav-toggle span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .site-header.menu-open .nav-toggle span:nth-child(2) {
    opacity: 0;
  }

  .site-header.menu-open .nav-toggle span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .mobile-nav-panel {
    position: absolute;
    top: calc(100% - 1px);
    right: var(--site-gutter-desktop);
    left: var(--site-gutter-desktop);
    z-index: 30;
    display: none;
    max-height: calc(100vh - var(--site-header-height, 95px) - 20px);
    overflow-y: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    padding: 22px;
    border: 1px solid rgba(6, 29, 61, 0.1);
    border-radius: 0 0 6px 6px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 18px 36px rgba(6, 29, 61, 0.13);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .site-header.menu-open .mobile-nav-panel {
    display: flex;
  }

  .mobile-nav-panel .main-nav {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .mobile-nav-panel .main-nav a {
    padding: 11px 0;
    font-size: 12px;
  }

  .mobile-nav-panel .main-nav a.active::after {
    bottom: 6px;
  }

  .mobile-nav-panel .header-cta {
    align-self: flex-start;
  }
}

@media (max-width: 1050px) {
  .hero,
  .feature-hero,
  .whychina-hero,
  .about-hero,
  .faq-hero,
  .consultation-hero,
  .hospital-hero,
  .news-hero {
    height: auto;
    min-height: 600px;
    aspect-ratio: auto;
  }

  .hero-grid,
  .feature-hero-inner,
  .whychina-hero-inner,
  .about-hero-inner,
  .faq-hero-content,
  .consultation-hero-inner,
  .hospital-hero-inner,
  .news-hero-inner {
    height: auto;
    min-height: 600px;
    box-sizing: border-box;
  }

  .hero-copy,
  .feature-hero-copy,
  .whychina-hero-copy,
  .about-hero-inner,
  .faq-hero-content,
  .consultation-hero-copy,
  .hospital-hero-copy,
  .news-hero-copy {
    box-sizing: border-box;
    padding-bottom: 64px;
  }

  .faq-hero-content {
    height: auto;
  }

  .included-feature {
    margin-top: 0;
  }
}

@media (max-width: 767px) {
  .header-inner {
    gap: 10px;
  }

  .header-actions {
    margin-left: auto;
    gap: 10px;
  }

  .header-actions > .language,
  .header-inner > .language {
    padding-left: 0;
    border-left: 0;
    font-size: 12px;
  }

  .mobile-nav-panel {
    right: var(--site-gutter-mobile);
    left: var(--site-gutter-mobile);
  }

  .mobile-nav-panel .header-cta {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .header-inner {
    gap: 6px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .brand {
    max-width: 174px;
    min-width: 0;
    flex: 0 1 174px;
    gap: 6px;
  }

  .brand-mark {
    width: 42px;
    flex: 0 0 42px;
  }

  .brand-name {
    max-width: 126px;
    min-width: 0;
    overflow: hidden;
  }

  .brand-title {
    font-size: 13px;
    letter-spacing: 0.055em;
  }

  .brand-subtitle {
    font-size: 5px;
    letter-spacing: 0.02em;
  }

  .header-actions {
    gap: 6px;
  }

  .header-actions > .language,
  .header-inner > .language {
    gap: 4px;
    font-size: 10px;
  }

  .nav-toggle {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
}

@media (max-width: 390px) {
  .brand {
    max-width: 158px;
    flex-basis: 158px;
  }

  .brand-name {
    max-width: 110px;
  }

  .brand-title {
    font-size: 12px;
  }

  .brand-subtitle {
    font-size: 4.5px;
  }
}

/*
 * Header language switcher visibility contract.
 * This is intentionally the final header rule so legacy responsive blocks
 * cannot hide, collapse, clip, or move the switcher outside the viewport.
 */
.site-header,
.site-header .header-inner,
.site-header .header-actions {
  overflow: visible;
}

.site-header .header-actions,
.site-header .language,
.site-header .language-switcher {
  width: auto;
  max-width: none;
  min-width: max-content;
  height: auto;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  white-space: nowrap;
  overflow: visible;
  visibility: visible;
  opacity: 1;
  position: relative;
  inset: auto;
  transform: none;
  z-index: 4;
}

@media (max-width: 1320px) {
  .site-header .main-nav,
  .site-header .header-cta {
    flex-shrink: 1;
  }

  .site-header .header-actions {
    margin-left: auto;
  }
}

@media (max-width: 767px) {
  .site-header .header-actions,
  .site-header .language,
  .site-header .language-switcher {
    display: flex;
    visibility: visible;
    opacity: 1;
  }
}

@media (min-width: 768px) and (max-width: 1050px) {
  .site-footer .footer-grid {
    grid-template-columns: minmax(290px, 1.2fr) repeat(2, minmax(150px, 1fr));
  }

  .site-footer .footer-description {
    max-width: 320px;
  }
}

@media (max-width: 1050px) {
  .site-footer .footer-description-break {
    display: none;
  }
}

/* FAQ CTA: keep translated copy in its own column and crop the source artwork
   to the visible panel so it never reveals the image's built-in white margins. */
.faq-bottom-cta {
  grid-template-columns:
    minmax(0, 1.25fr)
    1px
    minmax(300px, 0.72fr)
    minmax(220px, 0.65fr);
  background-image:
    linear-gradient(90deg, rgba(255,255,255,0.98) 0%, rgba(255,255,255,0.98) 46%, rgba(255,255,255,0.86) 62%, rgba(255,255,255,0.1) 100%),
    url("assets/faq-cta-cropped.png");
  background-position: center, right center;
  background-size: 100% 100%, cover;
}

.faq-bottom-copy {
  min-width: 0;
}

.faq-bottom-copy h2 {
  white-space: normal;
  text-wrap: balance;
}

.faq-bottom-cta .button {
  width: 100%;
  min-width: 0;
  max-width: 420px;
  white-space: nowrap;
}

/* Localized metric values such as “1,28 M” must remain one unit. */
.whychina-stat-number strong {
  white-space: nowrap;
  font-size: clamp(58px, 5.8vw, 88px);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

html[data-language="fr"] .whychina-stat-number strong {
  font-size: clamp(56px, 5.5vw, 84px);
}

.whychina-stat-number span {
  font-size: 22px;
}

@media (max-width: 1023px) {
  .faq-bottom-cta {
    grid-template-columns: 1fr;
    background-position: center, right center;
    background-size: 100% 100%, cover;
  }

  .faq-bottom-cta .button {
    max-width: none;
  }
}

@media (max-width: 767px) {
  .faq-bottom-cta .button {
    white-space: normal;
  }

  .whychina-stat-number strong,
  html[data-language="fr"] .whychina-stat-number strong {
    font-size: clamp(50px, 15vw, 64px);
  }

  .whychina-stat-number span {
    font-size: 18px;
  }
}

@media (min-width: 1051px) and (max-width: 1250px) {
  .site-footer .footer-grid > div:first-child {
    min-width: 300px;
  }

  .site-footer .footer-description {
    max-width: 320px;
  }
}

/* Mobile header hard boundary: keep language controls and menu inside viewport. */
@media (max-width: 767px) {
  .site-header {
    width: 100%;
  }

  .site-header .header-inner {
    position: relative;
    width: inherit;
    max-width: inherit;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    gap: 6px;
    padding-right: 12px;
    padding-left: 12px;
    overflow: visible;
  }

  .site-header .brand {
    grid-column: 1;
    max-width: 100%;
    min-width: 0;
  }

  .site-header .header-actions {
    grid-column: 2;
    position: static;
    margin: 0;
    transform: none;
  }

  .site-header .language,
  .site-header .language-switcher {
    display: flex;
    flex-shrink: 0;
    visibility: visible;
    opacity: 1;
  }
}

/* Mobile footer brand: prevent the shared header brand limits from clipping it. */
@media (max-width: 767px) {
  .site-footer .footer-grid > div:first-child,
  .site-footer .footer-brand {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
  }

  .site-footer .footer-brand {
    display: inline-flex;
    flex: none;
  }

  .site-footer .footer-brand .brand-name {
    width: auto;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
  }

  .site-footer .footer-brand .brand-title {
    max-width: 100%;
    font-size: 22px;
    white-space: nowrap;
    overflow: visible;
    letter-spacing: 0.14em;
  }
}

/* French-only overflow fixes for the two specified sections. */
html[data-language="fr"] .featured-page .collections-feature .collection-row:nth-child(4) > * {
  min-width: 0;
}

html[data-language="fr"] .featured-page .collections-feature .collection-row:nth-child(4) .collection-copy h3 {
  font-size: 28px;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}

html[data-language="fr"] .featured-page .collections-feature .collection-row:nth-child(4) ul {
  min-width: 0;
  overflow-x: visible;
}

html[data-language="fr"] .featured-page .collections-feature .collection-row:nth-child(4) li {
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}

html[data-language="fr"] .about-difference-section,
html[data-language="fr"] .about-difference-section .about-panel,
html[data-language="fr"] .about-difference-section .about-difference-grid,
html[data-language="fr"] .about-difference-section .about-feature-card {
  min-width: 0;
  max-width: 100%;
}

html[data-language="fr"] .about-difference-section .about-difference-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

html[data-language="fr"] .about-difference-section .about-feature-card h3,
html[data-language="fr"] .about-difference-section .about-feature-card p {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

@media (min-width: 768px) and (max-width: 1160px) {
  html[data-language="fr"] .about-difference-section .about-difference-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  html[data-language="fr"] .about-difference-section .about-difference-grid {
    grid-template-columns: 1fr;
  }
}
