/*
 * Ghosted text and the selection context menu (issue #11; spec R-5.1,
 * R-7.3). Consumes public/css/tokens.css; nothing is hard-coded except the
 * shadow. Both apply in plain and Write_On mode (the tokens live on :root).
 * Design notes: docs/design/ghosts-and-menu.md
 */

/* ---- Ghosts (R-5.1) ----
   The fade is applied to the text colour, not `opacity`, so that on ghosted
   text the selection highlight and the inline-indicator underline (which
   sets its own colour) stay fully visible: the text is still selectable and
   its alternatives still show. Dots live in an overlay and are unaffected. */

.te-ghost {
    color: color-mix(in srgb, currentColor calc(var(--te-ghost-opacity) * 100%), transparent);
}

@supports not (color: color-mix(in srgb, red 50%, transparent)) {
    .te-ghost {
        opacity: var(--te-ghost-opacity);
    }
}

/* ---- Selection context menu (R-7.3) ---- */

.te-selection-menu {
    position: fixed;
    z-index: 1000;
    box-sizing: border-box;
    min-width: 18rem;
    max-width: calc(100vw - 16px);
    margin: 0;
    padding: 0.375rem;
    background-color: var(--te-color-popover);
    border: 1px solid var(--te-color-panel-border);
    border-radius: var(--te-radius-popover);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    color: var(--te-color-text);
    font-family: var(--te-font-mono);
    font-size: 0.8125rem;
    line-height: 1.4;
    color-scheme: dark;
    outline: none;
    user-select: none;
}

.te-selection-menu-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 2.5rem;
    padding: 0.4375rem 0.625rem;
    border-radius: calc(var(--te-radius-popover) - 3px);
    cursor: pointer;
    outline: none;
    white-space: nowrap;
}

/* Hovered or keyboard-active row: slightly lighter (R-7.3). */
.te-selection-menu-item--active {
    background-color: var(--te-color-popover-hover);
}

/* A visible focus ring for keyboard users. */
.te-selection-menu-item:focus-visible {
    box-shadow: inset 0 0 0 1px var(--te-color-accent);
}

.te-selection-menu-key {
    color: var(--te-color-text-dim);
    font-variant-numeric: tabular-nums;
}
