/* Responsive corrections verified against the actual mobile page, not its frame. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Keep background scrolling separate from the open procedure or contact sheet. */
html:has(dialog[open]) {
  overflow: hidden;
}

.mobile-menu {
  max-height: calc(100vh - 110px);
  max-height: calc(100dvh - 110px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(1, 73, 72, .98);
}

.mobile-menu a[hidden] {
  display: none;
}

.action-sheet {
  max-width: min(100%, 480px);
  max-height: calc(100vh - 12px);
  max-height: calc(100dvh - max(12px, env(safe-area-inset-top)));
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* The close control remains reachable while reading a long preparation. */
.action-sheet:not(.catalog-sheet) .sheet-close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 4;
  margin: -10px -6px 0 10px;
}

.catalog-sheet {
  width: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}

.catalog-item {
  grid-template-columns: 42px minmax(0, 1fr) 22px;
}

.catalog-item strong,
.profile-timeline span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.profile-timeline p {
  grid-template-columns: 67px minmax(0, 1fr);
}

.profile-details summary svg,
.preparation-block summary svg,
.procedure-media summary svg,
.reviews-link svg {
  flex: 0 0 18px;
}

.whatsapp {
  height: auto;
  min-height: 70px;
  padding: 14px 12px;
  text-align: center;
  line-height: 1.35;
}

.whatsapp .brand-icon {
  flex-shrink: 0;
}

@media (max-width: 480px) {
  /* An in-flow guide cannot cover the doctor's name, text, or menu entries. */
  .scroll-guide {
    position: static;
    width: max-content;
    max-width: calc(100% - 40px);
    margin: 18px auto -28px;
    transform: none;
    animation: none;
  }
}

@media (max-width: 390px) {
  .service-card {
    grid-template-columns: 56px minmax(0, 1fr) auto;
  }

  .social-link small {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (max-height: 440px) and (orientation: landscape) {
  .catalog-sheet {
    padding-top: calc(18px + env(safe-area-inset-top));
  }

  .catalog-sheet > .sheet-label {
    margin-top: 0;
    padding-right: 52px;
  }

  .catalog-sheet > h2 {
    padding-right: 44px;
    font-size: 24px;
  }
}
