/* Position rankings (docs/adr/0015). */

.rankings {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 40rem;
}

/* Scrolled to from the pitch: leave a little space above. */
.rankings > turbo-frame {
    display: block;
    scroll-margin-top: 1rem;
}

/* The pitch of every position, beside the list on wide screens only. */
.positions-editor__pitch {
    display: none;
}

@media (min-width: 64rem) {
    .positions-editor {
        display: grid;
        grid-template-columns: minmax(0, 40rem) minmax(0, 26rem);
        gap: 2rem;
        align-items: start;
    }

    .positions-editor__pitch {
        display: block;
        position: sticky;
        top: 1rem;
    }
}

.positions-editor__hint {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.pitch__slot--link {
    color: inherit;
    text-decoration: none;
}

.pitch__slot--link:hover .pitch__position,
.pitch__slot--link:focus-visible .pitch__position,
.pitch__slot--link.is-selected .pitch__position {
    background-color: var(--white);
    outline: 0.2rem solid var(--black);
    outline-offset: 0.1rem;
}

.pitch__slot--link:focus-visible {
    outline: none;
}

/* Overview: the top three per position. */
.rankings-table__code,
.ranking__code {
    font-size: 0.875rem;
    font-weight: 400;
}

/* Update: one collapsible card per position, striped like table rows.
   Each card sits in its own Turbo Frame, so count the frames. */
.ranking {
    border: 0.125rem solid var(--border);
    background-color: var(--white);
}

.rankings > turbo-frame:nth-child(even) > .ranking {
    background-color: var(--row-stripe);
}

.ranking[open] {
    border-color: var(--tertiary);
}

.ranking__summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
}

.ranking[open] .ranking__summary {
    background-color: var(--tertiary);
}

.ranking__title {
    font-size: 1.25rem;
    font-weight: 700;
}

.ranking__top {
    font-size: 0.875rem;
}

.ranking__form {
    padding: 0.5rem 1rem 1rem;
    background-color: var(--white);
}

.ranking__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    background-color: var(--white);
}

.ranking__item:nth-child(even) {
    background-color: var(--row-stripe);
}

/* SortableJS: the placeholder where the dragged item will land. */
.ranking__item.sortable-ghost {
    background-color: var(--tertiary);
}

.ranking__handle {
    padding: 0 0.25rem;
    font-size: 1.25rem;
    line-height: 1;
    cursor: grab;
    touch-action: none;
}

.ranking__rank {
    min-width: 1.5rem;
    font-weight: 700;
    text-align: right;
}

.ranking__who {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
}

.ranking__name {
    font-weight: 700;
    overflow-wrap: break-word;
}

.ranking__choice {
    font-size: 0.875rem;
}

.ranking__moves {
    display: flex;
    gap: 0.25rem;
}

.ranking__move {
    width: 2rem;
    height: 2rem;
    border: 0.125rem solid var(--black);
    background-color: var(--white);
    color: var(--black);
    font-weight: 700;
    cursor: pointer;
}

.ranking__move:hover,
.ranking__move:focus-visible {
    background-color: var(--tertiary);
}

.ranking__move:disabled {
    opacity: 0.3;
    cursor: default;
    background-color: var(--white);
}
