:root {
  --kalc-violet:    #592c86;
  --kalc-yellow:    #fff374;
  --ad-duration:    9s;
  --bezier-springy: cubic-bezier(0.34, 1.56, 0.64, 1);
  /* slot machine config */
  --item-h: 4rem;
  --step: 14deg;
  --radius: 16rem;
  --drum-duration: 9s;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  width: 994px;
  height: 250px;
  overflow: hidden;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* AD */
.ad {
  position: relative;
  width: 994px;
  height: 250px;
  overflow: hidden;
  cursor: pointer;
  background-color: var(--kalc-violet);
  border: 1px solid var(--kalc-violet);
}
/* AD HOVER */
.ad:hover .logo {
  transform: rotate(-10deg);
}
.ad:hover .drum-wrap li {
    padding: 1rem 2.25rem;
}
.ad:hover .bg img {
  transform: scale(1.1);
}
.ad:hover .info-text {
  transform: translateY(-.5rem);
  color: #fff374;
}
.ad:hover .blob-text > svg path {
  fill: #592c86;
}
.ad:hover .info-text p:last-child {
  gap: 0 .75rem;
}

/* CURTAIN */
/* For the wide format the blob is sized by width so it covers the full ad horizontally */
/* @keyframes blob-curtain {
  from { transform: translateY(0%)    rotate(-50deg)  scale(1.5); }
  to   { transform: translateY(-100%) rotate(-130deg) scale(1);   }
}
.blob-curtain svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  transform: translateY(0%) rotate(-50deg) scale(1.5);
  animation: blob-curtain 1.5s cubic-bezier(0.39, 0.58, 0.57, 1) 1 forwards;
} */

/* BACKGROUND */
.bg {
  width: 100%;
  height: 100%;
}
@keyframes moving-bg {
  0%   { transform: scale(1.1); }
  16%  { transform: scale(1); }
  100% { transform: scale(1); }
}
.bg img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  transform: scale(1);
  transition: transform .2s linear;
  animation: moving-bg var(--ad-duration) ease-in-out 0s 1 forwards;
}

/* LOGO */
.logo {
  position: absolute;
  top: -1.75rem;
  right: -2.75rem;
  transition: transform .5s var(--bezier-springy);
}
@keyframes logo-intro {
  /* — initial pop-in — */
  0%,  4% { transform: scale(0) rotate(-12deg); }
  7%      { transform: scale(1) rotate(0deg); }

  /* — pulse 1 (synced to CTA, cycle 1) — */
  28%  { transform: scale(1) rotate(0deg); animation-timing-function: ease-in; }
  29%  { transform: scale(0.3) rotate(-6deg); }
  31%  { transform: scale(1) rotate(0deg); }

  /* — pulse 2 (synced to CTA, cycle 2) — */
  61%  { transform: scale(1) rotate(0deg); animation-timing-function: ease-in; }
  62%  { transform: scale(0.3) rotate(-6deg); }
  64%  { transform: scale(1) rotate(0deg); }

  /* — pulse 3 (synced to CTA, cycle 3) — */
  94%  { transform: scale(1) rotate(0deg); animation-timing-function: ease-in; }
  95%  { transform: scale(0.3) rotate(-6deg); }
  97%  { transform: scale(1) rotate(0deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.logo svg {
  height: 225px;
  transform: scale(0);
  transform-origin: center;
  will-change: transform;
  animation: logo-intro calc(var(--ad-duration) * 3) var(--bezier-springy) 0s 1 forwards;
}

/* Slot Machine */
.drum-wrap {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  transform: translateY(-25%);
}
.scene {
  position: relative;
  padding-left: 2.5rem;
  width: 640px;
  height: calc(7 * var(--item-h));
  overflow: hidden;
}
.barrel {
  list-style: none;
  position: absolute;
  left: 2.5rem;
  top: 50%;
  transform-origin: calc(-1 * var(--radius)) 0;
  animation: drum-roll var(--drum-duration) linear 0s 3 forwards;
}

.barrel li {
  position: absolute;
  left: 0;
  top: calc(-0.5 * var(--item-h));  /* centre word on the pivot line */
  height: var(--item-h);
  width: fit-content;
  display: flex;
  align-items: center;
  padding: 1rem 2rem;
  white-space: nowrap;
  font-size: 2rem;
  font-weight: 700;
  transform-origin: calc(-1 * var(--radius)) 50%;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: calc(var(--item-h) / 2);
  transition: padding .2s ease-in-out;
  backdrop-filter: blur(5px);
  background: rgba(255,255,255,.25);
  color: #592c86;
}
@keyframes change-chip-color {
  0% { background-color: rgba(255,255,255,.25); color: #592c86; }
  15%, 85% { background-color: #592c86; color: #fff374; }
  100% { background-color: rgba(255,255,255,.25); color: #592c86; }
}
.barrel li:first-child {animation: slot-1 var(--drum-duration) linear 0s 3 forwards;}
.barrel li:nth-child(2) {animation: slot-2 var(--drum-duration) linear 0s 3 forwards;}
.barrel li:nth-child(3) {animation: slot-3 var(--drum-duration) linear 0s 3 forwards;}
.barrel li:nth-child(4) {animation: slot-4 var(--drum-duration) linear 0s 3 forwards;}
.barrel li:nth-child(5) {animation: slot-5 var(--drum-duration) linear 0s 3 forwards;}
.barrel li:nth-child(6) {animation: slot-6 var(--drum-duration) linear 0s 3 forwards;}
.barrel li:last-child {
  background-color: #fff374;
  color: #592c86;
}
.barrel li {
  backdrop-filter: blur(5px);
  overflow: visible;
  background: rgba(255,255,255,.25);
  color: #592c86;
}

/* Pre-rotate each spoke to its position on the dial */
.barrel li:nth-child(1) { transform: rotate(0deg); }
.barrel li:nth-child(2) { transform: rotate(calc(1 * var(--step))); }
.barrel li:nth-child(3) { transform: rotate(calc(2 * var(--step))); }
.barrel li:nth-child(4) { transform: rotate(calc(3 * var(--step))); }
.barrel li:nth-child(5) { transform: rotate(calc(4 * var(--step))); }
.barrel li:nth-child(6) { transform: rotate(calc(5 * var(--step))); }
.barrel li:nth-child(7) { transform: rotate(calc(6 * var(--step))); }

/*
  Barrel steps backward by --step each tick.
  animation-timing-function on a keyframe applies to the transition
  from that frame to the next — each tick gets its own spring.
*/
@keyframes drum-roll {
  0%,  10% { transform: rotate(0deg);                        animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }
  15%, 25% { transform: rotate(calc(-1 * var(--step)));      animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }
  30%, 40% { transform: rotate(calc(-2 * var(--step)));      animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }
  45%, 55% { transform: rotate(calc(-3 * var(--step)));      animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }
  60%, 70% { transform: rotate(calc(-4 * var(--step)));      animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }
  75%, 85% { transform: rotate(calc(-5 * var(--step)));      animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }
  90%,100% { transform: rotate(calc(-6 * var(--step)));      }
}
@keyframes slot-1 {
  0%,  10% { background-color: #592c86; color: #fff374; }
  15%, 25% { background-color: rgba(255,255,255,.25); color: #592c86; }
  30%, 40% { background-color: rgba(255,255,255,.25); color: #592c86; }
  45%, 55% { background-color: rgba(255,255,255,.25); color: #592c86; }
  60%, 70% { background-color: rgba(255,255,255,.25); color: #592c86; }
  75%, 85% { background-color: rgba(255,255,255,.25); color: #592c86; }
  90%,100% { background-color: rgba(255,255,255,.25); color: #592c86; }
}
@keyframes slot-2 {
  0%,  10% { background-color: rgba(255,255,255,.25); color: #592c86; }
  15%, 25% { background-color: #592c86; color: #fff374; }
  30%, 40% { background-color: rgba(255,255,255,.25); color: #592c86; }
  45%, 55% { background-color: rgba(255,255,255,.25); color: #592c86; }
  60%, 70% { background-color: rgba(255,255,255,.25); color: #592c86; }
  75%, 85% { background-color: rgba(255,255,255,.25); color: #592c86; }
  90%,100% { background-color: rgba(255,255,255,.25); color: #592c86; }
}
@keyframes slot-3 {
  0%,  10% { background-color: rgba(255,255,255,.25); color: #592c86; }
  15%, 25% { background-color: rgba(255,255,255,.25); color: #592c86; }
  30%, 40% { background-color: #592c86; color: #fff374; }
  45%, 55% { background-color: rgba(255,255,255,.25); color: #592c86; }
  60%, 70% { background-color: rgba(255,255,255,.25); color: #592c86; }
  75%, 85% { background-color: rgba(255,255,255,.25); color: #592c86; }
  90%,100% { background-color: rgba(255,255,255,.25); color: #592c86; }
}
@keyframes slot-4 {
  0%,  10% { background-color: rgba(255,255,255,.25); color: #592c86; }
  15%, 25% { background-color: rgba(255,255,255,.25); color: #592c86; }
  30%, 40% { background-color: rgba(255,255,255,.25); color: #592c86; }
  45%, 55% { background-color: #592c86; color: #fff374; }
  60%, 70% { background-color: rgba(255,255,255,.25); color: #592c86; }
  75%, 85% { background-color: rgba(255,255,255,.25); color: #592c86; }
  90%,100% { background-color: rgba(255,255,255,.25); color: #592c86; }
}
@keyframes slot-5 {
  0%,  10% { background-color: rgba(255,255,255,.25); color: #592c86; }
  15%, 25% { background-color: rgba(255,255,255,.25); color: #592c86; }
  30%, 40% { background-color: rgba(255,255,255,.25); color: #592c86; }
  45%, 55% { background-color: rgba(255,255,255,.25); color: #592c86; }
  60%, 70% { background-color: #592c86; color: #fff374; }
  75%, 85% { background-color: rgba(255,255,255,.25); color: #592c86; }
  90%,100% { background-color: rgba(255,255,255,.25); color: #592c86; }
}
@keyframes slot-6 {
  0%,  10% { background-color: rgba(255,255,255,.25); color: #592c86; }
  15%, 25% { background-color: rgba(255,255,255,.25); color: #592c86; }
  30%, 40% { background-color: rgba(255,255,255,.25); color: #592c86; }
  45%, 55% { background-color: rgba(255,255,255,.25); color: #592c86; }
  60%, 70% { background-color: rgba(255,255,255,.25); color: #592c86; }
  75%, 85% { background-color: #592c86; color: #fff374; }
  90%,100% { background-color: rgba(255,255,255,.25); color: #592c86; }
}

/* --- Click area --- */

.click-area {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: block;
  cursor: pointer;
}
