/* The titanium club pass that catches the light: the Black membership pass of a private athletic club, in brushed
   graphite titanium, alone on a white page. Every layer of the metal reads the same few numbers that script.js writes
   on the tilting element: where the light is (--lx, --ly), from which side it comes (--la) and how strong (--li).
   The brushing runs left to right, so the light on it is a tall streak that slides across, never a round spot.
   One accent: a cold lime, only on the ring of the visits and on the seconds of the code. */
:root {
  --page: #ffffff;            /* the page */
  --ti-dark: #1c1e22;         /* titanium in the shade */
  --ti: #34373d;              /* titanium */
  --ti-light: #5a5e66;        /* titanium where the light falls */
  --etch: #b7bcc4;            /* the engraved words: the bare metal under the coating */
  --etch-soft: #969ba4;       /* the small engraved words */
  --accent: #c8f53c;          /* the one accent: cold lime */
  --code: #eef1f4;            /* the digits of the entry code */
  --muted: #8b9098;           /* the line under the pass */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

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

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

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

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

/* the wrap is GSAP's (entrance) and the measure of everything inside: 1cqw is a hundredth of the pass */
.wrap {
  position: relative;
  width: min(640px, 86vw, 58vh * 1.586);
  container-type: inline-size;
  opacity: 0;
}

/* ---------------------------------------------------------------- the shadows on the floor, moved by script.js */
.floor {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  aspect-ratio: 1.586;
  pointer-events: none;
}

.floor i {
  position: absolute;
  border-radius: 7cqw;
}

/* a wide soft shadow far below and a tight one close to the pass: together they read as height */
.floor__soft {
  inset: 14% 6% -6%;
  background: rgba(16, 20, 28, 0.34);
  filter: blur(5.5cqw);
}

.floor__tight {
  inset: 10% 3% 1%;
  background: rgba(16, 20, 28, 0.42);
  filter: blur(1.6cqw);
}

/* ---------------------------------------------------------------- the pass */
.tilt {
  position: relative;
  width: 100%;
  aspect-ratio: 1.586;
  transform-style: preserve-3d;
  touch-action: none;
  --lx: 30%;
  --ly: 30%;
  --la: 135deg;
  --li: 0.6;
  --lxb: 70%;
}

.flip {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.face {
  position: absolute;
  inset: 0;
  border-radius: 4.6cqw;
  overflow: hidden;
  isolation: isolate;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow:
    0 0.2cqw 0.4cqw rgba(0, 0, 0, 0.22),
    0 1.2cqw 2.4cqw -0.6cqw rgba(10, 14, 22, 0.28);
}

.face--back {
  transform: rotateY(180deg);
}

.face > i,
.face > svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* the metal: a broad soft reflection that slides a little with the light, on graphite titanium */
.metal {
  background:
    linear-gradient(162deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 38%, rgba(0, 0, 0, 0.24)),
    linear-gradient(100deg, var(--ti-dark) 0%, var(--ti) 22%, var(--ti-light) 36%, var(--ti) 50%, var(--ti-dark) 70%, var(--ti) 86%, var(--ti-dark) 100%);
  background-size: 100% 100%, 260% 100%;
  background-position: 0 0, calc(100% - var(--lx)) 0;
}

.metal--back {
  background-position: 0 0, calc(100% - var(--lxb)) 0;
  filter: brightness(0.9);
}

/* the brushing: noise stretched left to right until it becomes hairlines */
.brush {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='300'%3E%3Cfilter id='b' x='0' y='0'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0035 0.95' numOctaves='3' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 1.6 0 0 0 -0.55'/%3E%3C/filter%3E%3Crect width='600' height='300' filter='url(%23b)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 600px 300px, 300px 300px;
  mix-blend-mode: overlay;
  opacity: 0.9;
}

/* the fine lines of the guilloche, drawn by script.js: barely there until the light passes */
.guilloche {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: rgba(255, 255, 255, 0.5);
  stroke-width: 0.5;
  vector-effect: non-scaling-stroke;
  mix-blend-mode: soft-light;
  opacity: calc(0.25 + var(--li) * 0.45);
  -webkit-mask: radial-gradient(60% 120% at var(--lx) var(--ly), #000, rgba(0, 0, 0, 0.25) 70%);
  mask: radial-gradient(60% 120% at var(--lx) var(--ly), #000, rgba(0, 0, 0, 0.25) 70%);
}

/* the anisotropic streak: across the brushing the light stretches into a tall band, with a faint warm and cold fringe */
.aniso {
  background: linear-gradient(90deg,
    transparent calc(var(--lx) - 30%),
    rgba(255, 196, 150, 0.05) calc(var(--lx) - 13%),
    rgba(255, 255, 255, 0.52) calc(var(--lx) - 2%),
    rgba(255, 255, 255, 0.62) var(--lx),
    rgba(255, 255, 255, 0.5) calc(var(--lx) + 2%),
    rgba(150, 200, 255, 0.06) calc(var(--lx) + 13%),
    transparent calc(var(--lx) + 30%));
  mix-blend-mode: overlay;
  opacity: var(--li);
}

.face--back .aniso {
  background: linear-gradient(90deg,
    transparent calc(var(--lxb) - 30%),
    rgba(255, 196, 150, 0.05) calc(var(--lxb) - 13%),
    rgba(255, 255, 255, 0.5) calc(var(--lxb) - 2%),
    rgba(255, 255, 255, 0.58) var(--lxb),
    rgba(255, 255, 255, 0.48) calc(var(--lxb) + 2%),
    rgba(150, 200, 255, 0.06) calc(var(--lxb) + 13%),
    transparent calc(var(--lxb) + 30%));
}

/* the hot spot: where the lamp is, a tall soft glow on top of the streak */
.hot {
  background: radial-gradient(16% 62% at var(--lx) var(--ly), rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05) 55%, transparent 80%);
  mix-blend-mode: screen;
  opacity: var(--li);
}

.face--back .hot {
  background: radial-gradient(16% 62% at var(--lxb) var(--ly), rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04) 55%, transparent 80%);
}

/* the machined edge: dark all round, bright on the side the light comes from */
.bevel {
  border-radius: inherit;
  box-shadow:
    inset 0 0.25cqw 0 rgba(255, 255, 255, 0.07),
    inset 0 -0.3cqw 0.4cqw rgba(0, 0, 0, 0.45),
    inset 0 0 0 0.15cqw rgba(0, 0, 0, 0.55);
}

.bevel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--la), rgba(255, 255, 255, 0) 0deg, rgba(255, 255, 255, 0.9) 40deg, rgba(255, 255, 255, 0.15) 90deg, rgba(255, 255, 255, 0) 150deg, rgba(255, 255, 255, 0) 200deg, rgba(255, 255, 255, 0.3) 230deg, rgba(255, 255, 255, 0) 280deg);
  -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);
  opacity: calc(0.35 + var(--li) * 0.65);
}

/* ---------------------------------------------------------------- engraved words: the bare metal under the coating */
.etch {
  color: var(--etch);
  text-shadow: 0 -0.5px 0 rgba(0, 0, 0, 0.75), 0 0.6px 0 rgba(255, 255, 255, 0.12);
}

.front {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 6.4cqw 6.8cqw 6cqw;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.front__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 4cqw;
}

.brand {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 2.2cqw;
}

.brand__mark {
  width: 6.6cqw;
  height: 6.6cqw;
  fill: none;
  stroke: var(--etch);
  stroke-width: 1.3;
  stroke-linejoin: round;
  filter: drop-shadow(0 -0.5px 0 rgba(0, 0, 0, 0.7));
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 0.5cqw;
}

.brand__name {
  font-size: max(11px, 3.9cqw);
  line-height: 1;
  font-weight: 620;
  font-variation-settings: 'wdth' 125;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand__sub {
  font-size: max(7.5px, 2.15cqw);
  line-height: 1;
  font-weight: 480;
  font-variation-settings: 'wdth' 112;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--etch-soft);
}

/* the visits of the month: a small engraved ring that fills */
.visits {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 1cqw;
}

.ring {
  width: 12.6cqw;
  height: 12.6cqw;
  overflow: visible;
}

.ring circle {
  fill: none;
}

/* the groove cut into the metal, its lower lip catching light */
.ring__groove {
  stroke: rgba(0, 0, 0, 0.5);
  stroke-width: 4.2;
}

.ring__edge {
  stroke: rgba(255, 255, 255, 0.09);
  stroke-width: 0.6;
  transform: translateY(2.2px);
}

.ring__fill {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 1.2px color-mix(in srgb, var(--accent) 60%, transparent));
}

.visits__num {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 12.6cqw;
  display: grid;
  place-items: center;
}

.visits__num .etch {
  font-size: max(11px, 4.1cqw);
  font-weight: 640;
  font-variation-settings: 'wdth' 100;
  color: #e3e6ea;
  line-height: 1;
}

.visits__label {
  font-size: max(7px, 1.9cqw);
  font-weight: 520;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--etch-soft);
  white-space: nowrap;
}

.nfc {
  position: absolute;
  left: 6.4cqw;
  top: 43%;
  width: 5.4cqw;
  height: 5.4cqw;
  fill: none;
  stroke: var(--etch-soft);
  stroke-width: 1.6;
  stroke-linecap: round;
  filter: drop-shadow(0 -0.5px 0 rgba(0, 0, 0, 0.7));
}

.front__bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 3cqw;
}

.member {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.member__label {
  font-size: max(7px, 1.9cqw);
  font-weight: 520;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--etch-soft);
}

.member__name {
  margin-top: 1.1cqw;
  font-size: max(13px, 5.2cqw);
  line-height: 1;
  font-weight: 560;
  font-variation-settings: 'wdth' 118;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.member__since {
  margin-top: 1.4cqw;
  font-size: max(7.5px, 2.1cqw);
  font-weight: 460;
  letter-spacing: 0.08em;
  color: var(--etch-soft);
  white-space: nowrap;
}

.tier {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1.3cqw;
}

.tier__level {
  font-size: max(12px, 4.6cqw);
  line-height: 1;
  font-weight: 700;
  font-style: italic;
  font-variation-settings: 'wdth' 112;
  letter-spacing: 0.02em;
}

/* the badge is milled: a groove all round, a lip of light at the bottom */
.tier__badge {
  padding: 0.9cqw 1.8cqw;
  border-radius: 99px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0.6px 0 rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.14);
  font-size: max(6.5px, 1.75cqw);
  font-weight: 560;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* the whole front is one button: it turns the pass */
.hit {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  border-radius: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hit:focus-visible,
.turn:focus-visible,
.code:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- the back */
.stripe {
  inset: 22% 0 auto !important;
  height: 0.2cqw;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.55) 8%, rgba(0, 0, 0, 0.55) 92%, transparent);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.back {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 5.6cqw 6.8cqw 6cqw;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.back__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 7cqw;
}

.back__label {
  display: flex;
  align-items: center;
  gap: 1.8cqw;
  font-size: max(8px, 2.15cqw);
  font-weight: 560;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.back__label .brand__mark {
  width: 4.4cqw;
  height: 4.4cqw;
}

.turn {
  width: max(32px, 7.4cqw);
  height: max(32px, 7.4cqw);
  margin-right: -1.6cqw;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0.6px 0 rgba(255, 255, 255, 0.1);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.turn svg {
  width: 52%;
  height: 52%;
  fill: none;
  stroke: var(--etch);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) {
  .turn:hover svg {
    stroke: #e6e9ed;
  }
}

/* the code sits in a recessed plate, cut a little deeper than the face */
.code {
  position: relative;
  align-self: stretch;
  height: 19cqw;
  border: 0;
  margin: 0;
  padding: 0 3cqw;
  border-radius: 2.6cqw;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0.16));
  box-shadow:
    inset 0 0.5cqw 1.2cqw rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(0, 0, 0, 0.5),
    0 0.6px 0 rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.code__digits {
  display: flex;
  align-items: center;
  gap: 1.1cqw;
}

.dg {
  position: relative;
  width: 6.6cqw;
  height: 10cqw;
  display: grid;
  place-items: center;
}

.dg--gap {
  margin-left: 3cqw;
}

/* each hidden digit is an engraved block with fine hatching */
.dg__hatch {
  position: absolute;
  inset: 0.6cqw 0.2cqw;
  border-radius: 1cqw;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 3.5px),
    rgba(0, 0, 0, 0.24);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45), 0 0.6px 0 rgba(255, 255, 255, 0.1);
}

.dg__n {
  position: relative;
  font-size: max(20px, 8.4cqw);
  line-height: 1;
  font-weight: 600;
  font-variation-settings: 'wdth' 104;
  color: var(--code);
  text-shadow: 0 0 0.8cqw rgba(255, 255, 255, 0.18), 0 -0.5px 0 rgba(0, 0, 0, 0.6);
  opacity: 0;
}

.code__hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1.2cqw;
  font-size: max(7px, 1.8cqw);
  font-weight: 540;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--etch-soft);
  text-shadow: 0 -0.5px 0 rgba(0, 0, 0, 0.7);
}

.back__bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4cqw;
}

/* the barcode, engraved: each bar grows from the bottom when the code is shown */
.bars {
  width: 34cqw;
  height: 6.4cqw;
  flex: none;
}

.bars rect {
  fill: var(--etch);
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

.valid {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1.3cqw;
  min-width: 0;
}

.valid__track {
  position: relative;
  width: 22cqw;
  height: 2px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0.6px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.valid__line {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.valid__text {
  font-size: max(7px, 1.85cqw);
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--etch-soft);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- under the pass */
.note {
  margin: 7.4cqw 0 0;
  text-align: center;
  font-size: clamp(11px, 2.5cqw, 13.5px);
  font-weight: 470;
  font-variation-settings: 'wdth' 104;
  letter-spacing: 0.01em;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .floor__soft,
  .floor__tight {
    transition: none;
  }
}
