/* #703: the pair UI (PairStage, CardPairsRail, PairPage extras). Scoped under #cardLibraryDetail / .deck-stage / .deck-rail; tokens of the d03 card template only, no new palette.
   Motion is CSS transform/opacity/translate only and is switched off by prefers-reduced-motion. Logical properties + a mirrored tilt keep RTL correct. */
/* the "N combinations" anchor of the Previous/Next row is styled in card-detail-d03.css (it is in the first HTML: its rules must be there at first paint, not with this later sheet) */

/* PairStage: two cards, overlap about 13%, opposite tilt, the touched/focused one comes forward and the other dims. */
.deck-stage { --tilt: 4deg; --w: min(42vw, 270px); position: relative; display: flex; justify-content: center; align-items: flex-start; padding: 12px 0 6px; isolation: isolate; }
[dir="rtl"] .deck-stage { --tilt: -4deg; }
.deck-stage__card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; width: var(--w); flex: none; color: inherit; text-decoration: none; transform-origin: 50% 90%; transition: transform .24s ease, filter .24s ease; }
.deck-stage__card--a { transform: rotate(calc(var(--tilt) * -1)); z-index: 1; }
.deck-stage__card--b { transform: rotate(var(--tilt)); margin-inline-start: calc(var(--w) * -0.13); z-index: 2; }
.deck-stage__card:hover, .deck-stage__card:focus-visible { transform: rotate(0deg) scale(1.06); z-index: 3; }
.deck-stage:has(.deck-stage__card:hover, .deck-stage__card:focus-visible) .deck-stage__card:not(:hover):not(:focus-visible) { filter: brightness(.78); }
.deck-stage__card:focus-visible { outline: 3px solid var(--d01-gold, currentColor); outline-offset: 4px; border-radius: 12px; }
.deck-stage__frame { position: relative; display: block; width: 100%; aspect-ratio: 720 / 1200; border-radius: 12px; overflow: hidden; background: var(--d03-panel, var(--surface)); border: 1px solid var(--d03-border, var(--border)); box-shadow: 0 10px 26px rgba(20, 12, 8, .22); }
.deck-stage__ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 10px; text-align: center; font-weight: 600; overflow-wrap: anywhere; }
.deck-stage__frame picture, .deck-stage__frame img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.deck-stage__frame img { object-fit: cover; }
.deck-stage__name { font-size: .92rem; font-weight: 600; text-align: center; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: no-preference) {
  .deck-stage__card--a { animation: deck-stage-float 8s ease-in-out infinite; }
  .deck-stage__card--b { animation: deck-stage-float 9s ease-in-out -3s infinite; }
}
@keyframes deck-stage-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -3px; } }

/* PairPage layout: the card-page grid, the stage wider than a single card; beside the text from 1100px, above it and centred below. */
#cardLibraryDetail .d03-layout.deck-pair-layout { grid-template-columns: minmax(0, 46%) minmax(0, 1fr); gap: 28px; }
#cardLibraryDetail .deck-pair-stage-col { max-width: none; aspect-ratio: auto; position: sticky; top: 92px; align-self: start; margin: 0; }
@media (max-width: 1099px) {
  #cardLibraryDetail .d03-layout.deck-pair-layout { grid-template-columns: 1fr; gap: 14px; }
  #cardLibraryDetail .deck-pair-stage-col { position: static; max-width: none; aspect-ratio: auto; margin: 0 auto; }
}
#cardLibraryDetail .deck-pair-sub { display: grid; gap: 4px; margin: 0 0 10px; }
#cardLibraryDetail .deck-pair-sub h3 { font-size: 1rem; margin: 0; }
#cardLibraryDetail .deck-pair-sub p { margin: 0; }

/* CardPairsRail: the panel, the fixed-height preview, the text chips, the native expander. */
.deck-rail__lead { color: var(--d03-muted, var(--muted)); }
.deck-rail__preview { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; height: 188px; overflow: hidden; }
.deck-rail__duo { position: relative; width: 148px; height: 176px; flex: none; }
.deck-rail__card { --r: -5deg; position: absolute; top: 8px; width: 92px; aspect-ratio: 720 / 1200; border-radius: 8px; overflow: hidden; background: var(--d03-panel, var(--surface)); border: 1px solid var(--d03-border, var(--border)); box-shadow: 0 6px 16px rgba(20, 12, 8, .2); rotate: var(--r); }
[dir="rtl"] .deck-rail__card { --r: 5deg; }
[dir="rtl"] .deck-rail__card--partner { --r: -5deg; }
.deck-rail__card--ours { inset-inline-start: 4px; z-index: 1; }
.deck-rail__card--partner { --r: 5deg; inset-inline-start: 52px; z-index: 2; transition: opacity .22s ease; }
.deck-rail__card--partner.is-swapping { opacity: 0; }
.deck-rail__ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 6px; text-align: center; font-size: .72rem; font-weight: 600; overflow-wrap: anywhere; }
.deck-rail__card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .22s ease; }
.deck-rail__card img.is-ready { opacity: 1; }
.deck-rail__text { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.deck-rail__text strong { font-size: 1.02rem; overflow-wrap: anywhere; }
.deck-rail__text [data-rail-teaser] { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--d03-muted, var(--muted)); font-size: .9rem; }
.deck-rail__chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 10px; }
.deck-rail__chip { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 14px; border: 1px solid var(--d03-border, var(--border)); border-radius: 999px; color: var(--d03-accent, var(--accent)); text-decoration: none; font-size: .92rem; }
.deck-rail__chip:hover { border-color: var(--d03-accent, var(--accent)); }
.deck-rail__chip[aria-current="true"] { background: color-mix(in srgb, var(--d03-accent, var(--accent)) 12%, transparent); border-color: var(--d03-accent, var(--accent)); }
.deck-rail__chip:focus-visible, .deck-rail__summary:focus-visible, .deck-rail__open:focus-visible { outline: 3px solid var(--d01-gold, currentColor); outline-offset: 2px; }
.deck-rail__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--d01-gold, currentColor); flex: none; }
.deck-rail__more { display: grid; gap: 10px; }
.deck-rail__summary { display: inline-flex; width: max-content; min-height: 44px; align-items: center; cursor: pointer; color: var(--d03-accent, var(--accent)); font-weight: 600; list-style: none; }
.deck-rail__summary::-webkit-details-marker { display: none; }
.deck-rail__summary-open { display: none; }
.deck-rail__more[open] .deck-rail__summary-open { display: inline; }
.deck-rail__more[open] .deck-rail__summary-closed { display: none; }
@media (max-width: 480px) { .deck-rail__preview { grid-template-columns: 112px minmax(0, 1fr); gap: 10px; } .deck-rail__duo { width: 112px; } .deck-rail__card { width: 70px; } .deck-rail__card--partner { inset-inline-start: 38px; } }
@media (prefers-reduced-motion: reduce) {
  .deck-stage__card, .deck-rail__card, .deck-rail__card img { transition: none; }
  .deck-stage__card:hover, .deck-stage__card:focus-visible { transform: none; }
  .deck-stage__card--a { transform: rotate(calc(var(--tilt) * -1)); }
  .deck-stage__card--b { transform: rotate(var(--tilt)); }
  .deck-rail__card--partner.is-swapping { opacity: 1; }
}
.deck-rail__hub { margin: 10px 0 0; font-size: .95rem; }
.deck-rail__hub a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
