/* Действия карточки: кнопки, всплывающее меню, полоса действий.
   Часть v3/word-card.css; порядок частей важен — см. static/README.md. */
[data-word-actions] :is(.app-button, .icon-button)[aria-pressed="true"] .action-icon,
[data-word-actions] :is(.app-button, .icon-button)[aria-current]:not([aria-current="false"]) .action-icon,
[data-word-actions] :is(.app-button, .icon-button)[aria-expanded="true"] .action-icon,
:is([data-word-action-strip], .section-head__action-rail--block, .audio-action-row) :is(.icon-button, .audio-speaker-trigger)[aria-pressed="true"] .action-icon,
:is([data-word-action-strip], .section-head__action-rail--block, .audio-action-row) :is(.icon-button, .audio-speaker-trigger)[aria-expanded="true"] .action-icon {
    opacity: 1;
}

[data-word-actions] :is(.app-button, .icon-button)[aria-pressed="true"] .action-icon__img,
[data-word-actions] :is(.app-button, .icon-button)[aria-current]:not([aria-current="false"]) .action-icon__img {
    filter: var(--icon-filter);
}

/* Hard-reset icon rendering for example actions (Safari-safe): no external <img> dependency. */
:is([data-word-action-strip]) :is(.icon-button)::before {
    content: none !important;
    display: none !important;
}

:is([data-word-action-strip]) .action-icon__img {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    -webkit-filter: var(--icon-filter) !important;
    filter: var(--icon-filter) !important;
}

[data-word-actions] [data-word-action] {
    width: 36px;
    min-width: 36px;
    padding: 0;
    gap: 0;
    flex: 0 0 auto;
    justify-content: center;
    font-size: var(--font-size-sm);
    line-height: var(--type-button-line);
    font-weight: var(--type-control-weight);
    color: currentColor;
    max-width: 36px;
    white-space: nowrap;
}

[data-word-actions] [data-word-action] .action-icon {
    flex: 0 0 14px;
}

[data-word-actions] [data-word-action-label] {
    display: none;
    align-items: center;
    min-width: 0;
    max-inline-size: 10ch;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--font-size-sm);
    line-height: var(--type-button-line);
    color: currentColor;
}

[data-word-actions] [data-word-action-meta].button-panel__status {
    flex: 0 0 auto;
    --button-panel-status-min-height: calc(var(--button-height-unified) - 8px);
    --button-panel-status-min-width: calc(var(--button-height-unified) * 2);
    --button-panel-status-padding: 0 var(--control-padding-x-base);
    --button-panel-status-bg: var(--word-surface-active);
    --button-panel-status-font-size: var(--font-size-xs);
    --button-panel-status-font-weight: var(--type-label-weight);
    --button-panel-status-line-height: var(--type-label-line);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-word-actions] [data-word-action][aria-pressed="true"],
[data-word-actions] [data-word-action][aria-current]:not([aria-current="false"]) {
    border-color: var(--control-selected-border);
}

[data-word-actions][data-compact="1"] [data-word-action] {
    width: 36px;
    min-width: 36px;
    padding: 0;
    gap: 0;
    justify-content: center;
}

[data-word-actions][data-compact="1"] [data-word-action-label] {
    display: none;
}

[data-word-actions][data-compact="1"] [data-word-actions-primary] {
    gap: 8px;
}

@container (max-width: 540px) {
    [data-word-editor-columns] {
        grid-template-columns: minmax(0, 1fr);
    }

    [data-word-actions] [data-word-actions-primary] {
        gap: var(--control-gap-base);
    }

    [data-word-actions] [data-word-action] {
        width: 36px;
        min-width: 36px;
        padding: 0;
        gap: 0;
        justify-content: center;
    }

    [data-word-actions] [data-word-action-label],
    [data-word-actions] [data-word-action-meta] {
        display: none;
    }
}

[data-word-actions] [data-word-actions-more] {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    flex: 0 0 auto;
    justify-content: flex-start;
    min-height: var(--button-height-unified);
    padding: 0;
}

[data-word-actions-more-trigger] {
    width: var(--button-height-unified);
    min-width: var(--button-height-unified);
    gap: 0;
    box-shadow: var(--shadow-none);
    appearance: none;
    -webkit-appearance: none;
}

[data-word-actions-more-trigger] .action-icon {
    width: 14px;
    height: 14px;
}

[data-word-actions-more-trigger] .action-icon__img {
    filter: var(--icon-filter);
}

[data-word-actions] :is(.app-button, .icon-button)[disabled],
[data-word-actions] :is(.app-button, .icon-button)[aria-disabled="true"] {
    opacity: 0.62;
    pointer-events: none;
}

[data-word-actions] :is(.app-button, .icon-button)[disabled] .action-icon,
[data-word-actions] :is(.app-button, .icon-button)[aria-disabled="true"] .action-icon {
    opacity: 0.76;
}

[data-word-actions-more-menu] {
    position: absolute;
    top: calc(100% + var(--control-gap-tight));
    right: 0;
    min-width: 220px;
    max-width: min(280px, calc(100vw - 24px));
    padding: 12px;
    border-radius: var(--surface-radius);
    border: 1px solid var(--glass-surface-border);
    background: var(--glass-surface-bg-strong);
    box-shadow: var(--glass-surface-shadow);
    -webkit-backdrop-filter: var(--glass-surface-backdrop);
    backdrop-filter: var(--glass-surface-backdrop);
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: var(--z-popover);
}

[data-word-actions].is-more-open [data-word-actions-more-menu],
[data-word-actions][data-open="true"] [data-word-actions-more-menu],
[data-word-actions-more-menu][data-open="true"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

[data-word-actions].is-more-open,
[data-word-actions][data-open="true"] {
    z-index: var(--z-popover);
}

[data-word-actions-more-menu] .menu-button {
    --menu-button-bg: transparent;
    --menu-button-bg-hover: var(--glass-control-hover-bg);
    --menu-button-bg-active: var(--glass-control-active-bg);
    --menu-button-border: transparent;
    --menu-button-border-hover: transparent;
    --menu-button-color: var(--theme-text-normal);
    --menu-button-color-hover: var(--theme-text-strong);
    width: 100%;
    min-width: 0;
    margin: 0;
}

/* Keep menu rows visually identical even if global helper classes are present. */
[data-word-actions-more-menu] .menu-button[data-info-target],
[data-word-actions-more-menu] .menu-button[data-feedback-action] {
    margin-left: 0;
    position: static;
}

[data-word-actions-more-menu] .menu-button .action-icon__img {
    filter: var(--icon-filter);
    opacity: var(--state-opacity-muted);
}

[data-word-actions-more-menu] .menu-button .action-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
}

[data-word-actions-more-menu] .menu-button > span:not(.action-icon) {
    color: currentColor;
    letter-spacing: 0;
    white-space: nowrap;
}

[data-word-section],
[data-word-cluster-section],
[data-word-shared-section] {
    --surface-quiet-radius: var(--surface-radius);
    --surface-quiet-border: var(--container-border-section);
    --surface-quiet-bg: var(--container-surface-section);
    --surface-quiet-backdrop: none;
    --content-panel-shell-padding-x: clamp(14px, 1.4vw, 18px);
    --content-panel-shell-padding-y: clamp(10px, 1.1vw, 14px);
    --content-panel-shell-body-padding-top: 8px;
    --section-head-summary-offset: 6px;
}

:is(
    [data-word-section="usage"],
    [data-word-section="translations"],
    [data-word-section="examples"],
    [data-word-section="semantic-context"]
) {
    --content-panel-shell-padding-y: clamp(10px, 1vw, 14px);
    --content-panel-shell-body-padding-top: 8px;
}
