/* Оболочка статьи: кластеры, заголовок, эквиваленты.
   Часть v3/word-card.css; порядок частей важен — см. static/README.md. */
/**
 * Карточка словарной статьи: заголовок, эквиваленты, примеры, действия.
 *
 * Часть бывшего v3/word.css (2542 строки). Разрез сделан по границам правил
 * без единой перестановки: части подключаются подряд в base.html, и склейка
 * даёт исходный файл байт в байт. Порядок менять нельзя — в CSS он и есть
 * каскад, а здесь медиазапросы разбросаны по всему файлу, а не собраны в
 * хвосте, так что «адаптив отдельно» тут не выделить.
 *
 * Части лежат в v3/, рядом с прежним файлом: относительные пути к картинкам
 * считаются от таблицы стилей, и глубину менять нельзя.
 */
/* Word entry media/audio + in-card content primitives. */

/* Shared surface-mix aliases — used by button hover/active overrides throughout this file */
:root {
    --word-surface-hover: color-mix(in srgb, var(--theme-surface-base) 88%, var(--theme-surface-subtle));
    --word-surface-active: color-mix(in srgb, var(--theme-surface-base) 82%, var(--theme-surface-subtle));
}

[data-word-entry-shell].content-container {
    --surface-quiet-radius: var(--surface-radius);
    --surface-quiet-border: var(--container-border-shell);
    --surface-quiet-bg: var(--container-surface-subsection);
    --surface-quiet-backdrop: none;
    --content-body-inset-x: clamp(14px, 1.4vw, 18px);
    --content-body-inset-y: clamp(12px, 1.2vw, 16px);
    padding: 0;
    gap: 0;
    border-radius: var(--surface-radius);
    border: 0;
    background: var(--theme-surface-base);
}

[data-word-entry-shell] > .content-body,
[data-word-entry-body] {
    display: grid;
    gap: 8px;
}

[data-word-cluster] {
    --word-cluster-rail-bg: color-mix(in srgb, var(--theme-surface-base) 72%, var(--theme-surface-subsection));
    display: grid;
    gap: 8px;
    min-width: 0;
}

[data-word-cluster] + [data-word-cluster] {
    margin-top: clamp(10px, 1.2vw, 14px);
}

[data-word-cluster] + :is([data-word-async-placeholder], [data-word-async-target], [data-word-section]) {
    margin-top: 0;
}

[data-word-shared-group] {
    display: grid;
    gap: 8px;
    min-width: 0;
    margin-top: clamp(12px, 1.4vw, 18px);
}

[data-word-cluster] + [data-word-shared-group] {
    margin-top: clamp(10px, 1.2vw, 14px);
}

[data-word-shared-group][hidden] {
    display: none !important;
}

[data-word-shared-group] > .section-head {
    margin-bottom: 0;
}

[data-word-shared-group] > .section-head .section-head__inner {
    padding-top: 0;
}

[data-word-shared-stack] {
    display: grid;
    gap: 8px;
    min-width: 0;
}

[data-word-shared-stack] > * {
    min-width: 0;
    margin-top: 0;
}

[data-word-shared-stack] > [data-word-async-target] {
    display: grid;
    gap: 0;
}

[data-word-cluster-stack] {
    display: grid;
    gap: 8px;
    min-width: 0;
    position: relative;
    padding-inline-start: clamp(10px, 1.2vw, 14px);
}

[data-word-cluster-stack]::before {
    content: "";
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 0;
    width: 2px;
    border-radius: var(--radius-pill);
    background: var(--word-cluster-rail-bg);
}

[data-word-cluster-stack] > * {
    min-width: 0;
    margin-top: 0;
}

[data-word-entry-hero] {
    min-width: 0;
    gap: 10px;
}

[data-word-entry-hero][data-word-entry-layout="split"] {
    display: grid;
    grid-template-columns: minmax(0, 1.62fr) minmax(220px, 0.72fr);
    grid-template-areas:
        "head media"
        "actions media";
    align-items: start;
    gap: 14px 20px;
}

[data-word-entry-hero][data-word-entry-layout="stack"] {
    display: grid;
    justify-items: stretch;
    align-content: start;
    gap: 10px;
}

[data-word-entry-head] {
    --layout-stack-gap: 7px;
    max-width: 72ch;
    grid-area: head;
}

[data-word-entry-hero][data-word-entry-layout="stack"] [data-word-entry-head] {
    grid-area: auto;
    inline-size: min(100%, 64ch);
    max-width: 64ch;
    justify-self: start;
}

[data-word-entry-shell] .title-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--control-gap-base) var(--control-gap-wide);
    margin: 0;
    padding: 0;
}

[data-word-entry-shell] .title-row > * {
    min-width: 0;
}

[data-word-entry-shell] .title-row > .text-title {
    --text-title-size: clamp(28px, 2.3vw, 36px);
    --text-title-line: 1.08;
    --text-title-weight: var(--hierarchy-title-weight);
    --text-title-track: -0.02em;
    --text-title-color: var(--text-primary);
}

[data-word-entry-shell] .title-row > .text-title sup {
    margin-left: 4px;
    font-size: 0.45em;
    line-height: var(--type-control-line);
    vertical-align: top;
    color: var(--text-secondary);
}

[data-word-chip].badge {
    --badge-min-height: 22px;
    --badge-padding: 2px 8px;
    --badge-border: 0;
    --badge-bg: var(--theme-surface-subtle);
    --badge-color: var(--theme-text-muted);
    --badge-font-size: var(--type-label-size);
    --badge-line-height: var(--type-label-line);
    --badge-letter-spacing: 0;
    --badge-text-transform: none;
}

[data-word-entry-shell] .title-row [data-word-chip] {
    align-self: baseline;
    margin-bottom: 2px;
}

[data-word-entry-summary] > .badge {
    color: var(--theme-text-normal);
}

[data-word-entry-summary] {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    overflow-wrap: break-word;
}

[data-word-meaning].text-summary {
    margin: 0;
    padding: 0;
    font-size: var(--type-body-xl-size);
    line-height: 1.45;
    color: var(--text-primary);
    max-width: 65ch;
}

[data-word-meaning].text-summary[data-word-meaning-tone="definition"] {
    font-size: var(--type-body-lg-size);
    line-height: 1.6;
    color: var(--text-primary);
}

[data-word-entry-meta] {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px 10px;
    margin: 0;
}

[data-word-entry-meta-line].text-meta {
    flex: 1 1 100%;
    margin: 0;
    max-width: 65ch;
    --text-meta-size: var(--type-body-sm-size);
    --text-meta-line: 1.5;
    --text-meta-color: var(--theme-text-muted);
}

[data-word-entry-meta] > .badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    --badge-min-height: 24px;
    --badge-padding: 2px 8px;
    --badge-border: 0;
    --badge-bg: var(--theme-surface-subtle);
    --badge-color: var(--theme-text-muted);
    --badge-font-size: var(--type-body-sm-size);
    --badge-line-height: 1.25;
    --badge-letter-spacing: 0;
    --badge-text-transform: none;
}

[data-word-entry-meta] > .badge .action-icon {
    --action-icon-size: 12px;
    color: inherit;
    opacity: 0.8;
}

[data-word-entry-meta] > .badge .text-meta {
    color: inherit;
}

[data-word-grammar-actions] {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

[data-word-equivalent-list].list-shell {
    --list-shell-gap: 0;
    --list-shell-padding: 0;
    --list-shell-radius: var(--radius-none);
    --list-shell-bg: transparent;
    --list-shell-border: 0;
}

[data-word-equivalent-row] {
    display: grid;
    gap: 6px;
    padding: 8px var(--content-panel-shell-padding-x, 10px);
    border-top: 1px solid color-mix(in srgb, var(--theme-border-normal) 58%, transparent);
    background: var(--theme-surface-base);
}

[data-word-equivalent-row]:first-child {
    border-top: 0;
}

[data-word-equivalent-words] {
    --layout-cluster-align: flex-start;
    --layout-cluster-gap: 6px 8px;
}

[data-word-equivalent-link] {
    display: inline-flex;
    align-items: baseline;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    color: var(--theme-text-strong);
    font-size: clamp(22px, 1.9vw, 30px);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.01em;
    text-decoration: none;
}

[data-word-equivalent-link]:is(:hover, :focus-visible) {
    color: var(--text-link-color);
}

/* Comma separator between equivalent words.
 *
 * Rendered as an explicit DOM node (.equiv-sep) — not ::after — so that
 * font-size, line-height, and flex behaviour are all under direct control
 * and cannot cause height instability from inherited body line-height.
 *
 * Placement: last child inside .equiv-word-pair (inline-flex), so the
 * comma always stays with its pair when the cluster wraps.
 */
.equiv-sep {
    font-size: clamp(22px, 1.9vw, 30px); /* match [data-word-equivalent-link] */
    line-height: 1;                        /* keep flex-item height == font-size */
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--theme-text-muted);
    pointer-events: none;
    user-select: none;
    /* The pair's gap:4px would add unwanted space before the comma.
       Pull back by 2px: leaves 2px optical gap (looks natural). */
    margin-inline-start: -2px;
}

/* Equiv word + audio buttons wrapper */
.equiv-word-pair {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Row of voice buttons (one per voice) */