/*
 * Bottom sheet (bottom-sheet controller, templates/components/_bottom_sheet.html.twig), PLAN.md §11.2.
 * Surfaces and colours from the main app's panel tokens (--background-upper, --background-modal).
 */

.bottom-sheet {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    max-width: 640px;
    max-height: calc(100dvh - env(safe-area-inset-top) - var(--spacing-large));
    margin: 0 auto;
    padding: 0 0 env(safe-area-inset-bottom);
    border: 0;
    border-radius: var(--border-radius-large) var(--border-radius-large) 0 0;
    background: var(--capture-color-surface);
    color: var(--capture-color-text);
    box-shadow: var(--main-box-shadow);
    transform: translateY(100%);
    transition: transform var(--animation-timing-base) cubic-bezier(0.2, 0.8, 0.2, 1);
    overscroll-behavior: contain;
}

.bottom-sheet[open] {
    display: flex;
    flex-direction: column;
}

.bottom-sheet--visible {
    transform: translateY(0);
}

.bottom-sheet--dragging {
    transition: none;
}

.bottom-sheet::backdrop {
    background: rgba(var(--background-modal), 0);
    transition: background-color var(--animation-timing-base);
}

.bottom-sheet--visible::backdrop {
    background: rgba(var(--background-modal), 0.4);
}

.bottom-sheet__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-small) var(--capture-gutter) var(--spacing-medium);
    touch-action: none; /* the header is the drag handle */
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
}

.bottom-sheet__grabber {
    width: 36px;
    height: 5px;
    margin-bottom: var(--spacing-medium);
    border-radius: 3px;
    background: var(--capture-color-border-hard);
}

.bottom-sheet .bottom-sheet__title {
    align-self: stretch;
    margin: 0;
    font-size: var(--size-subtitle);
    color: var(--capture-color-heading);
}

.bottom-sheet__content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 var(--capture-gutter);
}

.bottom-sheet__actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-small);
    padding: var(--spacing-medium-large) var(--capture-gutter);
}

@media (prefers-reduced-motion: reduce) {
    .bottom-sheet,
    .bottom-sheet::backdrop {
        transition: none;
    }
}
