/* Respond to the usable viewport, including laptop scaling and browser chrome. */
@media (min-width: 769px) and (max-height: 850px) {
  body.wl #main .wl-section { padding-block: clamp(28px, 4vh, 44px); }
  body.wl #main .wl-ghero {
    min-height: 0; padding-top: calc(var(--nav-h, 76px) + 24px); padding-bottom: 28px;
  }
  body.wl #main :is(.wl-hero h1,.wl-ghero h1) { font-size: clamp(36px, 4vw, 54px); }
  body.wl #main :is(.wl-trads,.wl-progs,.wl-cards,.wl-steps) { gap: clamp(12px, 2vh, 20px); }
  body.wl #main :is(.wl-card-art,.wl-prog-band) { height: clamp(120px, 20vh, 170px); min-height: 0; }
  body.wl #main :is(.wl-prog-body,.wl-card-body,.wl-trad) { padding: clamp(16px, 2vh, 22px); }
}
@media (min-width: 769px) {
  body:not(.wl) { --density-gap: clamp(12px, 1.5vh, 20px); }
  body:not(.wl) #navbar.nav-reference .nav-utility-inner { height: 32px; min-height: 32px; padding-block: 0 !important; }
  body:not(.wl) #navbar .care-mode-switch { padding: 2px; }
  body:not(.wl) #navbar .care-mode-switch > a { padding: 3px 10px !important; font-size: 12px; line-height: 1.3; }
  body:not(.wl) #navbar.nav-reference .nav-utility-inner > p,
  body:not(.wl) #navbar.nav-reference .nav-utility-contact { font-size: 12px; }
  body:not(.wl) #navbar.nav-reference .nav-inner { height: 60px; gap: 12px; }
  body:not(.wl) #navbar.nav-reference::before { inset-block-start: 28px; }
  body:not(.wl) #navbar.nav-reference .nav-brand-mark { width: 58px; height: 44px; }
  body:not(.wl) #navbar.nav-reference .nav-brand-mark img { width: 140px; }
  body:not(.wl) #navbar.nav-reference .nav-brand-name { font-size: 24px; }
  body:not(.wl) #main .page-hero {
    padding-top: calc(var(--nav-h, 88px) + clamp(12px, 2vh, 24px)) !important;
    padding-bottom: clamp(12px, 2vh, 24px) !important;
  }
  body:not(.wl) #main .page-hero h1 { font-size: clamp(28px, 2.5vw, 40px) !important; line-height: 1.2; margin-bottom: 8px !important; }
  body:not(.wl) #main .medical-treatment-intro .hero-sub { font-size: 14px !important; line-height: 1.5; margin-bottom: 0 !important; max-width: 95ch; }
  body:not(.wl) #main .medical-treatment-directory { padding-top: var(--density-gap) !important; }
  body:not(.wl) #main .directory-toolbar-slim { margin-bottom: 10px; gap: 4px 12px; }
  body:not(.wl) #main :is(.treatment-cards-grid,.hospitals-grid,.doctors-grid) { gap: var(--density-gap) !important; }
  body:not(.wl) #main .treatment-cards-grid { grid-template-columns: repeat(auto-fill,minmax(300px,1fr)) !important; }
  body:not(.wl) #main .rd-section { padding-block: clamp(24px, 4vh, 48px); }
  body:not(.wl) #main .treatment-card { padding: 12px !important; min-height: 0; }
  body:not(.wl) #main .treatment-card .treatment-card-body { padding: 0 !important; }
  body:not(.wl) #main .treatment-card .medical-treatment-paper {
    height: clamp(120px, 16vh, 200px) !important; min-height: 0;
  }
  body:not(.wl) #main .treatment-card :is(.treatment-card-price,.treatment-card-tag) {
    min-height: 50px; margin: 0 0 8px !important;
  }
  body:not(.wl) #main .treatment-card .treatment-card-name {
    font-size: 18px !important; line-height: 1.3; margin-bottom: 6px !important;
  }
  body:not(.wl) #main .treatment-card .treatment-card-body > p {
    font-size: 13px !important; line-height: 1.45; margin: 0 0 10px !important;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  }
  body:not(.wl) #main .treatment-card .treatment-card-links {
    display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px;
  }
  body:not(.wl) #main .treatment-card .treatment-card-links > a {
    display: flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 6px 8px; font-size: 12px !important;
    line-height: 1.35; white-space: normal; box-sizing: border-box;
  }
  body:not(.wl) #main .profile-hero-aligned .profile-hero-picture { max-height: min(48vh, 500px); }
  body:not(.wl) #main .profile-hero-aligned .profile-hero-picture img { max-height: min(48vh, 500px); }
  body:not(.wl) #main .medical-task-links .medical-task-sticker { height: clamp(96px, 18vh, 200px); }
}
@media (min-width: 769px) and (max-height: 850px) {
  body:not(.wl) #main :is(.hospital-card,.doctor-card) { padding: 12px !important; }
  body:not(.wl) #main :is(.hospital-card-img,.rd-hcard-img) { height: clamp(80px, 12vh, 120px); min-height: 0; }
  body:not(.wl) #main .doctor-avatar { width: 72px; height: 72px; margin-bottom: 8px; }
  body:not(.wl) #main .rd-head { margin-bottom: 16px; }
  body:not(.wl) #main .rd-hero-discovery .rd-hero-inner { padding-block: 20px 24px; }
}
/* One consistent hierarchy at every size: image, name, price, preview, actions. */
body:not(.wl) #main .treatment-card {
  display: flex; flex-direction: column; padding: 14px !important; min-width: 0;
}
body:not(.wl) #main .treatment-card .treatment-card-body {
  display: flex; flex-direction: column; padding: 0 !important; min-width: 0;
}
body:not(.wl) #main .treatment-card .treatment-card-name {
  order: 0; font-size: 18px !important; line-height: 1.3;
  min-height: 46px; margin: 0 0 6px !important;
}
body:not(.wl) #main .treatment-card :is(.treatment-card-price,.treatment-card-tag) {
  order: 1; min-height: 40px; margin: 0 0 8px !important; padding: 0;
}
body:not(.wl) #main .treatment-card .treatment-card-body > p {
  order: 2; font-size: 14px !important; line-height: 1.4;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; margin: 0 0 8px !important;
}
body:not(.wl) #main .treatment-card .treatment-card-links {
  order: 3; margin-top: auto; display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between; gap: 8px;
}
body:not(.wl) #main .treatment-card .treatment-card-links > a {
  min-height: 44px; display: inline-flex; align-items: center;
  justify-content: center; padding: 6px 10px; font-size: 13px !important;
  box-sizing: border-box; white-space: normal;
}
@media (min-width: 769px) {
  body:not(.wl) #main .treatment-card .medical-treatment-paper {
    height: clamp(72px, 11vh, 180px) !important; margin-bottom: 8px;
  }
  body:not(.wl).medical-refined #main > section.medical-treatment-directory { padding-top: 12px !important; }
}
body:not(.wl) #main .treatment-card .medical-treatment-paper img {
  width: 100%; height: 100% !important; max-height: 100% !important;
  min-height: 0; object-fit: contain !important;
}
@media (min-width: 769px) and (max-height: 850px) {
  body:not(.wl).medical-refined #main > section.medical-treatment-directory:not(.rd-hero):not(.page-hero) {
    padding-block-start: 8px !important;
  }
}
/* Phone layouts keep their readable text and touch targets, with bounded artwork. */
@media (max-width: 768px) {
  body:not(.wl) #main .treatment-card .medical-treatment-paper {
    height: clamp(140px, 25svh, 220px) !important; min-height: 0;
  }
}
