/* The Copy email button with the address that peels off and folds into the envelope */
:root {
  --fondo: #ffffff;
  --pillola: #18181c;          /* the dark body of the pill */
  --pillola-alta: #2a2a31;     /* its lighter top */
  --scritta: #f4f2ee;          /* the label */
  --tenue: #9a9aa3;            /* the address under the label */
  --busta: #e9e5dc;            /* the lines of the envelope */
  --pozzetto: #232329;         /* the round well around the envelope */
  --carta: #fffdf8;            /* the paper slip */
  --carta-bordo: #ece6da;
  --inchiostro: #1c1c21;       /* the address printed on the slip */
  --accento: #ff7a4d;          /* the warm accent: selection, seal, tick */
}

* { box-sizing: border-box; margin: 0; }
html { font-size: clamp(13px, min(1.2vw, 2.35vh), 17px); }
html, body { height: 100%; }
body {
  background: var(--fondo);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; }

.stage {
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.wrap {
  position: relative;
  padding: 3.4rem 1.4rem;
  display: grid;
  place-items: center;
}

/* ---- the pill: GSAP moves it, the skin carries the material ---- */
.pill {
  position: relative;
  width: min(18.6rem, 86vw);
  height: 3.6rem;
}
.skin {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--pillola-alta), var(--pillola) 62%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 1px 1px rgba(16, 16, 22, 0.22),
    0 6px 14px -6px rgba(16, 16, 22, 0.42),
    0 20px 34px -18px rgba(16, 16, 22, 0.5);
  transition: box-shadow 0.25s ease;
}
.skin__light {
  position: absolute;
  inset: -40%;
  opacity: 0;
  background: radial-gradient(circle at var(--lx, 50%) var(--ly, 50%), rgba(255, 196, 170, 0.16), transparent 38%);
}
.skin__sweep {
  position: absolute;
  top: 0; bottom: 0;
  left: -40%;
  width: 40%;
  opacity: 0;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.12) 45%, rgba(255, 190, 160, 0.16) 55%, transparent);
}
.pill:has(.btn:focus-visible) .skin {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    0 0 0 3px #ffffff,
    0 0 0 5px var(--accento),
    0 20px 34px -18px rgba(16, 16, 22, 0.5);
}

.btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.15rem 0 0.55rem;
  border: 0;
  border-radius: 999px;
  background: none;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  text-align: left;
}

/* ---- the envelope in its round well (no transform on the well: the slip slides between back and front) ---- */
.well {
  position: relative;
  flex: none;
  width: 2.55rem;
  height: 2.55rem;
}
.well__disc {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #31313a, var(--pozzetto) 70%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 -2px 4px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.04);
}
.env, .seal {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.env--back { z-index: 1; }
.env--front { z-index: 3; }
.seal { z-index: 4; }
.env path {
  fill: none;
  stroke: var(--busta);
  stroke-width: 1.35;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.env__body { fill: var(--pozzetto) !important; }
.env__pocket { fill: var(--pozzetto) !important; stroke: none !important; }
.env__flap--down { fill: var(--pozzetto) !important; }
.env__flap--up { fill: #2b2b33 !important; }
.env__seam { stroke-opacity: 0.55; }
.seal rect { fill: var(--accento); }
.seal path { fill: none; stroke: #2a130a; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- the label and the address, each in a one-line window ---- */
.txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}
.txt__win {
  position: relative;
  display: block;
  height: 1.25em;
  overflow: hidden;
  font-size: 0.98rem;
  font-weight: 620;
  font-stretch: 104%;
  letter-spacing: -0.005em;
  color: var(--scritta);
}
.txt__win--sub {
  font-family: 'Geist Mono Variable', 'Geist Mono', ui-monospace, monospace;
  font-size: 0.74rem;
  font-weight: 450;
  font-stretch: 100%;
  letter-spacing: 0;
  color: var(--tenue);
  overflow: visible;
  height: 1.3em;
  clip-path: inset(0 -0.3em 0 -0.3em);
}
.txt__now, .txt__next {
  position: absolute;
  left: 0; top: 0;
  white-space: nowrap;
}
.txt__sel {
  position: absolute;
  left: -0.22em; top: 0.02em;
  height: 1.26em;
  border-radius: 0.3em;
  background: color-mix(in srgb, var(--accento) 30%, transparent);
  transform-origin: 0 50%;
  transform: scaleX(0);
  width: 0;
}

/* ---- the copy icon that becomes the tick ---- */
.copyicon {
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
}
.copyicon svg { width: 100%; height: 100%; overflow: visible; }
.copyicon rect { fill: none; stroke: var(--tenue); stroke-width: 1.4; }
.copyicon__front { fill: var(--pillola) !important; stroke: var(--scritta) !important; }
.copyicon__tick { fill: none; stroke: var(--accento); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- the paper slip ---- */
.slip {
  position: absolute;
  left: 0; top: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.6rem 0.32rem 0.34rem;
  border-radius: 0.55rem;
  background: linear-gradient(180deg, #ffffff, var(--carta));
  box-shadow:
    inset 0 0 0 1px var(--carta-bordo),
    inset 0 1px 0 #ffffff,
    0 1px 2px rgba(16, 16, 22, 0.12),
    0 8px 18px -8px rgba(16, 16, 22, 0.35);
  white-space: nowrap;
  visibility: hidden;
  pointer-events: none;
  will-change: transform;
}
.slip__mark {
  display: grid;
  place-items: center;
  width: 1.15rem; height: 1.15rem;
  border-radius: 0.36rem;
  background: var(--accento);
  color: #2a130a;
  font-size: 0.7rem;
  font-weight: 700;
}
.slip__text {
  display: inline-block;
  overflow: hidden;
  max-width: 20em;
  margin-left: 0.4rem;
  font-family: 'Geist Mono Variable', 'Geist Mono', ui-monospace, monospace;
  font-size: 0.74rem;
  color: var(--inchiostro);
}

/* the pilot's pointer */
.pointer {
  position: absolute;
  left: 0; top: 0;
  z-index: 10;
  width: 22px; height: 22px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}
.pointer svg { width: 100%; height: 100%; }
.pointer path { fill: #ffffff; stroke: #18181c; stroke-width: 1.3; stroke-linejoin: round; }

.sr {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
