
/* Conceal the native H3 dialog during automatic formatting.
   Existing visible popups are excluded. The temporary markers
   are removed by H3Shortcut.js after completion or failure. */
body[data-epd-h3-opening] .Popup:not([data-epd-h3-existing-visible]),
.Popup[data-epd-h3-auto-save] {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: none !important;
    animation: none !important;
}

/* Conceal the intermediate Edit Image form before the native
   Image action opens the Select Image picker.
   Existing visible popups are excluded. */
body[data-epd-photo-opening] .Popup:not([data-epd-photo-existing-visible]) {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: none !important;
    animation: none !important;
}

/* Keep Edit Image concealed while the selected image
   is saved automatically through the native workflow. */
.Popup[data-epd-photo-auto-save] {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: none !important;
    animation: none !important;
}

/* Conceal the native Enhancements menu while opening Image.
   Opacity keeps native menu items measurable and clickable.
   InsertPhotoShortcut.js manages the temporary markers. */
body[data-epd-photo-menu-opening]
.ProseMirrorToolbar [data-epd-photo-menu-trigger],
body[data-epd-photo-menu-opening]
.ProseMirrorToolbar ul.rte2-toolbar-submenu-2-items[aria-label="Enhancements"] {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: none !important;
    animation: none !important;
}

/* Conceal the native Enhancements menu during automatic
   module insertion without affecting manual usage. */
body[data-epd-mira-menu-opening]
.ProseMirrorToolbar ul.rte2-toolbar-submenu-2-items[aria-label="Enhancements"] {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: none !important;
    animation: none !important;
}

/* Conceal newly created intermediate module dialogs.
   The temporary markers are cleared by the module workflow. */
body[data-epd-mira-opening] .Popup:not([data-epd-mira-existing-visible]) {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: none !important;
    animation: none !important;
}

/*
 * Dedicated responsive editorial toolbar.
 *
 * All six shortcuts appear below the native Brightspot toolbar.
 *
 * Sticky positioning follows the native toolbar while the editor
 * is visible. Both toolbars naturally disappear when scrolling
 * beyond the editor container.
 *
 * The native toolbar height and background are supplied by
 * EditorialShortcutsCommon.js through CSS custom properties.
 *
 * A solid background prevents underlying article content from
 * showing through the editorial buttons.
 */
.epd-editorial-toolbar {
    box-sizing: border-box;

    position: sticky;
    top: var(--epd-native-toolbar-height, 45px);
    z-index: 100;

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;

    max-width: 100%;
    min-width: 0;

    padding: 7px 10px;

    color: inherit;
    background: var(--epd-editorial-background, Canvas);

    border-top: 1px solid rgba(128, 128, 128, 0.20);
    border-bottom: 1px solid rgba(128, 128, 128, 0.20);
}

/* Keep the native toolbar above the editorial toolbar.
   Apply only when the editorial toolbar is installed. */
.ProseMirrorToolbar:has(+ .epd-editorial-toolbar) {
    z-index: 101;
}

/* Responsive container for the six editorial shortcuts. */
.epd-editorial-toolbar-actions {
    box-sizing: border-box;

    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;

    min-width: 0;
}

/* Shared appearance for editorial shortcut buttons. */
.epd-editorial-toolbar .epd-editorial-button {
    box-sizing: border-box;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    max-width: 100%;
    min-height: 30px;

    padding: 5px 10px;

    border: 1px solid rgba(128, 128, 128, 0.35);
    border-radius: 5px;

    background: rgba(128, 128, 128, 0.10);
    color: inherit;

    cursor: pointer;

    font: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
}

/* Shared SVG icon styling. */
.epd-editorial-toolbar .epd-editorial-button svg {
    display: block;
    flex: none;

    width: 18px;
    height: 18px;

    stroke: currentColor;
}

/* Hover state. */
.epd-editorial-toolbar .epd-editorial-button:hover {
    background: rgba(128, 128, 128, 0.23);
}

/* Keyboard accessibility. */
.epd-editorial-toolbar .epd-editorial-button:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Prevent repeated actions while a shortcut is running. */
.epd-editorial-toolbar .epd-editorial-button:disabled {
    cursor: wait;
    opacity: 0.6;
}

/*
 * Narrow-screen layout.
 *
 * Allow shortcut buttons to wrap onto additional rows instead
 * of overflowing or disappearing outside the editor.
 */
@media (max-width: 640px) {
    .epd-editorial-toolbar {
        gap: 6px;
        padding: 6px;
    }

    .epd-editorial-toolbar-actions {
        flex-basis: 100%;
    }
}

/*
 * Keep the native and editorial toolbars sticky only while
 * the rich text editor has focus.
 *
 * This prevents both toolbars from overlapping Brightspot's
 * global search results while preserving sticky behavior
 * during editing.
 */
.ProseMirrorContainer
.ProseMirrorToolbar:has(+ .epd-editorial-toolbar),
.ProseMirrorContainer
.epd-editorial-toolbar {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
}

/* Native Brightspot toolbar. */
.ProseMirrorContainer:focus-within
.ProseMirrorToolbar:has(+ .epd-editorial-toolbar) {
    position: sticky !important;
    top: 0 !important;
    z-index: 101 !important;
}

/* Editorial shortcuts toolbar. */
.ProseMirrorContainer:focus-within
.epd-editorial-toolbar {
    position: sticky !important;
    top: var(--epd-native-toolbar-height, 45px) !important;
    z-index: 100 !important;
}
