/* The Add to bag button with the perfume bottle that flies into it: a small product card of an invented perfumery
   on white, with a real photo. The button is two layers: .cta__body is moved by GSAP (hover lift, press, the spring
   swell), its child .cta__skin takes colours and light from CSS. The flying picture lives outside the card, in the
   stage, so it can cross the card's edge. */
:root {
  --page: #ffffff;           /* the page */
  --card: #ffffff;           /* the card */
  --ink: #131614;            /* the words and the button */
  --ink-2: #26302b;          /* the top of the button's glass */
  --muted: #6f746f;          /* the small words */
  --line: rgba(19, 22, 20, 0.09); /* the hairline borders */
  --photo: #e9efe9;          /* behind the photo while it loads */
  --accent: #3f9b78;         /* the one accent, the green of the glass: the count, the check, the glow */
  --accent-rgb: 63, 155, 120; /* the same accent, for glows and shadows (the script keeps it in step) */
  --pointer: #131614;        /* the drawn pointer of the autopilot */
}

* {
  box-sizing: border-box;
  margin: 0;
}

html,
body {
  height: 100%;
}

html {
  touch-action: manipulation;
}

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

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 2.4vh, 16px);
  overflow: hidden;
}

/* ---------- the card ---------- */
.card {
  position: relative;
  width: min(372px, 92vw);
  padding: clamp(8px, 1.6vh, 10px) clamp(8px, 1.6vh, 10px) clamp(8px, 1.6vh, 10px);
  border-radius: 24px;
  background: var(--card);
  box-shadow:
    0 0 0 1px var(--line),
    0 1px 1px rgba(19, 22, 20, 0.03),
    0 3px 6px -2px rgba(19, 22, 20, 0.05),
    0 14px 28px -12px rgba(19, 22, 20, 0.1),
    0 36px 64px -30px rgba(19, 22, 20, 0.18);
  opacity: 0;
}

.card__pic {
  position: relative;
  height: clamp(92px, 31vh, 232px);
  border-radius: 16px;
  overflow: hidden;
  background: var(--photo);
  isolation: isolate;
}

/* GSAP moves .card__photo (the little kick when the bottle leaves), the img keeps its CSS */
.card__photo {
  position: absolute;
  inset: 0;
  display: block;
}

.card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 74% 46%;
  filter: saturate(1.04) contrast(1.03);
}

/* a soft light on the glass of the photo, a hairline edge, and the glint that sweeps across when the bottle leaves */
.card__pic::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(19, 22, 20, 0.06), inset 0 -40px 50px -40px rgba(10, 20, 14, 0.35);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 38%);
  pointer-events: none;
}

.card__glint {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 38%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.34) 48%, rgba(255, 255, 255, 0.06) 56%, rgba(255, 255, 255, 0) 100%);
  transform: translateX(-120%) skewX(-14deg);
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.card__chip {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 4px 9px 4px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 560;
  font-stretch: 110%;
  letter-spacing: 0.01em;
  color: #fff;
  background: rgba(16, 22, 18, 0.26);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  backdrop-filter: blur(10px) saturate(1.4);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.card__info {
  padding: clamp(8px, 1.8vh, 13px) 6px clamp(8px, 1.8vh, 12px);
}

.card__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.card__house {
  font-size: 10.5px;
  font-weight: 620;
  font-stretch: 125%;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.card__price {
  font-size: 15px;
  font-weight: 600;
  font-stretch: 100%;
  letter-spacing: -0.01em;
}

.card__name {
  margin-top: 3px;
  font-size: 17px;
  font-weight: 600;
  font-stretch: 92%;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.card__kind {
  font-weight: 440;
  color: var(--muted);
  font-stretch: 100%;
  letter-spacing: 0;
  font-size: 14px;
  margin-left: 4px;
}

.card__notes {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 430;
}

/* ---------- the button ---------- */
.cta {
  position: relative;
}

.cta__btn {
  display: block;
  width: 100%;
  height: clamp(50px, 12vh, 60px);
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 999px;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.cta__body {
  position: relative;
  display: block;
  height: 100%;
  border-radius: 999px;
}

.cta__skin {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  isolation: isolate;
  color: #f4f7f4;
  background:
    radial-gradient(120% 140% at 50% -40%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, var(--ink-2) 0%, var(--ink) 62%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 -2px 6px rgba(0, 0, 0, 0.35),
    0 1px 2px rgba(19, 22, 20, 0.2),
    0 8px 18px -8px rgba(19, 22, 20, 0.45),
    0 20px 34px -22px rgba(var(--accent-rgb), 0.55);
  transition: box-shadow 0.4s ease;
}

/* a fine grain on the glass */
.cta__skin::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.16;
  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'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.55 0'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* the green glow that rises from the bag when the bottle lands */
.cta__skin::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -30px;
  bottom: -30px;
  width: 60%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(var(--accent-rgb), 0.55), rgba(var(--accent-rgb), 0));
  opacity: var(--glow, 0);
  pointer-events: none;
}

/* the reflection that runs across the glass */
.cta__sheen {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 46%;
  background: linear-gradient(105deg, rgba(255, 255, 255, 0) 10%, rgba(255, 255, 255, 0.16) 46%, rgba(255, 255, 255, 0.32) 50%, rgba(255, 255, 255, 0.08) 55%, rgba(255, 255, 255, 0) 90%);
  transform: translateX(-130%);
  pointer-events: none;
}

.cta__words {
  position: relative;
  flex: 1;
  height: 100%;
  overflow: hidden;
  margin-left: 52px; /* the same as the well on the right, so the words sit in the middle of the button */
}

.cta__word {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 15.5px;
  font-weight: 580;
  font-stretch: 104%;
  letter-spacing: 0.005em;
  white-space: nowrap;
}

.cta__word--done {
  color: #e9f6ef;
  opacity: 0;
}

.cta__check {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(var(--accent-rgb), 0.6));
}

.cta__check path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

/* the round well on the right with the bag and its count */
.cta__well {
  position: relative;
  flex: none;
  width: clamp(40px, 9.4vh, 46px);
  height: clamp(40px, 9.4vh, 46px);
  margin-right: 7px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(100% 100% at 50% 20%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 2px 6px rgba(0, 0, 0, 0.3);
}

.cta__bag {
  width: 22px;
  height: 22px;
  overflow: visible;
  fill: none;
  stroke: #f4f7f4;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cta__bag-body {
  fill: rgba(255, 255, 255, 0.06);
}

.cta__count {
  position: absolute;
  right: -3px;
  top: -2px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--ink), 0 2px 8px rgba(var(--accent-rgb), 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 11px;
  font-weight: 680;
  font-stretch: 100%;
  line-height: 18px;
  text-align: center;
}

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

.cta__digits span {
  display: block;
  height: 18px;
}

/* the focus ring for the keyboard */
.cta__btn:focus-visible .cta__skin {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 0 0 3px var(--page),
    0 0 0 5px rgba(var(--accent-rgb), 0.85),
    0 8px 18px -8px rgba(19, 22, 20, 0.45);
}

@media (hover: hover) {
  .cta__btn:hover .cta__skin,
  .cta.is-hover .cta__skin {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.22),
      inset 0 0 0 1px rgba(255, 255, 255, 0.08),
      inset 0 -2px 6px rgba(0, 0, 0, 0.35),
      0 1px 2px rgba(19, 22, 20, 0.2),
      0 12px 24px -10px rgba(19, 22, 20, 0.5),
      0 24px 40px -22px rgba(var(--accent-rgb), 0.7);
  }
}

/* ---------- the flying picture ---------- */
.fly {
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  border-radius: 12px;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 6px 14px -4px rgba(19, 22, 20, 0.35), 0 18px 30px -14px rgba(19, 22, 20, 0.35);
  will-change: transform;
}

.fly__img {
  position: absolute;
  inset: 0;
  background: url("boccetta.webp") 74% 46% / cover no-repeat;
}

.fly__shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 45%);
}

/* ---------- the drawn pointer ---------- */
.pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  z-index: 6;
  fill: var(--pointer);
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  opacity: 0;
  pointer-events: none;
}

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

@media (max-height: 470px) {
  .card__notes {
    display: none;
  }
}
