.rail-filters .filter-checkbox {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    min-height: 32px;
    margin: 0;
    padding: var(--space-xs) var(--space-sm);
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    font: inherit;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    text-align: left;
    cursor: pointer;
}

.rail-filters .filter-checkbox > i {
    flex: none;
    width: 18px;
    text-align: center;
    color: var(--color-text-light);
}

.rail-filters .filter-checkbox:hover {
    background: var(--color-bg);
}

/* The input covers the row so the label and count share a single target. */
.rail-filters .filter-checkbox input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.rail-filters .filter-checkbox:has(input:checked) {
    background: var(--color-primary-light);
    box-shadow: inset 3px 0 0 var(--color-primary);
}

.rail-filters .filter-checkbox:has(input:checked) > i {
    color: var(--color-primary-dark);
}

.rail-filters .filter-checkbox:has(input:checked) > span:not(.filter-count) {
    font-weight: 700;
}

.rail-filters .filter-checkbox:has(input:focus-visible) {
    outline: 3px solid var(--color-primary);
    outline-offset: -1px;
}

.rail-filters .filter-count {
    margin-left: auto;
    background: none;
    padding: 0;
    font-weight: 400;
}

.rail__group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-border-light);
}

.rail__group-name {
    margin: 0 0 2px var(--space-sm);
    font-family: var(--font-base);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

#rail-lang label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-block-size: 28px;
    cursor: pointer;
}

#rail-info .workspace__meta {
    margin: 0;
    padding: 0;
    border: none;
}

.filter-more {
    margin-block-start: var(--space-sm);
}

.filter-more__name {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin: 0 0 2px;
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
}

.letters-drawer__line .selection-sentence {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: var(--font-size-sm);
    color: var(--color-text);
}

.letters-drawer__line .selection-sentence__lead {
    display: inline;
    margin-right: var(--space-xs);
    font-size: var(--font-size-sm);
    font-weight: 400;
    color: var(--color-text-light);
}

.content-wrapper:has(> .filter-sidebar:not([hidden])) #reset-filters {
    display: none;
}

.letters-drawer__reset {
    flex: none;
    min-height: 24px;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: var(--font-size-sm);
    color: var(--color-link);
    text-decoration: underline;
    cursor: pointer;
}

/* The language key that is the language filter: one row of marks over the width of a figure, each
   as wide as its share of the selection and at least as wide as its name; the band of a mark is
   its share, the name stands below it. A pressed mark carries the selection colour under its name,
   marks outside a language filter fade. */
.language-key {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: var(--space-xs) 2px;
    width: 100%;
}

.language-key__name {
    flex: none;
    align-self: flex-end;
    padding: 0 var(--space-sm) 2px 0;
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
}

.language-key__mark {
    display: flex;
    flex-basis: auto;
    flex-direction: column;
    flex-shrink: 0;
    gap: 3px;
    min-width: 0;
    min-height: 24px;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    text-align: left;
    cursor: pointer;
}

.language-key__mark::before {
    content: "";
    display: block;
    height: 8px;
    background: var(--language);
}

.language-key__label {
    padding: 0 var(--space-xs) 2px 0;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
}

.language-key__mark:hover .language-key__label {
    border-bottom-color: var(--color-border-control);
}

.language-key__mark[aria-pressed="true"] .language-key__label {
    border-bottom-color: var(--color-primary);
    font-weight: 700;
}

.language-key__mark.is-outside::before {
    opacity: 0.3;
}

.language-key__mark.is-outside .language-key__label {
    color: var(--color-text-light);
}

.language-key__mark:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 1px;
}

.language-key__other {
    display: flex;
    flex: none;
    align-items: flex-end;
    gap: var(--space-xs);
    margin-left: var(--space-md);
    padding-bottom: 4px;
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
}

.language-key__other::before {
    content: "";
    width: 10px;
    height: 10px;
    margin-bottom: 3px;
    border-radius: 2px;
    background: var(--language);
}
