/*
 * First-time guide (js/tutorial.js): en Tionet and his speech bubble over the
 * main screen, with a spotlight on the part he is talking about.
 */
.tt { position: fixed; inset: 0; z-index: 90; animation: tt-in .3s ease-out both; cursor: pointer; }
.tt.out { animation: tt-out .3s ease-in both; }
html.tt-open, html.tt-open body { overscroll-behavior: none; }

/* The spotlight: a clear window in a dark veil, moving from part to part. */
.tt-spot {
  position: fixed; border-radius: 20px; pointer-events: auto;
  box-shadow: 0 0 0 200vmax rgba(14, 10, 6, .72), 0 0 0 3px #f2b705, 0 0 24px 6px rgba(242, 183, 5, .45);
  transition: top .45s cubic-bezier(.3, .9, .3, 1), left .45s cubic-bezier(.3, .9, .3, 1), width .45s cubic-bezier(.3, .9, .3, 1), height .45s cubic-bezier(.3, .9, .3, 1);
  animation: tt-pulse 1.8s ease-in-out infinite;
}

/* En Tionet sits on top of his speech bubble, at the bottom (or top) of the screen. */
.tt-guide {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); width: min(560px, calc(100% - 24px));
  transform: translateX(-50%);
  display: flex; flex-direction: column;
}
/* Pointing at something low on the screen: the bubble goes up and en Tionet hangs below it. */
.tt-guide.top { bottom: auto; top: calc(8px + env(safe-area-inset-top)); flex-direction: column-reverse; }
.tt-guide.top .tt-tionet { width: 120px; margin: -14px 0 0 auto; margin-right: 10px; }
/* The welcome: nothing to point at yet, so he stands big in the middle. */
.tt-guide.center { bottom: auto; top: 50%; transform: translate(-50%, -50%); }
.tt-guide.center .tt-tionet { width: 230px; margin: 0 auto -22px; }
.tt-guide.hop .tt-bubble { animation: tt-hop .4s cubic-bezier(.3, 1.5, .5, 1); }
.tt-tionet { display: block; width: 150px; height: auto; margin: 0 0 -18px 6px; position: relative; z-index: 1; overflow: visible; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .35)); }
.tt-bubble { position: relative; padding: 16px 18px 14px; }
.tt-name { font-family: var(--display); font-weight: 800; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.tt-text { margin-top: 4px; min-height: 4.5em; font-size: 1.08rem; line-height: 1.45; font-weight: 600; }
.tt-foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.tt-dots { display: flex; gap: 5px; margin-right: auto; }
.tt-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.tt-dots i.on { background: var(--accent); width: 18px; border-radius: 99px; }
.tt-tap { white-space: nowrap; font-size: .86rem; font-weight: 700; color: var(--muted); animation: tt-blinktext 1.6s ease-in-out infinite; }
.tt:focus { outline: none; }

/* He breathes, blinks, waves his twig and moves his mouth while he talks. */
.tt-tionet .tt-body { transform-box: view-box; transform-origin: 100px 120px; animation: tt-breathe 2.6s ease-in-out infinite; }
.tt-tionet .tt-arm { transform-box: view-box; transform-origin: 104px 46px; animation: tt-wave 1.2s ease-in-out infinite; }
.tt-tionet .tt-eyes { transform-box: view-box; transform-origin: 52px 73px; animation: tt-blink 4.2s infinite; }
.tt-tionet .tt-cap { transform-box: view-box; transform-origin: 52px 50px; animation: tt-cap 2.6s ease-in-out infinite; }
.tt-tionet .tt-talk { display: none; }
.tt.talking .tt-tionet .tt-smile { display: none; }
.tt.talking .tt-tionet .tt-talk { display: inline; transform-box: fill-box; transform-origin: 50% 0; animation: tt-mouth .22s ease-in-out infinite alternate; }

@keyframes tt-in { from { opacity: 0; } }
@keyframes tt-blinktext { 50% { opacity: .45; } }
@keyframes tt-out { to { opacity: 0; } }
@keyframes tt-hop { 0% { transform: translateY(10px) scale(.97); } 60% { transform: translateY(-4px); } }
@keyframes tt-pulse { 50% { box-shadow: 0 0 0 200vmax rgba(14, 10, 6, .72), 0 0 0 3px #f2b705, 0 0 34px 10px rgba(242, 183, 5, .6); } }
@keyframes tt-breathe { 50% { transform: scale(1.025, .975); } }
@keyframes tt-wave { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(16deg); } }
@keyframes tt-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes tt-cap { 50% { transform: rotate(-3deg); } }
@keyframes tt-mouth { from { transform: scaleY(.45); } to { transform: scaleY(1); } }
