/* Storybook Audio button: chunky, bouncy and in the site colours. */
.nmm-audio { display: flex; justify-content: center; margin: 0 0 18px; }
.nmm-audio__btn {
	display: inline-flex; align-items: center; gap: 14px;
	padding: 10px 26px 10px 10px; margin: 0;
	background: var(--honey, #F7E2A8); color: var(--teal-dark, #17464C);
	border: 3px solid var(--honey-deep, #E5C67E); border-bottom-width: 8px; border-radius: 999px;
	font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
	transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), border-bottom-width .12s ease, background-color .2s ease;
}
.nmm-audio__btn:hover { transform: translateY(-3px) rotate(-2deg); background: #F9E8B8; }
.nmm-audio__btn:active { transform: translateY(3px) scale(.98); border-bottom-width: 4px; }
.nmm-audio__btn:focus-visible { outline: 4px solid var(--teal, #1F5C63); outline-offset: 4px; }

.nmm-audio__btn { position: relative; }
.nmm-audio__spk {
	flex: none; width: 64px; height: 64px; border-radius: 50%; position: relative;
	display: flex; align-items: center; justify-content: center;
	background: var(--terracotta, #C57A5E); color: var(--paper, #FDF2DA);
	border: 3px solid var(--paper, #FDF2DA); box-shadow: 0 0 0 3px var(--terracotta, #C57A5E);
	transition: background-color .25s ease, box-shadow .25s ease;
	animation: nmm-audio-hello 3.2s ease-in-out 1.2s infinite;
}
/* little cat ears on the speaker, like Maw Maw listening */
.nmm-audio__spk::before, .nmm-audio__spk::after { content: ""; position: absolute; top: -9px; width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 16px solid var(--terracotta, #C57A5E); transition: border-color .25s ease; }
.nmm-audio__spk::before { left: 4px; transform: rotate(-22deg); }
.nmm-audio__spk::after { right: 4px; transform: rotate(22deg); }
.nmm-audio__btn.is-playing .nmm-audio__spk::before, .nmm-audio__btn.is-playing .nmm-audio__spk::after { border-bottom-color: var(--teal, #1F5C63); }
/* a twinkling star on the button */
.nmm-audio__btn::after { content: ""; position: absolute; top: -12px; right: 14px; width: 24px; height: 24px; background: var(--star) center / contain no-repeat; animation: nmm-audio-star 2.6s ease-in-out infinite; pointer-events: none; }
@keyframes nmm-audio-star { 0%, 100% { transform: scale(.8) rotate(0); opacity: .7; } 50% { transform: scale(1.15) rotate(20deg); opacity: 1; } }
.nmm-audio__spk svg { width: 36px; height: 36px; }
.nmm-audio__ic-pause { display: none; }

.nmm-audio__txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; text-align: left; }
.nmm-audio__txt b { font-family: 'Fredoka', system-ui, sans-serif; font-weight: 700; font-size: 30px; letter-spacing: .01em; color: var(--teal-dark, #17464C); }
.nmm-audio__sub { font-size: 14px; font-weight: 700; color: var(--ink-soft, #4E6265); margin-top: 3px; }

.nmm-audio__waves { display: flex; align-items: flex-end; gap: 4px; height: 34px; margin-left: 2px; }
.nmm-audio__waves i { display: block; width: 7px; height: 10px; border-radius: 4px; background: var(--teal, #1F5C63); opacity: .35; }
.nmm-audio__waves i:nth-child(2) { height: 16px; } .nmm-audio__waves i:nth-child(3) { height: 22px; } .nmm-audio__waves i:nth-child(4) { height: 16px; }

/* while the story is being read */
.nmm-audio__btn.is-playing { background: var(--leaf, #EAF1E0); border-color: var(--leaf-deep, #A3BF8C); }
.nmm-audio__btn.is-playing .nmm-audio__spk { background: var(--teal, #1F5C63); box-shadow: 0 0 0 3px var(--teal, #1F5C63), 0 0 0 9px rgba(31, 92, 99, .18); animation: nmm-audio-pulse 1.6s ease-in-out infinite; }
.nmm-audio__btn.is-playing .nmm-audio__ic-play { display: none; }
.nmm-audio__btn.is-playing .nmm-audio__ic-pause { display: block; }
.nmm-audio__btn.is-playing .nmm-audio__waves i { opacity: 1; animation: nmm-audio-bob .9s ease-in-out infinite; }
.nmm-audio__btn.is-playing .nmm-audio__waves i:nth-child(2) { animation-delay: .12s; }
.nmm-audio__btn.is-playing .nmm-audio__waves i:nth-child(3) { animation-delay: .24s; }
.nmm-audio__btn.is-playing .nmm-audio__waves i:nth-child(4) { animation-delay: .36s; }
.nmm-audio__btn.is-playing .nmm-audio__waves i:nth-child(5) { animation-delay: .48s; }

/* the sentence group being read gets a soft highlighter glow, to help early readers follow along */
.book .nmm-reading { background: rgba(247, 226, 168, .75); box-shadow: 0 0 0 6px rgba(247, 226, 168, .75); border-radius: 6px; }

@keyframes nmm-audio-bob { 0%, 100% { height: 8px; } 50% { height: 32px; } }
@keyframes nmm-audio-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes nmm-audio-hello { 0%, 84%, 100% { transform: rotate(0); } 88% { transform: rotate(-12deg); } 92% { transform: rotate(10deg); } 96% { transform: rotate(-6deg); } }

@media (max-width: 600px) {
	.nmm-audio__btn { gap: 10px; padding: 8px 20px 8px 8px; }
	.nmm-audio__spk { width: 54px; height: 54px; }
	.nmm-audio__spk svg { width: 30px; height: 30px; }
	.nmm-audio__txt b { font-size: 25px; }
	.nmm-audio__sub { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
	.nmm-audio__btn, .nmm-audio__btn::after, .nmm-audio__spk, .nmm-audio__waves i { animation: none !important; transition: none !important; }
}
