/*
 * First entry into the app: a green four-leaf clover makes room and grows its fifth, golden leaf
 * (the Quintleaf mark), then the page shows. intro.js decides when it plays and when it leaves.
 *
 * Timeline (ms): 120–890 the four leaves sprout one after another · 1000–1600 they part ·
 * 1080–1820 the gold leaf rises and opens · 1500–2400 its glow · 1700–2500 a sheen crosses it ·
 * 1750–2210 the wordmark. CSS animations, not JS: they stay smooth while the page is still loading.
 * Only transform and opacity move (the sheen is a transform inside the SVG).
 */
.ql-intro { display: none; }
.ql-intro-on, .ql-intro-on body { overflow: hidden; }

.ql-intro-on .ql-intro {
  /* easeOutBack (easings.net): the small pop when the gold leaf opens */
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --cx: 95px;   /* the clover's centre inside .ql-clover, where the leaves meet */
  --cy: 104px;
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: radial-gradient(60% 55% at 50% 44%, var(--surface) 0%, var(--bg) 72%);
  cursor: pointer;
  transition: opacity 360ms var(--ease-out);
}
.ql-intro.is-leaving { opacity: 0; pointer-events: none; }

.ql-intro-stage { display: grid; justify-items: center; gap: 22px; transform: translateY(-3vh); }
.ql-clover { position: relative; width: 190px; height: 170px; }
.ql-intro svg { width: 100%; height: 100%; overflow: visible; stroke: none; }
.ql-intro .ql-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.ql-s-green-0 { stop-color: var(--green-900); }
.ql-s-green-1 { stop-color: var(--green-600); }
.ql-s-gold-0 { stop-color: var(--gold-600); }
.ql-s-gold-1 { stop-color: var(--gold); }
.ql-s-gold-2 { stop-color: color-mix(in srgb, var(--gold) 45%, #fff); }
/* a thin light edge keeps overlapping leaves apart */
.ql-edge { stroke: var(--surface); stroke-width: 1.2; stroke-linejoin: round; }
.ql-vein { fill: none; stroke: var(--green-100); stroke-opacity: .42; stroke-width: .7; stroke-linecap: round; }
.ql-vein--gold { stroke: color-mix(in srgb, var(--gold-100) 70%, #fff); stroke-opacity: .75; stroke-width: .8; }

/* ---- the four green leaves: sprout, then part to make room at the top ---- */
.ql-leaf {
  position: absolute;
  left: calc(var(--cx) - 36px);
  top: calc(var(--cy) - 72px);
  width: 72px;
  height: 72px;
  transform-origin: 50% 100%;
  animation: 600ms var(--ease-in-out) 1000ms both;
}
/* from a cross (45° apart from the top) to the mark's places (72° apart), a little smaller */
.ql-leaf--1 { transform: rotate(72deg) scale(.94);  animation-name: ql-part-1; }
.ql-leaf--2 { transform: rotate(144deg) scale(.94); animation-name: ql-part-2; }
.ql-leaf--3 { transform: rotate(216deg) scale(.94); animation-name: ql-part-3; }
.ql-leaf--4 { transform: rotate(288deg) scale(.94); animation-name: ql-part-4; }
@keyframes ql-part-1 { from { transform: rotate(45deg) scale(1); } }
@keyframes ql-part-2 { from { transform: rotate(135deg) scale(1); } }
@keyframes ql-part-3 { from { transform: rotate(225deg) scale(1); } }
@keyframes ql-part-4 { from { transform: rotate(315deg) scale(1); } }

.ql-leaf-grow {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: 50% 100%;
  animation: ql-sprout 560ms var(--ease-out) 120ms both;
}
.ql-leaf--2 .ql-leaf-grow { animation-delay: 190ms; }
.ql-leaf--3 .ql-leaf-grow { animation-delay: 260ms; }
.ql-leaf--4 .ql-leaf-grow { animation-delay: 330ms; }
@keyframes ql-sprout {
  from { opacity: 0; transform: scale(.4, .3); }
  45% { opacity: 1; }
}

/* ---- the fifth leaf: a thin shoot rises from the centre, then opens gold ---- */
.ql-glow {
  position: absolute;
  left: calc(var(--cx) - 62px);
  top: calc(var(--cy) - 116px);
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 55%, transparent), color-mix(in srgb, var(--gold) 0%, transparent));
  opacity: 0;
  transform: scale(.6);
  animation: ql-glow 900ms var(--ease-out) 1500ms forwards;
}
@keyframes ql-glow {
  40% { opacity: 1; transform: scale(1.05); }
  to { opacity: .55; transform: none; }
}
.ql-intro.is-waiting .ql-glow { opacity: .55; transform: none; animation: ql-breathe 1400ms var(--ease-in-out) infinite alternate; }
@keyframes ql-breathe { to { opacity: 1; transform: scale(1.08); } }

.ql-gold {
  position: absolute;
  left: calc(var(--cx) - 31.5px);
  top: calc(var(--cy) - 99px);
  width: 63px;
  height: 99px;
}
.ql-gold-rise, .ql-gold-open { display: block; width: 100%; height: 100%; transform-origin: 50% 100%; }
.ql-gold-rise { animation: ql-rise 700ms var(--ease-out) 1080ms both; }
.ql-gold-open { animation: ql-open 640ms var(--ease-out-back) 1180ms both; }
@keyframes ql-rise {
  from { opacity: 0; transform: scaleY(.18); }
  30% { opacity: 1; }
}
@keyframes ql-open { from { transform: rotate(-14deg) scaleX(.22); } }

.ql-sheen { transform: translateX(-40px); animation: ql-sheen 800ms var(--ease-in-out) 1700ms forwards; }
@keyframes ql-sheen { to { transform: translateX(60px); } }

.ql-intro-word { width: auto; height: 28px; opacity: 0; transform: translateY(8px); animation: ql-word 460ms var(--ease-out) 1750ms forwards; }
@keyframes ql-word { to { opacity: 1; transform: none; } }

/* Fewer, gentler: no growing, turning or sliding; the leaves and the wordmark fade in, the gold one last. */
@media (prefers-reduced-motion: reduce) {
  .ql-leaf, .ql-sheen, .ql-gold-open { animation: none; }
  .ql-leaf .ql-leaf-grow { animation: ql-fade 240ms ease both; }
  .ql-gold-rise { animation: ql-fade 400ms ease 450ms both; }
  .ql-glow { transform: none; animation: ql-glow-in 400ms ease 450ms forwards; }
  .ql-intro.is-waiting .ql-glow { animation: none; }
  .ql-intro-word { transform: none; animation: ql-word 300ms ease 500ms forwards; }
  .ql-intro-on .ql-intro { transition-duration: 200ms; }
}
@keyframes ql-fade { from { opacity: 0; } }
@keyframes ql-glow-in { to { opacity: .55; } }
