/* The Share button of a document in a made-up docs app, alone on black. The pill is one element moved by GSAP (width,
   lift, beat); its body, the grain, the pass of light and the two contents (the Share button and the open panel) sit
   in a clipped layer inside it, so the panel shows from the middle while the pill widens. A GSAP element never has a
   transform in the CSS. */
:root {
  --page: #000000;            /* the page */
  --pill-top: #26262c;        /* the top of the pill's body */
  --pill-bottom: #121215;     /* the bottom of the pill's body */
  --ink: #f3f3f5;             /* the words */
  --muted: #8d8d98;           /* the small words and the host of the link */
  --accent: #86adff;          /* the globe, the light, Copied */
  --button: #f3f3f5;          /* the Copy button */
  --button-ink: #0b0b0d;      /* the words on the Copy button */
}

* { 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;
}

/* the wrap is as wide as the open pill, so the frame of the preview holds the whole gesture */
.wrap {
  position: relative;
  width: min(392px, calc(100vw - 32px));
  height: 92px;
  display: grid;
  place-items: center;
}

.pill {
  position: relative;
  height: 60px;
  width: 132px;
  border-radius: 30px;
  --mx: 50%;
  --ow: 360px;
}

/* the soft light the pill throws on the floor */
.pill__floor {
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: -16px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(134, 173, 255, 0.22), transparent);
  filter: blur(6px);
  pointer-events: none;
}

/* the halo of the beat: it swells once when the link is copied */
.pill__halo {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow: 0 0 0 1px rgba(134, 173, 255, 0.55), 0 0 26px 2px rgba(134, 173, 255, 0.35);
  opacity: 0;
  pointer-events: none;
}

.pill__clip {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background: linear-gradient(180deg, var(--pill-top), var(--pill-bottom));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.07),
    0 2px 4px rgba(0, 0, 0, 0.5),
    0 14px 34px -12px rgba(0, 0, 0, 0.9),
    0 26px 60px -26px rgba(134, 173, 255, 0.28);
  isolation: isolate;
}

/* a fine grain, so the body reads as a material and not a flat fill */
.pill__grain {
  position: absolute;
  inset: 0;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
  pointer-events: none;
}

/* the pass of light across the whole pill when the link is copied */
.pill__sheen {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 140px;
  background: linear-gradient(100deg, rgba(190, 210, 255, 0) 10%, rgba(190, 210, 255, 0.07) 38%, rgba(255, 255, 255, 0.16) 50%, rgba(190, 210, 255, 0.07) 62%, rgba(190, 210, 255, 0) 90%);
  filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

/* the 1px edge that catches the light where the pointer is */
.pill__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(150px 70px at var(--mx) 0%, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.08) 60%, rgba(255, 255, 255, 0.03));
  -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, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0.4;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.pill.is-hot .pill__edge { opacity: 1; }

/* ---- the closed button ---- */
.share {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: inherit;
  background: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  outline: none;
}
.share:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.pill.is-open .share { pointer-events: none; }
.share__in {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}
.share__ic {
  width: 19px;
  height: 19px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.share__word {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-stretch: 100%;
  transition: font-stretch 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@media (hover: hover) {
  .pill.is-hot .share__word { font-stretch: 112%; }
}

/* ---- the open panel ---- */
.panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: var(--ow);
  margin-left: calc(var(--ow) / -2);
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px;
  visibility: hidden;
}
.pill.is-open .panel { visibility: visible; }

.acc {
  flex: none;
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(134, 173, 255, 0.13);
  box-shadow: inset 0 0 0 1px rgba(134, 173, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--accent);
  cursor: pointer;
  outline: none;
  display: grid;
  place-items: center;
}
.acc:focus-visible { box-shadow: inset 0 0 0 1px rgba(134, 173, 255, 0.22), 0 0 0 2px var(--accent); }
.acc__ic {
  width: 22px;
  height: 22px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.globe__lat { opacity: 0.55; }
.lock { opacity: 0; }

.link {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.link__url {
  position: relative;
  display: block;
  font-size: 14.5px;
  font-weight: 580;
  letter-spacing: -0.005em;
  line-height: 18px;
  white-space: nowrap;
}
.link__text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link__host { color: var(--muted); font-weight: 500; }
.link__slug { color: var(--ink); }
/* the same words again, painted only by a moving band of light */
.link__glint {
  position: absolute;
  inset: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: transparent;
  --gx: -40%;
  background: linear-gradient(100deg, transparent calc(var(--gx) - 22%), rgba(134, 173, 255, 0.9) calc(var(--gx) - 6%), #ffffff var(--gx), rgba(134, 173, 255, 0.9) calc(var(--gx) + 6%), transparent calc(var(--gx) + 22%));
  -webkit-background-clip: text;
  background-clip: text;
  pointer-events: none;
}
.link__who {
  display: block;
  height: 15px;
  overflow: hidden;
  font-size: 12px;
  line-height: 15px;
  color: var(--muted);
  font-stretch: 96%;
}
.link__whoin { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.copy {
  flex: none;
  position: relative;
  height: 44px;
  min-width: 96px;
  padding: 0 16px 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 22px;
  background: var(--button);
  color: var(--button-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 4px 12px -4px rgba(0, 0, 0, 0.6);
  font: inherit;
  cursor: pointer;
  outline: none;
}
.copy:focus-visible { box-shadow: 0 0 0 2px var(--page), 0 0 0 4px var(--accent); }
.copy__ic {
  position: relative;
  width: 17px;
  height: 17px;
}
.copy__ic svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.copy__words {
  display: block;
  height: 18px;
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 620;
  letter-spacing: -0.01em;
  line-height: 18px;
}
.copy__col { display: flex; flex-direction: column; }
.copy__col span { display: block; height: 18px; }

/* ---- the drawn pointer of the autopilot ---- */
.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  fill: #ffffff;
  stroke: #0b0b0d;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
  opacity: 0;
  visibility: hidden;
  z-index: 10;
}

@media (max-width: 380px) {
  .panel { gap: 9px; padding: 0 7px; }
  .acc { width: 42px; height: 42px; }
  .copy { min-width: 88px; padding: 0 13px 0 11px; }
  .link__url { font-size: 13.5px; }
}
