/* The map demo at /demo/ fills the window below the header, with no footer. Its search box and category buttons float
   over the map's top left. Results, a place's details, and directions open in panels: side by side down the left on
   desktop, as a sheet over the bottom of the map on phones. Bootstrap's position classes have no breakpoints. */
body:has(.demo-app) {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
body:has(.demo-app) > main {
  display: flex;
  flex: 1;
  min-height: 0;
}
.demo-app {
  --panel: 25rem;
}
.demo-search {
  position: absolute;
  z-index: 6;
  top: 0.5rem;
  left: 0.5rem;
  right: 0.5rem;
}
.demo-chips {
  position: absolute;
  z-index: 2;
  top: 3.75rem;
  left: 0;
  right: 0;
  display: flex;
  gap: 0.5rem;
  padding: 0 0.5rem 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.demo-panel {
  position: absolute;
  z-index: 4;
  inset: auto 0 0 0;
  max-height: 55%;
  overflow-y: auto;
  border-top: var(--bs-border-width) solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-xl) var(--bs-border-radius-xl) 0 0;
  box-shadow: 0 -0.25rem 1rem rgba(0, 0, 0, 0.1);
}
.demo-details {
  z-index: 5;
}
/* Directions keep the travel mode and stops in view, and their steps scroll below them. The close and swap buttons, and
   each stop's remove button, share a column on the right. */
.demo-directions {
  display: flex;
  flex-direction: column;
  overflow: visible;
}
.demo-side {
  flex-shrink: 0;
  width: 2rem;
}
/* A dotted line runs from each stop's icon down to the next one's, across the gap between the rows. */
[data-stops] > li:not(:last-child) .demo-stop::after {
  content: "";
  position: absolute;
  top: calc(50% + 0.875rem);
  height: calc(100% - 1.25rem);
  border-left: 2px dotted currentColor;
}
.demo-directions [role="listbox"] {
  max-height: 16rem;
  overflow-y: auto;
}
.demo-area {
  position: absolute;
  z-index: 2;
  top: 6.5rem;
  left: 50%;
  transform: translateX(-50%);
}
/* The style switcher sits in the bottom left on desktop. On phones, where the sheet covers the bottom, it sits below the
   category buttons on the right. */
.demo-styles {
  position: absolute;
  z-index: 2;
  top: 6.5rem;
  right: 0.5rem;
}
.demo-error {
  z-index: 7;
  bottom: 2.5rem;
  width: max-content;
  max-width: calc(100% - 2rem);
}
.demo-error:empty {
  display: none;
}
.demo-app.directing :is(.demo-search, .demo-chips, .demo-area, .demo-list, .demo-details) {
  display: none;
}
/* On phones, a place's details cover the list, which comes back when they close. */
@media (max-width: 767.98px) {
  .demo-app.viewing .demo-list {
    display: none;
  }
}
@media (min-width: 768px) {
  .demo-search {
    top: 0.75rem;
    left: 0.75rem;
    right: auto;
    width: calc(var(--panel) - 1.5rem);
  }
  .demo-chips {
    top: 0.75rem;
    left: var(--panel);
    padding: 0.25rem 0.75rem 0.5rem 0;
  }
  .demo-panel {
    inset: 0 auto 0 0;
    width: var(--panel);
    max-height: none;
    padding-top: 4rem;
    border-top: 0;
    border-right: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: 0;
    box-shadow: none;
  }
  .demo-directions {
    padding-top: 0;
  }
  /* A place picked from the list opens beside it. One picked any other way opens in the list's place. */
  .demo-app.listing .demo-details {
    left: var(--panel);
    padding-top: 0;
  }
  .demo-area {
    top: 3.75rem;
  }
  .demo-styles {
    top: auto;
    right: auto;
    bottom: 0.75rem;
    left: 0.75rem;
  }
  .demo-app:is(.listing, .viewing, .directing) :is(.demo-chips, .demo-styles) {
    left: calc(var(--panel) + 0.75rem);
  }
  .demo-app.listing.viewing :is(.demo-chips, .demo-styles) {
    left: calc(2 * var(--panel) + 0.75rem);
  }
  .demo-app.listing .demo-area {
    left: calc(50% + var(--panel) / 2);
  }
  .demo-app.listing.viewing .demo-area {
    left: calc(50% + var(--panel));
  }
}
