/**
 * 右键美化 — front end.
 *
 * Moved out of the child theme (`star-fix-context-menu.php`). Behaviour is
 * unchanged; the three things that had to change are names:
 *
 *   - `.usercm` / `.copy-tooltip` / `.quick-nav` became `e-onenav-ctxt*`, so a
 *     theme or another plugin that happens to own `.divider` or `.disabled`
 *     cannot restyle this menu;
 *   - the accent reads `--e-onenav-ctxt-accent` first, then the theme colour,
 *     then the original iOS blue — an unset setting is indistinguishable from
 *     the old behaviour;
 *   - the tooltip's fade is a CSS transition rather than jQuery's `.animate()`,
 *     so the script no longer depends on jQuery.
 *
 * `.io-black-mode` is the theme's dark-mode body class and is deliberately
 * kept: it is the contract we are hooking into, not a name we introduce.
 */

.e-onenav-ctxt,
.e-onenav-ctxt a {
    text-decoration: none;
}

.e-onenav-ctxt-tip {
    position: fixed;
    z-index: 2147483647;
    padding: 7.2px 14.4px;
    color: #fff;
    font-size: 15.6px;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .5s ease;
}

.e-onenav-ctxt-tip.is-on {
    opacity: 1;
    transition: none;
}

.e-onenav-ctxt {
    background: rgba(255, 255, 255, .7);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    width: 160px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .1), 0 0 0 0 var(--e-onenav-ctxt-accent, var(--theme-color, #007AFF)) !important;
    position: absolute;
    display: none;
    z-index: 10000;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .3);
    transition: box-shadow .3s ease, border .3s ease, opacity .2s ease, transform .2s ease;
    opacity: 0;
    transform: scale(.95);
}

.e-onenav-ctxt.show {
    opacity: 1;
    transform: scale(1);
}

.e-onenav-ctxt:hover {
    box-shadow:
        0 8px 32px rgba(0, 0, 0, .1),
        0 0 0 2px var(--e-onenav-ctxt-accent, var(--theme-color, #007AFF)) !important;
}

.e-onenav-ctxt ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.e-onenav-ctxt ul li {
    margin: 0;
    padding: 0;
    position: relative;
}

.e-onenav-ctxt ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: var(--e-onenav-ctxt-accent, var(--theme-color, #007AFF));
    opacity: 0;
    transition: opacity .2s ease;
    z-index: -1;
}

.e-onenav-ctxt ul li:hover::before {
    opacity: .2;
}

.e-onenav-ctxt ul li a {
    color: #555;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    transition: color .2s ease;
    position: relative;
    z-index: 1;
    font-size: 16px;
}

.e-onenav-ctxt ul li a i,
.e-onenav-ctxt ul li a svg {
    flex: none;
    width: 20px;
    height: 18px;
    margin-right: 12px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.e-onenav-ctxt ul li a:hover {
    color: var(--e-onenav-ctxt-accent, var(--theme-color, #007AFF)) !important;
}

.e-onenav-ctxt ul li a:hover i,
.e-onenav-ctxt ul li a:hover svg {
    color: var(--e-onenav-ctxt-accent, var(--theme-color, #007AFF)) !important;
}

.e-onenav-ctxt ul li.e-onenav-ctxt-divider {
    height: 1px;
    background: transparent;
    border-top: 1px dashed var(--e-onenav-ctxt-accent, var(--theme-color, #007AFF)) !important;
    margin: 4px 15px;
    opacity: .6;
}

.e-onenav-ctxt ul li.e-onenav-ctxt-divider:hover {
    opacity: 1;
}

.e-onenav-ctxt a.e-onenav-ctxt-off {
    color: rgba(204, 204, 204, .7) !important;
    cursor: not-allowed;
}

.e-onenav-ctxt a.e-onenav-ctxt-off:hover {
    background-color: transparent !important;
}

.e-onenav-ctxt-quick {
    display: flex;
    justify-content: space-around;
    padding: 4px 6px;
    margin-top: 8px;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    margin-bottom: 3px;
}

.e-onenav-ctxt-quick a {
    /* A fixed box, not an inline icon: the glyph is an SVG now, and an
       anchor whose only child has no intrinsic width would collapse to
       0×0 and stop being clickable. */
    width: 34px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color .25s ease, transform .25s ease;
    color: rgba(85, 85, 85, .9);
    font-size: 15px;
    background: transparent;
    position: relative;
}

.e-onenav-ctxt-quick a svg {
    width: 16px;
    height: 16px;
}

.e-onenav-ctxt-quick a::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--e-onenav-ctxt-accent, var(--theme-color, #007AFF));
    border-radius: 6px;
    opacity: 0;
    transition: opacity .25s ease;
    z-index: -1;
}

.e-onenav-ctxt-quick a:hover::before {
    opacity: .15;
}

.e-onenav-ctxt-quick a:active::before {
    opacity: .25;
}

.e-onenav-ctxt-quick a.e-onenav-ctxt-nav-off {
    opacity: .35;
    cursor: not-allowed;
    pointer-events: none;
}

.e-onenav-ctxt-quick a:hover {
    color: var(--e-onenav-ctxt-accent, var(--theme-color, #007AFF)) !important;
    transform: scale(.98);
}

.e-onenav-ctxt-quick a i,
.e-onenav-ctxt-quick a svg {
    transition: transform .2s ease;
    position: relative;
    z-index: 1;
}

.e-onenav-ctxt-quick a:hover i,
.e-onenav-ctxt-quick a:hover svg {
    transform: scale(1.1);
}

.e-onenav-ctxt-quick a::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: border-color .3s ease;
}

.e-onenav-ctxt-quick a:hover::after {
    border-color: var(--e-onenav-ctxt-accent, var(--theme-color, rgba(0, 122, 255, .3))) !important;
}

.io-black-mode .e-onenav-ctxt {
    background: rgba(30, 30, 30, .7);
    border: 1px solid rgba(255, 255, 255, .1);
}

.io-black-mode .e-onenav-ctxt ul li a {
    color: #eee;
}

.io-black-mode .e-onenav-ctxt ul li a i,
.io-black-mode .e-onenav-ctxt ul li a svg {
    color: #bbb;
}

.io-black-mode .e-onenav-ctxt-quick a {
    color: rgba(230, 230, 230, .9);
}

.io-black-mode .e-onenav-ctxt-tip {
    background: rgba(20, 20, 20, .85);
}
