/* fan-gallery.css — the card fan that fan-gallery.js lays out. Link it from any page
   that calls fanGallery(); the behaviour and the markup contract are in that file.

   Ported 2026-09-19 from the card-fan-carousel hand-over (React + GSAP). The layout
   numbers are its FAN_POSITIONS; the two elastic eases are GSAP's elastic.out(1,.75)
   and elastic.out(1.05,.78) sampled into linear() curves, with a plain overshoot where
   linear() is not understood.

   Everything the script writes is a custom property on the card (--x --y in rem, --r in
   deg, --s, --o, --z); the transform below is the only place they are composed, so
   changing the motion means editing this sheet, not the script.

   WITHOUT THE SCRIPT the stage is a plain horizontal scroll row of the same cards, so a
   page whose module never arrives still shows every game. The script adds .fan-on.

   Sizing comes from three tokens the breakpoints below set — the card's width, and the
   multiplier --fan-m that scales the fan's spread — and five colour tokens a page may
   override on the .fan element: --fan-accent (the active dot, the hover ring),
   --fan-fg (arrows), --fan-hair (borders), --fan-btn (arrow button fill) and --fan-cap
   (the caption's colour). */

.fan {
  --fan-card-w: 17.5rem;
  --fan-m: 1;
  --fan-card-h: calc(var(--fan-card-w) * 9 / 7);
  /* Sag of the outer cards (7.3rem at spread 1) plus room for the hover lift. */
  --fan-h: calc(var(--fan-card-h) + 7.5rem * var(--fan-m) + 1.5rem);
  --fan-lift: calc(2.4rem * var(--fan-m));
  --fan-r: 12px;
  --fan-accent: currentColor;
  --fan-fg: currentColor;
  --fan-hair: rgba(128, 128, 128, 0.35);
  --fan-btn: rgba(128, 128, 128, 0.08);
  --fan-cap: currentColor;
  --fan-ease-move:  linear(0.0, 0.254, 0.496, 0.703, 0.864, 0.978, 1.05, 1.088, 1.101, 1.097, 1.083, 1.065, 1.046, 1.029, 1.016, 1.005, 0.999, 0.995, 0.993, 0.993, 0.993, 0.994, 0.996, 0.997, 0.998, 0.999, 1.0, 1.0, 1);
  --fan-ease-enter: linear(0.0, 0.322, 0.595, 0.806, 0.957, 1.054, 1.107, 1.127, 1.125, 1.11, 1.088, 1.065, 1.044, 1.026, 1.012, 1.002, 0.996, 0.993, 0.991, 0.992, 0.993, 0.994, 0.996, 0.997, 0.998, 0.999, 1.0, 1.0, 1);
  --fan-ease-slide: cubic-bezier(0.16, 1, 0.3, 1);
  --fan-ease-exit:  cubic-bezier(0.55, 0, 1, 0.45);
  position: relative;
  width: 100%;
}
@supports not (transition-timing-function: linear(0, 1)) {
  .fan {
    --fan-ease-move:  cubic-bezier(0.34, 1.45, 0.64, 1);
    --fan-ease-enter: cubic-bezier(0.34, 1.6, 0.64, 1);
  }
}
@media (max-width: 1279px) { .fan { --fan-card-w: 15rem;  --fan-m: 0.82; } }
@media (max-width: 1023px) { .fan { --fan-card-w: 12.5rem; --fan-m: 0.62; } }
@media (max-width: 767px)  { .fan { --fan-card-w: 10rem;  --fan-m: 0.5; } }
@media (max-width: 639px)  { .fan { --fan-card-w: 8.5rem; --fan-m: 0.38; } }
@media (max-width: 479px)  { .fan { --fan-card-w: 7rem;   --fan-m: 0.28; } }

/* ── The no-script row ─────────────────────────────────────────────────────── */
.fan-stage {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 0 12px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.fan-card {
  flex: none;
  display: block;
  position: relative;   /* a stamp or badge inside the card positions against the card, in
                           the strip too; .fan-on makes it absolute, which is also positioned */
  width: var(--fan-card-w);
  aspect-ratio: 7 / 9;
  border-radius: var(--fan-r);
  overflow: hidden;
  background: #111;
  border: 1px solid var(--fan-hair);
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.65);
  scroll-snap-align: center;
  color: inherit;
  text-decoration: none;
}
.fan-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.fan-card:focus-visible {
  outline: 2px solid var(--fan-accent);
  outline-offset: 4px;
}

/* ── The fan ───────────────────────────────────────────────────────────────── */
.fan-on .fan-stage {
  position: relative;   /* the cards' containing block — without it 50% is the .fan's */
  display: block;
  height: var(--fan-h);
  overflow: visible;
  padding: 0;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.fan-on .fan-card {
  position: absolute;
  left: 50%;
  top: calc(50% - var(--fan-lift));
  margin: calc(var(--fan-card-h) / -2) 0 0 calc(var(--fan-card-w) / -2);
  height: var(--fan-card-h);
  transform: translate(var(--x, 0rem), var(--y, 0rem)) rotate(var(--r, 0deg)) scale(var(--s, 1));
  opacity: var(--o, 1);
  z-index: var(--z, 1);
  transition:
    transform 0.5s var(--fan-ease-move),
    opacity 0.4s ease;
}
.fan-on .fan-card img { pointer-events: none; }
/* A cycle slides rather than springs; a card leaving accelerates away. */
.fan-on .fan-card.is-sliding { transition-timing-function: var(--fan-ease-slide), ease; }
.fan-on .fan-card.is-exiting { transition: transform 0.4s var(--fan-ease-exit), opacity 0.3s ease; }
/* The entrance: up from below with a spring, one card after another (delay set inline). */
.fan-on .fan-card.is-entering { transition: transform 1.2s var(--fan-ease-enter), opacity 0.5s ease; }
/* A card put somewhere WITHOUT motion — the frame before it enters. */
.fan-on .fan-card.fan-jump { transition: none !important; }
/* Cards outside the seven visible slots are parked, not just invisible. */
.fan-on .fan-card[aria-hidden="true"] { pointer-events: none; }
/* The card under the pointer is the one about to be clicked, so it comes to the front
   (the hand-over kept it in the fan's own order, half under its inner neighbour). */
.fan-on .fan-card:hover { z-index: calc(var(--z, 1) + 20); }

/* ── Arrows, dots, caption ──────────────────────────────────────────────────── */
.fan-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 10px;
}
.fan-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--fan-hair);
  background: var(--fan-btn);
  color: var(--fan-fg);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.3s ease, color 0.3s ease, transform 0.3s var(--fan-ease-slide);
}
.fan-btn svg { display: block; width: 18px; height: 18px; }
.fan-btn:hover { border-color: var(--fan-accent); color: var(--fan-accent); }
.fan-btn:active { transform: scale(0.94); }
.fan-btn:focus-visible { outline: 2px solid var(--fan-accent); outline-offset: 3px; }
.fan-dots {
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.fan-dot {
  display: block;
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fan-hair);
  cursor: pointer;
  position: relative;
  transition: transform 0.3s var(--fan-ease-slide), background 0.3s ease;
}
/* A 7px dot is not a tap target; the hit area is grown without moving the row. */
.fan-dot::before { content: ''; position: absolute; inset: -10px -4px; }
.fan-dot.is-on { background: var(--fan-accent); transform: scale(1.35); }
.fan-dot:focus-visible { outline: 2px solid var(--fan-accent); outline-offset: 4px; }
.fan-cap {
  margin: 14px 0 0;
  text-align: center;
  color: var(--fan-cap);
  font-size: 15px;
  line-height: 1.3;
  min-height: 1.3em;
}
@media (max-width: 639px) {
  .fan-nav { gap: 12px; }
  .fan-btn { width: 40px; height: 40px; }
  .fan-dots { gap: 6px; }
  .fan-dot { width: 6px; height: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .fan-on .fan-card,
  .fan-on .fan-card.is-sliding,
  .fan-on .fan-card.is-exiting,
  .fan-on .fan-card.is-entering { transition: opacity 0.2s ease; }
  .fan-btn, .fan-dot { transition: none; }
}
