/* RealRacer.ai bottom-sheet primitive.
 *
 * Pattern: mobile-first one-thumb picker (Apple Music / iOS share
 * sheet voice). Slides up from the bottom on phone; centres at
 * ≥920px desktop so it doesn't feel weird on a 27" screen.
 *
 * Markup is created dynamically by /static/sheet.js — pages don't
 * inline it. Reusable for venue / car / plan / setup / any other
 * "pick one from a list" UX.
 *
 * v2 design tokens — assumes tokens.css is loaded (palette + type).
 */

.rr-sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
  z-index: 80;
}
.rr-sheet-backdrop.open {
  opacity: 1; visibility: visible;
}

.rr-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  border-top: 1px solid var(--border);
  padding: 14px 22px 36px;
  padding-bottom: calc(36px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.4, 1.2, .6, 1);
  z-index: 90;
  max-height: 80vh;
  overflow-y: auto;
}
.rr-sheet.open {
  transform: translateY(0);
}

@media (min-width: 920px) {
  /* Desktop: centre the sheet so it doesn't read as "swipe-up from a
     50" monitor". Still slides up from the bottom for continuity. */
  .rr-sheet {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
  }
  .rr-sheet.open {
    transform: translateX(-50%) translateY(0);
  }
}

.rr-sheet-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--faint);
  margin: 0 auto 14px;
}
.rr-sheet-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  color: var(--text);
}
.rr-sheet-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.5;
}

.rr-sheet-list {
  list-style: none;
  display: flex; flex-direction: column;
  margin: 0; padding: 0;
}
.rr-sheet-list li {
  padding: 16px 4px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  cursor: pointer;
  transition: background .15s;
}
.rr-sheet-list li:last-child {
  border-bottom: none;
}
.rr-sheet-list li:hover {
  background: var(--surface-2);
}
.rr-sheet-list li:active {
  background: var(--border);
}
.rr-sheet-list li.is-static {
  cursor: default;
}
.rr-sheet-list li.is-static:hover,
.rr-sheet-list li.is-static:active {
  background: transparent;
}
.rr-sheet-list .rr-sheet-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  flex: 1;
  color: var(--text);
}
.rr-sheet-list .rr-sheet-tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.rr-sheet-list .rr-sheet-tag.is-here {
  color: var(--green);
}

.rr-sheet-empty {
  padding: 28px 4px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

/* ── Keyboard + selection state ──────────────────────────────────────
 *
 * The rows are focusable now (roving tabindex — see sheet.js). A focus
 * ring is not decoration here: it is the ONLY thing telling a keyboard
 * user which of 300 cars they are about to choose. `:focus-visible`
 * rather than `:focus` so a tap does not leave a ring behind on touch. */
.rr-sheet-list li:focus { outline: none; }
.rr-sheet-list li:focus-visible {
  outline: 2px solid var(--orange, #ff8000);
  outline-offset: -2px;
  border-radius: 6px;
  background: var(--surface-2);
}
/* The current choice, so the list opens showing you where you are. */
.rr-sheet-list li.is-selected .rr-sheet-name { color: var(--orange, #ff8000); }
.rr-sheet-list li.is-selected::after {
  content: '✓';
  font-family: var(--mono);
  font-size: 13px;
  color: var(--orange, #ff8000);
}

/* ── Free-text panel ("…or type your own") ───────────────────────────
 * Replaces the list in place rather than stacking a second dialog on a
 * sheet that is already aria-modal. */
.rr-sheet-custom[hidden] { display: none; }
.rr-sheet-custom {
  display: flex; flex-direction: column; gap: 10px;
  padding: 8px 4px 4px;
}
.rr-sheet-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg, #08080c);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--display, inherit);
  font-size: 16px;   /* 16px or iOS Safari zooms the page on focus */
}
.rr-sheet-input:focus-visible {
  outline: 2px solid var(--orange, #ff8000);
  outline-offset: 1px;
}
.rr-sheet-hint {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.rr-sheet-hint[hidden] { display: none; }
.rr-sheet-actions { display: flex; gap: 10px; justify-content: flex-end; }
.rr-sheet-btn {
  padding: 11px 20px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
}
.rr-sheet-btn:focus-visible {
  outline: 2px solid var(--orange, #ff8000);
  outline-offset: 2px;
}
.rr-sheet-save {
  background: var(--orange, #ff8000);
  border-color: transparent;
  color: #0a0a10;
  font-weight: 700;
}
.rr-sheet-save:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
