/* Hide pause icon by default */
#pause-play-button [data-audio-icon="pause"] { display: none; }
#pause-play-button [data-audio-icon="play"]  { display: block; }

/* When button is playing, flip the visibility */
#pause-play-button[data-audio-state="playing"] [data-audio-icon="pause"]  { display: block; }
#pause-play-button[data-audio-state="playing"] [data-audio-icon="play"]  { display: none; }

#pause-play-button[data-audio-state="playing"] {
    transform: scale(95%);
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    background-color: hsl(231 100 65);
    color: white;
}


/* reader page styles */

/* reader control styles */

.controls {
    border-top: 1px solid var(--color-gray-200);
    height: 60px;
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    background-color: var(--color-white);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    z-index: 1000;
}

.controls__button {
    padding-block: 0.25em;
    padding-inline: 0.75em;
    border: 1px solid var(--color-gray-200);
    border-radius: 0.25em;
    transition:
        background-color 100ms ease-in,
        fill 100ms ease-in,
        stroke 100ms ease-in,
        color 100ms ease-in;
}

.controls__button.active {
    background-color: var(--color-blue-500);
    fill: var(--color-white);
    color: var(--color-white);
}

@media screen and (width <= 639px) {
    .controls {
        padding-block: 1em;
        justify-content: space-evenly;
    }
}

/* reader widget shared styles */

.widget {
    border: 1px solid var(--color-gray-200);
    position: absolute;
    height: 100px;
    top: -7rem;
    right: 0.5rem;
    background-color: var(--color-white);
    width: 100%;
    max-width: 500px;
    border-radius: 0.375rem;
}

/* reader speed widget styles */

.speed-btn {
    width: 100%;
    height: 100%;
    border: 1px solid var(--color-gray-200);
    border-radius: 0.25rem;
}

.speed-btn.active {
    color: var(--color-white);
    background-color: var(--color-blue-500);
}

.speed-widget__list {
    height: 100%;
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(8, 1fr);
    padding: 8px;
}

@media screen and (width <= 639px) {
    .widget {
        top: -100px;
        right: 0px;
    }
}

/* reader translate widget styles */

.translate-widget__form {
    height: 50px;
    border-bottom: 1px solid var(--color-gray-200);
    display: flex;
    gap: 4px;
    justify-content: start;
    align-items: center;
}

.translate-widget__input {
    flex-grow: 1;
    height: 100%;
    padding-inline: 8px;
}

.translate-widget__preview {
    border-bottom: 1px solid var(--color-gray-200);
    height: 50px;
    padding-inline: 8px;
    margin-right: 32px;
    display: flex;
    justify-content: start;
    align-items: center;
    overflow-x: auto;
    text-wrap: nowrap;
}

.translate-widget__delete {
    position: absolute;
    top: 0;
    right: 0;
    width: 32px;
    height: 100%;
    display: grid;
    place-content: center;
}

.translate-widget__translation {
    height: 50px;
    padding-inline: 8px;
    margin-right: 32px;
    display: flex;
    justify-content: start;
    align-items: center;
    overflow-y: auto;
    text-wrap: none;
}

/* reader styles */

.reader {
    padding-top: 48px;
    padding-bottom: 60px;
    max-width: 600px;
    margin-inline: auto;
    height: 100vh;
    display:flex;

    scroll-snap-type: x mandatory;
    overflow-x: scroll;
    overflow-y: auto;
    scroll-behavior: smooth;

    /* Hide scrollbar (cross-browser) */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.reader__page {
    width: 100vw;
    max-width: 600px;
    position: relative;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    padding-bottom: 48px;
}

.reader__img-wrapper {
    width: 100vw;
    max-width: 600px;
    margin-inline: auto;
    aspect-ratio: 1;
    background-color: var(--color-gray-900);
    color: var(--color-white);
}

.reader__img {
    object-fit: cover;
}

.reader__no-img {
    width: 100%;
    height: 100%;
    display: grid;
    place-content: center;
    padding: 2rem;
    text-align: center;
    text-wrap: balance;
}

.reader__content {
    padding-inline: 2rem;
}

.reader__heading {
    margin-top: 2rem;
    text-align: center;
    text-wrap: balance;
    margin-bottom: 2rem;
}

.reader__paragraph {
    margin-top: 4rem;
    font-size: var(--text-2xl);
    line-height: var(--leading-2xl); 
    margin-bottom: 16px;
}

.reader__word {
    color: var(--color-gray-500);
    cursor: pointer;
}

.reader__word.active {
    color: var(--color-black);
}

.text--top {
        margin-bottom: 16px;
    }

@media screen and (width <= 639px) {
    .reader {
        padding-inline: 8px;
    }

}

@media (min-width: 640px) { 
    .reader__img-wrapper {
        aspect-ratio: 16 / 9;
    }

    .reader__img {
        width: 100%;
        margin-inline: auto;
        aspect-ratio: 16 / 9;
    }
}
