/* The Add to playlist button of a made-up music app, alone on black. Above it the song's row, with its cover in a
   soft socket; below it the pill, one element moved by GSAP (width, lift, press, gulp), with its body, grain, light
   and the two contents (closed: plus and Add to playlist; open: the stack of covers and the two rolling lines) in a
   clipped layer. The cover in flight is a copy living in the wrap, above everything. Every GSAP element has its
   look on a child: no transform in the CSS of what GSAP moves. */
:root {
  --page: #000000;            /* the page */
  --row: #0e0e11;             /* the song's row */
  --row-edge: rgba(255, 255, 255, 0.07); /* the 1px edge of the row */
  --pill-top: #2a2a30;        /* the top of the pill's body */
  --pill-bottom: #131316;     /* the bottom of the pill's body */
  --ink: #f5f3ef;             /* the words */
  --muted: #8e8c94;           /* the small words */
  --accent: #ffb04a;          /* the check, the count and the light */
  --cover: 48px;              /* the song's cover */
  --sc: 30px;                 /* a cover in the stack */
}

* { 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(330px, calc(100vw - 32px));
  height: min(232px, 64vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

/* ---- the abstract covers: gradients only, so a copy is just the same class ---- */
.art {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.art::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
/* a sun cut by the horizon over striped water */
.art--harbour {
  background:
    radial-gradient(circle at 50% 100%, #ffd58a 0 30%, #ff9c56 30.5% 36%, transparent 36.5%) top / 100% 60% no-repeat,
    repeating-linear-gradient(180deg, rgba(255, 176, 98, 0.55) 0 1px, transparent 1px 4px) bottom / 100% 40% no-repeat,
    linear-gradient(180deg, #1f1650 0%, #6e2b70 42%, #c24a6c 60%, #150c2c 60%, #0b0618 100%);
}
.art--tide {
  background:
    radial-gradient(circle at 32% 34%, #8af2d4 0 17%, transparent 18%),
    radial-gradient(circle at 68% 66%, #2b9c93 0 27%, transparent 28%),
    linear-gradient(135deg, #10404a, #05151a);
}
.art--ember {
  background:
    radial-gradient(circle at 70% 30%, #fff1d6 0 13%, transparent 14%),
    linear-gradient(135deg, #ff6a3d 0 49%, #2a0e0a 50%);
}
.art--bloom {
  background:
    radial-gradient(circle at 38% 52%, rgba(184, 156, 255, 0.95) 0 25%, transparent 26%),
    radial-gradient(circle at 63% 48%, rgba(255, 118, 196, 0.8) 0 25%, transparent 26%),
    linear-gradient(160deg, #241645, #0f0a22);
}

/* ---- the song's row ---- */
.track {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, #131317, var(--row));
  box-shadow: inset 0 0 0 1px var(--row-edge), inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 18px 40px -22px rgba(0, 0, 0, 0.9);
}
.socket {
  position: relative;
  flex: none;
  width: var(--cover);
  height: var(--cover);
  border-radius: 10px;
  perspective: 260px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  background: #070709;
}
.socket__ghost {
  opacity: 0.12;
  filter: saturate(0.4) blur(1px);
  transform: scale(0.82);
}
.cover {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.9), 0 1px 2px rgba(0, 0, 0, 0.6);
}
.cover__face { border-radius: 10px; }
.cover__sheen {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  background: radial-gradient(circle at var(--sx, 30%) var(--sy, 20%), rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 55%);
  mix-blend-mode: soft-light;
  opacity: 0;
}
.track__text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.track__text b {
  font-size: 15px;
  font-weight: 620;
  font-stretch: 104%;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track__text i {
  font-style: normal;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.track__wave {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: 0.7;
}

/* ---- the pill ---- */
.pill {
  position: relative;
  height: 60px;
  width: 196px;
  border-radius: 999px;
  box-shadow: 0 18px 34px -16px rgba(0, 0, 0, 0.95), 0 2px 6px rgba(0, 0, 0, 0.7);
}
.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.08;
  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='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
  pointer-events: none;
}
.pill__light {
  position: absolute;
  top: -40px;
  bottom: -40px;
  left: 0;
  width: 120px;
  background: radial-gradient(closest-side, rgba(255, 176, 74, 0.26), rgba(255, 176, 74, 0));
  pointer-events: none;
  opacity: 0;
}
.pill__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 -1px 0 rgba(0, 0, 0, 0.5);
}

.add {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: inherit;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  outline: none;
}
.pill:has(.add:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }

.closed, .open {
  position: absolute;
  top: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.closed {
  left: 0;
  padding: 0 24px 0 20px;
  gap: 10px;
}
.plus {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.9;
  stroke-linecap: round;
}
.closed__word {
  font-size: 15.5px;
  font-weight: 600;
  font-stretch: 106%;
  letter-spacing: -0.005em;
}

.open {
  left: 0;
  text-align: left;
  padding: 0 24px 0 14px;
  gap: 13px;
  visibility: hidden;
}
.stack {
  position: relative;
  flex: none;
  width: 48px;
  height: 42px;
}
.sc {
  position: absolute;
  width: var(--sc);
  height: var(--sc);
  border-radius: 6px;
  box-shadow: 0 4px 8px -3px rgba(0, 0, 0, 0.85), 0 0 0 0.5px rgba(0, 0, 0, 0.6);
}
.sc .art { border-radius: 6px; }
.sc--1 { left: 0; top: 9px; }
.sc--2 { left: 5px; top: 6px; }
.sc--3 { left: 10px; top: 3px; }
.sc--top { left: 16px; top: 1px; opacity: 0; }

.lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.line1 {
  display: inline-flex;
  align-items: center;
  gap: 0;
  font-size: 15px;
  font-weight: 620;
  font-stretch: 104%;
  letter-spacing: -0.01em;
}
.check {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-right: 5px;
}
.roll {
  display: grid;
  overflow: hidden;
  line-height: 20px;
  height: 20px;
}
.roll__item { grid-area: 1 / 1; }
.line2 {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  line-height: 16px;
}
.unit { margin-left: 0.28em; }
.num {
  display: inline-flex;
  color: var(--accent);
}
.digit {
  display: inline-grid;
  overflow: hidden;
  height: 16px;
}
.digit > span { grid-area: 1 / 1; }

/* ---- the cover in flight ---- */
.flyer {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cover);
  height: var(--cover);
  border-radius: 10px;
  pointer-events: none;
  visibility: hidden;
  z-index: 3;
  box-shadow: 0 14px 22px -10px rgba(0, 0, 0, 0.9);
}
.flyer__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0) 45%);
  mix-blend-mode: soft-light;
}

/* ---- the drawn pointer of the autopilot ---- */
.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  fill: #ffffff;
  stroke: #111114;
  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: 5;
}

@media (hover: hover) {
  .add:hover .plus { stroke: var(--accent); }
}
