/* Homepage opening. The photos are drawn on the canvas, the headline is real text on top. */

:root {
  --green: #8aab1f;
  --ink: #2d2d2e;
  --mute: #515154;
  --sans: "Montserrat", "itc-avant-garde-gothic-pro", "Avenir Next", "Century Gothic", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #0b0b0b;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Thin green bar along the bottom that fills as the opening plays */
#progress {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 0;
  height: 3px;
  background: var(--green);
  z-index: 6;
}

#skip {
  position: fixed;
  right: clamp(20px, 4vw, 56px);
  bottom: clamp(44px, 7vh, 68px);
  z-index: 8;
  padding: 10px 16px;
  font: 600 11px var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 99px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

#skip:hover {
  background: rgba(0, 0, 0, 0.6);
}

#skip:empty {
  display: none;
}

#skip:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}

/* ---- Headline ---- */

#headline {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 5vw;
  text-align: center;
  opacity: 0;
  pointer-events: none;
}

/* white sheet behind the headline, fades in when the headline appears */
#headline::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: #fff;
  opacity: 0;
  transition: opacity 0.55s ease;
}

#headline.on,
#headline.on::before {
  opacity: 1;
}

#headline h1 {
  width: 100%;
  margin: 0;
  font-size: clamp(40px, 7.5vw, 120px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.055em;
  color: var(--ink);
}

/* each line slides up from below its own edge */
#headline .line {
  display: block;
  overflow: hidden;
  padding: 0.04em 0 0.1em;
}

#headline .line > span {
  display: block;
  white-space: nowrap;
  transform: translateY(112%);
  transition: transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#headline.on .line > span {
  transform: none;
  transition-delay: 0.55s;
}

#headline.on .line:nth-child(2) > span {
  transition-delay: 0.65s;
}

#headline.on .line:nth-child(3) > span {
  transition-delay: 0.75s;
}

/* the rotating word */
#head-words {
  position: relative;
  display: block;
  height: 1.1em;
  color: var(--green);
}

#head-words b {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  white-space: nowrap;
  font-weight: 700;
  visibility: hidden; /* waiting words sit just below the line, keep them out of sight */
  transform: translateY(112%);
  transition: transform 0.75s cubic-bezier(0.7, 0, 0.2, 1);
}

#head-words b.on,
#head-words b.off {
  visibility: visible;
}

#head-words b.on {
  transform: none;
}

#head-words b.off {
  transform: translateY(-112%);
}

#head-tagline {
  margin: 3.2vh auto 0;
  font-size: clamp(15px, 1.4vw, 22px);
  color: var(--mute);
  opacity: 0;
  transition: opacity 1s 1.2s;
}

#headline.on #head-tagline {
  opacity: 1;
}

/* ---- Logo letters flying onto the headline ----
   While "morph" is set, the headline is split into single letters that the script moves. */

#headline.morph::before {
  opacity: 0;
  transition: none;
}

#headline.morph .line > span {
  transform: none;
  transition: none;
}

#headline h1 i {
  display: inline-block;
  font-style: normal;
}

#headline.morph.on #head-tagline {
  transition-delay: 1s;
}

/* ---- Scroll cue: a thin line that grows and shrinks under the headline ---- */

#scroll-cue {
  position: fixed;
  left: 0;
  right: 0;
  bottom: clamp(18px, 4vh, 34px);
  z-index: 9;
  width: max-content;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  background: none;
  border: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.8s 0.9s;
}

#headline.on ~ #scroll-cue {
  opacity: 1;
}

#scroll-cue i {
  display: block;
  width: 1px;
  height: 34px;
  background: linear-gradient(var(--ink), transparent);
  animation: scroll-cue 1.6s ease-in-out infinite;
}

@keyframes scroll-cue {
  0% {
    transform: scaleY(0.2);
    transform-origin: top;
  }
  50% {
    transform: scaleY(1);
    transform-origin: top;
  }
  51% {
    transform-origin: bottom;
  }
  100% {
    transform: scaleY(0.2);
    transform-origin: bottom;
  }
}


/* ---- Digital Innovation since 1999: the logo letters change shape into the digits ---- */

#morph {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
}

/* the words rise into place; the digits and the square wait until the morphing letters land on them */
#headline.morph #head-top,
#headline.morph #since {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.35em);
  transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#headline.morph #head-top {
  display: block;
}

#headline.rise #head-top,
#headline.rise #since {
  opacity: 1;
  transform: none;
}


#sq {
  display: inline-block;
  width: 0.15em;
  height: 0.15em;
  margin-left: 0.06em;
  background: var(--green);
}

/* only the plain-fade version fades the real digits in; the morph swaps them for the drawn ones in one frame */
#headline.fademode #digits,
#headline.fademode #sq {
  transition: opacity 0.8s ease 0.1s;
}

#headline.morph #digits,
#headline.morph #sq {
  opacity: 0;
}

#headline.landed #digits,
#headline.landed #sq {
  opacity: 1;
}

#headline.morph.on #head-tagline {
  transition-delay: 0.7s;
}

/* "Digital Innovation since 1999" has no rotating-word line */
#headline .line:nth-child(2){display:none !important}
