/**
 * 随机小姐姐 — front end.
 *
 * Ported from the site's `z-xjj.php` template. Two deliberate changes from
 * that copy:
 *
 *   - every class and custom property is prefixed `e-onenav-xjj`, so it can
 *     live on a site whose theme also says `.card`, `.chip` or `.poster`;
 *   - state is an attribute (`[data-playing]`, `.is-active`) rather than a
 *     bare `.playing` class for the same reason.
 *
 * Colours come from the OneNav theme's own custom properties with hard-coded
 * fallbacks, so the page matches whatever accent colour the site is set to
 * and still renders if those properties are absent. The panel colour and the
 * title rule can each be overridden from wp-admin; both arrive as inline
 * values of `--e-onenav-xjj-c` / `--e-onenav-xjj-accent` on the root element,
 * which is why every derived surface below reads those two variables instead
 * of a literal.
 */

.e-onenav-xjj {
    --e-onenav-xjj-c: var(--theme-color, #f4a31f);
    --e-onenav-xjj-c-rgb: var(--theme-color-rgb, 244, 163, 31);
    --e-onenav-xjj-text: var(--main-color, #1b1b26);
    --e-onenav-xjj-sub: var(--muted-color2, #5c5d6e);
    --e-onenav-xjj-muted: var(--muted-color, #8a8b9a);
    --e-onenav-xjj-line: var(--muted-bg-color, #e9eaf2);
    --e-onenav-xjj-card: var(--main-bg-color, #fff);
    --e-onenav-xjj-grad-side: linear-gradient(158deg, #ffc257 0%, #f4a31f 45%, #d98200 100%);
    --e-onenav-xjj-grad: linear-gradient(135deg, #ffcf6b, #f4a31f);
    --e-onenav-xjj-shadow: 0 18px 46px -24px rgba(38, 26, 92, .28);
    /* Readable "ink" for text sitting on a tinted background (active chip,
       notice strip, ghost button hover). Derived from the accent below so it
       follows the theme colour instead of staying the template's brown.
       Without color-mix() it falls back to the theme's own body colour: the
       bare accent would be too light to read on a near-white one. */
    --e-onenav-xjj-ink: var(--e-onenav-xjj-text);
    /* Colour of the short line under the panel title, when `accent_color`
       is left empty. A translucent white is the safe fallback; the
       @supports block below derives a real tint from the panel accent. */
    --e-onenav-xjj-accent-auto: rgba(255, 255, 255, .5);

    max-width: 1320px;
    margin: 26px auto;
    padding: 0 16px;
    box-sizing: border-box;
    color: var(--e-onenav-xjj-text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.e-onenav-xjj * {
    box-sizing: border-box;
}

@supports (color: color-mix(in srgb, red, blue)) {
    .e-onenav-xjj {
        --e-onenav-xjj-grad: linear-gradient(135deg, color-mix(in srgb, var(--e-onenav-xjj-c) 70%, #fff), var(--e-onenav-xjj-c));
        --e-onenav-xjj-grad-side: linear-gradient(158deg,
            color-mix(in srgb, var(--e-onenav-xjj-c) 68%, #fff) 0%,
            var(--e-onenav-xjj-c) 45%,
            color-mix(in srgb, var(--e-onenav-xjj-c) 82%, #000) 100%);
        /* Ink for text on the pale accent tint: the accent itself, cut with a
           neutral dark grey instead of pure black. Same hue, roughly halves
           the saturation, so the label reads as a muted accent rather than a
           saturated deep version of it. 40% is the most grey that still keeps
           even a near-white accent (#ffd400) above 4.5:1 — measured, not
           guessed; raising it drops the yellow case below the threshold. */
        --e-onenav-xjj-ink: color-mix(in srgb, var(--e-onenav-xjj-c) 40%, #2e2e3e);
        /* Lightened accent: the panel is the accent itself, so the line
           needs to sit brighter than it to read as an accent detail. */
        --e-onenav-xjj-accent-auto: color-mix(in srgb, var(--e-onenav-xjj-c) 55%, #fff);
    }
}

/* Switched off, or nothing configured yet. */
.e-onenav-xjj-off {
    margin: 0;
    padding: 40px 24px;
    box-sizing: border-box;
    border-radius: 16px;
    background: var(--e-onenav-xjj-line);
    color: var(--e-onenav-xjj-sub);
    font-size: 14px;
    line-height: 1.8;
    text-align: center;
}

/* Main card: brand panel on the left, controls on the right. */
.e-onenav-xjj-card {
    display: grid;
    grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
    background: var(--e-onenav-xjj-card);
    border-radius: 26px;
    overflow: hidden;
    box-shadow: var(--e-onenav-xjj-shadow);
}

.e-onenav-xjj-side {
    position: relative;
    overflow: hidden;
    padding: 40px 32px 28px;
    background: var(--e-onenav-xjj-grad-side);
    color: #fff;
    display: flex;
    flex-direction: column;
}

.e-onenav-xjj-side::before {
    content: "";
    position: absolute;
    right: -60px;
    top: -40px;
    border-left: 70px solid rgba(255, 255, 255, .10);
    border-bottom: 70px solid transparent;
    transform: rotate(12deg);
}

.e-onenav-xjj-side h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.3;
    font-weight: 900;
    letter-spacing: 1px;
    /* Neutral, not a warm brown: the panel colour is settable, and a shadow
       mixed for orange reads as dirt over a blue or green panel. */
    text-shadow: 0 3px 12px rgba(0, 0, 0, .26);
}

.e-onenav-xjj-side h1 em {
    font-style: normal;
    display: block;
    font-size: 15px;
    font-weight: 600;
    opacity: .92;
    margin-top: 6px;
    letter-spacing: .5px;
}

.e-onenav-xjj-line {
    display: block;
    width: 160px;
    height: 8px;
    margin: 14px 0 0;
    border-radius: 8px;
    /* `--e-onenav-xjj-accent` is only printed when the operator picks a
       colour; otherwise the derived tint above is used. */
    background: var(--e-onenav-xjj-accent, var(--e-onenav-xjj-accent-auto));
    box-shadow: 0 4px 14px rgba(255, 255, 255, .25);
    transform: rotate(-1.6deg);
}

@supports (color: color-mix(in srgb, red, blue)) {
    .e-onenav-xjj-line {
        /* Glow follows the line instead of staying the shipped green. */
        box-shadow: 0 4px 14px color-mix(in srgb,
            var(--e-onenav-xjj-accent, var(--e-onenav-xjj-accent-auto)) 45%,
            transparent);
    }
}

.e-onenav-xjj-side p {
    margin: 22px 0 0;
    font-size: 14px;
    line-height: 2;
    color: rgba(255, 255, 255, .92);
    font-weight: 500;
}

.e-onenav-xjj-list {
    list-style: none;
    margin: 22px 0 0;
    padding: 0;
    display: grid;
    gap: 11px;
}

.e-onenav-xjj-list li {
    position: relative;
    padding-left: 24px;
    font-size: 13px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .92);
}

.e-onenav-xjj-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .22);
    border: 1px solid rgba(255, 255, 255, .45);
}

.e-onenav-xjj-list li::after {
    content: "";
    position: absolute;
    left: 4.5px;
    top: 7px;
    width: 6px;
    height: 3px;
    border-left: 1.6px solid #fff;
    border-bottom: 1.6px solid #fff;
    transform: rotate(-45deg);
}

.e-onenav-xjj-illus {
    position: relative;
    flex: 0 0 auto;
    height: 260px;
    margin-top: auto;
}

.e-onenav-xjj-illus svg {
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 280px;
    height: auto;
    filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .3));
}

/* Control panel. */
.e-onenav-xjj-panel {
    padding: 26px 28px 24px;
    min-width: 0;
}

.e-onenav-xjj-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--e-onenav-xjj-muted);
    display: block;
    margin-bottom: 10px;
    letter-spacing: .3px;
}

.e-onenav-xjj-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.e-onenav-xjj-chip {
    position: relative;
    min-width: 34px;
    height: 32px;
    padding: 0 13px;
    border-radius: 9px;
    border: 1px solid var(--e-onenav-xjj-line);
    background: var(--e-onenav-xjj-card);
    color: var(--e-onenav-xjj-sub);
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    transition: .16s;
}

.e-onenav-xjj-chip:hover {
    border-color: rgba(var(--e-onenav-xjj-c-rgb), .5);
    color: var(--e-onenav-xjj-ink);
}

.e-onenav-xjj-chip.is-active {
    background: rgba(var(--e-onenav-xjj-c-rgb), .13);
    border-color: rgba(var(--e-onenav-xjj-c-rgb), .45);
    color: var(--e-onenav-xjj-ink);
}

.e-onenav-xjj-chip.is-active::after {
    content: "";
    position: absolute;
    right: 4px;
    top: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--e-onenav-xjj-c);
}

.e-onenav-xjj-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(var(--e-onenav-xjj-c-rgb), .10);
    color: var(--e-onenav-xjj-ink);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.7;
}

.e-onenav-xjj-notice svg {
    flex: none;
    width: 16px;
    height: 16px;
}

/* Player. */
.e-onenav-xjj-player {
    position: relative;
    height: 0;
    padding-top: 56.25%;
    margin: 0 0 14px;
    border-radius: 16px;
    overflow: hidden;
    background: #0e0f14;
    box-shadow: 0 24px 50px -30px rgba(0, 0, 0, .7);
}

@supports (aspect-ratio: 16/9) {
    .e-onenav-xjj-player {
        height: auto;
        padding-top: 0;
        aspect-ratio: 16 / 9;
    }
}

.e-onenav-xjj-player video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #0e0f14;
    display: block;
}

.e-onenav-xjj-poster {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(120% 100% at 18% 0%, rgba(var(--e-onenav-xjj-c-rgb), .22), transparent 62%),
        linear-gradient(160deg, #1b1e29 0%, #0c0e14 58%, #141821 100%);
    transition: opacity .35s ease, visibility .35s ease;
}

.e-onenav-xjj-poster::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
    background-size: 36px 36px;
}

/* Attribute, not a class: the theme may own `.playing`. */
.e-onenav-xjj-player[data-playing] .e-onenav-xjj-poster {
    opacity: 0;
    visibility: hidden;
}

.e-onenav-xjj-badge {
    position: absolute;
    left: 14px;
    top: 14px;
    padding: 5px 11px;
    border-radius: 7px;
    background: rgba(8, 10, 16, .55);
    border: 1px solid rgba(255, 255, 255, .18);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
}

.e-onenav-xjj-play {
    position: relative;
    width: 66px;
    height: 66px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    border: 1.5px solid rgba(255, 255, 255, .8);
    display: grid;
    place-items: center;
    backdrop-filter: blur(4px);
    transition: transform .2s, background .2s;
    cursor: pointer;
}

.e-onenav-xjj-play:hover {
    transform: scale(1.06);
    background: rgba(255, 255, 255, .26);
}

.e-onenav-xjj-play::after {
    content: "";
    width: 0;
    height: 0;
    margin-left: 4px;
    border-left: 16px solid #fff;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
}

.e-onenav-xjj-tip {
    position: absolute;
    bottom: 14px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, .7);
}

/* Buttons under the player. */
.e-onenav-xjj-ctrls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.e-onenav-xjj-main {
    flex: none;
    height: 46px;
    padding: 0 26px;
    border: 0;
    border-radius: 12px;
    background: var(--e-onenav-xjj-grad);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 10px 22px -12px rgba(var(--e-onenav-xjj-c-rgb), .9);
    transition: transform .18s, filter .18s;
}

.e-onenav-xjj-main:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

.e-onenav-xjj-ghost {
    flex: none;
    height: 46px;
    padding: 0 20px;
    border-radius: 12px;
    border: 1.5px solid var(--e-onenav-xjj-line);
    background: var(--e-onenav-xjj-card);
    color: var(--e-onenav-xjj-sub);
    font-size: 13.5px;
    font-weight: 700;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: .18s;
}

.e-onenav-xjj-ghost:hover {
    border-color: rgba(var(--e-onenav-xjj-c-rgb), .55);
    color: var(--e-onenav-xjj-ink);
    background: rgba(var(--e-onenav-xjj-c-rgb), .06);
}

@media (max-width: 860px) {
    .e-onenav-xjj-card {
        grid-template-columns: 1fr;
    }

    .e-onenav-xjj-side {
        padding: 30px 24px;
    }

    .e-onenav-xjj-illus {
        width: 170px;
        height: 160px;
        margin: 0 0 0 auto;
        flex: none;
    }

    .e-onenav-xjj-illus svg {
        width: 170px;
        bottom: 0;
    }

    .e-onenav-xjj-player {
        padding-top: 56.25%;
    }

    @supports (aspect-ratio: 16/9) {
        .e-onenav-xjj-player {
            height: auto;
            padding-top: 0;
            aspect-ratio: 16 / 9;
        }
    }
}

@media (max-width: 680px) {
    .e-onenav-xjj-illus {
        display: none;
    }
}
