/* Разделы статьи: шапки, настройки показа, показатели похожести.
   Часть v3/word.css; порядок частей важен — см. static/README.md. */
.similarity-dot {
    width: 9px;
    height: 9px;
    min-width: 9px;
    min-height: 9px;
    border-radius: var(--radius-round);
    display: inline-flex;
    flex: 0 0 9px;
    border: 1px solid color-mix(in srgb, var(--text-secondary) 45%, transparent);
}

.similarity-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--control-gap-tight);
    min-height: 22px;
    padding: 0 8px;
    border-radius: var(--button-radius-unified);
    border: 1px solid color-mix(in srgb, var(--theme-border-normal) 82%, transparent);
    background: var(--sidebar-ladder-section-bg, var(--theme-surface-subsection));
    color: var(--text-secondary);
    flex: 0 0 auto;
}

.similarity-indicator--compact {
    min-height: 24px;
    padding: 0 9px;
}

/* Кнопки оценки лежат в разметке рядом со ссылкой, а не внутри неё:
   кнопка внутри ссылки неоднозначна и для мыши, и для клавиатуры, и для
   средств доступности. Визуально же им место внутри карточки, поэтому
   позиционируем их поверх её правого края. */
.list-shell > li:has(> .card-feedback) {
    position: relative;
}

.card-feedback {
    position: absolute;
    inset-inline-end: 0.6rem;
    inset-block-start: 0.5rem;
    display: inline-flex;
    gap: 0.15rem;
    align-items: center;
    /* Не конкурируют за внимание с самой карточкой: проявляются при наведении
       и фокусе, но с клавиатуры доступны всегда. */
    opacity: 0;
    transition: opacity 0.15s ease;
}

li:hover > .card-feedback,
li:focus-within > .card-feedback,
.card-feedback:focus-within {
    opacity: 1;
}

.card-feedback__button {
    --icon-size: 0.95rem;
    padding: 0.2rem;
}

/* Нажатое состояние не описывается здесь: оно общее для всех кнопок-
   переключателей с иконкой и задано в components/favorites.css. Своя заливка
   иконки выглядела чужеродно и расходилась с избранным и «изученным». */
.card-feedback__button[aria-pressed="true"] {
    opacity: 1;
}


.similarity-dot--high {
    background: color-mix(in srgb, var(--emphasis-accent-brand) 70%, transparent);
    border-color: color-mix(in srgb, var(--emphasis-accent-brand) 65%, transparent);
}

.section-head__controls--block,
.content-prefs {
    position: relative;
    z-index: 1;
}

.section-head__action-rail--block {
    flex: 0 0 auto;
    overflow: visible;
}

.content-prefs__trigger {
    margin-left: 0;
    color: var(--theme-text-strong);
}

.content-prefs__trigger .action-icon__img {
    -webkit-filter: var(--icon-filter);
    filter: var(--icon-filter);
}

.section-head__status--summary {
    border: 0;
    background: transparent;
    box-shadow: var(--shadow-none);
    border-radius: 0;
    padding: 0;
    font-size: var(--type-label-size);
    line-height: var(--type-control-line);
    white-space: nowrap;
}

.section-head__separator {
    color: var(--text-secondary);
    opacity: 0.52;
}

.section-head__metric-trigger {
    --status-trigger-min-height: 24px;
    --status-trigger-min-width: 0;
    --status-trigger-padding: 0 8px;
    --status-trigger-border: 1px solid var(--theme-border-surface-item);
    --status-trigger-border-hover: var(--theme-border-control);
    --status-trigger-bg: transparent;
    --status-trigger-bg-hover: transparent;
    --status-trigger-color: var(--text-secondary);
    --status-trigger-font-size: var(--type-label-size);
    --status-trigger-font-weight: var(--type-label-weight);
    --status-trigger-line-height: var(--type-control-line);
    margin: 0;
    font: inherit;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: var(--shadow-none);
    appearance: none;
    -webkit-appearance: none;
}

.section-head__metric-trigger--semantic {
    --status-trigger-border: 1px solid var(--theme-border-subtle);
    --status-trigger-bg: transparent;
    --status-trigger-bg-hover: transparent;
    --status-trigger-color: var(--theme-text-normal);
}

.section-head__metric-trigger--interactive {
    cursor: pointer;
}

.section-head__metric-trigger--interactive[aria-expanded="true"] {
    background: transparent;
    border-color: var(--theme-border-strong);
    color: var(--theme-text-strong);
}

.section-head__metric-trigger--interactive:focus-visible {
    outline: none;
    box-shadow: var(--state-focus-ring-shadow);
}

.section-head__status--summary .content-prefs {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.section-head__status--summary .status-trigger {
    --status-trigger-bg: transparent;
    --status-trigger-bg-hover: transparent;
}

.section-head__status--summary .content-prefs__stats {
    display: none;
}

.section-head__status--summary .content-prefs--header .content-prefs__trigger {
    background: transparent;
}

.section-head__status--summary .content-prefs__stats.button-panel__status {
    --button-panel-status-bg: transparent;
    --button-panel-status-border: 0;
}

:is([data-word-section], [data-word-cluster-section], [data-word-shared-section]) [data-section-head-state].status-trigger {
    --status-trigger-bg: transparent;
    --status-trigger-bg-hover: transparent;
}

.content-prefs {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--control-gap-tight);
    width: auto;
    max-width: 100%;
}

.content-prefs--summary {
    gap: 0;
}

.content-prefs--header {
    justify-content: flex-end;
}

.content-prefs--modal {
    width: 100%;
    display: grid;
    gap: var(--control-gap-loose);
    align-items: stretch;
    justify-content: flex-start;
}

.content-prefs__trigger {
    min-height: var(--button-height-unified);
    height: var(--button-height-unified);
    width: var(--button-height-unified);
    padding: 0;
    border-radius: var(--button-radius-unified);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.content-prefs__trigger .action-icon {
    --action-icon-size: 14px;
}

.content-prefs--header .content-prefs__trigger {
    width: 28px;
    min-height: 28px;
    height: 28px;
    border-radius: var(--button-radius-unified);
    border: 1px solid var(--border-color);
    background: var(--container-color);
    color: var(--txt-color);
}

.content-prefs--header .content-prefs__trigger .action-icon {
    --action-icon-size: var(--type-control-size);
}

.content-prefs__field {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--control-gap-loose);
    margin: 0;
}

.content-prefs__field--toggle {
    align-items: center;
}

.content-prefs__label {
    font-size: var(--type-control-meta-size);
    line-height: var(--type-control-meta-line);
    color: var(--text-secondary);
    white-space: nowrap;
}

.content-prefs .field-control {
    min-height: var(--button-height-unified);
    height: var(--button-height-unified);
    border-radius: var(--button-radius-unified);
    border: 1px solid var(--theme-border-normal);
    background: var(--theme-surface-subsection);
    color: var(--theme-text-strong);
    font-size: var(--font-size-sm);
    line-height: var(--type-control-meta-line);
    padding: 0 var(--control-padding-x-base);
    box-shadow: var(--shadow-none);
}

[data-semantic-pref-show-metric-input] {
    width: 18px;
    height: 18px;
    margin: 0;
    border-radius: var(--control-check-radius);
    border: 1px solid var(--theme-border-normal);
    accent-color: var(--emphasis-accent-brand);
}

[data-semantic-pref-score-input] {
    max-width: 180px;
}

.content-prefs .field-control:focus-visible,
[data-semantic-pref-show-metric-input]:focus-visible {
    outline: none;
    border-color: var(--border-color-focus);
    box-shadow: var(--state-focus-ring-shadow);
}

.content-prefs__reset {
    min-height: var(--button-height-unified);
    box-shadow: var(--shadow-none);
    justify-self: start;
}

.content-prefs__preset-row {
    --button-panel-actions-gap-x: var(--control-gap-tight);
    --button-panel-actions-gap-y: var(--control-gap-tight);
    margin: 0;
    justify-content: flex-start;
}

.content-prefs__preset {
    min-height: var(--button-height-unified);
    box-shadow: var(--shadow-none);
}

.content-prefs__preset[aria-pressed="true"] {
    background: var(--theme-surface-base);
    border-color: var(--theme-border-control);
    color: var(--theme-text-strong);
}

.content-prefs__reset[disabled] {
    opacity: 0.55;
    cursor: default;
}

.content-prefs__stats.button-panel__status {
    --button-panel-status-gap: var(--space-2);
    --button-panel-status-min-height: var(--button-height-unified);
    --button-panel-status-padding: 0 10px;
    --button-panel-status-radius: var(--button-radius-unified);
    --button-panel-status-bg: var(--theme-surface-base);
    --button-panel-status-font-size: var(--type-control-meta-size);
    --button-panel-status-line-height: var(--type-control-line);
}

.content-prefs--header .content-prefs__stats.button-panel__status {
    --button-panel-status-min-height: 28px;
    --button-panel-status-radius: var(--button-radius-unified);
    --button-panel-status-padding: 0 10px;
    --button-panel-status-font-size: var(--type-label-size);
}

[data-pref-stats] [data-pref-hidden-value],
[data-pref-stats] [data-pref-shown],
[data-pref-stats] [data-pref-total] {
    color: var(--theme-text-strong);
    font-weight: var(--type-label-weight);
}

[data-pref-stats] [data-pref-hidden-count][hidden] {
    display: none;
}

.content-prefs__about {
    display: grid;
    gap: 10px;
    border: 1px solid color-mix(in srgb, var(--field-border-color) 75%, transparent);
    border-radius: var(--radius-lg);
    padding: var(--control-padding-x-wide);
    background: color-mix(in srgb, var(--field-bg-color) 90%, transparent);
}

.content-prefs__about-title {
    margin: 0;
    font-size: var(--type-control-size);
}

.content-prefs__about-text {
    margin: 0;
    font-size: var(--font-size-sm);
    line-height: var(--type-body-sm-line-tight);
}

.content-note {
    margin: 0;
    min-width: 0;
}

.content-note__text {
    margin: 0;
    min-width: 0;
    color: var(--text-secondary);
}

.content-note--inline {
    margin: 0 0 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.content-note--inline .content-note__badge {
    --badge-min-height: 24px;
    --badge-padding: 0 10px;
    --badge-border: var(--container-border-subsection);
    --badge-bg: color-mix(in srgb, var(--container-surface-subsection) 84%, var(--container-surface-item));
    --badge-color: var(--theme-text-strong);
    --badge-font-size: var(--type-label-size);
    --badge-line-height: var(--type-control-line);
    --badge-font-weight: var(--type-caption-weight);
}

.content-note--inline .content-note__text {
    font-size: var(--type-control-meta-size);
    line-height: var(--type-caption-line);
}

.content-note--empty {
    margin: var(--space-5) 0 0;
    padding: 14px 16px;
    border-radius: var(--surface-radius-shell-mobile);
    border: var(--word-page-card-border);
    background: var(--theme-surface-subsection);
}

.content-footer__actions :is(.app-button, .chip-button) {
    min-height: var(--button-height-unified);
    border-radius: var(--button-radius-unified);
}

[data-example-list].list-shell {
    --list-shell-gap: var(--space-3);
    --list-shell-padding: 0;
    --list-shell-radius: 0;
    --list-shell-bg: transparent;
    --list-shell-border: 0;
    margin: 0;
    row-gap: var(--space-3);
    background: transparent;
}

[data-example-list].list-shell li {
    border-bottom: none;
    padding: 0;
    margin: 0;
}

@media (max-width: 900px) {
    .content-footer__actions {
        width: 100%;
        justify-content: flex-start;
    }

    .content-footer--progress {
        align-items: stretch;
    }

    .content-footer__actions .app-button {
        flex: 0 0 auto;
    }

    [data-word-actions] {
        align-items: stretch;
        flex-direction: column;
    }

    [data-word-actions] [data-word-actions-primary] {
        width: 100%;
    }

    [data-word-actions] [data-word-actions-more] {
        width: auto;
        justify-content: flex-end;
    }

    [data-word-actions-more-menu] {
        left: 0;
        right: auto;
        width: min(320px, calc(100vw - 32px));
    }

    :is([data-word-section], [data-word-cluster-section], [data-word-shared-section]) {
        --surface-quiet-radius: var(--surface-radius-shell-mobile);
        --content-panel-shell-padding-x: 10px;
        --content-panel-shell-padding-y: 10px;
        --content-panel-shell-body-padding-top: 8px;
    }

    .content-card--example {
        padding: 7px 10px;
        row-gap: 3px;
        column-gap: 6px;
    }
}

@media (max-width: 640px) {
    .content-footer__actions .app-button {
        width: auto;
        min-width: 0;
        flex: 0 0 auto;
    }

    [data-word-entry-shell].content-container {
        --content-body-inset-x: 10px;
        --content-body-inset-y: 10px;
    }

    [data-word-cluster] {
        gap: 8px;
    }

    [data-word-cluster] + [data-word-cluster] {
        margin-top: 8px;
    }

    [data-word-shared-group] {
        margin-top: 10px;
        gap: 8px;
    }
}

.content-card--example {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "body actions"
        "secondary secondary";
    column-gap: var(--control-gap-tight);
    row-gap: 4px;
    width: 100%;
    padding: 8px var(--content-panel-shell-padding-x, 12px);
    border: 1px solid color-mix(in srgb, var(--theme-border-surface-item) 82%, transparent);
    border-radius: var(--surface-radius);
    background: var(--theme-surface-base);
    overflow: visible;
    box-sizing: border-box;
}

.highlight-target {
    position: relative;
    isolation: isolate;
}

.highlight-target::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: color-mix(in srgb, var(--emphasis-accent-brand) 10%, transparent);
    opacity: 0;
    pointer-events: none;
    animation: hash-target-soft-tint 2.2s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes hash-target-soft-tint {
    0% {
        opacity: 0;
        transform: translateY(6px);
    }
    12% {
        opacity: 1;
        transform: translateY(0);
    }
    76% {
        opacity: 0.92;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(0);
    }
}

li[id^="word-usage-item-"],
li[id^="translation-item-"],
li[id^="example-item-"] {
    scroll-margin-top: 120px;
    border-radius: var(--surface-radius);
}

[data-word-action-strip="example"] {
    grid-area: actions;
    position: static;
    width: auto;
    max-width: 100%;
    margin: 0;
    pointer-events: auto;
    justify-content: flex-end;
    justify-self: end;
    align-self: start;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
    margin-left: 0;
}

.content-card--example .content-card__body {
    grid-area: body;
    min-width: 0;
    padding-right: 0;
    min-height: 26px;
}

.content-card--example .content-card__secondary {
    grid-area: secondary;
    min-width: 0;
}

.content-card--example > .text-meta {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0;
    font-size: var(--font-size-xs);
    color: var(--theme-text-muted);
}

@media (hover: hover) and (pointer: fine) {
    [data-word-action-strip="example"],
    [data-word-action-strip="reference"] {
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--motion-dur-xs) var(--motion-ease);
    }
    .content-card--example:hover [data-word-action-strip="example"],
    .content-card--example:focus-within [data-word-action-strip="example"],
    .word-reference-card:hover [data-word-action-strip="reference"],
    .word-reference-card:focus-within [data-word-action-strip="reference"],
    [data-word-action-strip]:has([data-card-actions-trigger][aria-expanded="true"]) {
        opacity: 1;
        pointer-events: auto;
    }
    /* Remove action strip from grid flow so it doesn't stretch the body/translation row gap */
    .content-card--example {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "body"
            "secondary";
    }
    .content-card--example [data-word-action-strip="example"] {
        position: absolute;
        grid-area: auto;
        top: 8px;
        right: var(--content-panel-shell-padding-x, 12px);
    }
}

@media (hover: none), (pointer: coarse) {
    [data-word-action-strip="example"],
    [data-word-action-strip="reference"] {
        opacity: 1;
    }
}

@media (max-width: 900px) {
    [data-word-entry-hero][data-word-entry-layout="split"] {
        grid-template-columns: 1fr;
        grid-template-areas:
            "head"
            "media"
            "actions";
        gap: 14px;
    }

    .section-head__controls--block {
        width: 100%;
        justify-content: flex-start;
    }

    .content-prefs--modal .content-prefs__field {
        flex: 1 1 220px;
        align-items: flex-start;
        flex-direction: column;
    }

    .content-prefs--modal .field-control {
        width: 100%;
    }

    .content-prefs--summary {
        flex-wrap: wrap;
        width: 100%;
    }

    .content-prefs--header {
        width: auto;
        flex-wrap: nowrap;
        justify-content: flex-end;
    }

    [data-pref-stats] {
        width: auto;
    }
}

/* Card actions popover — ⋯ trigger */
[data-card-actions-menu] {
    position: fixed;
    z-index: var(--z-popover);
    display: flex;
    gap: 2px;
    padding: 4px;
    background: var(--container-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-floating);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(3px);
    transition:
        opacity 140ms var(--motion-ease),
        transform 140ms var(--motion-ease),
        visibility 0s 140ms;
    top: 0;
    left: 0;
}

[data-card-actions-menu][data-open] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition:
        opacity 140ms var(--motion-ease),
        transform 140ms var(--motion-ease),
        visibility 0s;
}

[data-example-body] {
    display: grid;
    gap: 1px;
}

.menu-button--stack[data-word-entry-nav-link] {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
}

.menu-button--stack[data-word-entry-nav-link] .menu-button__meta {
    display: block;
    width: 100%;
    color: var(--theme-text-muted);
    line-height: 1.35;
}

/* ── Карточка семантического соседа ──────────────────────────────────────
   Сигнал здесь один и крошечный, поэтому у него нет ни рамки, ни подложки:
   девятипиксельная точка в обведённой пилюле выглядит тяжелее самой точки.
   Слот .result-card__signal сохранён, чтобы не расходиться с остальными
   карточками, — снимается только оформление. */
.result-card__signal--bare {
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    /* Точка выравнивается по строчной высоте заголовка, а не по его боксу:
       иначе она «висит» выше строки при переносе длинной единицы. */
    align-self: center;
}

/* Две строки вместо трёх: заголовок с точкой и строка перевода. Просвет
   между ними уже общего карточного, иначе короткие пары читаются вразброс. */
.list-shell .result-card--search .result-card__body {
    --result-card-body-gap: 3px;
}

.result-card__equivalents {
    color: var(--theme-text-strong, currentColor);
}

.result-card__summary {
    font-size: var(--type-body-sm-size, inherit);
    line-height: 1.35;
}
