/* The Share room key button of a made-up hotel app, alone on white. The pill is one element moved by GSAP (width,
   lift, press); its body, the grain, the light and the two contents (the button and the sharing state) sit in a
   clipped layer inside it. The key card lives in a slot behind the pill whose bottom edge is the middle of the pill, so
   it comes out of the button; the copy lives over the pill and flies into the avatar. A GSAP element never has a
   transform in the CSS. */
:root {
  --page: #ffffff;            /* the page */
  --pill-top: #2a2b31;        /* the top of the pill's body */
  --pill-bottom: #121317;     /* the bottom of the pill's body */
  --ink: #f5f3ee;             /* the words on the pill */
  --muted: #9b998f;           /* the small words */
  --brass: #d8bd86;           /* the warm brass of the hotel: the edge of the key, the ring */
  --card-top: #23262f;        /* the key card, top */
  --card-bottom: #0f1116;     /* the key card, bottom */
  --guest: #e7c9b4;           /* the avatar of the guest */
  --ok: #5fcf95;              /* the check */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  background: var(--page);
  color: var(--ink);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.wrap {
  position: relative;
  width: min(360px, calc(100vw - 32px));
  height: min(230px, 62vh);
  display: grid;
  place-items: end center;
  padding-bottom: 26px;
}

/* ---- the key card ---- */
.slot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 56px;               /* the middle of the pill */
  height: 190px;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.card {
  position: absolute;
  left: 50%;
  bottom: 44px;               /* at rest the whole card stands above the pill, with a little air */
  width: 112px;
  height: 70px;
  margin-left: -56px;
  border-radius: 10px;
  background: linear-gradient(160deg, var(--card-top), var(--card-bottom));
  box-shadow:
    inset 0 0 0 1px rgba(216, 189, 134, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 1px 1px rgba(10, 12, 18, 0.18),
    0 8px 18px -8px rgba(10, 12, 18, 0.5),
    0 22px 34px -18px rgba(10, 12, 18, 0.4);
  overflow: hidden;
  visibility: hidden;
}
.card__holo {
  position: absolute;
  inset: -40% -60%;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 228, 180, 0.0) 42%, rgba(255, 226, 170, 0.22) 47%, rgba(190, 220, 255, 0.18) 51%, rgba(255, 255, 255, 0) 56%);
  transform: translateX(var(--holo, -30%));
  mix-blend-mode: screen;
  pointer-events: none;
}
.card__brand {
  position: absolute;
  left: 10px;
  top: 8px;
  font-size: 8.5px;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brass);
}
.card__nfc {
  position: absolute;
  right: 8px;
  top: 6px;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: rgba(245, 243, 238, 0.55);
  stroke-width: 1.6;
  stroke-linecap: round;
}
.card__room {
  position: absolute;
  left: 10px;
  bottom: 7px;
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.card__room i {
  font-style: normal;
  font-size: 7px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(245, 243, 238, 0.5);
  margin-bottom: 3px;
}
.card__room b {
  font-size: 19px;
  font-weight: 600;
  font-stretch: 90%;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.card__chip {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 17px;
  height: 13px;
  border-radius: 3px;
  background: linear-gradient(135deg, #f0dcae, #b89656 60%, #e2c88f);
  box-shadow: inset 0 0 0 0.5px rgba(80, 60, 20, 0.5);
}

.card--copy {
  bottom: auto;
  top: 0;
  left: 0;
  margin-left: 0;
  z-index: 3;
  background: none;
  box-shadow: none;
  overflow: visible;
  pointer-events: none;
}
.card__fill {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(160deg, var(--card-top), var(--card-bottom));
  box-shadow:
    inset 0 0 0 1px rgba(216, 189, 134, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 10px 22px -10px rgba(10, 12, 18, 0.55);
  opacity: 0;
}
.card__dash {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: #8f8a7c;
  stroke-width: 1.2;
  stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke;
}

/* ---- the pill ---- */
.pill {
  position: relative;
  z-index: 2;
  height: 60px;
  width: 232px;
  border-radius: 999px;
}
.pill__halo {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    0 1px 1px rgba(14, 15, 20, 0.16),
    0 6px 14px -6px rgba(14, 15, 20, 0.42),
    0 20px 34px -18px rgba(14, 15, 20, 0.5),
    0 26px 40px -26px rgba(216, 189, 134, 0.35);
  pointer-events: none;
}
.pill__clip {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background: linear-gradient(180deg, var(--pill-top), var(--pill-bottom));
}
.pill__grain {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  pointer-events: none;
}
.pill__sheen {
  position: absolute;
  inset: 0;
  background: radial-gradient(120px 60px at var(--mx, 50%) 0%, rgba(255, 240, 210, 0.16), transparent 70%);
  opacity: 0;
  pointer-events: none;
}
.pill__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.share {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  position: absolute;
  inset: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
}
.share:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }
.share__in {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.key {
  width: 25px;
  height: 22px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.key__chip { fill: var(--brass); stroke: none; }
.key__wave { stroke: var(--brass); }
.share__word {
  font-size: 15.5px;
  font-weight: 560;
  font-stretch: 104%;
  letter-spacing: -0.005em;
}
.share__room {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--brass);
  padding: 4px 7px 3px;
  border-radius: 6px;
  background: rgba(216, 189, 134, 0.12);
  box-shadow: inset 0 0 0 1px rgba(216, 189, 134, 0.3);
  font-variant-numeric: tabular-nums;
}

.state {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 320px;
  margin-left: -160px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px 0 12px;
  visibility: hidden;
}
.guest {
  position: relative;
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}
.guest__ring {
  position: absolute;
  inset: -2px;
  width: 44px;
  height: 44px;
  fill: none;
  stroke: var(--brass);
  stroke-width: 1.6;
  stroke-linecap: round;
  transform: rotate(-90deg);
}
.guest__face {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #3b2a20;
  background: radial-gradient(circle at 35% 30%, #f6e2d2, var(--guest) 70%);
  box-shadow: inset 0 -2px 4px rgba(120, 70, 40, 0.18);
}
.guest__badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 2px var(--pill-bottom);
  display: grid;
  place-items: center;
  opacity: 0;
}
.guest__badge svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: #0d2a1b;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.lines__a, .lines__b {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  padding: 1px 0;
}
.lines__a span, .lines__b span { display: inline-block; }
.lines__a { font-size: 14.5px; font-weight: 560; }
.lines__b { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #ffffff;
  stroke: #111216;
  stroke-width: 1.4;
  stroke-linejoin: round;
  pointer-events: none;
  z-index: 9;
  opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

@media (max-width: 420px) {
  .state { width: min(320px, calc(100vw - 32px)); margin-left: calc(min(320px, calc(100vw - 32px)) / -2); }
  .lines__a { font-size: 13.5px; }
}
