/* «Почемучка»: 15 сцен-ответов на одной картинке (story-pochemu.js). Префикс pq-. */

/* карточка: вопрос — заголовок, ответ всегда открыт */
.pq-qa { margin: 0; }
.pq-qa summary { display: block; list-style: none; margin: 6px 0 8px; font: 900 28px/1.2 var(--text); color: var(--ink);
  cursor: default; pointer-events: none; }
.pq-qa summary::-webkit-details-marker { display: none; }
.pq-qa summary::marker { content: ""; }
.pq-qa summary:focus { outline: none; }
.pq-qa p { margin: 0 0 14px; }
.pq-acts { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 860px) { .pq-qa summary { font-size: 23px; } }

/* сцены: видна одна, соседняя плавно сменяет её */
.trip .pq-sc { opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility 0s linear .35s; }
.trip .pq-sc.on { opacity: 1; visibility: visible; transition: opacity .35s ease; }

/* общие движения */
.pq-dots path, path.pq-dots { stroke-dasharray: 0 24; }
.pq-sc.on .pq-dots path, .pq-sc.on path.pq-dots { animation: pq-flow 1.1s linear infinite; }
.pq-vap path { stroke-dasharray: 12 12; }
.pq-sc.on .pq-vap path { animation: pq-flow .9s linear infinite; }
.pq-dots2 path { stroke-dasharray: 0 24; }
.pq-sc.on .pq-dots2 path { animation: pq-flow 1.4s linear infinite; }
.pq-dash path { stroke-dasharray: 14 18; }
.pq-sc.on .pq-dash path { animation: pq-flow2 1s linear infinite; }
@keyframes pq-flow { to { stroke-dashoffset: -48; } }
@keyframes pq-flow2 { to { stroke-dashoffset: -64; } }
.pq-pop { transform-box: fill-box; transform-origin: center; animation: pq-pop .5s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes pq-pop { from { transform: scale(0); } to { transform: scale(1); } }
.pq-wig { transform-box: fill-box; transform-origin: center; }
.pq-sc.on .pq-wig { animation: pq-wig 1.3s ease-in-out infinite alternate; }
@keyframes pq-wig { from { transform: rotate(-9deg) scale(1); } to { transform: rotate(9deg) scale(1.06); } }

/* 1. море */
.pq-glow { opacity: .6; transform-box: fill-box; transform-origin: center; }
.trip.salt .pq-glow { animation: pq-glow 1s ease-out; }
@keyframes pq-glow { 30% { transform: scale(1.35); opacity: 1; } }
.pq-puffs circle { opacity: 0; }
.trip.salt .pq-puffs circle { animation: pq-rise 1.6s ease-out both; }
.pq-puffs circle:nth-child(2) { animation-delay: .2s !important; }
.pq-puffs circle:nth-child(3) { animation-delay: .4s !important; }
@keyframes pq-rise { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-150px); opacity: 0; } }

/* 2. синее море */
#s1-aq { transition: transform .8s cubic-bezier(.4, 1.3, .5, 1); }
.pq-pulse circle { opacity: 0; }
.trip.dive .pq-pulse circle { animation: pq-ray 1.4s ease-in both; }
@keyframes pq-ray { 0% { transform: translateY(0); opacity: 1; } 85% { opacity: 1; } 100% { transform: translateY(var(--d)); opacity: 0; } }
.pq-bubs circle { opacity: 0; }
.trip.dive .pq-bubs circle { animation: pq-bub 1.2s ease-out both; }
.pq-bubs circle:nth-child(2) { animation-delay: .25s !important; }
.pq-bubs circle:nth-child(3) { animation-delay: .5s !important; }
@keyframes pq-bub { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-70px); opacity: 0; } }

/* 3. облако */
.pq-puffs2 circle { opacity: 0; }
.trip.vapor .pq-puffs2 circle { animation: pq-up 1.5s ease-out both; }
.pq-puffs2 circle:nth-child(2n) { animation-delay: .25s !important; }
.pq-puffs2 circle:nth-child(3n) { animation-delay: .45s !important; }
@keyframes pq-up { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-270px); opacity: 0; } }
.pq-rain2 { opacity: 0; }
.trip.pq-raining .pq-rain2 { opacity: 1; }
.trip.pq-raining .pq-rain2 path { animation: pq-fall .6s linear infinite; }
@keyframes pq-fall { from { transform: translateY(-10px); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(60px); opacity: 0; } }

/* 4. радуга */
.trip.rainbow #s3-arcs path { animation: pq-draw 1.1s ease-out both; }
#s3-arcs path:nth-child(2) { animation-delay: .07s !important; }
#s3-arcs path:nth-child(3) { animation-delay: .14s !important; }
#s3-arcs path:nth-child(4) { animation-delay: .21s !important; }
#s3-arcs path:nth-child(5) { animation-delay: .28s !important; }
#s3-arcs path:nth-child(6) { animation-delay: .35s !important; }
#s3-arcs path:nth-child(7) { animation-delay: .42s !important; }
@keyframes pq-draw { from { stroke-dashoffset: 100; stroke-dasharray: 100 100; opacity: 1; } to { stroke-dashoffset: 0; stroke-dasharray: 100 100; opacity: 1; } }
.trip.rainbow #s3-glow { animation: pq-flash 1.6s ease-out; }
@keyframes pq-flash { 30% { opacity: .75; } 100% { opacity: 0; } }
.pq-stars path { opacity: 0; transform-box: fill-box; transform-origin: center; }
.trip.rainbow .pq-stars path { animation: pq-star 1.4s ease-out both; }
.pq-stars path:nth-child(2) { animation-delay: .3s !important; }
.pq-stars path:nth-child(3) { animation-delay: .6s !important; }
@keyframes pq-star { 0% { transform: scale(0) rotate(0); opacity: 1; } 50% { transform: scale(1.6) rotate(90deg); opacity: 1; } 100% { transform: scale(.4) rotate(180deg); opacity: 0; } }
.pq-sc.on .pq-rainl path { animation: pq-fall 1s linear infinite; }
.pq-rainl path:nth-child(2n) { animation-delay: .4s !important; }
.pq-rainl path:nth-child(3n) { animation-delay: .7s !important; }

/* 5. лужа */
.pq-sc.on .pq-fish { animation: pq-swim 6s ease-in-out infinite alternate; }
.pq-sc.on .pq-fish.f2 { animation-duration: 5s; animation-delay: -2s; }
.pq-sc.on .pq-fish.f3 { animation-duration: 7s; animation-delay: -4s; }
@keyframes pq-swim { from { transform: translateX(-40px); } to { transform: translateX(40px); } }
.pq-sc.on .pq-snow use { animation: pq-flake 4s linear infinite; }
.pq-snow use:nth-child(2n) { animation-delay: -1.5s !important; }
.pq-snow use:nth-child(3n) { animation-delay: -2.8s !important; }
@keyframes pq-flake { from { transform: translateY(-40px); opacity: 0; } 20% { opacity: 1; } to { transform: translateY(70px); opacity: 0; } }
.pq-snowb use { opacity: 0; }
.trip.freeze .pq-snowb use { animation: pq-flakeb 1.3s ease-in both; }
.pq-snowb use:nth-child(2n) { animation-delay: .2s !important; }
.pq-snowb use:nth-child(3n) { animation-delay: .4s !important; }
@keyframes pq-flakeb { from { transform: translateY(-30px) rotate(0); opacity: 0; } 20% { opacity: 1; } to { transform: translateY(130px); opacity: 0; } }
#s4-ice { transition: height .2s ease; }

/* 6. окно */
.pq-sc.on .pq-snowo circle { animation: pq-flake 5s linear infinite; }
.pq-snowo circle:nth-child(2n) { animation-delay: -2s !important; }
.pq-snowo circle:nth-child(3n) { animation-delay: -3.5s !important; }
.pq-sc.on .pq-steam path { stroke-dasharray: 14 12; animation: pq-flow 1.4s linear infinite reverse; }
.pq-grow { stroke-dasharray: 100 100; animation: pq-grow 1.8s ease-out both; }
@keyframes pq-grow { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }

/* 7. роса */
.pq-dd { transform-box: fill-box; transform-origin: center; }
.pq-sc.on #s6-new > g:nth-child(3n) .pq-dd { animation: pq-pop .5s cubic-bezier(.3, 1.6, .5, 1) both, pq-glint 2s ease-in-out .5s infinite; }
@keyframes pq-glint { 50% { opacity: .75; } }

/* 8. туман */
.pq-car { opacity: 0; }
.trip.fog .pq-car { animation: pq-drive 2.8s cubic-bezier(.3, 0, .7, 1) both; }
@keyframes pq-drive { 0% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(1400px); opacity: 1; } }

/* 9. река */
.pq-sc.on .pq-boat { animation: pq-bob 1.2s ease-in-out infinite alternate; }
@keyframes pq-bob { from { transform: rotate(-5deg); } to { transform: rotate(5deg) translateY(-3px); } }

/* 10. кран */
.pq-sc.on .pq-bub9 circle { animation: pq-bub 1.4s ease-out infinite; }
.pq-bub9 circle:nth-child(2) { animation-delay: .5s !important; }
.pq-bub9 circle:nth-child(3) { animation-delay: .9s !important; }
.pq-wheel { transform-box: fill-box; transform-origin: center; }
.pq-sc.run .pq-wheel { animation: pq-spin 2.4s linear infinite; }
.trip.tap .pq-wheel { animation: pq-spin .45s linear infinite; }
@keyframes pq-spin { to { transform: rotate(360deg); } }
.pq-stream { opacity: 0; stroke-dasharray: 10 6; }
.trip.tap .pq-stream { animation: pq-pour 1s linear both; }
@keyframes pq-pour { 0% { opacity: 0; stroke-dashoffset: 0; } 10%, 85% { opacity: 1; } 100% { opacity: 0; stroke-dashoffset: -48; } }

/* 11. чайник */
.pq-bub10 circle { opacity: 0; }
.pq-sc.run .pq-bub10 circle { animation: pq-bub10 1.6s ease-in infinite; }
.pq-bub10 circle:nth-child(2) { animation-delay: .4s !important; }
.pq-bub10 circle:nth-child(3) { animation-delay: .8s !important; }
.pq-bub10 circle:nth-child(4) { animation-delay: 1.1s !important; }
.pq-bub10 circle:nth-child(5) { animation-delay: 1.3s !important; }
@keyframes pq-bub10 { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-150px); opacity: 0; } }
.pq-bubb circle { opacity: 0; }
.trip.boil .pq-bubb circle { animation: pq-bub10 .7s ease-in 3; }
.pq-bubb circle:nth-child(2n) { animation-delay: .2s !important; }
.pq-bubb circle:nth-child(3n) { animation-delay: .35s !important; }
.pq-sc.on .pq-steam10 path { stroke-dasharray: 16 12; animation: pq-flow 1.2s linear infinite reverse; }
.pq-steamb circle { opacity: 0; }
.trip.boil .pq-steamb circle { animation: pq-steam 1.3s ease-out 2; }
.pq-steamb circle:nth-child(2) { animation-delay: .3s !important; }
@keyframes pq-steam { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(-30px, -140px) scale(1.6); opacity: 0; } }
.pq-fire path { transform-box: fill-box; transform-origin: 50% 100%; }
.pq-sc.run .pq-fire path { animation: pq-flick .35s ease-in-out infinite alternate; }
.pq-fire path:nth-child(2n) { animation-delay: -.15s !important; }
.trip.boil .pq-fire path { animation: pq-flame .3s ease-in-out 6 alternate; }
@keyframes pq-flick { to { transform: scaleY(.85); } }
@keyframes pq-flame { to { transform: scaleY(1.7); } }

/* 12. лупа */
.pq-zap { transform-box: fill-box; transform-origin: center; animation: pq-zap 1.8s ease both; }
@keyframes pq-zap { 0% { transform: scale(0); opacity: 1; } 25% { transform: scale(1.1); } 60% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0) rotate(200deg); opacity: 0; } }

/* 13. каток */
.pq-skater { transform-box: view-box; }
.trip.skate .pq-skater { animation: pq-glide 2.6s ease-in-out both; }
@keyframes pq-glide { 0% { transform: translateX(0); } 45% { transform: translateX(400px); } 55% { transform: translateX(410px); }
  100% { transform: translateX(0); } }
.pq-spark circle { opacity: 0; }
.trip.skate .pq-spark circle { animation: pq-spark .6s ease-out 4; }
.pq-spark circle:nth-child(2) { animation-delay: .2s !important; }
.pq-spark circle:nth-child(3) { animation-delay: .4s !important; }
@keyframes pq-spark { 0% { opacity: 1; transform: translateX(0); } 100% { opacity: 0; transform: translateX(-30px); } }
.pq-sc.on .pq-blade { animation: pq-blade 2.4s ease-in-out infinite alternate; }
@keyframes pq-blade { from { transform: translateX(-30px); } to { transform: translateX(30px); } }

/* 14. бассейн */
.pq-sc.on .pq-smell path { stroke-dasharray: 14 10; animation: pq-flow 1.3s linear infinite reverse; }
.pq-cdrop { opacity: 0; }
.trip.chlor .pq-cdrop { animation: pq-cdrop .9s ease-in 2; }
@keyframes pq-cdrop { 0% { transform: translateY(-6px); opacity: 1; } 100% { transform: translateY(60px); opacity: 0; } }

/* 15. арбуз */
.pq-sliceb { transform-box: fill-box; transform-origin: 50% 100%; }
.trip.bite .pq-sliceb { animation: pq-shake .45s ease; }
@keyframes pq-shake { 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
.pq-splash { animation: pq-splash .9s ease-out both; }
@keyframes pq-splash { 0% { transform: translate(0, 0); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)); opacity: 0; } }

/* без движения: итог виден сразу, нажатия меняют картинку и счётчики */
@media (prefers-reduced-motion: reduce) {
  .trip.pq-raining .pq-rain2 { opacity: 1; }
  .trip.fog .pq-car { opacity: 1; transform: translateX(560px); }
  .trip.tap .pq-stream { opacity: 1; }
  .pq-zap { opacity: 1; }
}
