/* The dentistry page head loads this sheet. Size the full-width controls against their own row. */
@supports selector(::-webkit-scrollbar) {
  .ao4-carousel-viewport,
  :has(> .sti-clinic-gallery, > .vn-results-track) {
    container-type: inline-size;
    --carousel-inset: max(16px, calc((100cqi - 560px) / 2));
  }
}

:is(#main, body.am26) :is(
  .ao4-carousel-viewport > [tabindex="0"],
  .te-track,
  .sti-clinic-gallery,
  .vn-results-track,
  .am26-doctors-carousel,
  [data-am26-service-layout="carousel"],
  .am26-service-post-rail,
  .am26-promotions-carousel,
  .m33-post-section__grid,
  .m33-articles-rail__viewport
) {
  --carousel-thumb: #748c7e;
  --carousel-track: rgb(58 88 70 / 16%);
  --carousel-hit-height: 28px;
  /* Shared rails explicitly hide the native control, including on mobile. */
  scrollbar-width: auto !important;
  scrollbar-color: var(--carousel-thumb) var(--carousel-track);

  @supports selector(::-webkit-scrollbar) {
    scrollbar-color: auto;

    &::-webkit-scrollbar:horizontal {
      display: block !important;
      height: var(--carousel-hit-height) !important;
    }

    &::-webkit-scrollbar-track:horizontal,
    &::-webkit-scrollbar-thumb:horizontal {
      border-block: solid transparent;
      border-radius: 5px / calc(var(--carousel-hit-height) / 2);
      background-clip: padding-box;
    }

    &::-webkit-scrollbar-track:horizontal {
      /* Keep a long row's control within easy reach at the center. */
      margin-inline: var(--carousel-inset, 16px);
      border-block-width: calc((var(--carousel-hit-height) - 3px) / 2);
      background-color: var(--carousel-track);
    }

    &::-webkit-scrollbar-thumb:horizontal {
      min-width: 48px;
      border-block-width: calc((var(--carousel-hit-height) - 8px) / 2);
      background-color: var(--carousel-thumb);
    }

    &::-webkit-scrollbar-thumb:horizontal:hover,
    &:focus-visible::-webkit-scrollbar-thumb:horizontal {
      background-color: #587562;
    }

    &::-webkit-scrollbar-thumb:horizontal:active {
      background-color: #425e4d;
    }
  }

  @media (any-pointer: coarse) {
    --carousel-hit-height: 44px;
  }

  @media (forced-colors: active) {
    --carousel-thumb: ButtonText;
    --carousel-track: Canvas;
    scrollbar-color: auto;
  }
}
