/* The active marker is set only by a sheet whose own media query matches. */
:root[data-cas-mobile-sheet-open] {
  overflow: hidden;
  overscroll-behavior: none;
  scrollbar-gutter: stable;
}

.cas-mobile-sheet[open][data-cas-mobile-sheet-active] {
  --cas-sheet-accent: #d10c42;
  --cas-sheet-selected: #f2f4f6;
  --cas-sheet-divider: #e7e8ea;
  --cas-sheet-gutter: 16px;
  --cas-sheet-tail: 24px;
  --cas-sheet-motion: 180ms;
  position: fixed;
  inset: auto auto var(--cas-sheet-bottom, 0px)
    calc(var(--cas-sheet-left, 0px) + var(--cas-sheet-width, 100%) * .5);
  transform: translate(-50%, var(--cas-sheet-drag, 0px));
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(560px, var(--cas-sheet-width, 100%));
  max-width: none;
  max-height: calc(var(--cas-sheet-height, 100vh) - max(12px, env(safe-area-inset-top, 0px)));
  max-height: calc(var(--cas-sheet-height, 100dvh) - max(12px, env(safe-area-inset-top, 0px)));
  padding: 0 max(var(--cas-sheet-gutter), env(safe-area-inset-right, 0px)) 0
    max(var(--cas-sheet-gutter), env(safe-area-inset-left, 0px));
  margin: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 16px 16px 0 0;
  background: #fff;
  color: #18181b;
  box-shadow: 0 -6px 24px rgb(23 23 23 / 14%);
  font: 400 1.6rem/1.4 Raleway, sans-serif;
}

.cas-mobile-sheet[data-cas-mobile-sheet-active]::backdrop {
  background: rgb(24 24 27 / 38%);
}

.cas-mobile-sheet[data-cas-mobile-sheet-active] .cas-mobile-sheet__header {
  flex: 0 0 auto;
  padding-block: 12px 10px;
}

.cas-mobile-sheet[data-cas-mobile-sheet-active] [data-cas-mobile-sheet-drag] {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.cas-mobile-sheet[data-cas-mobile-sheet-active] .cas-mobile-sheet__grabber {
  display: block;
  width: 44px;
  height: 4px;
  margin: 0 auto 2px;
  border-radius: 10px;
  background: #b6b7b9;
}

.cas-mobile-sheet[data-cas-mobile-sheet-active] .cas-mobile-sheet__title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.cas-mobile-sheet[data-cas-mobile-sheet-active] .cas-mobile-sheet__title {
  margin: 0;
  color: inherit;
  font: 600 2.2rem/1.22 Raleway, sans-serif;
  overflow-wrap: anywhere;
}

.cas-mobile-sheet[data-cas-mobile-sheet-active] .cas-mobile-sheet__description {
  margin: 0;
  color: #555960;
  font: 400 1.4rem/1.4 Raleway, sans-serif;
}

.cas-mobile-sheet[data-cas-mobile-sheet-active] button.cas-mobile-sheet__dismiss {
  box-sizing: border-box;
  min-width: 44px;
  min-height: 44px;
  padding: 4px 0 4px 8px;
  margin: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--cas-sheet-accent);
  box-shadow: none;
  font: 700 1.6rem/1.25 Raleway, sans-serif;
  cursor: pointer;
}

.cas-mobile-sheet[data-cas-mobile-sheet-active] button.cas-mobile-sheet__dismiss:focus-visible {
  outline: 2px solid var(--cas-sheet-accent) !important;
  outline-offset: -2px;
}

.cas-mobile-sheet[data-cas-mobile-sheet-active] .cas-mobile-sheet__content {
  flex: 1 1 auto;
  min-height: 0;
  padding-block: 2px calc(var(--cas-sheet-tail) + env(safe-area-inset-bottom, 0px));
  overflow: hidden auto;
  overscroll-behavior: contain;
}

@media (prefers-reduced-motion: no-preference) {
  .cas-mobile-sheet[open][data-cas-mobile-sheet-active]:not([data-cas-mobile-sheet-dragged]) {
    animation: cas-mobile-sheet-enter var(--cas-sheet-motion) ease-out;
  }

  .cas-mobile-sheet[open][data-cas-mobile-sheet-active][data-cas-mobile-sheet-settling] {
    transition: transform var(--cas-sheet-motion) ease-out;
  }

  @keyframes cas-mobile-sheet-enter {
    from { transform: translate(-50%, 100%); }
  }
}
