/* Audio explainer animation (screen-recorder-with-audio page).
   Markup defaults to the final state (both switches on, merged clip), which is what no-JS and reduced motion see.
   JS drives it by toggling .m-on (mic), .s-on (system audio), .is-both and .is-done on the figure. */
.au { margin: 24px 0 8px; }
.au-card { position: relative; background: var(--card); border-radius: 30px; padding: 16px 18px 12px; box-shadow: 0 6px 0 rgba(11,36,64,.08), 0 26px 60px rgba(11,36,64,.11); display: grid; gap: 12px; }
.au-stage { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 380px); justify-content: center; gap: clamp(14px, 4vw, 40px); align-items: center; }

/* Screen */
.au-screen { position: relative; width: 100%; aspect-ratio: 16 / 10; border: 3px solid var(--navy); border-radius: 12px; background: #DCEBFA; overflow: hidden; }
.au-pic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: left top; }
.au-rec { position: absolute; left: 8px; top: 8px; width: 11px; height: 11px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 0 2px #fff; animation: au-blink 1.2s steps(2, jump-none) infinite; transition: opacity .3s; }
.au.is-done .au-rec { opacity: 0; animation: none; }
@keyframes au-blink { 50% { opacity: .25; } }

/* Switches */
.au-sws { display: grid; gap: 14px; }
.au-sw { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: #fff; border: 3px solid var(--navy); border-radius: 16px; box-shadow: 0 4px 0 var(--navy); color: var(--navy); font: 700 clamp(13px, 1.7vw, 16px)/1.2 var(--display); }
.au-ico { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; }
.au-ico svg { width: 16px; height: 16px; }
.au-tg { position: relative; flex: none; margin-left: auto; width: 42px; height: 24px; border: 3px solid var(--navy); border-radius: 999px; background: #fff; transition: background-color .25s; }
.au-tg::after { content: ""; position: absolute; left: 2px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--navy); transition: transform .25s cubic-bezier(.3,1.5,.5,1); }
.au.m-on .au-sw-mic .au-tg, .au.s-on .au-sw-sys .au-tg { background: var(--sun); }
.au.m-on .au-sw-mic .au-tg::after, .au.s-on .au-sw-sys .au-tg::after { transform: translateX(18px); }

/* Timeline */
.au-tracks { position: relative; display: grid; gap: 8px; height: 96px; }
.au-row { display: flex; gap: 10px; align-items: stretch; height: 44px; transition: transform .5s ease, opacity .4s ease; }
.au-head { flex: none; width: 92px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.au-face { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--navy); background: #DCEBFA url(/assets/img/cam-face.webp) 0 0 / 600% 100% no-repeat; opacity: .4; transition: opacity .3s; }
.au-spk { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--navy); background: var(--soft); display: grid; place-items: center; color: var(--navy); opacity: .4; transition: opacity .3s; }
.au-spk svg { width: 18px; height: 18px; }
.au.m-on .au-face, .au.s-on .au-spk { opacity: 1; }
.au.m-on:not(.is-done) .au-face { animation: au-talk .9s steps(1, end) infinite; }
.au.is-done .au-face { background-position-x: 80%; }
@keyframes au-talk { 0% { background-position-x: 0%; } 12% { background-position-x: 20%; } 26% { background-position-x: 40%; } 38% { background-position-x: 20%; } 52% { background-position-x: 60%; } 66% { background-position-x: 0%; } 78% { background-position-x: 80%; } 90% { background-position-x: 100%; } }
.au-meter { flex: none; display: flex; align-items: flex-end; gap: 3px; height: 26px; }
.au-meter i { display: block; width: 4px; height: 100%; border-radius: 2px; background: var(--navy); transform: scaleY(.15); transform-origin: 50% 100%; animation: au-bounce .5s ease-in-out infinite alternate; animation-play-state: paused; }
.au-meter i:nth-child(2) { animation-duration: .38s; } .au-meter i:nth-child(3) { animation-duration: .62s; } .au-meter i:nth-child(4) { animation-duration: .45s; }
@keyframes au-bounce { from { transform: scaleY(.15); } to { transform: scaleY(1); } }
.au.m-on:not(.is-done) .au-voice .au-meter i, .au.s-on:not(.is-done) .au-sys .au-meter i { animation-play-state: running; }
.au.is-done .au-meter i { transform: scaleY(.15); animation: none; }

.au-lane { position: relative; flex: 1; min-width: 0; border: 3px solid var(--navy); border-radius: 12px; background: #F3F8FD; overflow: hidden; opacity: .45; transition: opacity .3s, box-shadow .3s; }
.au.m-on .au-voice .au-lane, .au.s-on .au-sys .au-lane { opacity: 1; }
.au.is-both:not(.is-done) .au-lane { box-shadow: inset 0 0 0 2px var(--sun); }
.au-tag { position: absolute; left: 6px; top: 3px; z-index: 1; padding: 1px 6px; border-radius: 6px; background: #fff; border: 2px solid var(--navy); font: 700 10px/1.3 var(--display); color: var(--navy); }
.au-grow { position: absolute; inset: 0; display: flex; align-items: center; transform: scaleY(.08); transition: transform .45s cubic-bezier(.3,1.4,.5,1); }
.au.m-on .au-voice .au-grow, .au.s-on .au-sys .au-grow { transform: scaleY(1); }
.au-strip { display: flex; align-items: center; height: 100%; width: max-content; animation: au-scroll 6s linear infinite; animation-play-state: paused; }
.au.m-on:not(.is-done) .au-voice .au-strip, .au.s-on:not(.is-done) .au-sys .au-strip { animation-play-state: running; }
.au-sys .au-strip { animation-duration: 8s; }
@keyframes au-scroll { to { transform: translateX(-50%); } }
.au-strip i, .au-clipwave i { display: block; flex: none; width: 4px; margin-right: 3px; border-radius: 2px; }
.au-voice .au-strip i { background: var(--rec); }
.au-sys .au-strip i { background: var(--accent); }

/* Merged clip */
.au-clip { position: absolute; inset: 0; display: flex; align-items: center; gap: 12px; padding: 0 12px; background: #fff; border: 3px solid var(--navy); border-radius: 14px; box-shadow: 0 4px 0 var(--navy); opacity: 0; transform: scale(.94); pointer-events: none; transition: opacity .35s ease, transform .45s cubic-bezier(.3,1.4,.5,1); }
.au.is-done .au-clip { opacity: 1; transform: none; transition-delay: .3s; }
.au-clipplay { flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--sun); border: 3px solid var(--navy); box-shadow: 0 3px 0 var(--navy); display: grid; place-items: center; color: var(--navy); }
.au-clipplay svg { width: 16px; height: 16px; margin-left: 2px; }
.au-clipwave { flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; overflow: hidden; }
.au-clipwave:empty { background: repeating-linear-gradient(90deg, var(--navy) 0 4px, transparent 4px 7px); height: 40%; }
.au-clipwave i { background: linear-gradient(to bottom, var(--rec) 50%, var(--accent) 50%); }
.au.is-done .au-voice { transform: translateY(26px) scale(.92); opacity: 0; }
.au.is-done .au-sys { transform: translateY(-26px) scale(.92); opacity: 0; }

/* Caption + controls */
.au-foot { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.au-step { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--sun); border: 3px solid var(--navy); box-shadow: 0 3px 0 var(--navy); font: 800 14px/1 var(--display); color: var(--navy); }
.au-cap { flex: 1; min-width: 0; margin: 0; font-size: 15px; line-height: 1.35; color: var(--body); }
.au-cap b { color: var(--navy); }
.au-btn { flex: none; display: none; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 12px; border: 2.5px solid var(--navy); background: #fff; color: var(--navy); font: 700 13px/1 var(--display); cursor: pointer; box-shadow: 0 3px 0 var(--navy); }
.au-btn:active { translate: 0 2px; box-shadow: 0 1px 0 var(--navy); }
.au-btn svg { width: 12px; height: 12px; }
.au-steps { margin: 0; padding: 0 4px; list-style: none; display: grid; gap: 6px; font-size: 14.5px; color: var(--body); counter-reset: au; }
.au-steps li { display: flex; gap: 8px; }
.au-steps li::before { counter-increment: au; content: counter(au); flex: none; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: var(--sun); border: 2px solid var(--navy); font: 800 12px/1 var(--display); color: var(--navy); }
.au.is-js .au-steps { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.au.is-js .au-btn { display: inline-flex; }
.au:not(.is-js) .au-foot { display: none; }
.au.is-idle *, .au.is-idle *::after { animation-play-state: paused !important; }

@media (max-width: 560px) {
  .au-card { padding: 12px 12px 10px; border-radius: 24px; }
  .au-stage { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 10px; }
  .au-sws { gap: 10px; }
  .au-sw { padding: 6px 8px; gap: 6px; border-radius: 12px; font-size: 12px; }
  .au-ico { display: none; }
  .au-tg { width: 34px; height: 20px; }
  .au-tg::after { width: 10px; height: 10px; margin-top: -5px; }
  .au.m-on .au-sw-mic .au-tg::after, .au.s-on .au-sw-sys .au-tg::after { transform: translateX(14px); }
  .au-head { width: 64px; }
  .au-meter { display: none; }
  .au-head { justify-content: center; }
  .au-cap { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .au *, .au *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 900px) {
  .au { margin-left: calc(50% - min(440px, 50vw - 24px)); margin-right: calc(50% - min(440px, 50vw - 24px)); }
}
