/* M Sphinx — deck: the girls as gold-foil cards.
   Desktop (.deck--fan): a hand of cards in an arc. Phone (.deck--stack): a swipeable stack.
   JS drives layout through inline transforms and the sheen through custom properties:
   --sp (sheen band position), --sa (sheen angle), --so (sheen opacity), --tx/--ty (tilt). */

.deck {
  --deck-w: 360px;                       /* card size when open / on top of the stack */
  --deck-r: 10px;
  --deck-rim: 6px;                       /* thin foil frame */
  --deck-foil:
    linear-gradient(118deg,
      var(--gold-lo) 0%, var(--gold) 12%, var(--gold-hi) 21%,
      color-mix(in srgb, var(--gold) 70%, var(--gold-lo)) 33%,
      var(--gold-hi) 46%, var(--gold-lo) 58%, var(--gold) 70%,
      var(--gold-hi) 81%, color-mix(in srgb, var(--gold) 55%, var(--gold-lo)) 92%, var(--gold-lo) 100%);
  --deck-shine: color-mix(in srgb, var(--gold-hi) 82%, white);
  position: relative;
  color: var(--cream);
}

/* ---------- Heading (preview) ---------- */
.deck__head { display: grid; gap: 1rem; margin-bottom: clamp(28px, 4vw, 56px); }
.deck__head .lede { max-width: 30em; }
.deck__more {
  color: var(--gold); font-weight: 600; text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: .3em;
  transition: color .25s var(--ease);
}
.deck__more:hover { color: var(--gold-hi); }
.deck__foot { display: flex; justify-content: center; margin-top: clamp(20px, 3vw, 40px); }

/* ---------- Language filter: plain text buttons ---------- */
.deck__filter {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1.6rem;
  margin: 0 0 clamp(20px, 3vw, 40px); padding: 0; list-style: none;
}
.deck__lang {
  background: none; border: 0; padding: .5em .1em; min-height: 44px;
  color: var(--mute); font: 500 1rem/1 var(--font-body);
  text-decoration: underline; text-decoration-color: transparent;
  text-decoration-thickness: 2px; text-underline-offset: .55em;
  transition: color .25s var(--ease), text-decoration-color .25s var(--ease);
}
.deck__lang:hover { color: var(--cream); }
.deck__lang[aria-pressed="true"] { color: var(--gold); text-decoration-color: var(--gold); }

/* ---------- Stage ---------- */
.deck__stage {
  position: relative;
  height: 590px;
  isolation: isolate;
  user-select: none; -webkit-user-select: none;
}
.deck--stack .deck__stage {
  height: calc(var(--deck-w) * 1.4 + 84px);
  touch-action: pan-y;                   /* page scrolls vertically, we take horizontal swipes */
  /* full-bleed so a swiped card can leave the screen, clipped so the page never scrolls sideways */
  margin-inline: calc(50% - 50vw);
  overflow-x: clip; overflow-y: visible;
}


/* Slot = position in the fan/stack. Card dimensions are the open size; the fan scales them down. */
.deck__slot {
  position: absolute; left: 50%; top: 50%;
  width: var(--deck-w); aspect-ratio: 5 / 7;
  margin-left: calc(var(--deck-w) / -2);
  margin-top: calc(var(--deck-w) * -.7);
  transform-origin: 50% 50%;
  transition: transform .85s var(--ease-out), opacity .5s var(--ease), filter .6s var(--ease);
  will-change: transform;
}
.deck__slot.is-hidden { opacity: 0; pointer-events: none; visibility: hidden; transition: transform .5s var(--ease), opacity .35s var(--ease), visibility 0s .5s; }
.deck__slot.is-dragging { transition: none; }
.deck--fan .deck__slot.is-dim { filter: brightness(.3) saturate(.6); }

/* Tilt (pointer / phone) sits between position and flip */
.deck__tilt {
  width: 100%; height: 100%;
  transform: perspective(1400px) rotateX(var(--deck-ty, 0deg)) rotateY(var(--deck-tx, 0deg));
  transform-style: preserve-3d;
  transition: transform .5s var(--ease-out);
}
.deck__slot.is-tracking .deck__tilt { transition: transform .12s linear; }

.deck__inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 1.05s var(--ease-out);
}
.deck__slot.is-flipped .deck__inner { transform: rotateY(180deg); }

.deck__face {
  position: absolute; inset: 0;
  border-radius: var(--deck-r);
  overflow: hidden; isolation: isolate;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .85), 0 2px 6px rgba(0, 0, 0, .5);
}
.deck__face--back { transform: rotateY(180deg); background: var(--ink-2); }

/* ---------- Front ---------- */
.deck__front {
  display: block; width: 100%; height: 100%; padding: 0; border: 0;
  background: var(--ink-2); border-radius: inherit; text-align: center;
  cursor: pointer;
}
.deck__front:focus-visible { outline: none; }
.deck__slot:has(.deck__front:focus-visible) .deck__face--front { box-shadow: 0 0 0 2px var(--ink-0), 0 0 0 4px var(--gold); }
.deck__photo {
  position: absolute; inset: var(--deck-rim);
  border-radius: calc(var(--deck-r) - 3px);
  overflow: hidden; background: var(--ink-1);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .55);
}
.deck__photo img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 14%;
  pointer-events: none;
}
/* readability under the cartouche only, not a decorative wash */
.deck__photo::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 30%;
  background: linear-gradient(to top, rgba(10, 9, 8, .78), rgba(10, 9, 8, 0));
}

/* Foil frame: one gold ring around the card, the band of light travels across it */
.deck__frame {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  border-radius: inherit; padding: var(--deck-rim);
  background:
    linear-gradient(var(--deck-sa, 105deg), transparent 44%, color-mix(in srgb, white 70%, var(--deck-shine)) 50%, transparent 56%) var(--deck-sp, 120%) 0 / 300% 100% no-repeat,
    var(--deck-foil) calc(20% + var(--deck-sp, 120%) * .6) 0 / 260% 100%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
/* faint pass of the same light over the photo, like a laminated card */
.deck__sheen {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(var(--deck-sa, 105deg),
      transparent 43%, color-mix(in srgb, var(--deck-shine) 30%, transparent) 47%,
      var(--deck-shine) 50%, color-mix(in srgb, var(--deck-shine) 30%, transparent) 53%, transparent 57%)
    var(--deck-sp, 120%) 0 / 300% 100% no-repeat;
  mix-blend-mode: screen;
  opacity: calc(var(--deck-so, 0) * .42);
}

/* Cartouche: oval ring + bar at the end, name inside */
.deck__cartouche {
  position: absolute; z-index: 3; left: 50%; bottom: 7%;
  transform: translateX(-50%);
  display: grid; place-items: center;
  min-width: 46%; height: 3.2em; padding: 0 1.4em;
  border-radius: 999px;
  background: rgba(10, 9, 8, .5);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--gold-hi);
  font-size: 1rem;
}
.deck__cartouche::before {             /* the ring */
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 2px;
  background: var(--deck-foil) calc(20% + var(--deck-sp, 120%) * .6) 0 / 260% 100%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.deck__cartouche::after {              /* the bar */
  content: ""; position: absolute; top: 4%; bottom: 4%; right: -7px; width: 3px; border-radius: 1px;
  background: var(--deck-foil) 50% 0 / 100% 300%;
}
.deck__glyph, .deck__latin {
  grid-area: 1 / 1; white-space: nowrap;
  transition: opacity .45s var(--ease), filter .45s var(--ease), transform .45s var(--ease);
}
.deck__glyph { font: 400 1.65em/1 var(--font-glyph); letter-spacing: .06em; }
.deck__latin {
  font: 700 1.3em/1 var(--font-display); letter-spacing: .02em;
  opacity: 0; filter: blur(4px); transform: scale(.92);
}
.deck__slot.is-flipped .deck__face--front .deck__glyph { opacity: 0; filter: blur(4px); transform: scale(1.08); }
.deck__slot.is-flipped .deck__face--front .deck__latin { opacity: 1; filter: none; transform: none; }

/* ---------- Back ---------- */
.deck__back {
  position: absolute; inset: var(--deck-rim);
  border-radius: calc(var(--deck-r) - 3px);
  display: flex; flex-direction: column; gap: .85em;
  padding: 1.6em 1.5em 1.35em;
  background: var(--ink-1);
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: left;
  font-size: .95rem;
}
.deck__back .deck__cartouche {
  position: relative; left: auto; bottom: auto; transform: none;
  align-self: flex-start; min-width: 0; height: 2.9em; padding: 0 1.4em;
  margin-right: 10px; background: transparent;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.deck__back .deck__latin { opacity: 1; filter: none; transform: none; font-size: 1.75em; color: var(--gold-hi); }
.deck__langs { color: var(--gold); font-weight: 500; font-size: .95em; margin-top: -.1em; }
.deck__bio { color: var(--cream); font: 500 1.17em/1.42 var(--font-display); margin-block: auto; }
.deck__facts {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .6em;
  margin: 0; padding: .8em 0 0; border-top: 1px solid var(--line);
  font-size: .82em; line-height: 1.3;
}
.deck__facts dt { color: var(--mute); }
.deck__facts dd { margin: .2em 0 0; color: var(--cream); font-weight: 500; }
.deck__ask { width: 100%; min-height: 48px; font-size: .95rem; }
.deck__close {
  position: absolute; top: .9em; right: .9em;
  min-width: 44px; min-height: 44px; padding: 0 .4em;
  background: none; border: 0; color: var(--mute);
  font: 500 .85rem/1 var(--font-body);
  transition: color .25s var(--ease);
}
.deck__close:hover { color: var(--gold-hi); }

/* ---------- Counter + hint (phone) ---------- */
.deck__meta {
  display: none;
  position: absolute; left: 0; right: 0; bottom: 0;
  justify-content: space-between; align-items: baseline;
  width: var(--deck-w); margin-inline: auto;
  color: var(--mute); font-size: var(--fs-small);
}
.deck__count { color: var(--gold); font-variant-numeric: tabular-nums; font-weight: 600; }
.deck--stack .deck__meta { display: flex; }
.deck--stack .deck__slot { top: 0; margin-top: 0; }

/* Phone: card sized to the screen, a bit smaller type on the back */
.deck--stack { --deck-w: min(78vw, 340px); }
.deck--stack .deck__back { font-size: .86rem; padding: 1.2em 1.1em 1em; gap: .7em; }
.deck--stack .deck__cartouche:not(.deck__back .deck__cartouche) { font-size: .9rem; }

/* ---------- Reduced motion: no tilt, no sweep, flip = cross-fade ---------- */
@media (prefers-reduced-motion: reduce) {
  .deck__sheen { display: none; }
  .deck__tilt { transform: none !important; }
  .deck__slot.is-flipped .deck__inner { transform: none; }
  .deck__face--back { transform: none; opacity: 0; visibility: hidden; transition: opacity .2s linear, visibility 0s .2s !important; }
  .deck__slot.is-flipped .deck__face--back { opacity: 1; visibility: visible; transition: opacity .2s linear !important; }
}

.deck__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
