/*
 * Reader styles used when the Madara theme is not installed.
 * Kept deliberately neutral so Kadence, Astra, GeneratePress and friends keep
 * control of typography and colour.
 */

.ums-chapter-list {
    margin: 2em 0;
}

.ums-chapter-list__title {
    margin: 0 0 .5em;
    font-size: 1.25em;
}

/*
 * The list flows with the page. It must not become a scrolling box: that reads
 * as a second page nested inside the real one, and it hides chapters from
 * search engines and from anyone scrolling normally.
 */
.ums-chapter-list__items {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: none;
    overflow: visible;
    border: 1px solid rgba(128, 128, 128, .25);
    border-radius: 4px;
}

.ums-chapter-list__item {
    margin: 0;
    border-bottom: 1px solid rgba(128, 128, 128, .18);
}

.ums-chapter-list__item:last-child {
    border-bottom: 0;
}

.ums-chapter-list__item a {
    display: block;
    padding: .65em 1em;
    text-decoration: none;
}

.ums-chapter-list__item a:hover,
.ums-chapter-list__item a:focus {
    background: rgba(128, 128, 128, .1);
}

.ums-reader {
    margin: 1em 0 2em;
}

.ums-reader__title {
    margin: 0 0 .75em;
}

.ums-reader__warning {
    margin: 0 0 1em;
    padding: .75em 1em;
    border-left: 4px solid currentColor;
    background: rgba(128, 128, 128, .12);
    opacity: .9;
}

.ums-reader__nav {
    display: flex;
    flex-wrap: wrap;
    gap: .75em;
    justify-content: space-between;
    margin: 1em 0;
}

.ums-reader__nav:empty {
    display: none;
}

.ums-reader__nav a {
    display: inline-block;
    padding: .5em 1em;
    border: 1px solid rgba(128, 128, 128, .35);
    border-radius: 4px;
    text-decoration: none;
}

.ums-reader__nav-next {
    margin-left: auto;
}

.ums-reader__pages {
    display: block;
    margin: 0 auto;
    max-width: 900px;
    text-align: center;
}

.ums-reader__page {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto;
}

.ums-reader__text {
    line-height: 1.7;
}

.ums-reader__text img {
    max-width: 100%;
    height: auto;
}

.ums-reader__empty {
    padding: 2em;
    text-align: center;
    opacity: .75;
}

.ums-reader__back {
    margin-top: 1.5em;
}

@media (max-width: 600px) {
    .ums-reader__nav a {
        flex: 1 1 100%;
        text-align: center;
    }
}

/* Episode player. The frame fills the reading column and keeps a 16:9 shape
   so the video is never squashed or clipped on any screen size. */
.ums-player {
    position: relative;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto 1.5em;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
}

.ums-player iframe,
.ums-player video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 240px;
    border: 0;
}

.ums-player--empty {
    background: rgba(128, 128, 128, .12);
    padding: 3em 1em;
    text-align: center;
    color: inherit;
}

.ums-player--empty p {
    margin: 0;
    opacity: .8;
}

.ums-episode__synopsis {
    max-width: 1100px;
    margin: 0 auto 1.5em;
    line-height: 1.7;
}

/* -------------------------------------------------------------------------
 * The anime watch page.
 *
 * The plugin's own template, inside the theme's header and footer. The
 * player fills the column and is capped by the height of the screen, so it
 * is as large as it can be without the controls falling off the bottom. The
 * episode list sits beside it on wide screens and under it on narrow ones.
 * ---------------------------------------------------------------------- */

.ums-watch {
    box-sizing: border-box;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 16px 16px 40px;
}

.ums-watch *,
.ums-watch *::before,
.ums-watch *::after {
    box-sizing: border-box;
}

.ums-watch__crumbs {
    margin: 0 0 12px;
    font-size: .9em;
    opacity: .8;
}

.ums-watch__crumbs a {
    text-decoration: none;
}

.ums-watch__sep {
    margin: 0 .5em;
    opacity: .6;
}

.ums-watch__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

@media (min-width: 1024px) {
    .ums-watch__layout {
        grid-template-columns: minmax(0, 1fr) 320px;
    }
}

@media (min-width: 1400px) {
    .ums-watch__layout {
        grid-template-columns: minmax(0, 1fr) 360px;
    }
}

.ums-watch__main {
    min-width: 0;
}

/* The player: full column width, 16:9, never taller than the screen. */
.ums-watch .ums-player {
    max-width: none;
    margin: 0;
    border-radius: 8px;
}

.ums-watch .ums-player iframe,
.ums-watch .ums-player video {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 220px;
    max-height: calc(100vh - 150px);
}

.ums-watch .ums-player--empty {
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1em;
}

.ums-watch__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 12px 0 18px;
}

.ums-watch__prev,
.ums-watch__next {
    display: inline-block;
    padding: .5em 1em;
    border: 1px solid rgba(128, 128, 128, .35);
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
}

.ums-watch__prev.is-off,
.ums-watch__next.is-off {
    opacity: .45;
}

.ums-watch__now {
    flex: 1 1 auto;
    text-align: center;
    font-weight: 600;
}

.ums-watch__title {
    margin: 0 0 .25em;
    font-size: 1.6em;
    line-height: 1.25;
}

.ums-watch__subtitle {
    margin: 0 0 1em;
    font-size: 1.1em;
    opacity: .8;
}

.ums-watch .ums-episode__synopsis {
    max-width: none;
    margin: 0 0 1em;
}

/* The episode list beside the player. It scrolls inside itself so a series
   with hundreds of episodes does not push the series card off the screen;
   the same list, in full, is on the series page. */
.ums-watch__list {
    border: 1px solid rgba(128, 128, 128, .25);
    border-radius: 8px;
    overflow: hidden;
}

.ums-watch__list-title {
    margin: 0;
    padding: 12px 16px;
    font-size: 1.05em;
    border-bottom: 1px solid rgba(128, 128, 128, .25);
}

.ums-watch__list-title span {
    font-weight: normal;
    opacity: .7;
}

.ums-watch__episodes {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 420px;
    overflow-y: auto;
}

@media (min-width: 1024px) {
    .ums-watch__episodes {
        max-height: min(70vh, 640px);
    }
}

.ums-watch__episode {
    margin: 0;
    border-bottom: 1px solid rgba(128, 128, 128, .15);
}

.ums-watch__episode:last-child {
    border-bottom: 0;
}

.ums-watch__episode a {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 9px 14px;
    text-decoration: none;
    line-height: 1.4;
}

.ums-watch__episode a:hover,
.ums-watch__episode a:focus {
    background: rgba(128, 128, 128, .1);
}

.ums-watch__episode.is-current a {
    background: rgba(128, 128, 128, .18);
    font-weight: 600;
}

.ums-watch__episode-number {
    flex: 0 0 2.5em;
    opacity: .7;
    font-variant-numeric: tabular-nums;
}

.ums-watch__episode-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The series card under the player. */
.ums-watch__series {
    display: flex;
    gap: 20px;
    margin-top: 28px;
    padding: 20px;
    border: 1px solid rgba(128, 128, 128, .25);
    border-radius: 8px;
}

.ums-watch__poster {
    flex: 0 0 120px;
}

.ums-watch__poster img {
    display: block;
    width: 120px;
    height: auto;
    border-radius: 6px;
}

.ums-watch__series-body {
    flex: 1 1 auto;
    min-width: 0;
}

.ums-watch__series-title {
    margin: 0 0 .3em;
    font-size: 1.3em;
}

.ums-watch__series-title a {
    text-decoration: none;
}

.ums-watch__facts {
    margin: 0 0 .75em;
    opacity: .75;
}

.ums-watch__series-text {
    margin: 0 0 .75em;
    line-height: 1.6;
}

.ums-watch__series-link {
    margin: 0;
}

@media (max-width: 600px) {
    .ums-watch__series {
        flex-direction: column;
    }

    .ums-watch__poster {
        flex-basis: auto;
    }

    .ums-watch__now {
        flex-basis: 100%;
        order: -1;
    }
}

/* Server buttons under the player. A page cannot tell whether somebody
   else's frame is playing, so the visitor switches. */
.ums-servers {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 10px 0 0;
    font-size: .95em;
}

.ums-servers__label {
    opacity: .75;
    margin-right: 2px;
}

.ums-servers__btn {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    padding: .4em .95em;
    background: transparent;
    border: 1px solid rgba(128, 128, 128, .4);
    border-radius: 6px;
    line-height: 1.3;
}

.ums-servers__btn:hover,
.ums-servers__btn:focus-visible {
    background: rgba(128, 128, 128, .14);
}

.ums-servers__btn.is-current {
    background: rgba(128, 128, 128, .22);
    border-color: rgba(128, 128, 128, .7);
    font-weight: 600;
}

@media (max-width: 600px) {
    .ums-servers__label {
        flex: 1 1 100%;
    }
}
