/*
 * Touch-device responsive guard.
 * This is intentionally limited to responsive/layout behavior so the
 * existing desktop design and page content remain unchanged.
 */
html.touch-device,
html.touch-device body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

html.touch-device *,
html.touch-device *::before,
html.touch-device *::after {
  box-sizing: border-box;
}

html.touch-device img,
html.touch-device svg,
html.touch-device video,
html.touch-device iframe {
  max-width: 100%;
}

/* Keep the shared header in mobile mode even if browser zoom changes the CSS viewport. */
html.touch-device .header-container,
html.touch-device .container,
html.touch-device .hero-container {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

html.touch-device .mobile-menu-toggle {
  display: flex;
}

html.touch-device .main-nav {
  position: fixed;
  top: 0;
  right: 0;
  width: min(300px, 100vw);
  height: 100dvh;
  max-width: 100vw;
  background: linear-gradient(180deg, white 0%, var(--color-section-sage) 100%);
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: var(--space-24) var(--space-6) var(--space-6);
  box-shadow: var(--shadow-xl);
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  border-left: 1px solid var(--color-border-light);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

html.touch-device .main-nav.active {
  transform: translateX(0);
}

html.touch-device .main-nav a {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  border-radius: 0;
}

html.touch-device .main-nav a::after {
  display: none;
}

html.touch-device .header-cta {
  margin-left: 0;
  margin-top: var(--space-4);
}

html.touch-device .header-cta .btn {
  width: 100%;
}

/* Force the existing mobile one-column layouts on touch devices, independent of zoom level. */
html.touch-device .about-container,
html.touch-device .treatment-category-with-image,
html.touch-device .treatment-category-with-image.reverse,
html.touch-device .conditions-list,
html.touch-device .procedures-list,
html.touch-device .chambers-grid,
html.touch-device .appointment-steps,
html.touch-device .contact-grid,
html.touch-device .footer-content {
  grid-template-columns: 1fr;
}

html.touch-device .about-image-wrapper {
  position: static;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

html.touch-device .appointment-chamber-card {
  grid-template-columns: 1fr;
}

html.touch-device .chamber-schedule {
  grid-template-columns: 1fr;
}

html.touch-device .chamber-actions {
  flex-direction: column;
}

html.touch-device .chamber-actions .btn,
html.touch-device .appointment-chamber-cta .btn {
  width: 100%;
}

html.touch-device .appointment-chamber-cta {
  flex-direction: column;
}

html.touch-device .container {
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}

@media (min-width: 769px) {
  html.touch-device .about-container {
    gap: var(--space-10);
  }
}
