/* The giveaway entry button of Kiln Roasters, a made-up coffee roaster: one small card alone on white, a single tomato accent. */
:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --bordo: #ebeae6;
  --tinta: #f5f3ef;          /* the thumbnail */
  --testo: #17140f;
  --testo-2: #5f5b53;
  --testo-3: #9e998e;
  --accento: #e2552d;        /* the single accent: the pill, the ticket, the entry number */
  --accento-scuro: #b93d1b;
  --biglietto: #fff3ec;      /* the ticket paper, a pale wash of the accent */
  --fessura: #2a241d;        /* the slot the ticket prints out of */
  --kraft: #d9c3a2;          /* the coffee bag in the thumbnail, a neutral */
  --ombra: 30, 24, 18;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { font-size: clamp(9px, min(4.2vw, 3.2vh), 19px); }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.stage { height: 100vh; display: grid; place-items: center; padding: 2vh 4vw; }

/* the card */
.card {
  position: relative;
  width: min(18.5em, 92vw);
  padding: 1.15em 1.15em 1em;
  border-radius: 1.4em;
  background: var(--carta);
  box-shadow:
    0 1px 1px rgba(var(--ombra), .05),
    0 6px 14px -6px rgba(var(--ombra), .10),
    0 26px 50px -26px rgba(var(--ombra), .26);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .9em;
  isolation: isolate;
}
.card__edge {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 3;
  padding: 1px;
  background: linear-gradient(180deg, #f1f0ec, var(--bordo) 30%, #e2e0da);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* the prize */
.prize { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .8em; align-items: center; }
.thumb {
  width: 3.4em; height: 3.4em; border-radius: .95em; display: grid; place-items: center;
  background: var(--tinta);
  box-shadow: inset 0 0 0 1px rgba(var(--ombra), .04);
}
.thumb svg { width: 2.7em; height: 2.7em; display: block; overflow: visible; }
.bag { fill: var(--kraft); stroke: #a98d66; stroke-width: .8; stroke-linejoin: round; }
.bag__fold { fill: none; stroke: #a98d66; stroke-width: .8; }
.bag__crimp { fill: none; stroke: #b9a07c; stroke-width: .8; stroke-dasharray: .7 1.1; stroke-linecap: round; }
.bag__label { fill: #fbf7f0; stroke: #c4ab86; stroke-width: .6; }
.bean { fill: none; stroke: var(--accento); stroke-width: 1; stroke-linecap: round; }
.prize__txt { display: grid; gap: .12em; min-width: 0; }
.brand { font-size: .68em; color: var(--testo-3); font-weight: 600; letter-spacing: .02em; }
.name { font-size: 1.06em; font-weight: 650; letter-spacing: -.015em; line-height: 1.15; }
.meta { font-size: .72em; color: var(--testo-2); }

/* entries and time left */
.facts {
  display: flex; justify-content: space-between; align-items: center; gap: .5em;
  padding: .6em .85em; border-radius: .9em; border: 1px solid var(--bordo);
  font-size: .78em; color: var(--testo-2);
}
.fact { display: inline-flex; align-items: center; gap: .35em; white-space: nowrap; }
.fact .roll { font-weight: 650; color: var(--testo); }
.fact--end b { font-weight: 650; color: var(--testo); font-variant-numeric: tabular-nums; }

/* the rolling digits: each digit is a window over a column 0-9 */
.roll { display: inline-flex; font-variant-numeric: tabular-nums; white-space: nowrap; }
.roll .ch { display: inline-block; position: relative; height: 1.2em; line-height: 1.2em; overflow: hidden; vertical-align: bottom;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent); }
.roll .col { display: block; will-change: transform; }
.roll .col span { display: block; height: 1.2em; text-align: center; }
.roll .fix { display: inline-block; height: 1.2em; line-height: 1.2em; vertical-align: bottom; }

/* the well: a slot like a ticket printer's, the ticket comes out of it downwards */
.well { position: relative; height: .55em; margin: -.25em 0 -.1em; overflow: hidden; }
.slot {
  position: absolute; left: 12%; right: 12%; top: 0; height: .26em; border-radius: 99em; z-index: 2;
  background: var(--fessura);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9), inset 0 1px 1.5px rgba(0, 0, 0, .55);
}
.ticket {
  position: absolute; left: 15%; right: 15%; top: .16em; height: 4.4em; z-index: 1;
  display: grid; grid-template-columns: 2.3em minmax(0, 1fr);
  background: var(--biglietto);
  color: var(--accento-scuro);
  border-radius: .35em .35em 0 0;
  box-shadow: inset 0 0 0 1px rgba(226, 85, 45, .2);
  /* the toothed bottom edge */
  -webkit-mask: radial-gradient(circle .26em at 50% 100%, transparent 96%, #000) 50% 0 / .62em 100% repeat-x;
  mask: radial-gradient(circle .26em at 50% 100%, transparent 96%, #000) 50% 0 / .62em 100% repeat-x;
  visibility: hidden; /* GSAP places it (yPercent) and shows it: a CSS transform here would add to its own */
  overflow: hidden;
}
.ticket__stub { position: relative; display: grid; place-items: center; border-right: 1px dashed rgba(226, 85, 45, .38); }
.hole {
  width: .78em; height: .78em; border-radius: 50%;
  background: var(--carta);
  box-shadow: inset 0 1px 2px rgba(var(--ombra), .28), 0 0 0 1px rgba(226, 85, 45, .25);
}
.ticket__body { display: grid; align-content: center; gap: .3em; padding: .1em .75em .45em; min-width: 0; }
.ticket__top { display: flex; align-items: baseline; justify-content: space-between; gap: .4em; }
.ticket__lab { font-size: .56em; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.ticket__num { font-family: "JetBrains Mono Variable", ui-monospace, monospace; font-size: 1.05em; font-weight: 600; letter-spacing: -.01em; color: var(--accento); display: inline-flex; }
.ticket__bottom { display: flex; justify-content: space-between; gap: .4em; font-size: .6em; color: rgba(185, 61, 27, .78); white-space: nowrap; }
.ticket__entries { display: inline-flex; align-items: center; gap: .3em; font-weight: 650; }
.ticket__shine {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .7) 50%, transparent 65%);
  visibility: hidden;
}

/* the pill: the site's elastic pill, the label widens on the wdth axis, the ground swells with a bounce */
.pill {
  position: relative; height: 3em; width: 100%;
  color: #fff; font-size: .9em; font-weight: 620;
  border-radius: 99em;
  touch-action: manipulation;
}
.pill__bg {
  position: absolute; inset: 0; border-radius: inherit; background: var(--accento);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 8px 18px -10px rgba(226, 85, 45, .85);
  transition: transform .5s cubic-bezier(.34, 1.56, .64, 1), background-color .35s ease;
}
.pill__bg::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .14), transparent 55%);
}
.pill.is-in .pill__bg { background: var(--testo); box-shadow: 0 1px 0 rgba(255, 255, 255, .14) inset, 0 8px 18px -10px rgba(23, 20, 15, .7); }
.pill__face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .45em; white-space: nowrap; pointer-events: none; }
.pill__face[data-face="in"] { opacity: 0; }
.pill__txt { display: inline-block; font-stretch: 100%; transition: font-stretch .45s cubic-bezier(.34, 1.56, .64, 1); }
@media (hover: hover) {
  .pill:hover .pill__txt { font-stretch: 112%; }
  .pill:hover .pill__bg { transform: scale(1.025, 1.08); }
}
.pill.is-hover .pill__txt { font-stretch: 112%; }
.pill.is-hover .pill__bg { transform: scale(1.025, 1.08); }
.pill:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }
.tick { width: 1.1em; height: 1.1em; display: block; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tick path { stroke-dasharray: 1 1; stroke-dashoffset: 1; }

/* share for more entries */
.share { position: relative; height: 1.6em; margin-top: -.35em; font-size: .74em; color: var(--testo-2); font-weight: 560; opacity: 0; }
.share__face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .4em; white-space: nowrap; }
.share__face[data-sface="done"] { opacity: 0; color: var(--accento-scuro); }
.ico { width: 1.05em; height: 1.05em; display: block; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ico path[pathLength] { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
@media (hover: hover) { .share:hover { color: var(--testo); } }
.share:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; border-radius: .4em; }

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