/*
 * Tadaroo live logo: "The Pocket", with Tadaroo peeking out (round 2).
 * Rules for old smart-TV browsers (Chromium 53+):
 *   - only `transform` and `opacity` are animated, only on <g> groups;
 *   - no filters, masks, blend modes, CSS variables in keyframes or transform-box;
 *   - transform origins are written in SVG user units by the script (px = user units).
 * Timeline (1.4 s) is matched to the "ta-da!" sting:
 *   0.00-0.20  the pocket pops on               (qanun run)
 *   0.25-0.36  the pocket squashes              ("ta")
 *   0.40       Tadaroo springs up out of it, ears flop open, the glow lights ("DA!")
 *   0.45-1.20  the two names come out of the pocket, reading outward; his eyes open
 *   1.20-1.40  settle: a small bounce and a sly blink (chord tail)
 */

.tadaroo-logo {
  display: inline-block;
  line-height: 0;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
.tadaroo-logo svg { display: block; width: 100%; height: auto; overflow: visible; }
.tadaroo-logo:focus-visible { box-shadow: 0 0 0 3px rgba(255, 210, 94, 0.6); border-radius: 12px; }

/* word colours (the mark carries its own colours per theme) */
.tl-word { fill: #FFF4E0; }
.tl-theme-cream .tl-word { fill: #2B1640; }

/* ---------------- intro (1.4 s) ---------------- */
.is-intro .tl-root   { animation: tl-settle 1.4s linear both; }
.is-intro .tl-pocket { animation: tl-pocket-intro 1.4s linear both; }
.is-intro .tl-peek   { animation: tl-peek-intro 1.4s linear both; }
.is-intro .tl-ear-l  { animation: tl-ear-l-intro 1.4s linear both; }
.is-intro .tl-ear-r  { animation: tl-ear-r-intro 1.4s linear both; }
.is-intro .tl-eyes   { animation: tl-eyes-intro 1.4s linear both; }
.is-intro .tl-glow   { animation: tl-glow-intro 1.4s linear both; }
.is-intro .tl-glyph-ar { animation: tl-out-left 0.46s cubic-bezier(0.2, 0.9, 0.3, 1.25) both; }
.is-intro .tl-glyph-la { animation: tl-out-right 0.46s cubic-bezier(0.2, 0.9, 0.3, 1.25) both; }

@keyframes tl-pocket-intro {
  0%   { opacity: 0; transform: scale(0.2, 0.2); animation-timing-function: cubic-bezier(0.2, 0.8, 0.4, 1.3); }
  14%  { opacity: 1; transform: scale(1, 1); animation-timing-function: ease-in-out; }
  18%  { transform: scale(1, 1); animation-timing-function: ease-in; }
  26%  { transform: scale(1.12, 0.84); animation-timing-function: ease-out; }  /* "ta" */
  31%  { transform: scale(0.94, 1.08); animation-timing-function: ease-in-out; } /* "DA!" */
  40%  { transform: scale(1.03, 0.97); animation-timing-function: ease-in-out; }
  50%  { transform: scale(1, 1); }
  100% { opacity: 1; transform: scale(1, 1); }
}
@keyframes tl-peek-intro {           /* hidden in the pocket, then springs up on "DA!" */
  0%   { opacity: 0; transform: translate(0, 104px); }
  13%  { opacity: 0; transform: translate(0, 104px); }
  14%  { opacity: 1; transform: translate(0, 104px); }
  28%  { opacity: 1; transform: translate(0, 104px); animation-timing-function: cubic-bezier(0.15, 0.9, 0.35, 1.2); }
  38%  { transform: translate(0, -9px); animation-timing-function: ease-in-out; }
  47%  { transform: translate(0, 3px); animation-timing-function: ease-in-out; }
  55%  { transform: translate(0, 0); }
  100% { opacity: 1; transform: translate(0, 0); }
}
@keyframes tl-ear-l-intro {          /* ears trail behind the jump, then flop open */
  0%, 30% { transform: rotate(14deg); animation-timing-function: ease-out; }
  42%  { transform: rotate(-9deg); animation-timing-function: ease-in-out; }
  52%  { transform: rotate(4deg); animation-timing-function: ease-in-out; }
  60%  { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}
@keyframes tl-ear-r-intro {
  0%, 31% { transform: rotate(-14deg); animation-timing-function: ease-out; }
  44%  { transform: rotate(10deg); animation-timing-function: ease-in-out; }
  54%  { transform: rotate(-4deg); animation-timing-function: ease-in-out; }
  62%  { transform: rotate(0deg); }
  86%  { transform: rotate(0deg); animation-timing-function: ease-out; }
  91%  { transform: rotate(12deg); animation-timing-function: ease-in-out; }  /* a cheeky twitch */
  100% { transform: rotate(0deg); }
}
@keyframes tl-eyes-intro {           /* eyes closed in the pocket, open after the jump, sly blink at the end */
  0%, 40% { transform: scale(1, 0.12); }
  48%  { transform: scale(1, 1); }
  88%  { transform: scale(1, 1); }
  92%  { transform: scale(1, 0.12); }
  96%, 100% { transform: scale(1, 1); }
}
@keyframes tl-glow-intro {
  0%, 28% { opacity: 0; transform: scale(0.4, 0.4); animation-timing-function: ease-out; }
  40%  { opacity: 1; transform: scale(1.15, 1.15); animation-timing-function: ease-in-out; }
  56%, 100% { opacity: 1; transform: scale(1, 1); }
}
@keyframes tl-out-left {  /* Arabic: right to left, out of the pocket on its right */
  0%   { opacity: 0; transform: translate(46px, 0) scale(0.35, 0.35); }
  45%  { opacity: 1; }
  100% { opacity: 1; transform: translate(0, 0) scale(1, 1); }
}
@keyframes tl-out-right { /* Latin: left to right, out of the pocket on its left */
  0%   { opacity: 0; transform: translate(-46px, 0) scale(0.35, 0.35); }
  45%  { opacity: 1; }
  100% { opacity: 1; transform: translate(0, 0) scale(1, 1); }
}
@keyframes tl-settle {
  0%, 84% { transform: translate(0, 0); animation-timing-function: ease-out; }
  91%  { transform: translate(0, -4px); animation-timing-function: ease-in; }
  100% { transform: translate(0, 0); }
}

/* ---------------- idle loop (loading screens): an ear twitch and a slow blink ---------------- */
.is-idle .tl-ear-r  { animation: tl-twitch 3.2s ease-in-out infinite; }
.is-idle .tl-eyes   { animation: tl-blink 3.2s linear infinite; }
.is-idle .tl-peek   { animation: tl-breathe 3.2s ease-in-out infinite; }

@keyframes tl-twitch {
  0%, 30%, 44%, 100% { transform: rotate(0deg); }
  35% { transform: rotate(13deg); }
  39% { transform: rotate(-3deg); }
}
@keyframes tl-blink {
  0%, 70%, 76%, 100% { transform: scale(1, 1); }
  73% { transform: scale(1, 0.12); }
}
@keyframes tl-breathe {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(0, 2px); }
}

/* ---------------- hover: twitch and blink;  tap: ta-da ---------------- */
.is-poke .tl-ear-r { animation: tl-poke-ear 0.6s ease-in-out both; }
.is-poke .tl-eyes  { animation: tl-poke-blink 0.5s linear both; }
.is-tada .tl-peek  { animation: tl-tada-hop 0.7s linear both; }
.is-tada .tl-ear-l { animation: tl-tada-ear-l 0.7s ease-in-out both; }
.is-tada .tl-ear-r { animation: tl-tada-ear-r 0.7s ease-in-out both; }
.is-tada .tl-pocket { animation: tl-tada-pocket 0.7s ease-in-out both; }
.is-tada .tl-glow  { animation: tl-tada-glow 0.7s ease-out both; }

@keyframes tl-poke-ear {
  0%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(15deg); }
  60% { transform: rotate(-4deg); }
}
@keyframes tl-poke-blink {
  0%, 30%, 60%, 100% { transform: scale(1, 1); }
  45% { transform: scale(1, 0.12); }
}
@keyframes tl-tada-hop {
  0%   { transform: translate(0, 0); animation-timing-function: ease-in; }
  15%  { transform: translate(0, 10px); animation-timing-function: cubic-bezier(0.2, 0.9, 0.3, 1.2); }
  45%  { transform: translate(0, -14px); animation-timing-function: ease-in-out; }
  70%  { transform: translate(0, 2px); animation-timing-function: ease-in-out; }
  100% { transform: translate(0, 0); }
}
@keyframes tl-tada-ear-l { 0%, 100% { transform: rotate(0deg); } 45% { transform: rotate(-12deg); } 70% { transform: rotate(4deg); } }
@keyframes tl-tada-ear-r { 0%, 100% { transform: rotate(0deg); } 45% { transform: rotate(12deg); } 70% { transform: rotate(-4deg); } }
@keyframes tl-tada-pocket {
  0%, 100% { transform: scale(1, 1); }
  15% { transform: scale(1.08, 0.9); }
  45% { transform: scale(0.96, 1.05); }
}
@keyframes tl-tada-glow {
  0% { transform: scale(1, 1); opacity: 1; }
  40% { transform: scale(1.35, 1.35); opacity: 1; }
  100% { transform: scale(1, 1); opacity: 1; }
}

/* ---------------- reduced motion: no movement, a soft glow instead ---------------- */
.tl-reduced .tl-root, .tl-reduced .tl-root * { animation: none !important; }
.tl-reduced .tl-glow { transition: opacity 0.3s; }
.tl-reduced.is-tada .tl-glow, .tl-reduced.is-poke .tl-glow { opacity: 0.4; }
@media (prefers-reduced-motion: reduce) {
  .tadaroo-logo .tl-root, .tadaroo-logo .tl-root * { animation: none !important; }
  .tadaroo-logo .tl-glow { transition: opacity 0.3s; }
  .tadaroo-logo.is-tada .tl-glow, .tadaroo-logo.is-poke .tl-glow { opacity: 0.4; }
}
