/* Second Wind Club, the memberships dealt as a fan. Each card carries its own pair of colours (ground and ink); the
   page takes the colours of the card in the middle, mixed live by script.js while the deck moves. Card sizes come
   from --w, measured on the width and on the height so the fan always fits, sideways too. */
:root {
  /* the four pairs, ground and ink: violet and lilac, petrol and mint, umber and amber, chalk and soot */
  --violet: #241034;
  --lilac: #e7b6ff;
  --petrol: #062d30;
  --mint: #93f2d8;
  --umber: #2d1c0a;
  --amber: #ffae5c;
  --chalk: #f5f2ec;
  --soot: #151413;
  /* the page under the deck, set again at every frame by script.js */
  --page: #170a22;
  --page-ink: #e7b6ff;
  --w: min(280px, 38vw, 44vh); /* the width of a card */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--page-ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* a soft light over the page, the colour of the ink, so the ground is never flat */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 50% 42%, color-mix(in srgb, var(--page-ink) 13%, transparent), transparent 70%),
    radial-gradient(90% 70% at 50% 110%, rgba(0, 0, 0, 0.32), transparent 70%);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

button {
  font: inherit;
  color: inherit;
}

.stage {
  position: relative;
  height: 100svh;
  min-height: 320px;
  max-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(10px, 3vh, 28px) clamp(12px, 4vw, 40px);
  overflow: hidden;
}

/* ---------------------------------------------------------------- head */
.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(100%, 620px);
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(11px, 1.9vh, 14px);
  font-weight: 640;
  font-stretch: 112%;
  letter-spacing: 0.01em;
}

.brand__mark {
  width: 1.5em;
  height: 1.5em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.sound {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px 6px 8px;
  border: 1px solid color-mix(in srgb, var(--page-ink) 26%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--page-ink) 6%, transparent);
  font-size: clamp(10px, 1.7vh, 12px);
  font-weight: 560;
  font-stretch: 108%;
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.sound svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound__wave {
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
  transform-origin: 10px 10px;
}

.sound__off {
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sound[aria-pressed='false'] .sound__wave {
  opacity: 0;
  transform: scale(0.6);
}

.sound[aria-pressed='false'] .sound__off {
  opacity: 1;
}

@media (hover: hover) {
  .sound:hover {
    background: color-mix(in srgb, var(--page-ink) 14%, transparent);
    border-color: color-mix(in srgb, var(--page-ink) 45%, transparent);
  }
}

/* ---------------------------------------------------------------- deck */
.deck {
  position: relative;
  align-self: center;
  width: 100%;
  height: min(100%, calc(var(--w) * 1.82));
  touch-action: pan-y;
  cursor: grab;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.deck.is-grabbing {
  cursor: grabbing;
}

.deck:focus-visible::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  width: calc(var(--w) * 0.5);
  height: 2px;
  margin-left: calc(var(--w) * -0.25);
  border-radius: 2px;
  background: currentColor;
  opacity: 0.5;
}

/* one element for the script (its transform), its child for the CSS */
.card {
  position: absolute;
  left: 50%;
  top: 47%;
  width: var(--w);
  height: calc(var(--w) * 1.5);
  margin-left: calc(var(--w) * -0.5);
  margin-top: calc(var(--w) * -0.75);
  will-change: transform, opacity;
}

.card__lift {
  position: absolute;
  inset: 0;
  width: var(--w);
  height: calc(var(--w) * 1.5);
  container-type: size;
}

/* the shadow under the card, moved by the script with the lean of the card */
.card__shadow {
  position: absolute;
  inset: 4% 6%;
  border-radius: 1em;
  background: rgba(0, 0, 0, 0.55);
  filter: blur(calc(var(--w) * 0.09));
  transform: translate(var(--sx, 0px), var(--sy, 18px)) scale(0.96);
  opacity: var(--so, 0.8);
}

.card__body {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 8cqw 8cqw 7.5cqw;
  border-radius: 7cqw;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(120% 70% at 20% 0%, color-mix(in srgb, var(--ink) 16%, transparent), transparent 62%),
    linear-gradient(170deg, color-mix(in srgb, var(--ground) 88%, #fff 12%), var(--ground) 46%, color-mix(in srgb, var(--ground) 82%, #000 18%));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 22%, transparent),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.3);
}

/* the grain of the card stock */
.card__grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1.4 -0.2'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
}

.card--light .card__grain {
  mix-blend-mode: multiply;
  opacity: 0.16;
}

/* the lanes of a running track, drawn thin in the ink of the card */
.card__track {
  position: absolute;
  left: -20%;
  right: -20%;
  top: 9%;
  width: 140%;
  height: 44%;
  fill: none;
  stroke: var(--ink);
  stroke-width: 0.6;
  opacity: 0.22;
  -webkit-mask: linear-gradient(180deg, transparent 4%, #000 30%, #000 62%, transparent 96%);
  mask: linear-gradient(180deg, transparent 4%, #000 30%, #000 62%, transparent 96%);
  pointer-events: none;
}

.card__track .lane--lit {
  stroke-width: 1.1;
  opacity: 1;
}

/* the sheen: a wide soft band that slides over the card while the deck moves */
.card__sheen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: soft-light;
}

.card__sheen-band {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: -60%;
  width: 70%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.0) 20%, rgba(255, 255, 255, 0.55) 50%, rgba(255, 255, 255, 0) 80%, transparent);
  transform: translateX(0%);
}

/* the 1px edge that catches the light: brighter on the side the light comes from */
.card__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background: linear-gradient(var(--la, 150deg), color-mix(in srgb, #fff 62%, var(--ink)), color-mix(in srgb, #fff 8%, transparent) 34%, transparent 58%, color-mix(in srgb, var(--ink) 30%, transparent));
  -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);
}

.card--light .card__edge {
  background: linear-gradient(var(--la, 150deg), #fff, rgba(255, 255, 255, 0.4) 34%, transparent 58%, rgba(0, 0, 0, 0.18));
}

.card__top,
.card__mid,
.card__foot {
  position: relative;
}

.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4cqw;
  font-size: 5.4cqw;
  font-weight: 560;
  font-stretch: 108%;
  letter-spacing: 0.02em;
}

.card__club {
  display: inline-flex;
  align-items: center;
  gap: 2.4cqw;
  opacity: 0.82;
}

.card__club svg {
  width: 8cqw;
  height: 8cqw;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.card__term {
  padding: 1.2cqw 3.2cqw 1.4cqw;
  border: 1px solid color-mix(in srgb, var(--ink) 34%, transparent);
  border-radius: 99px;
  white-space: nowrap;
}

.card__mid {
  margin-top: auto;
}

.card__name {
  margin: 0;
  font-size: 21cqw;
  line-height: 0.86;
  font-weight: 860;
  font-stretch: 75%;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.card__for {
  margin: 3.6cqw 0 0;
  font-size: 5.6cqw;
  line-height: 1.3;
  font-weight: 440;
  opacity: 0.78;
  max-width: 88%;
}

.card__perks {
  list-style: none;
  margin: 5cqw 0 0;
  padding: 4cqw 0 0;
  border-top: 1px solid color-mix(in srgb, var(--ink) 20%, transparent);
  font-size: 5.2cqw;
  line-height: 1.25;
  display: grid;
  gap: 2.4cqw;
}

.card__perks li {
  display: flex;
  align-items: center;
  gap: 2.6cqw;
}

.card__perks svg {
  flex: none;
  width: 5.4cqw;
  height: 5.4cqw;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 3cqw;
  margin-top: 6cqw;
}

.card__price {
  margin: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 1.4cqw;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.card__from {
  flex-basis: 100%;
  font-size: 4.8cqw;
  font-weight: 500;
  opacity: 0.7;
  margin-bottom: 1.4cqw;
}

.card__from:empty {
  display: none;
}

.card__figure {
  display: inline-flex;
  font-size: 13cqw;
  font-weight: 760;
  font-stretch: 86%;
  letter-spacing: -0.01em;
}

.card__per {
  font-size: 4.8cqw;
  opacity: 0.7;
}

/* a rolling digit: a window one line high over a strip of 0 to 9 twice */
.reel {
  display: inline-block;
  height: 1em;
  line-height: 1;
  overflow: hidden;
  vertical-align: top;
}

.reel__strip {
  display: flex;
  flex-direction: column;
}

.reel__strip span {
  display: block;
  height: 1em;
  text-align: center;
}

.join {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2cqw;
  padding: 3.4cqw 5cqw 3.6cqw 5.6cqw;
  border: 0;
  border-radius: 99px;
  background: transparent;
  color: var(--ground);
  font-size: 5.6cqw;
  font-weight: 640;
  font-stretch: 112%;
  cursor: pointer;
  isolation: isolate;
}

.join__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 2cqw 5cqw -2cqw color-mix(in srgb, var(--ink) 60%, transparent);
  transition: transform 0.5s cubic-bezier(0.3, 1.7, 0.5, 1);
}

.join__arrow {
  width: 4.6cqw;
  height: 4.6cqw;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.45s cubic-bezier(0.3, 1.7, 0.5, 1);
}

@media (hover: hover) {
  .card.is-center .join:hover .join__bg {
    transform: scaleX(1.06) scaleY(1.1);
  }
  .card.is-center .join:hover .join__arrow {
    transform: translateX(1.2cqw);
  }
}

/* small cards keep the name, the line and the price: the perks wait for room */
@container (max-width: 190px) {
  .card__perks {
    display: none;
  }
  .card__for {
    font-size: 6.4cqw;
  }
}

/* ---------------------------------------------------------------- bar */
.bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 4vw, 28px);
  padding-top: clamp(4px, 1.4vh, 12px);
}

.arrow {
  display: grid;
  place-items: center;
  width: clamp(34px, 6.4vh, 44px);
  height: clamp(34px, 6.4vh, 44px);
  border: 1px solid color-mix(in srgb, var(--page-ink) 30%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--page-ink) 6%, transparent);
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.arrow svg {
  width: 46%;
  height: 46%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) {
  .arrow:hover {
    background: color-mix(in srgb, var(--page-ink) 16%, transparent);
    border-color: color-mix(in srgb, var(--page-ink) 55%, transparent);
  }
}

.hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: clamp(10px, 1.7vh, 12px);
  font-weight: 500;
  font-stretch: 108%;
  opacity: 0.66;
  white-space: nowrap;
}

.hint__hand {
  width: 22px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
