/* css/driver-info.css — the full-screen "about your driver" overlay,
 * reachable from the floating person-icon button and from tapping the
 * persistent driver badge. Same fade mechanics as .sleep-overlay
 * (components.css), just its own content instead of "tap to wake". */

.driver-info-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 420ms var(--ease-standard);
}

.driver-info-overlay[hidden] {
  display: none;
}

.driver-info-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.driver-info-card {
  position: relative;
  width: min(28rem, calc(100vw - 2 * var(--space-lg)));
  max-height: calc(100vh - 2 * var(--space-lg));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-xl) var(--space-lg) var(--space-lg);
  overflow-y: auto;
  scrollbar-width: none;
}

/* Applied once a profile has actually loaded (js/driver-info.js) — the
 * loading placeholder stays the narrow single-column card above; only the
 * real two-column portrait/trivia layout needs the wider frame. */
.driver-info-card--wide {
  width: min(44rem, calc(100vw - 2 * var(--space-lg)));
  align-items: stretch;
  text-align: left;
}

.driver-info-card::-webkit-scrollbar {
  display: none;
}

.driver-info-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--color-text-secondary);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-hairline-faint);
}

/* Rotated 180deg so the chevron points left/"back", matching the same
 * convention used by .search-back-btn in css/now-playing.css. */
.driver-info-close svg {
  width: 1.1rem;
  height: 1.1rem;
  transform: rotate(180deg);
}

/* ---- Two-column layout --------------------------------------------------
 * Left: portrait + name + a handwritten-feeling send-off. Right: the
 * driver's trivia, one question at a time in a horizontal carousel instead
 * of a stacked list — matches every other swipeable card set in the app. */

.driver-info-columns {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: var(--space-lg);
  width: 100%;
  align-items: start;
}

@media (orientation: portrait) {
  .driver-info-columns {
    grid-template-columns: 1fr;
  }
}

.driver-info-col--portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.driver-info-col--trivia {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 14rem;
}

.driver-info-caption {
  margin-top: var(--space-md);
  font-family: var(--font-cursive);
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  color: var(--color-accent);
}

.driver-info-trivia-mount {
  flex: 1;
  min-height: 12rem;
}

.driver-info-trivia-empty {
  margin: auto;
  color: var(--color-text-secondary);
  font-size: var(--text-body);
  text-align: center;
}

.driver-info-portrait-frame {
  width: clamp(7rem, 22vw, 9.5rem);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--color-hairline);
  box-shadow: var(--shadow-tight);
  margin-bottom: var(--space-md);
  background: radial-gradient(circle, var(--color-accent-faint), var(--color-surface-raised));
}

.driver-info-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.driver-info-name {
  font-size: var(--text-title);
  margin-bottom: var(--space-xs);
}

.driver-info-tagline {
  color: var(--color-text-secondary);
  font-size: var(--text-body);
  max-width: 32ch;
}

.driver-info-trivia-mount .trivia-card {
  height: 100%;
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-hairline-faint);
}

.driver-info-trivia-mount .trivia-card__icon {
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  color: var(--color-accent);
  margin-top: 0.15rem;
}

.driver-info-trivia-mount .trivia-card__text {
  min-width: 0;
}

.driver-info-trivia-mount .trivia-question {
  font-size: var(--text-body);
  color: var(--color-text-primary);
  margin-bottom: 0.35rem;
}

.driver-info-trivia-mount .trivia-answer {
  font-size: var(--text-caption);
  color: var(--color-text-secondary);
}

/* Driver-only bookend, reachable by any passenger browsing this popup —
 * gated shut by default behind two steps (js/driver-info.js): a secret
 * 5-taps-within-2s gesture on the portrait reveals/hides this wrapper, and
 * even revealed, a tap alone still can't fire it — a press-and-hold (timed
 * against .end-day-btn__fill below) opens a driver PIN modal instead of
 * acting directly. */
.end-day-gate {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: max-height 280ms var(--ease-standard), opacity 280ms var(--ease-standard);
}

.end-day-gate.is-revealed {
  max-height: 6rem;
  opacity: 1;
  pointer-events: auto;
}

.end-day-btn {
  position: relative;
  overflow: hidden;
  margin-top: var(--space-lg);
  color: var(--color-text-secondary);
  background: none;
  border-color: var(--color-hairline-faint);
}

.end-day-btn:disabled {
  opacity: 0.5;
}

.end-day-btn__fill {
  position: absolute;
  inset: 0;
  transform-origin: left;
  transform: scaleX(0);
  background: var(--color-accent-soft);
}

/* transition-duration must match js/driver-info.js's HOLD_MS. */
.end-day-btn.is-holding .end-day-btn__fill {
  transition: transform 1400ms linear;
  transform: scaleX(1);
}

.end-day-btn__label {
  position: relative;
  z-index: 1;
}

/* Phase 8 driver feedback/report QR (js/driver-info.js) — shares the
 * end-day-gate's reveal mechanics (.js-reveal-gate) exactly, just a second
 * instance of the same collapse/reveal transition. */
.driver-report-gate {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: max-height 280ms var(--ease-standard), opacity 280ms var(--ease-standard);
}

.driver-report-gate.is-revealed {
  max-height: 22rem;
  opacity: 1;
  pointer-events: auto;
}

.driver-report-gate__label {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
  text-align: center;
}

.driver-report-qr-frame {
  margin: 0 auto;
}
