/**
 * Save style on a basket line (D54 PR 4).
 *
 * The button wears the Theme's own "Edit this part" classes (`btn--text
 * mmj-part__edit`, journey.css), so it reads as that link's sibling; this
 * sheet only spaces the pair, marks the saving state and draws the reason
 * tooltip. Its result shows in the `.csd-toast` Save design uses
 * (core-saved-designs.css, a dependency), and the failed-save notice wears
 * WooCommerce's `.woocommerce-info`, which the Theme styles for the basket.
 */

.mmj-part__edit + .core-style-basket__wrap {
    margin-left: var(--sp-4);
}

.core-style-basket__wrap {
    position: relative;
    display: inline-block;
}

.core-style-basket__save:focus-visible {
    outline: 0;
    box-shadow: var(--focus-ring);
    border-radius: var(--r-xs);
}

.core-style-basket__save:disabled {
    opacity: 0.5;
    cursor: progress;
}

/* The reason tooltip — Coal with Paper text, the same pair as the
   "Saved as …" toast, so no new colour pairing. Hidden until the wrapper is
   hovered (pointer devices only: a tap on touch just saves) or the button has
   keyboard focus; hovering the tooltip itself keeps it up (WCAG 1.4.13), and
   Escape dismisses it (core-style-basket.js sets `is-dismissed`). */
.core-style-basket__tip {
    position: absolute;
    bottom: calc(100% + var(--sp-2));
    left: 50%;
    z-index: var(--z-raised);
    width: 230px;
    max-width: calc(100vw - 32px);
    padding: var(--sp-2) 10px;
    border-radius: var(--r-sm);
    background: var(--ink);
    color: var(--paper);
    font-size: var(--fs-12);
    line-height: var(--lh-body);
    text-align: left;
    white-space: normal;
    pointer-events: auto;
    visibility: hidden;
    opacity: 0;
    transform: translateX(-50%);
    transition: opacity var(--dur-fast) var(--ease), visibility 0s linear var(--dur-fast);
}

.core-style-basket__tip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border: 5px solid transparent;
    border-top-color: var(--ink);
}

@media (hover: hover) {
    .core-style-basket__wrap:hover .core-style-basket__tip {
        visibility: visible;
        opacity: 1;
        transition-delay: 0s;
    }
}

.core-style-basket__save:focus-visible + .core-style-basket__tip {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

.core-style-basket__wrap.is-dismissed .core-style-basket__tip {
    visibility: hidden;
    opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
    .core-style-basket__tip {
        transition: none;
    }
}
