/* Coca-Cola style study: "Recognized in the dark". Unofficial, by Peter Bu. */
@font-face { font-family: "Fira Cond"; src: url("fonts/FiraSansExtraCondensed-ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: block; }
@font-face { font-family: "Fira Cond"; src: url("fonts/FiraSansExtraCondensed-Black.ttf") format("truetype"); font-weight: 900; font-display: block; }
@font-face { font-family: "Great Vibes"; src: url("fonts/GreatVibes-Regular.ttf") format("truetype"); font-weight: 400; font-display: block; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-VF.ttf") format("truetype"); font-weight: 100 900; font-display: block; }

:root {
  --red: #F40009;
  --red-deep: #9C2A2C;
  --white: #FFFFFF;
  --black: #000000;
  --glass-green: #9DBFA8;
  --warm-light: #FFE2B0;
  --pop: cubic-bezier(.34, 1.56, .64, 1);
  --pop-soft: cubic-bezier(.34, 1.25, .64, 1);
  --settle: cubic-bezier(.16, 1, .3, 1);
  --head: "Fira Cond", "Arial Narrow", sans-serif;
  --body: "Inter", "Helvetica Neue", Arial, sans-serif;
  --script: "Great Vibes", cursive;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--black); overflow: hidden; }
body { color: var(--white); font-family: var(--body); -webkit-font-smoothing: antialiased; }

#viewport { position: fixed; inset: 0; background: var(--black); transition: background-color .7s ease; cursor: default; user-select: none; }
#stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; overflow: hidden; }
#ground, #ground2 { position: absolute; inset: 0; }
#ground { background: var(--black); transition: background-color .7s ease; }
#ground2 { display: none; }
#gl, #fx, #tx { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; pointer-events: none; }
#gl { visibility: hidden; }
#vignette {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .9s ease;
  background: radial-gradient(ellipse 78% 74% at 50% 46%, rgba(156, 42, 44, 0) 60%, rgba(156, 42, 44, .5) 100%);
}
body.red-ground #vignette { opacity: 1; }
body.portrait #vignette { display: none; }

#slides { position: absolute; inset: 0; }
.slide { position: absolute; inset: 0; visibility: hidden; }
.slide.active { visibility: visible; }
.slide canvas.art { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; pointer-events: none; }
.slide aside.notes { display: none; }

/* leaving: fades driven by CSS, wipes by clip-path from the engine */
.slide.leaving { transition: opacity .8s ease, transform .9s ease, filter .8s ease; }
.slide.leave-crossfade { opacity: 0; }
.slide.leave-seam { opacity: 0; transition-duration: .9s; }
.slide.leave-fade { opacity: 0; transition-duration: .2s; }
.slide.leave-fizz { opacity: 0; transform: translateY(-110px); filter: blur(12px); transition: opacity .55s ease .15s, transform .9s cubic-bezier(.55, 0, .8, .2), filter .6s ease; }

/* layout blocks */
.blk { position: absolute; left: var(--x); top: var(--y); width: var(--w); }
.blk.center { left: 0; right: 0; width: auto; display: flex; flex-direction: column; align-items: center; text-align: center; }
.blk.right { left: auto; right: var(--r); text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
p, h1, h2 { margin: 0; }

/* build steps */
[data-step] {
  opacity: 0; transform: translateY(36px); filter: blur(10px);
  transition: opacity .55s ease, transform 1s var(--pop-soft), filter .6s ease;
}
[data-step].on { opacity: 1; transform: none; filter: none; }
[data-step].gone { opacity: 0; transform: translateY(-34px); filter: blur(8px); transition-duration: .45s; transition-delay: 0s !important; }
.instant [data-step], .instant .w, .instant .flood, .instant .coupon, .instant .odo-lift, .instant .era-cap { transition: none !important; }

/* type roles */
.date { font: 500 30px/1.2 var(--body); letter-spacing: .02em; margin-bottom: 26px; display: flex; align-items: center; gap: 18px; }
.date::before { content: ""; width: 52px; height: 4px; border-radius: 2px; background: var(--white); flex: none; }
.blk.center .date::before { display: none; }
.date.gap { margin-top: 38px; margin-bottom: 14px; }

.word { font: 900 290px/.84 var(--head); letter-spacing: .004em; margin: 0 0 26px -6px; font-variant-numeric: tabular-nums; }
[data-step].word { transform: translateY(40px) scale(.84); transform-origin: 0 80%; transition: opacity .45s ease, transform 1.05s var(--pop), filter .5s ease; }
.blk.center [data-step].word { transform-origin: 50% 80%; }
.blk.right [data-step].word { transform-origin: 100% 80%; }
[data-step].word.on { transform: none; }
.word.giant { font-size: 470px; line-height: .8; margin-bottom: 18px; }
.word.mid { font-size: 236px; margin-bottom: 10px; }

.title { font: 800 140px/.9 var(--head); text-transform: uppercase; letter-spacing: .008em; margin-bottom: 30px; }
.title.huge { font-size: 196px; line-height: .86; }
[data-step].title { transform: none; filter: none; transition: opacity .2s ease; }
.title .wm { display: inline-block; overflow: hidden; vertical-align: top; padding: .06em .02em .02em; margin: -.06em -.02em -.02em; }
.title .w { display: inline-block; transform: translateY(112%); transition: transform 1s var(--pop-soft); transition-delay: calc(var(--d, 0s) + var(--wi) * .075s); }
.title.on .w { transform: none; }

.sub { font: 400 38px/1.3 var(--body); margin-bottom: 20px; max-width: 980px; text-wrap: pretty; }
.sub.narrow { max-width: 1240px; }
.sub.big { font: 800 84px/.96 var(--head); text-transform: uppercase; letter-spacing: .01em; margin-bottom: 36px; }
.sub.em { font-weight: 600; }
.pair { display: flex; align-items: flex-end; gap: 34px; }
.sub.side { font-size: 46px; line-height: 1.12; font-weight: 500; max-width: 440px; padding-bottom: 74px; margin: 0; }
.line { font: 800 62px/.98 var(--head); text-transform: uppercase; letter-spacing: .012em; margin-top: 26px; max-width: 900px; }
.line.xl { font-size: 112px; line-height: .92; margin: 0; }
.line.one, .title.one { max-width: none; white-space: nowrap; }
.title.one { font-size: 140px; line-height: .9; }
.meta { font: 500 36px/1.25 var(--body); }
.live { font: 500 32px/1.3 var(--body); font-variant-numeric: tabular-nums; margin-top: 6px; }
.live.on { opacity: .92; }
.live b { font-weight: 700; }
.disclaimer { position: absolute; left: 150px; bottom: 96px; max-width: 1640px; font: 400 18px/1.3 var(--body); letter-spacing: .01em; }
.disclaimer.on { opacity: .86; }
.micro { position: absolute; left: 150px; bottom: 134px; font: 400 23px/1.3 var(--body); }
.micro.on { opacity: .8; }

/* C04: the pen ride on a ledger page, then the reversal to white on red */
.word.c04 { font-size: 160px; line-height: .84; margin-bottom: 0; }
.slide[data-id="two-cs"] .inkable { color: #3A2414; transition: opacity .55s ease, transform 1s var(--pop-soft), filter .6s ease, color .28s linear; }
.slide[data-id="two-cs"] [data-step].word.inkable { transition: opacity .45s ease, transform 1.05s var(--pop), filter .5s ease, color .28s linear; }
.slide[data-id="two-cs"] .inkable.white { color: var(--white); }
body:has(.slide[data-id="two-cs"].active:not([data-cur="2"])) #hud { color: #3A2414; }
body:has(.slide[data-id="two-cs"].active:not([data-cur="2"])) #hud .track { stroke: rgba(58, 36, 20, .26); }
body:has(.slide[data-id="two-cs"].active:not([data-cur="2"])) #hud .prog { stroke: #3A2414; }

/* C05: coupon */
.coupon { position: absolute; left: 1090px; top: 300px; width: 680px; height: 320px; display: flex; filter: drop-shadow(0 30px 40px rgba(90, 0, 6, .35)); }
[data-step].coupon { transform: rotate(-5deg) translateY(80px) scale(.9); filter: drop-shadow(0 30px 40px rgba(90, 0, 6, .35)) blur(8px); }
[data-step].coupon.on { transform: rotate(-5deg); filter: drop-shadow(0 30px 40px rgba(90, 0, 6, .35)); }
.coupon .stub { width: 150px; background: #FFF8F2; border-radius: 16px 0 0 16px; display: flex; align-items: center; justify-content: center; color: var(--red); }
.coupon .stub span { font: 800 46px/1 var(--head); letter-spacing: .08em; transform: rotate(-90deg); }
.coupon .ticket { position: relative; flex: 1; background: #FFF8F2; border-radius: 0 16px 16px 0; color: var(--red); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; transform-origin: 0 0; }
.coupon .ticket::after { content: ""; position: absolute; inset: 22px; border: 3px solid var(--red); border-radius: 8px; }
.coupon .ticket::before { content: ""; position: absolute; left: -7px; top: 12px; bottom: 12px; width: 14px; background: radial-gradient(circle, var(--red) 4.5px, transparent 5px) 0 0 / 14px 24px repeat-y; }
.coupon .big { font: 900 64px/.9 var(--head); }
.coupon .mark { display: block; width: 340px; line-height: 0; }
.coupon .mark svg { display: block; width: 100%; height: auto; }
.coupon .small { font: 600 24px/1 var(--body); letter-spacing: .32em; text-transform: uppercase; }
.slide[data-cur="1"] .coupon .ticket { animation: tear 1.7s cubic-bezier(.5, 0, .7, 1) .15s forwards; }
@keyframes tear {
  0% { transform: none; }
  16% { transform: rotate(7deg) translate(14px, -6px); }
  100% { transform: translate(560px, 980px) rotate(52deg); opacity: .9; }
}

/* C07: the labels are drawn on the art canvas; the list stays for screen readers */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* C08: the $ of the big word clears the date line */
.slide[data-id="brief"] .word { margin-top: 66px; }

/* C09: room between the line and the last sub */
.sub.after-line { margin-top: 28px; }

/* C08: the pointer is the hand, so the system cursor hides */
@media (pointer: fine) { body:not(.embed):has(.slide[data-id="brief"].active:not([data-cur="0"])) #viewport { cursor: none; } }

/* C09: Georgia Green glow */
.glow.green { position: absolute; left: 1010px; top: 0; width: 920px; height: 1080px; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(ellipse 48% 46% at 52% 50%, rgba(157, 191, 168, .2), rgba(157, 191, 168, 0) 70%); opacity: .55; transition: opacity 1.4s ease; }
.slide[data-cur="1"] .glow.green { opacity: 1; }

/* C13: flip calendar, meter, flood */
.flood { position: absolute; inset: 0; background: var(--red); clip-path: circle(0% at 50% 52%); opacity: 1; transition: clip-path 1.15s cubic-bezier(.65, 0, .35, 1), opacity .45s ease 1.1s; pointer-events: none; }
.slide[data-cur="2"] .flood, .slide[data-cur="3"] .flood { clip-path: circle(80% at 50% 52%); opacity: 0; }
.cal { position: absolute; left: 1080px; top: 520px; display: flex; gap: 22px; align-items: flex-end; }
.cal .card { position: relative; width: 250px; height: 300px; border-radius: 20px; background: #FFFFFF; color: #111; display: flex; align-items: center; justify-content: center; font: 900 196px/1 var(--head); box-shadow: 0 24px 50px rgba(255, 255, 255, .08); perspective: 600px; }
.cal .card.month { width: 280px; font-size: 128px; color: var(--red); }
.cal .card::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; background: rgba(0, 0, 0, .28); }
.cal .card span { display: block; }
.cal .card.flip span { animation: flip .16s ease-out; }
@keyframes flip { from { transform: rotateX(75deg) translateY(-14px); opacity: .3; } to { transform: none; opacity: 1; } }
.cal .days { font: 500 34px/1 var(--body); margin: 0 0 16px 14px; white-space: nowrap; }
.cal .dn { font: 800 72px/1 var(--head); font-variant-numeric: tabular-nums; display: inline-block; min-width: 1.2em; }
.meter { width: 640px; height: 18px; border-radius: 9px; background: rgba(255, 255, 255, .18); margin: 16px 0 18px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--red); transform-origin: left center; transform: scaleX(.2667); border-radius: 9px; }
.d79 .word { font-size: 200px; margin-bottom: 0; }

/* C14: eras */
.era-year { position: absolute; left: 126px; top: 40px; margin: 0; padding: 14px 20px 10px; border-radius: 20px; background: #000; box-shadow: 0 0 30px 20px #000; font: 900 120px/.84 var(--head); letter-spacing: .004em; font-variant-numeric: tabular-nums; z-index: 2; }
.era-cap { position: absolute; left: 0; right: 0; top: 790px; max-width: none; margin: 0; text-align: center; opacity: 0; transform: translateY(14px); transition: opacity .45s ease, transform .6s var(--settle); }
.era-cap.on { opacity: .95; transform: none; }
.era-line { max-width: none; white-space: nowrap; margin-top: 0; }

/* C15: odometer */
.odo-lift { transition: transform .9s var(--settle); transform-origin: 50% 50%; }
.slide[data-id="today"][data-cur="1"] .odo-lift { transform: translateY(-308px) scale(.38); }
.odo { font: 900 236px/1 var(--head); height: 1em; display: flex; justify-content: center; white-space: nowrap; margin-bottom: 30px; }
.odo-in { display: inline-flex; }
.odo .dg { display: inline-block; height: 1em; overflow: hidden; width: .5em; text-align: center; -webkit-mask-image: linear-gradient(transparent 0, #000 14%, #000 86%, transparent 100%); mask-image: linear-gradient(transparent 0, #000 14%, #000 86%, transparent 100%); }
.odo .strip { display: flex; flex-direction: column; will-change: transform; }
.odo .strip i { font-style: normal; height: 1em; line-height: 1em; display: block; }
.odo .cm { display: inline-block; width: .2em; }
.odo .dg.off, .odo .cm.off { display: none; }

/* HUD: the progress line, straight before 1969 and a ribbon after */
#hud { position: absolute; left: 0; right: 0; bottom: 18px; height: 80px; pointer-events: none; transition: opacity .4s; }
#hud .num { position: absolute; left: 78px; top: 22px; font: 800 30px/1 var(--head); letter-spacing: .05em; }
#hud svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#hud .track { fill: none; stroke: rgba(255, 255, 255, .26); stroke-width: 3; }
#hud .prog { fill: none; stroke: var(--white); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 1 1; stroke-dashoffset: 1; transition: stroke-dashoffset .9s var(--pop-soft); }
#hud .curve { display: none; }
#hud.curved .curve { display: inline; }
#hud.curved .straight { display: none; }
body.still #hud { display: none; }
/* QA seek frames and jumps: the progress line lands without its transition */
#hud.instant .prog { transition: none !important; }
/* the loop seam (slide 16 to slide 1): the line fades out and back instead of jumping from curve to straight */
#hud.seam svg { opacity: 0; transition: opacity .35s ease; }
#hud svg { transition: opacity .5s ease; }

/* C16 end: one centred column, the disclaimer clear of the rising curve */
.slide[data-id="end"] .micro, .slide[data-id="end"] .disclaimer { left: 0; right: 0; margin: 0 auto; text-align: center; }
.slide[data-id="end"] .title.one { margin-bottom: 10px; }
.slide[data-id="end"] .sub { margin-bottom: 0; }
.slide[data-id="end"] .disclaimer { bottom: 100px; max-width: 1500px; }
.slide[data-id="end"] .micro { bottom: 138px; font-size: 21px; }
/* the loop seam (autoplay): the copy leaves before the glass walks back to the cold open's first frame */
.slide[data-id="end"].outro [data-step].on { opacity: 0 !important; transition: opacity .45s ease !important; transition-delay: 0s !important; }

#embed-disclaimer { display: none; }
body.embed #embed-disclaimer { display: block; position: absolute; left: 150px; bottom: 96px; margin: 0; font: 400 16px/1.3 var(--body); color: rgba(255, 255, 255, .86); }
body.embed .disclaimer { display: none; }

/* overlays (screen space) */
#notes, #help { position: fixed; z-index: 10; display: none; background: rgba(10, 0, 0, .86); color: #fff; font: 400 14px/1.5 var(--body); padding: 16px 18px; border-radius: 12px; max-width: min(560px, 92vw); max-height: 52vh; overflow: auto; }
#notes { right: 16px; bottom: 16px; }
#help { left: 16px; top: 16px; }
#notes .h, #help .h { font-weight: 700; margin: 0 0 6px; }
#help p { margin: 0 0 4px; }
body.show-notes #notes, body.show-help #help { display: block; }
#hint, #flash, #rotate { position: fixed; z-index: 9; margin: 0; font: 500 13px/1.3 var(--body); color: #fff; background: rgba(0, 0, 0, .6); padding: 8px 12px; border-radius: 999px; opacity: 0; transition: opacity .5s; pointer-events: none; }
#hint { right: 16px; top: 16px; }
#hint.on, #flash.on { opacity: 1; }
#flash { left: 50%; top: 16px; transform: translateX(-50%); }
#rotate { left: 50%; bottom: 20px; transform: translateX(-50%); background: rgba(0, 0, 0, .72); color: #fff; font-size: 15px; font-weight: 600; padding: 10px 16px; white-space: nowrap; box-shadow: 0 0 0 1px rgba(255, 255, 255, .22); }
body.portrait #rotate { opacity: 1; transition: none; }
body.embed #hint, body.embed #rotate, body.embed #notes, body.embed #help { display: none; }

/* stills and reduced motion */
body.still *, body.still *::before, body.still *::after { transition: none !important; animation: none !important; }
body.still .slide[data-cur="1"] .coupon .ticket { opacity: 0; }
body.reduced [data-step], body.reduced .title .w, body.reduced .flood, body.reduced .era-cap { transition: opacity .2s ease !important; transform: none !important; filter: none !important; }
body.reduced .odo-lift { transition: opacity .2s ease !important; }
body.reduced .slide[data-id="two-cs"] .inkable { transition: opacity .2s ease, color .2s ease !important; }
body.reduced [data-step].gone { opacity: 0; }
body.reduced .slide[data-cur="1"] .coupon .ticket { animation: none; opacity: 0; transition: opacity .2s; }
body.reduced .coupon.on { transform: rotate(-5deg) !important; }
