/* Profile deck: one profile at a time with looping previous/next.
   Loaded after member-redesign.css. Tokens come from member-app.css (:root). See ../DESIGN.md. */
:root {
  --deck-radius: 16px;
  --deck-shadow: 0 22px 54px rgba(62, 34, 48, .11);
  --deck-enter: 340ms;
  --deck-ease: cubic-bezier(.22, 1, .36, 1);
}
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.flip { transform: scaleX(-1); }

.deck { display: grid; gap: 16px; min-width: 0; }
.discovery-section .deck { padding: 20px 22px 22px; }

/* Stack: two tinted cards peek out below the active one, so the pool reads as a pile, not a count. */
.deck-stack { position: relative; isolation: isolate; padding-bottom: 18px; }
.deck-ghost { position: absolute; inset: 0 0 18px; z-index: -1; border: 1px solid var(--line); border-radius: var(--deck-radius); transform-origin: 50% 100%; pointer-events: none; }
.ghost-near { background: #f6eef1; transform: translateY(9px) scale(.968); }
.ghost-far { z-index: -2; background: #efe4e8; transform: translateY(18px) scale(.936); }

.deck-card {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 470px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--deck-radius);
  background: var(--surface); box-shadow: var(--deck-shadow); touch-action: pan-y;
  transition: opacity .2s var(--ease-out);
}
.deck-stack.is-paging .deck-card { opacity: .55; }
.deck-card[data-enter="next"] { animation: deck-in-next var(--deck-enter) var(--deck-ease) both; }
.deck-card[data-enter="prev"] { animation: deck-in-prev var(--deck-enter) var(--deck-ease) both; }
@keyframes deck-in-next { from { opacity: 0; transform: translateX(26px) scale(.99); filter: blur(4px); } }
@keyframes deck-in-prev { from { opacity: 0; transform: translateX(-26px) scale(.99); filter: blur(4px); } }

.deck-portrait { position: relative; display: block; min-width: 0; background: #eae5df; }
.deck-portrait .profile-photo { width: 100%; height: 100%; min-height: 470px; border-radius: 0; }
.deck-portrait .profile-photo img { object-position: center 22%; }
.deck-portrait:hover .profile-photo img { transform: scale(1.025); }

.deck-info { display: flex; min-width: 0; flex-direction: column; gap: 12px; padding: 26px 28px 24px; }
.deck-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.deck-meta .profile-number { display: inline; }
.deck-title { margin: 6px 0 0; font-size: clamp(32px, 3.1vw, 44px); line-height: 1.12; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.deck-place { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--ink-soft); font-size: 16px; }
.deck-place svg { width: 17px; height: 17px; color: var(--rose); stroke-width: 1.8; }
.deck-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 6px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); }
.deck-facts div { min-width: 0; }
.deck-facts dt { color: var(--muted); font-size: 12.5px; }
.deck-facts dd { margin: 1px 0 0; color: var(--ink); font-size: 15.5px; font-weight: 600; overflow-wrap: anywhere; }
.deck-matches { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.deck-matches > span:first-child { margin-right: 4px; color: var(--muted); font-size: 12.5px; }
.match-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 10px; border-radius: 6px; color: var(--rose-dark); background: var(--tint); font-size: 12.5px; font-weight: 600; }
.deck-open { justify-content: space-between; margin-top: auto; }

/* Controls */
.deck-controls { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.deck-nav {
  display: inline-flex; min-width: 48px; min-height: 48px; align-items: center; justify-content: center; gap: 8px;
  padding: 0 18px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink-soft); background: var(--surface);
  font-weight: 700; transition: transform .16s var(--ease-out), background-color .16s, border-color .16s, color .16s;
}
.deck-nav:hover { border-color: #d8aabd; color: var(--rose-dark); background: #fff8fa; }
.deck-nav:active { transform: scale(.97); }
.deck-nav.primary { border-color: var(--rose-dark); color: #fff; background: var(--rose-dark); }
.deck-nav.primary:hover { border-color: var(--rose-deep); color: #fff; background: var(--rose-deep); }
.deck-nav:focus-visible, .deck-open:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.deck-peek { display: flex; min-width: 0; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.deck-peek-photo { display: grid; width: 40px; height: 40px; flex: none; place-items: center; overflow: hidden; border: 2px solid var(--surface); border-radius: 50%; color: var(--rose); background: var(--tint); box-shadow: 0 0 0 1px var(--line); }
.deck-peek-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.deck-peek-photo svg { width: 18px; height: 18px; }
.deck-peek-text { display: grid; min-width: 0; line-height: 1.35; }
.deck-peek-text small { font-size: 11.5px; }
.deck-peek-text strong { overflow: hidden; color: var(--ink-soft); font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }

/* Loading */
.deck-skeleton { box-shadow: none; }
.deck-skeleton-photo { min-height: 470px; border-radius: 0; }

/* Search: the deck replaces the result grid and pager */
.search-main .deck { margin-top: 4px; }

/* Profile details: previous/next beside "back" */
.detail-stepper { display: inline-flex; gap: 8px; }
.page-header .header-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 1250px) {
  .deck-card { min-height: 430px; }
  .deck-portrait .profile-photo, .deck-skeleton-photo { min-height: 430px; }
  .deck-info { padding: 22px 22px 20px; }
}
@media (max-width: 760px) {
  .discovery-section .deck { padding: 14px 14px 16px; }
  .deck-card { grid-template-columns: 1fr; min-height: 0; }
  .deck-portrait .profile-photo { height: auto; min-height: 0; aspect-ratio: 10 / 9.4; max-height: 56dvh; }
  .deck-skeleton-photo { min-height: 0; aspect-ratio: 10 / 9.4; }
  .deck-info { gap: 10px; padding: 18px 18px 18px; }
  .deck-title { margin-top: 2px; font-size: 32px; }
  .deck-facts { gap: 12px 16px; padding-top: 14px; }
  /* Controls stay in thumb reach above the mobile tab bar while the deck is on screen. */
  .deck-controls {
    position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 30;
    margin: 0 -4px; padding: 8px; border: 1px solid var(--line); border-radius: 12px;
    background: rgba(255, 253, 251, .94); box-shadow: 0 -6px 22px rgba(48, 35, 45, .07);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  .deck-nav { padding: 0 14px; }
  .detail-stepper { width: 100%; }
  .detail-stepper .button { flex: 1; }
}
@media (max-width: 400px) {
  .deck-peek-text small { display: none; }
  .deck-nav span { display: none; }
  .deck-nav { width: 48px; padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .deck-card[data-enter] { animation: none; }
  .deck-card, .deck-nav, .deck-portrait .profile-photo img { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .deck-controls { background: #fffdfb; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
