/* ============================================================
   HELP POPOVER — anchored to the ? button in the rail
   Uses the Popover API + CSS A Anchor Positioning. Shares the
   .floating-panel aesthetic but lives in the top-layer.
   ============================================================ */

.rail-btn--help {
    anchor-name: --help-anchor;
}

.help-popover {
    color: var(--color-text);

    /* Sizing similar to the panel stack */
    min-width: var(--panel-min-w);
    max-width: 28dvw;
    max-height: 94dvh;
    overflow: hidden;

    display: flex;
    flex-direction: column;

    /* Entry animation (opener states, same as .floating-panel) */
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    transform-origin: right center;
    transition:
        opacity var(--transition-slow),
        transform var(--transition-slow),
        overlay var(--transition-slow) allow-discrete,
        display var(--transition-slow) allow-discrete;

    /* Anchor Positioning: appears to the left of the ? button */
    position-anchor: --help-anchor;
    position-area: inline-start center;
    margin-inline-end: var(--space-3);
}

.help-popover:not(:popover-open) {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.96);
}

@starting-style {
    .help-popover:popover-open {
        opacity: 0;
        transform: scale(0.96);
    }
}

/* Fallback si el browser no soporta Anchor Positioning */
@supports not (anchor-name: --a) {
    .help-popover {
        position-area: center;
        inset: auto;
        margin: auto;
    }
}

