/* sheet.css — presentation for the reusable bottom sheet (ui-sheet.mjs).
   All colours come from the design tokens in styles.css; nothing hardcoded. */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(20, 31, 27, 0.45);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.sheet-backdrop.is-visible {
  opacity: 1;
}

.sheet-panel {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 51;
  width: min(720px, 100%);
  /* translateX(-50%) centres it; the Y slide is combined in the keyed states
     and in the drag transform so centring is never lost. */
  transform: translateX(-50%);
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.28);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}
.sheet-panel.is-entering,
.sheet-panel.is-leaving {
  transform: translate(-50%, 100%);
}

.sheet-grip {
  flex: 0 0 auto;
  appearance: none;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  width: 100%;
  height: 30px;
  cursor: grab;
  touch-action: none; /* let the pointer drag work without scrolling */
}
.sheet-grip::before {
  content: "";
  width: 40px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--line);
}
.sheet-grip:active {
  cursor: grabbing;
}
/* Visible keyboard focus on the grip (it doubles as the close control) — mark
   the handle itself rather than boxing the whole row. */
.sheet-grip:focus-visible {
  outline: none;
}
.sheet-grip:focus-visible::before {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green2);
}

.sheet-content {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 18px calc(24px + env(safe-area-inset-bottom));
}
@media (min-width: 650px) {
  .sheet-content {
    padding-left: 28px;
    padding-right: 28px;
  }
}

/* Lock the page behind the sheet so only the sheet scrolls. */
body.sheet-open {
  overflow: hidden;
}

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