.issue_tree_header {
    padding-top: 20px;
    border-top: 2px solid grey;

    padding-bottom: 10px;
    border-bottom: 1px solid grey;
}
.issue_tree_header > span:first-child {
    font-size: larger;
    font-weight: bold;
}
.issue_tree_header > span:last-child {
    float: right;
    font-size: small;
}

ul.issue_tree {
    margin: 0;
    padding: 0;
}

li.issue_tree_elem {
    list-style: none;
    display: block;
    user-select: none;
}
li.issue_tree_elem ul {
    padding: 0;
}

.branch_issue {
    padding: 10px 0;
    display: block;
    border-bottom: 1px solid grey;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.branch_issue > * {
    vertical-align: middle;
    margin-right: 25px;
    margin-left: 5px;
}
.branch_issue:focus-visible {
    background-color: var(--gold) !important;
    color: white;
}

.arrow-img {
    transition: transform 0.2s ease-in-out;
    transform: rotate(0deg);
}
.arrow-img.expanded {
    transform: rotate(90deg);
}

.branch_list {
    --indent: 50px;
    max-height: 0;
    overflow: hidden;
    background-color: var(--beige1);
    transition: max-height 0.2s ease-in-out;
}

/* Indent per nesting level; depth 5+ shares the depth-4 indent and shade. */
.branch_list .branch_issue > span:first-child{
    margin-left: calc(var(--indent)*1);
}
.branch_list .branch_list .branch_issue > span:first-child {
    margin-left: calc(var(--indent)*2);
}
.branch_list .branch_list .branch_list .branch_issue > span:first-child {
    margin-left: calc(var(--indent)*3);
}
.branch_list .branch_list .branch_list .branch_list .branch_issue > span:first-child {
    margin-left: calc(var(--indent)*4);
}

.branch_list .branch_issue {
    background-color: hsl(35, 20%, 90%);
}
.branch_list .branch_list .branch_issue {
    background-color: hsl(35, 20%, 80%);
}
.branch_list .branch_list .branch_list .branch_issue {
    background-color: hsl(35, 20%, 70%);
}
.branch_list .branch_list .branch_list .branch_list .branch_issue {
    background-color: hsl(35, 20%, 60%);
}

.leaf_issue {
    display: flex;
    text-decoration: none;
    color: black;
    align-items: center;
}
.leaf_issue > :last-child {
    margin-left: auto;
}
.leaf_issue > :nth-child(2) {
    min-width: 8em;
}

/* The gold row highlight only where a pointer can hover: on touch it would
   stick to the row just tapped (the :focus-visible twin above is unconditional).
   !important beats the per-level backgrounds. */
@media (hover: hover) {
    .branch_issue:hover {
        background-color: var(--gold) !important;
        color: white;
    }
}

/* Compact layout (WCAG 1.4.10): shrink the per-level indent, let a leaf row wrap
   its count and icons under a long title, and give every row a 44px tap height. */
@media (max-width: 960px) {
    /* The sort links float right on desktop; on a narrow screen that overlaps
       the "Dostępne roczniki" heading and the first tree row. Stack them below
       the heading instead, with comfortable tap spacing. */
    .issue_tree_header > span:last-child {
        float: none;
        display: block;
        margin-top: 10px;
    }
    .issue_tree_header > span:last-child > a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }
    .branch_list {
        --indent: 24px;
    }
    .branch_issue > * {
        margin-right: 8px;
        margin-left: 0;
    }
    .branch_issue,
    .leaf_issue {
        min-height: 44px;
        flex-wrap: wrap;
        row-gap: 4px;
    }
    /* The title takes the line; once indent + count + icons leave it under 10em
       they wrap beneath it instead of squeezing the title into a sliver. */
    .branch_issue > span:first-child {
        flex: 1 1 10em;
        min-width: 0;
        overflow-wrap: anywhere;
    }
    .leaf_issue > :nth-child(2) {
        min-width: 0;
    }
}

/* Phone portrait: the smallest indent that still reads as nesting. */
@media (max-width: 640px) {
    .branch_list {
        --indent: 16px;
    }
}
