/* The newsletter Subscribe button with the envelope that seals and flies off. One element per job: GSAP moves the
   pill's width, the envelope and the layers; the CSS draws the materials (graphite, a 1px edge that takes the light,
   cream paper with its folds, the accent stamp). */
:root {
  --fondo: #000000;
  --grafite-alta: #1b1b1f;
  --grafite-bassa: #0e0e11;
  --bordo: rgba(255, 255, 255, 0.09);
  --inchiostro: #f3efe8;
  --grigio: #8d8a85;
  --accento: #ff9b6a;
  --accento-inchiostro: #1a0f09;
  --carta-alta: #f7f1e6;
  --carta-bassa: #e4d8c5;
  --carta-lembo: #ece2d2;
  --carta-dentro: #b9ab94;
  --errore: #ff6b6b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.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 piece: the pill, the room above it where the envelope leaves, the line below */
.pezzo {
  position: relative;
  width: min(360px, 90vw);
  padding-top: clamp(64px, 17vh, 104px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.aria { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.scia { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.scia__via { fill: none; stroke: none; }
.scia__riga { fill: none; stroke-width: 1.4; stroke-linecap: round; opacity: 0; }
.scia__riga--fine { stroke: var(--inchiostro); stroke-width: 0.8; stroke-opacity: 0.35; }

/* the pill: graphite with a lit top edge, a soft accent glow under it and a fine grain */
.pill {
  position: relative;
  height: 60px;
  width: 176px;
  max-width: 100%;
  border-radius: 999px;
  background:
    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%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--grafite-alta), var(--grafite-bassa));
  box-shadow:
    inset 0 0 0 1px var(--bordo),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    0 1px 2px rgba(0, 0, 0, 0.6),
    0 18px 34px -18px rgba(0, 0, 0, 0.9);
  isolation: isolate;
  transition: box-shadow 0.35s ease;
}
.pill.is-focus {
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accento) 45%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    0 0 0 4px color-mix(in srgb, var(--accento) 12%, transparent),
    0 18px 34px -18px rgba(0, 0, 0, 0.9);
}
.pill.is-err {
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--errore) 70%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 4px color-mix(in srgb, var(--errore) 12%, transparent),
    0 18px 34px -18px rgba(0, 0, 0, 0.9);
}
.pill__glow {
  position: absolute;
  left: 12%; right: 12%;
  bottom: -14px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accento) 42%, transparent), transparent);
  filter: blur(10px);
  opacity: 0.22;
  z-index: -1;
  pointer-events: none;
}
.pill__shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}
.pill__shine::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 0;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.09), transparent);
  transform: translateX(var(--sx, -120%));
}

.pill__layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  white-space: nowrap;
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  border-radius: inherit;
  -webkit-tap-highlight-color: transparent;
}
.pill__layer:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }
.pill__rest {
  cursor: pointer;
  padding: 0 26px 0 58px;
  font-size: 16px;
  font-weight: 600;
  font-variation-settings: 'wdth' 104;
  letter-spacing: -0.005em;
  touch-action: manipulation;
}
.pill__label { display: inline-block; }

.pill__form { padding: 0 8px 0 58px; gap: 8px; }
.pill__field { position: relative; flex: 1 1 auto; min-width: 0; height: 100%; display: flex; align-items: center; }
.pill__field input {
  width: 100%;
  border: 0;
  background: none;
  color: var(--inchiostro);
  font: inherit;
  font-size: 15.5px;
  font-weight: 480;
  font-variation-settings: 'wdth' 100;
  caret-color: var(--accento);
  outline: none;
  transform-origin: 0 50%;
}
.pill__field input::placeholder { color: #5d5a56; }
.pill__send {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--accento-inchiostro);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accento) 80%, #ffffff), var(--accento));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 6px 14px -6px color-mix(in srgb, var(--accento) 70%, transparent);
  -webkit-tap-highlight-color: transparent;
}
.pill__send:focus-visible { outline: 2px solid var(--inchiostro); outline-offset: 2px; }
.pill__send svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.pill__done {
  justify-content: center;
  gap: 9px;
  padding: 0 26px;
  font-size: 16px;
  font-weight: 620;
  font-variation-settings: 'wdth' 104;
  cursor: pointer;
}
.pill__tick { width: 18px; height: 18px; fill: none; stroke: var(--accento); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.pill__tick path { stroke-dasharray: 1; stroke-dashoffset: 1; }

/* the envelope: cream paper, its inside darker, two folds, the flap that opens and shuts, the stamp */
.busta {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 46px;
  overflow: visible;
  pointer-events: none;
  z-index: 4;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.55));
}
.busta__dentro { fill: var(--carta-dentro); }
.busta__lembo-dietro { fill: #a89a82; stroke: rgba(0, 0, 0, 0.12); stroke-width: 0.4; stroke-linejoin: round; visibility: hidden; }
.busta__lettera rect { fill: #fffcf6; stroke: rgba(0, 0, 0, 0.1); stroke-width: 0.4; }
.busta__lettera path { fill: none; stroke: #c8bdad; stroke-width: 1.1; stroke-linecap: round; }
.busta__tasca { stroke: rgba(255, 255, 255, 0.6); stroke-width: 0.4; }
.busta__piega { fill: none; stroke: rgba(80, 60, 30, 0.16); stroke-width: 0.6; stroke-linecap: round; }
.busta__lembo { stroke: rgba(80, 60, 30, 0.18); stroke-width: 0.5; stroke-linejoin: round; }
.busta__bollo rect { fill: var(--accento); stroke: rgba(255, 255, 255, 0.55); stroke-width: 0.6; stroke-dasharray: 0.9 0.6; }
.busta__bollo path { fill: none; stroke: var(--accento-inchiostro); stroke-width: 0.7; stroke-linecap: round; stroke-linejoin: round; opacity: 0.55; }

/* the line under the pill */
.nota {
  position: relative;
  height: 18px;
  width: 100%;
  font-size: 13px;
  line-height: 18px;
  color: var(--grigio);
  font-variation-settings: 'wdth' 96;
  text-align: center;
}
.nota__riga { position: absolute; left: 0; right: 0; top: 0; white-space: nowrap; }
.nota__riga--err { color: var(--errore); opacity: 0; }
.nota__riga--yay { opacity: 0; }
.nota__riga--yay .num { color: var(--inchiostro); }
.num { display: inline-flex; font-variant-numeric: tabular-nums; }
.digit { display: inline-block; height: 18px; overflow: hidden; vertical-align: top; }
.digit__col { display: flex; flex-direction: column; }
.digit__col span { height: 18px; line-height: 18px; }

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -4px;
  fill: #f3efe8;
  stroke: #000;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
  pointer-events: none;
  opacity: 0;
  z-index: 10;
}

@media (hover: hover) {
  .pill__rest:hover { color: #ffffff; }
  .pill__send:hover { filter: brightness(1.06); }
}
@media (max-width: 360px) {
  .pill__field input { font-size: 14.5px; }
}
