/* Bottom sheet: modal <dialog> sliding up from the bottom edge (phone filter). */
@layer components {
  .bottom-sheet {
    position: fixed;
    inset: auto 0 0 0;
    inline-size: 100%;
    max-inline-size: 100%;
    max-block-size: 90dvh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: var(--component-bubble-radius-m) var(--component-bubble-radius-m) 0 0;
    background-color: var(--color-background-default);
    color: var(--color-text-default);
  }

  .bottom-sheet[open] {
    display: flex;
    flex-direction: column;
    animation: bottom-sheet-in var(--duration-normal) ease-out;
  }

  .bottom-sheet::backdrop {
    background-color: color-mix(in srgb, var(--color-background-overlay) 92%, transparent);
  }

  .bottom-sheet__panel {
    display: flex;
    flex-direction: column;
    min-block-size: 0;
    padding: var(--space-8) var(--layout-margin) var(--space-24);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .bottom-sheet__handle {
    flex: none;
    align-self: center;
    inline-size: 40px;
    block-size: 4px;
    margin-block-end: var(--space-8);
    border-radius: var(--radius-pill);
    background-color: var(--color-border-strong);
  }

  .bottom-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-16);
    margin-block-end: var(--space-16);
  }

  .bottom-sheet__title {
    font-size: var(--type-heading-m-size);
    line-height: var(--type-heading-m-line-height);
  }

  .bottom-sheet__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: var(--component-control-height-s);
    block-size: var(--component-control-height-s);
    margin-inline-end: calc(-1 * var(--space-8));
    padding: 0;
    border: 0;
    border-radius: var(--radius-pill);
    background: none;
    color: var(--color-text-default);
  }

  .bottom-sheet__close:hover {
    background-color: var(--color-background-subtle);
  }

  .bottom-sheet__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-16);
    position: sticky;
    inset-block-end: calc(-1 * var(--space-24));
    margin-block: var(--space-24) calc(-1 * var(--space-24));
    padding-block: var(--space-16) var(--space-24);
    background-color: var(--color-background-default);
  }

  .bottom-sheet__foot > .link {
    flex: none;
  }

  .bottom-sheet__foot > .button {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
  }

  html.sheet-open {
    overflow: hidden;
  }

  @keyframes bottom-sheet-in {
    from {
      transform: translateY(100%);
    }

    to {
      transform: translateY(0);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .bottom-sheet[open] {
      animation: none;
    }
  }
}
