/* Sticky Stacking Cards, in full: twenty of twenty-two. The pile is one list of
   sticky cards, each stuck five pixels below the last; a card's height is the
   deal, its box is the step, so each arrives over the one before. The names beside
   it keep the same step, so a card's name travels with it and leaves as it lands. */

.deal{position:relative;width:100vw;margin-inline:calc(50% - 50vw);border:0;border-radius:0;color:#F2EDE5;
  --ch:min(64svh,540px);--step:calc(var(--ch) * .52);
  display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:clamp(20px,4vw,72px);
  padding:calc(var(--ch) * .15) clamp(20px,5vw,72px) 0;
  background:radial-gradient(90% 70% at 32% 38%,#3B2A1B,#1A120C 58%,#0D0907)}

/* the pile */
/* a sticky card is held only within its list's content box, not its padding: the hold after the last card is content */
.pile{margin:0;padding:0;list-style:none}
.pile::after{content:'';display:block;height:calc(var(--ch) + 32svh)}
.card{position:sticky;top:calc(var(--bar) + 6svh + var(--i) * 5px);height:var(--step);display:flex;justify-content:center;
  view-timeline:--land block}
.face{position:relative;width:calc(var(--ch) / 2);height:var(--ch);flex:none;border-radius:6px;overflow:hidden;
  rotate:var(--r);box-shadow:0 18px 38px -10px rgb(0 0 0 / .78),0 2px 5px rgb(0 0 0 / .45);
  animation:deal linear both;animation-timeline:--land;animation-range:cover 0% cover 48%}
@keyframes deal{from{translate:calc(var(--x0) * var(--xk,1)) 42%;rotate:var(--r0);scale:1.06}}
.face img{display:block;width:100%;height:100%;object-fit:cover}
/* the gold catches the light once as the card comes down */
.face::after{content:'';position:absolute;inset:0;pointer-events:none;mix-blend-mode:overlay;
  background:linear-gradient(115deg,transparent 30%,rgb(255 244 214 / .75) 46%,rgb(255 250 235 / .95) 50%,rgb(255 244 214 / .75) 54%,transparent 70%) no-repeat;
  background-size:300% 100%;background-position:120% 0;
  animation:glint linear both;animation-timeline:--land;animation-range:cover 18% cover 52%}
@keyframes glint{to{background-position:-20% 0}}
.card.gap{height:var(--step)}

/* the names: one step each, beside the card they belong to */
.names{margin:0;padding:0;list-style:none}
.names li{height:var(--step);box-sizing:border-box;padding-top:calc(var(--ch) * .08);display:grid;align-content:start;gap:10px;max-width:40ch;
  animation:named linear both;animation-timeline:view();animation-range:cover 0% cover 100%}
/* a name is lit while its card is on its way down, and dims once it has landed */
@keyframes named{0%,18%{opacity:.26}36%,60%{opacity:1}80%,100%{opacity:.26}}
.names b{font-family:var(--display);font-weight:400;font-size:clamp(26px,3.4vw,46px);line-height:1;letter-spacing:-.02em}
.names span{font-size:clamp(13.5px,1.2vw,16px);line-height:1.5;color:#B4ABA0;text-wrap:pretty}
.names .lost b{color:#6E655C;text-decoration:line-through;text-decoration-thickness:1px;text-decoration-color:rgb(212 103 63 / .7)}
.names .lost span{font-family:var(--mono);font-size:10px;letter-spacing:.18em;text-transform:uppercase;color:var(--accent)}

@media (max-width:760px){
  /* a narrow column: smaller cards, dealt from nearly straight below so they never cross the names */
  .deal{--ch:min(36svh,280px);--xk:.25;grid-template-columns:minmax(0,46fr) minmax(0,54fr);gap:16px;padding-inline:14px}
  .names b{font-size:22px}
  .names span{font-size:13px}
}
@media (prefers-reduced-motion:reduce){
  .face,.face::after,.names li{animation:none}
  .face::after{display:none}
}
