/* "I believe the best ideas get even better together.": a sentence that is typed out as if someone were writing it while you watch
   (js/typed-quote.js). When the last word is typed it is picked out in pink, with a selection outline and two round handles. */
.tq {
  --pink: #e07aa9; /* the outline and the handles */
  --pink-fill: rgba(236, 160, 196, 0.32); /* the marker behind the word */
  position: absolute;
  left: 460px; /* the lower left of the board, between the Michael Scott sticker, the Harel card, the music player and the flow map: found by dragging the board down and to the left */
  top: 1783px;
  z-index: 2;
  box-sizing: border-box;
  width: 400px;
  padding: 14px 26px 18px;
  user-select: none;
  -webkit-user-select: none;
}

.tq__text {
  position: relative;
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.035em;
  color: var(--ink, #1c1b19);
}

/* every word is one piece (it never breaks in the middle) and every letter is there from the start, just not shown yet,
   so the lines never move while it is typed */
.tq__w {
  display: inline-block;
  white-space: nowrap;
}

.tq__c {
  opacity: 0;
}

.tq__c.is-on {
  opacity: 1;
}

.tq__caret {
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 1.05em;
  border-radius: 1px;
  background: var(--ink, #1c1b19);
  opacity: 0;
  pointer-events: none;
}

.tq.is-typing .tq__caret {
  opacity: 1;
  animation: tq-blink 1.05s steps(1) infinite;
}

/* while a key is being pressed the caret stays on; it blinks when the typing stops for a moment */
.tq.is-typing.is-key .tq__caret {
  animation: none;
}

@keyframes tq-blink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0; }
}

/* the pink marker, its outline and its handles: behind the last word. It starts when the first letter of that word is typed and
   grows with the letters (the script sets its width), so the pink appears as the word does */
.tq__box {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  transition: width 0.12s ease-out;
}

.tq__box .fill {
  position: absolute;
  inset: 0;
  background: var(--pink-fill);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.tq__box .ln {
  position: absolute;
  width: 2px;
  background: var(--pink);
  transform: scaleY(0);
  transition: transform 0.3s cubic-bezier(0.3, 0.7, 0.2, 1);
}

/* the left line hangs a little below the box, the right line a little above it (like a selection's two handles) */
.tq__box .ln.l { left: 0; top: -2px; bottom: -14px; transform-origin: 50% 0; }
.tq__box .ln.r { right: 0; top: -14px; bottom: -2px; transform-origin: 50% 100%; }

.tq__box .dot {
  position: absolute;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--pink);
  transform: scale(0);
  transition: transform 0.35s cubic-bezier(0.3, 1.7, 0.5, 1) 0.1s;
}

.tq__box .dot.l { left: -6px; bottom: -22px; }
.tq__box .dot.r { right: -6px; top: -22px; }

.tq.is-marking .tq__box .fill { opacity: 1; }
.tq.is-marking .tq__box .ln { transform: scaleY(1); }
.tq.is-marking .tq__box .dot { transform: scale(1); }

/* the word itself sits above the marker */
.tq__w--mark {
  position: relative;
  z-index: 1;
}

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

@media (prefers-reduced-motion: reduce) {
  .tq__box,
  .tq__box .fill,
  .tq__box .ln,
  .tq__box .dot {
    transition: none;
  }

  .tq.is-typing .tq__caret {
    animation: none;
  }
}

/* phones and tablets get the simpler home page without it */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  body.home .tq {
    display: none;
  }
}
