@font-face {
  font-family: IRANSansX;
  src: url("iransansx-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body { margin: 0; overflow: hidden; background: transparent; }
html, body, #banner-content { width: 100%; height: 100%; }

body {
  font: 700 8px IRANSansX, Tahoma, sans-serif;
}

body[data-clickable] { cursor: pointer; }

#banner-content {
  position: relative;
  container-type: size;
  isolation: isolate;
  overflow: hidden;
}

#panel {
  position: absolute;
  inset: auto 0 0;
  height: 115px;
  border-radius: 14px 14px 0 0;
  background: #da2129;
}

#panel::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse at 24% 77%, #f34743 0, transparent 64%);
  content: "";
  opacity: 0;
  transition: opacity 680ms ease;
}

#banner-content:is([data-scene="intro"], [data-scene="outro"]) #panel::before { opacity: 1; }

.sprite, #cta, #prize img {
  position: absolute;
  display: block;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.sprite {
  transition:
    left 760ms cubic-bezier(.24, .79, .22, 1),
    right 760ms cubic-bezier(.24, .79, .22, 1),
    bottom 760ms cubic-bezier(.24, .79, .22, 1),
    width 760ms cubic-bezier(.24, .79, .22, 1);
}

#headline {
  z-index: 4;
  left: 9px;
  bottom: 105px;
  width: 208px;
  filter: drop-shadow(1px 0 0 #da2129) drop-shadow(-1px 0 0 #da2129)
    drop-shadow(0 1px 0 #da2129) drop-shadow(0 -1px 0 #da2129);
}

#car {
  z-index: 2;
  right: 11px;
  bottom: 32px;
  width: 103px;
}

#mark {
  z-index: 3;
  right: 26px;
  bottom: 96px;
  width: 73px;
}

#cta {
  z-index: 3;
  right: 16px;
  bottom: 5px;
  width: 93px;
  aspect-ratio: 261 / 66;
  container-type: inline-size;
  overflow: hidden;
  transition: opacity 220ms ease 620ms;
}

#cta-track {
  position: absolute;
  inset: 0;
  display: grid;
  grid-auto-rows: 100%;
  transform: translateY(-200%);
}

.cta-slide {
  display: grid;
  place-items: center;
  background: #da2129;
}

.cta-art { display: block; width: 100%; height: auto; }

.cta-countdown-copy span {
  display: grid;
  place-items: center;
  width: 94%;
  height: 80%;
  border-radius: 999px;
  background: #ffdd00;
  color: #301708;
  font-size: clamp(5px, 10.9cqw, 12px);
  line-height: 1;
  white-space: nowrap;
}

#prize {
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 190ms ease, visibility 0s 190ms;
}

#night { left: calc(50% + 43px); bottom: 65px; width: 75px; }
#number { left: calc(50% + 44px); bottom: 39px; width: 43px; }
#peugeot { left: calc(50% + 88px); bottom: 34px; width: 35px; }

#brand-window {
  position: absolute;
  z-index: 1;
  bottom: 8px;
  left: 7px;
  right: 116px;
  transition: opacity 250ms ease 740ms;
}

#brand-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  justify-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.brand-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  gap: 3px;
  width: 44px;
  height: 82px;
  padding: 6px 4px 7px;
  border: 1px solid #fff4f1;
  border-radius: 9px;
  background: #fff;
  color: #3e191c;
  box-shadow: 0 2px 5px #86071142;
  font-size: 8.5px;
  line-height: 13px;
  white-space: nowrap;
  transform-origin: center bottom;
}

.brand-card img {
  display: block;
  width: 36px;
  max-width: 100%;
  height: 47px;
  object-fit: contain;
}

#banner-content[data-playing][data-scene="brands"] .brand-card {
  animation: card-pulse 8s cubic-bezier(.37, 0, .28, 1) 740ms 2;
}

#banner-content[data-playing][data-scene="brands"] .brand-card:nth-child(2) {
  animation-delay: 2740ms;
}

#banner-content[data-playing][data-scene="brands"] .brand-card:nth-child(3) {
  animation-delay: 4740ms;
}

#banner-content[data-playing][data-scene="brands"] .brand-card:nth-child(4) {
  animation-delay: 6740ms;
  /* End after the second pulse returns to rest at 25% of the final cycle. */
  animation-iteration-count: 1.25;
}

/* The first four card pulses finish 740ms + 4 × 2s after the brand scene starts. */
#banner-content[data-playing][data-scene="brands"] #cta-track {
  animation: cta-copy-roll 3720ms cubic-bezier(.37, 0, .28, 1) 8740ms both;
}

#banner-content[data-playing][data-scene="brands"] .cta-first {
  animation: cta-heartbeat 2s ease-in-out 740ms 4;
}

#banner-content[data-playing][data-scene="brands"] .cta-return {
  animation: cta-heartbeat 2s ease-in-out 12460ms 2;
}

#banner-content[data-playing="false"] :is(.brand-card, #cta-track, .cta-art) {
  animation-play-state: paused;
}

/* Scroll down for 360ms, hold the offer for 3000ms, then scroll down again. */
@keyframes cta-copy-roll {
  0% { transform: translateY(-200%); }
  9.677419%, 90.322581% { transform: translateY(-100%); }
  100% { transform: translateY(0); }
}

@keyframes cta-heartbeat {
  0%, 50%, 100% { transform: scale(1); }
  13% { transform: scale(1.04); }
  26% { transform: scale(.975); }
  36% { transform: scale(1.035); }
}

@keyframes card-pulse {
  0%, 25%, 100% { transform: scale(1); box-shadow: 0 2px 5px #86071142; }
  6.5%, 17.5% { transform: scale(1.10); box-shadow: 0 4px 9px #86071170; }
}

#banner-content:is([data-scene="intro"], [data-scene="outro"]) #headline {
  left: calc(50% - 116px);
  bottom: 87px;
  width: 232px;
}

#banner-content:is([data-scene="intro"], [data-scene="outro"]) #car {
  right: calc(50% + 5px);
  bottom: 7px;
  width: 128px;
}

#banner-content:is([data-scene="intro"], [data-scene="outro"]) #mark {
  right: calc(50% - 118px);
  bottom: 13px;
}

#banner-content:is([data-scene="intro"], [data-scene="outro"]) #prize {
  opacity: 1;
  visibility: visible;
}

#banner-content:is([data-scene="intro"], [data-scene="outro"]) :is(#brand-window, #cta) {
  opacity: 0;
  visibility: hidden;
}

#banner-content[data-scene="intro"] *,
#banner-content[data-scene="intro"] #panel::before { transition: none; }

/* Reflect every reveal around the end of the 990ms forward transition. */
#banner-content[data-scene="outro"] {
  --reverse-fade: cubic-bezier(.75, 0, .75, .9);
}

#banner-content[data-scene="outro"] #brand-window {
  transition: opacity 250ms var(--reverse-fade), visibility 0s 250ms;
}

#banner-content[data-scene="outro"] #cta {
  transition: opacity 220ms var(--reverse-fade) 150ms, visibility 0s 370ms;
}

#banner-content[data-scene="outro"] #cta-track { transform: translateY(0); }

#banner-content[data-scene="outro"] .sprite {
  transition-delay: 230ms;
  transition-timing-function: cubic-bezier(.78, 0, .76, .21);
}

#banner-content[data-scene="outro"] #panel::before {
  transition: opacity 680ms var(--reverse-fade) 310ms;
}

#banner-content[data-scene="outro"] #prize {
  transition: opacity 190ms var(--reverse-fade) 800ms, visibility 0s 800ms;
}

@media (max-height: 127px) {
  #banner-content {
    --title-width: min(160px, 145cqh);
    --car-width: min(85px, 80cqh);
    --cta-width: min(91px, 86cqh);
    --mark-width: min(70px, 58cqh);
    --number-width: min(39px, 32cqh);
  }

  #panel { height: 100%; border-radius: 10px; }
  #headline {
    width: var(--title-width);
    bottom: calc(100cqh - 5px - var(--title-width) * .1125);
  }

  #car { width: var(--car-width); right: 9px; bottom: calc(7px + var(--cta-width) * .253); }
  #mark { width: var(--mark-width); right: 20px; bottom: calc(100cqh - 5px - var(--mark-width) * .249); }
  #cta { width: var(--cta-width); right: 6px; bottom: 4px; }

  #brand-window { right: 104px; bottom: 6px; }
  .brand-card {
    width: min(54px, calc((100cqw - 114px) / 4.5));
    height: min(70px, calc(100cqh - 36px));
    padding: 3px 3px 4px;
    gap: 1px;
    font-size: 9px;
    line-height: 12px;
  }
  .brand-card img { width: 38px; height: min(40px, 34cqh); }

  #banner-content:is([data-scene="intro"], [data-scene="outro"]) #headline {
    width: var(--title-width);
    left: calc((100cqw - var(--title-width)) / 2);
    bottom: calc(100cqh - 5px - var(--title-width) * .1125);
  }
  #banner-content:is([data-scene="intro"], [data-scene="outro"]) #car { width: min(121px, 113cqh); right: calc(50% + 4px); bottom: 5px; }
  #banner-content:is([data-scene="intro"], [data-scene="outro"]) #mark { right: calc(50% - 9px - var(--mark-width)); bottom: 8px; }
  #night { left: calc(50% + 8px); width: min(73px, 70cqh); bottom: 52cqh; }
  #number { left: calc(50% + 8px); width: var(--number-width); bottom: 30cqh; }
  #peugeot { left: calc(50% + var(--number-width) + 13px); width: min(35px, 31cqh); bottom: 27cqh; }
}

@media (min-height: 180px) {
  #banner-content {
    --title-width: min(336px, calc(100cqw - 20px));
    --hero-band: clamp(72px, 36cqh, 112px);
    --car-width: min(148px, 44cqw, calc((var(--hero-band) - 12px) / .614));
    --cta-width: min(122px, 42cqw);
    --mark-width: min(113px, 40cqw);
    --number-width: min(48px, 15cqw);
    --card-height: clamp(69px, 39cqh, 138px);
  }

  #panel { height: 100%; border-radius: 16px; }
  #headline {
    width: var(--title-width);
    left: calc((100cqw - var(--title-width)) / 2);
    bottom: calc(100cqh - 11px - var(--title-width) * .1125);
  }

  #brand-window { inset: auto 12px var(--hero-band); }
  .brand-card {
    width: min(92px, calc((100cqw - 28px) / 4.45));
    height: var(--card-height);
    font-size: clamp(8px, 3.5cqw, 12px);
    line-height: 16px;
  }
  .brand-card img { width: min(74px, 20cqw); height: min(70px, calc(var(--card-height) * .58)); }

  #car { width: var(--car-width); right: 12px; bottom: 10px; }
  #mark { width: var(--mark-width); right: calc(100cqw - var(--mark-width) - 12px); bottom: calc(18px + var(--cta-width) * .253); }
  #cta { width: var(--cta-width); right: calc(100cqw - var(--cta-width) - 12px); bottom: 10px; }

  #banner-content:is([data-scene="intro"], [data-scene="outro"]) #headline {
    width: var(--title-width);
    left: calc((100cqw - var(--title-width)) / 2);
    bottom: 67cqh;
  }
  #banner-content:is([data-scene="intro"], [data-scene="outro"]) #car { width: min(149px, 45cqw); right: calc(50% + 3px); bottom: 23cqh; }
  #banner-content:is([data-scene="intro"], [data-scene="outro"]) #mark { right: calc(50% - 6px - var(--mark-width)); bottom: 18cqh; }
  #night { left: calc(50% + 7px); width: min(82px, 39cqw); bottom: 48cqh; }
  #number { left: calc(50% + 7px); width: var(--number-width); bottom: 33cqh; }
  #peugeot { left: calc(50% + var(--number-width) + 12px); width: min(38px, 15cqw); bottom: 29cqh; }
}

@media (max-height: 75px), (min-width: 420px) and (min-aspect-ratio: 17/5) and (max-height: 127px), (min-width: 700px) and (min-aspect-ratio: 3/1) and (min-height: 180px) {
  #banner-content {
    --right-zone: clamp(118px, 43cqw, 292px);
    --zone-height: min(122px, 100cqh);
    --zone-bottom: calc((100cqh - var(--zone-height)) / 2);
    --title-width: min(208px, calc(var(--right-zone) - 16px));
    --car-width: min(133px, calc((var(--zone-height) - var(--title-width) * .1125 - 10px) / .614), calc(var(--right-zone) * .47));
    --copy-width: calc(var(--right-zone) - var(--car-width) - 25px);
    --cta-width: min(108px, calc(var(--zone-height) * 1.12), var(--copy-width));
    --mark-width: min(78px, calc(var(--zone-height) * .81), var(--copy-width));
    --number-width: min(42px, calc(var(--zone-height) * .36));
    --card-height: min(98px, calc((var(--zone-height) - 12px) / 1.15));
  }

  #panel { height: 100%; border-radius: 10px; }
  #headline {
    left: calc(100cqw - var(--right-zone) + 6px);
    bottom: calc(100cqh - var(--zone-bottom) - 3px - var(--title-width) * .1125);
  }
  #car { right: 5px; bottom: calc(var(--zone-bottom) + 4px); }
  #cta { right: calc(var(--right-zone) - 6px - var(--cta-width)); bottom: calc(var(--zone-bottom) + 4px); }
  #mark {
    right: calc(var(--right-zone) - 6px - var(--mark-width));
    bottom: calc(var(--zone-bottom) + 7px + var(--cta-width) * .253);
  }

  #brand-window {
    left: 7px;
    right: calc(var(--right-zone) + 1px);
    bottom: calc((100cqh - var(--card-height)) / 2 - 1px);
  }
  .brand-card {
    width: min(94px, calc((100cqw - var(--right-zone) - 17px) / 4.5));
    height: var(--card-height);
    gap: 2px;
    padding: 2px 2px 3px;
    font-size: clamp(7.5px, calc(var(--zone-height) * .145), 12px);
    line-height: clamp(10px, calc(var(--zone-height) * .17), 15px);
    border-radius: 7px;
  }
  .brand-card img {
    width: min(74px, calc((100cqw - var(--right-zone) - 23px) / 4.5));
    height: 100%;
    max-height: 60px;
  }

  #banner-content:is([data-scene="intro"], [data-scene="outro"]) #headline {
    width: var(--title-width);
    left: calc(50% - 7px);
    bottom: calc(100cqh - var(--zone-bottom) - 3px - var(--title-width) * .1125);
  }
  #banner-content:is([data-scene="intro"], [data-scene="outro"]) #car {
    width: min(140px, calc(var(--zone-height) * 1.37));
    right: calc(50% + 14px);
    bottom: calc(var(--zone-bottom) + var(--zone-height) * .07);
  }
  #banner-content:is([data-scene="intro"], [data-scene="outro"]) #mark {
    right: calc(50% - var(--mark-width) - min(80px, 23cqw));
    bottom: calc(var(--zone-bottom) + var(--zone-height) * .12);
  }
  #night { left: calc(50% - 5px); width: min(76px, calc(var(--zone-height) * .73)); bottom: calc(var(--zone-bottom) + var(--zone-height) * .385); }
  #number { left: calc(50% - 5px); bottom: calc(var(--zone-bottom) + var(--zone-height) * .14); }
  #peugeot { left: calc(50% + var(--number-width)); width: min(33px, calc(var(--zone-height) * .28)); bottom: calc(var(--zone-bottom) + var(--zone-height) * .10); }
}

@media (min-height: 360px) and (max-aspect-ratio: 13/20) {
  #banner-content {
    --hero-band: 160px;
    --title-width: calc(100cqw - 19px);
    --card-height: min(143px, calc((100cqh - 241px) / 2));
    --car-width: min(132px, calc(100cqw - 24px));
    --mark-width: min(107px, calc(100cqw - 22px));
    --cta-width: min(116px, calc(100cqw - 23px));
  }

  #headline { bottom: calc(var(--hero-band) + var(--card-height) * 2 + 42px); }
  #brand-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 6px; }
  .brand-card { width: min(100px, calc((100cqw - 35px) / 2.2)); }
  .brand-card img { width: min(101px, 62cqw); }

  #car { right: calc((100cqw - var(--car-width)) / 2); bottom: 43px; }
  #mark { right: calc((100cqw - var(--mark-width)) / 2); bottom: calc(48px + var(--car-width) * .614); }
  #cta { right: calc((100cqw - var(--cta-width)) / 2); bottom: 10px; }

  #banner-content:is([data-scene="intro"], [data-scene="outro"]) #headline { bottom: 68cqh; }
  #banner-content:is([data-scene="intro"], [data-scene="outro"]) #car { width: var(--car-width); right: calc((100cqw - var(--car-width)) / 2); bottom: 49cqh; }
  #banner-content:is([data-scene="intro"], [data-scene="outro"]) #mark { right: calc((100cqw - var(--mark-width)) / 2); bottom: 30cqh; }
  #night { left: 29cqw; width: 42cqw; bottom: 42.5cqh; }
  #number { left: 33cqw; bottom: 38cqh; }
  #peugeot { left: 52cqw; width: 17cqw; bottom: 35cqh; }
}

@media (prefers-reduced-motion: reduce) {
  #banner-content *, #panel::before { transition: none; }
  #banner-content[data-scene="outro"] :is(.sprite, #brand-window, #cta, #prize),
  #banner-content[data-scene="outro"] #panel::before { transition: none; }
  #banner-content[data-playing][data-scene="brands"] :is(.brand-card, .cta-art) { animation: none; }
  #banner-content[data-playing][data-scene="brands"] #cta-track { animation-timing-function: steps(1, end); }
}
