/* Cannabionics v4, package M2: grow sequence (/how-it-works#grow), configurator bottle (/products#configure), quiz (/#fit,
   /resources#fit). Static states live in css/v4.css and css/p-guides.css; this file holds the M2 motion states.
   Motion only on transform, opacity, stroke-dashoffset; will-change only under .is-animating. */

/* ---------- 1. grow sequence ----------
   Layout, rig and numbers baseline: css/p-guides.css (B2, static final state). This block adds the motion states,
   which apply only once js/v4-grow.js has marked the figure .is-live. */
.v4-grow__drop { opacity: 0; }
.v4-grow.is-live .v4-grow__liquid { transform-box: fill-box; transform-origin: 50% 100%; }
/* bottom-up reveal of the inked plant over its ghost, transforms only: the window (.v4-grow__reveal, overflow hidden)
   moves down by (1 - g) of the plant height while the drawing inside moves up by the same amount, so the drawing stays
   put and only the window's top edge travels. The window reaches 28px above the plant for a feathered edge.
   --g (0 to 1, plant inked from the bottom up to that share) is written on .v4-grow per frame by js/v4-grow.js. */
.v4-grow.is-live .v4-grow__reveal {
  inset: -28px 0 0; transform: translateY(calc((1 - var(--g, 1)) * (100% - 28px)));
  -webkit-mask-image: linear-gradient(transparent, #000 28px); mask-image: linear-gradient(transparent, #000 28px);
}
.v4-grow.is-live .v4-grow__ink { top: 28px; height: auto; bottom: 0; transform: translateY(calc((var(--g, 1) - 1) * 100%)); }
.v4-grow.is-live .v4-grow__bud {
  opacity: 0; transform: translateY(6px) scale(.6); transform-box: fill-box; transform-origin: 50% 100%;
  transition: opacity var(--t-grow) var(--ease-out), transform var(--t-grow) var(--ease-out); transition-delay: calc(var(--i, 0) * 60ms);
}
.v4-grow.is-live.is-step-5 .v4-grow__bud { opacity: 1; transform: none; }
.v4-grow.is-animating :is(.v4-grow__cart, .v4-grow__liquid, .v4-grow__drop, .v4-grow__tube, .v4-grow__reveal, .v4-grow__ink) { will-change: transform, opacity; }
.v4-grow__steps .v3-step__n { transition: background-color 300ms var(--ease-out), color 300ms var(--ease-out); }
.v4-grow__steps > li.is-current .v3-step__n { background: var(--cb-green); color: #fff; }

/* under 960 the stage becomes a short sticky band (art left, numbers right) so the sequence stays in view while the
   steps scroll under it; the spec's non-sticky stage would scroll away before any step played */
@media (max-width: 959.98px) {
  .v4-grow.is-live .v4-grow__stage {
    position: sticky; top: var(--nav-h); z-index: 2; width: auto; max-width: none; margin: 0 calc(-1 * var(--gutter)); padding: var(--s-3) var(--gutter);
    grid-template-columns: min(28svh, 46%) minmax(0, 1fr); align-items: end;
    background: var(--v4-grow-bg, #fff); box-shadow: 0 1px 0 var(--cb-hair);
  }
  .v4-grow.is-live .v4-grow__plant, .v4-grow.is-live .v4-grow__rig { grid-area: 1 / 1 / 3 / 2; }
  .v4-grow.is-live .v4-grow__num { grid-column: 2; }
  .v4-grow.is-live .v4-grow__steps > li { min-height: 46svh; display: flex; flex-direction: column; justify-content: center; }
}
@media (min-width: 960px) {
  /* the sticky stage must fit a short laptop viewport: art height is 1.216 x stage width, numbers take ~180px */
  .v4-grow__stage { max-width: calc((100vh - var(--nav-h) - 200px) / 1.216); }
  /* room after the last step so the stage stays pinned while step 5 is read; progress ignores this padding */
  .v4-grow.is-live .v4-grow__steps { padding-bottom: 36vh; }
}
@media (prefers-reduced-motion: reduce) {
  .v4-grow.is-live .v4-grow__steps { padding-bottom: 0; }
  .v4-grow.is-live .v4-grow__stage { position: static; box-shadow: none; }
  .v4-grow.is-live .v4-grow__bud { opacity: 1; transform: none; }
}

/* ---------- 2. configurator bottle (js/v4-bottle.js) ---------- */
.v4-bottle__oil, .v4-bottle__meniscus { transition: transform var(--t-fill) var(--ease-out), fill 600ms var(--ease-out); }
.v4-bottle__meniscus { fill: #fff3c4; opacity: .9; }
.v4-bottle.is-live .v4-bottle__drops circle { opacity: 0; transform: translateY(-5px); transition: opacity 240ms var(--ease-out), transform 240ms var(--ease-out); transition-delay: calc(var(--i, 0) * 40ms); }
.v4-bottle.is-live .v4-bottle__drops circle.is-on { opacity: 1; transform: none; }
.v4-bottle.is-instant * { transition: none !important; }
/* one-line caption, right aligned under the bottle; it may run wider than the 60px figure, toward the panel text side */
.v4-bottle { display: flex; flex-direction: column; align-items: flex-end; }
.v4-bottle svg { align-self: stretch; }
.v4-bottle figcaption { width: max-content; white-space: nowrap; text-align: right; line-height: 1.4; }

/* ---------- 3. quiz (js/v4-quiz.js) ---------- */
.v4-quiz__dots { display: flex; gap: 8px; margin: 0 0 var(--s-4); padding: 0; list-style: none; }
.v4-quiz__dots li { width: 6px; height: 6px; border-radius: 50%; background: var(--cb-hair); transition: background-color 240ms var(--ease-out), transform 240ms var(--ease-out); }
.v4-quiz__dots li.is-on, .v4-quiz__dots.is-done li { background: var(--cb-green); }
.v4-quiz__dots li.is-on { transform: scale(1.35); }
.v4-quiz__q legend:focus { outline: none; }
.v4-quiz__q legend:focus-visible { outline: 2px solid var(--cb-green-deep); outline-offset: 4px; }
.v4-quiz__q, .v4-quiz__result { transition: transform 240ms var(--ease-out), opacity 240ms var(--ease-out); }
.v4-quiz .is-out-left { transform: translateX(-24px); opacity: 0; }
.v4-quiz .is-out-right { transform: translateX(24px); opacity: 0; }
.v4-quiz .is-from-right { transform: translateX(24px); opacity: 0; transition: none; }
.v4-quiz .is-from-left { transform: translateX(-24px); opacity: 0; transition: none; }
.v4-quiz .is-out-left, .v4-quiz .is-out-right { will-change: transform, opacity; }
.v4-quiz__err { margin-top: var(--s-3); color: var(--cb-err); font-size: var(--fs-small); }
.v4-quiz__err:empty { display: none; }
.v4-quiz__result:focus { outline: none; }
.v4-quiz__result { display: grid; gap: var(--s-3); max-width: 640px; padding: var(--s-6); border-radius: var(--r-panel); background: #fff; box-shadow: inset 0 0 0 1px var(--cb-hair), var(--sh-1); }
.v4-quiz__result[hidden] { display: none; }
.v4-quiz__kicker { font: 500 var(--fs-mono)/1 var(--ff-mono); letter-spacing: var(--ls-mono); text-transform: uppercase; color: var(--cb-green-deep); }
.v4-quiz__pick { font-family: var(--ff-display); font-size: var(--fs-h2); font-weight: 500; line-height: var(--lh-head); letter-spacing: var(--ls-head); color: var(--cb-ink); }
.v4-quiz__why { color: var(--cb-text); }
.v4-quiz__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-2); }
.v4-quiz__actions .v3-btn--ghost { color: var(--cb-ink); box-shadow: inset 0 0 0 1.5px var(--cb-hair); }
@media (prefers-reduced-motion: reduce) {
  .v4-quiz .is-out-left, .v4-quiz .is-out-right, .v4-quiz .is-from-left, .v4-quiz .is-from-right { transform: none; opacity: 1; }
}
