/**
 * 共通 А–Я 表現索引 — Idioms & Collocations Index
 *
 * One shared alphabetical index over CAT [2-3-1-3] + [2-3-1-5]. The control
 * band (type filter / meaning-colour legend / alphabet) is the same band the
 * hub previews in its 共通 А–Я 表現索引 section, so the two must stay visually
 * identical — the shared rules are duplicated in hubs/idioms-collocations-hub.css
 * under .idmhub-index-* names.
 *
 * Per the special-page background contract this file sets no body background.
 */

.idioms-collocations-index-layout {
    max-width: 1180px;
}

.idioms-collocations-index {
    --idmx-line: #e4dbcf;
    --idmx-ink: #34291f;
    --idmx-muted: #76675b;
    display: block;
}

/* ---------- Control band ---------- */

.idmx-controls {
    display: grid;
    gap: 13px;
    margin: 0 0 1.5rem;
    padding: 16px 18px;
    border: 1px solid #d7c9b9;
    border-radius: 12px;
    background: #fffdf9;
}

.idmx-control-row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
}

.idmx-control-label {
    padding-top: 6px;
    color: #5d4d41;
    font-size: 0.76rem;
    font-weight: 850;
}

.idmx-filter-list,
.idmx-legend,
.idmx-alphabet {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.idmx-filter,
.idmx-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 30px;
    padding: 4px 9px;
    border: 1px solid #d8cbbc;
    border-radius: 999px;
    background: #fff;
    color: #5a4a3e;
    font-size: 0.73rem;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.idmx-letter {
    min-width: 2.1rem;
}

a.idmx-filter:hover,
a.idmx-filter:focus,
a.idmx-letter:hover,
a.idmx-letter:focus {
    border-color: #9a7b5c;
    background: #f7f1e9;
    color: #3c2d23;
}

.idmx-filter.is-active,
.idmx-letter.is-active {
    border-color: #5f7f78;
    background: #5f7f78;
    color: #fff;
}

a.idmx-filter.is-active:hover,
a.idmx-filter.is-active:focus,
a.idmx-letter.is-active:hover,
a.idmx-letter.is-active:focus {
    border-color: #4d6a64;
    background: #4d6a64;
    color: #fff;
}

.idmx-filter__count {
    color: inherit;
    font-size: 0.68rem;
    font-weight: 750;
    opacity: 0.72;
}

.idmx-filter.is-pending {
    border-style: dashed;
    color: #8a7a6e;
    pointer-events: none;
}

.idmx-letter.is-disabled {
    opacity: 0.34;
    pointer-events: none;
}

.idmx-legend__key {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 27px;
    padding: 3px 7px;
    border: 1px solid #e1d7ca;
    border-radius: 6px;
    background: #fff;
    color: #65574c;
    font-size: 0.69rem;
    line-height: 1.2;
}

/* Shared by the legend keys and the per-entry markers. */
.idmx-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--idmx-marker, rgba(0, 0, 0, 0.18));
}

/* ---------- Letter sections ---------- */

.idmx-letter-section {
    margin: 0 0 1.9rem;
    scroll-margin-top: 3.5rem;
}

.idmx-letter-section__head {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin: 0 0 0.75rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid var(--idmx-line);
}

.idmx-letter-section__char {
    color: #d97800;
    font-size: 1.5rem;
    font-weight: 700;
}

.idmx-letter-section__count {
    color: var(--idmx-muted);
    font-size: 0.85rem;
}

/* ---------- Entries ---------- */

.idmx-results {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 24px;
}

.idmx-entry {
    display: block;
    min-width: 0;
    padding: 8px 0 9px;
    border-bottom: 1px solid #ece5dc;
    color: inherit;
    text-decoration: none;
}

a.idmx-entry:hover .idmx-entry__mn,
a.idmx-entry:focus .idmx-entry__mn {
    text-decoration: underline;
}

.idmx-entry__top {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 5px;
    line-height: 1.45;
}

.idmx-entry__mn {
    color: var(--idmx-ink);
    font-size: 0.82rem;
    font-weight: 850;
}

.idmx-entry__jp {
    color: #65574c;
    font-size: 0.75rem;
}

.idmx-entry__markers {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.idmx-entry__en {
    display: block;
    margin-top: 3px;
    color: #9a8d82;
    font-size: 0.68rem;
    line-height: 1.42;
}

.idmx-entry__type {
    display: inline-flex;
    margin-top: 5px;
    padding: 2px 6px;
    border: 1px solid #ddd2c5;
    border-radius: 999px;
    color: #77685c;
    font-size: 0.62rem;
    font-weight: 750;
}

.idmx-empty {
    margin: 1.5rem 0;
    color: var(--idmx-muted);
}

/* ---------- Footer ---------- */

.idmx-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--idmx-line);
}

.idmx-footer__total {
    margin: 0 0 0.25rem;
    font-weight: 700;
}

.idmx-footer__scope {
    margin: 0;
    color: var(--idmx-muted);
    font-size: 0.82rem;
}

@media (max-width: 980px) {
    .idmx-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .idmx-control-row { grid-template-columns: 1fr; }
    .idmx-control-label { padding-top: 0; }
    .idmx-results { grid-template-columns: 1fr; }
}
