/* ─── Project list ───────────────────────────────────────────────────
   Theme-agnostic: everything here borrows the theme's own colour through
   currentColor, so the list keeps its shape on any of the skins. What it
   adds is meaning that survives without colour — a marked current row, a
   word for every state, and a focus ring you can see. */

/* Two sections, each with its own quiet heading: the project you are in,
   and the ones you could switch to. */
.git-projects-group + .git-projects-group {
    margin-top: 0.5rem;
}

.git-projects-group-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.6;
    padding: 0 0 2px 0.2em;
    border-bottom: 1px solid currentColor;
    margin-bottom: 3px;
}

.git-project-row {
    display: flex;
    align-items: stretch;
    gap: 2px;
}

.git-project-row > .git-project-item {
    flex: 1 1 auto;
    min-width: 0;
}

/* The rename control only exists on the open project, so it does not need
   to shout — but it does need to be reachable and readable. */
.git-project-rename {
    flex: 0 0 auto;
    background: transparent;
    border: 1px solid currentColor;
    color: inherit;
    font-family: inherit;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 0.5em;
    cursor: pointer;
    opacity: 0.7;
}

.git-project-rename-save,
.git-project-rename-cancel {
    flex: 0 0 auto;
    background: transparent;
    border: 1px solid currentColor;
    color: inherit;
    font-family: inherit;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 0.5em;
    cursor: pointer;
}

.git-project-rename-cancel {
    opacity: 0.7;
}

.git-project-rename:hover,
.git-project-rename:focus,
.git-project-rename:focus-visible {
    opacity: 1;
    outline: 2px solid currentColor;
    outline-offset: -2px;
}

.git-project-rename-input {
    flex: 1 1 auto;
    min-width: 0;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: 0.8rem;
    border: 1px solid currentColor;
    padding: 0.3em 0.4em;
}

.git-project-row.is-renaming > .git-project-item,
.git-project-row.is-renaming > .git-project-rename {
    display: none;
}

.git-project-item {
    display: flex;
    align-items: baseline;
    gap: 0.4em;
}

.git-project-mark {
    flex: 0 0 0.8em;
    text-align: center;
    font-size: 0.7rem;
}

.git-project-name {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.git-project-note {
    flex: 0 0 auto;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.75;
}

/* The project you are in: bold and marked, not merely a shade brighter. */
.git-project-item.is-current {
    font-weight: bold;
    border-left-color: currentColor;
}

.git-project-item.is-uncached {
    opacity: 0.75;
}

/* Keyboard focus has to be visible — the list is walked with arrow keys. */
.git-project-item:focus,
.git-project-item:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -2px;
}

.git-projects-status {
    font-size: 0.72rem;
    margin: 0.25rem 0;
    opacity: 0.85;
}

.git-projects-status.is-error {
    color: #ff5533;
    opacity: 1;
}

/* Touch targets on a phone want more room than a menu row gives. */
/* ── On a phone ──────────────────────────────────────────────────────
   The drawer styles every button in it as a full-width row, which would
   break a row that holds more than one. These put the row back together
   and give each control a thumb-sized target of its own. */
@media (max-width: 768px) {
    .git-project-item {
        padding: 0.6em 0.5em;
        min-height: 44px;
        align-items: center;
    }

    #menu .git-project-row,
    #mobileMenu .git-project-row {
        flex-wrap: wrap;
        gap: 4px;
        margin-bottom: 2px;
    }

    #mobileMenu .menu-content .git-project-item {
        width: auto;
        flex: 1 1 auto;
        min-width: 0;
        padding: 0.6em 0.5em;
    }

    #mobileMenu .menu-content .git-project-rename,
    #mobileMenu .menu-content .git-project-rename-save,
    #mobileMenu .menu-content .git-project-rename-cancel {
        width: auto;
        flex: 0 0 auto;
        min-height: 44px;
        min-width: 56px;
        text-align: center;
        padding: 0 0.7em;
        font-size: 0.7rem;
    }

    #mobileMenu .menu-content .git-project-rename-input,
    .git-project-rename-input {
        flex: 1 1 100%;
        min-height: 44px;
        font-size: 16px; /* anything smaller and iOS zooms the page on focus */
    }

    .git-projects-container {
        max-height: 45vh;
    }

    .git-projects-group-label {
        font-size: 0.68rem;
        padding-bottom: 4px;
    }

    .git-project-note {
        font-size: 0.7rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .git-project-item {
        transition: none;
    }
}
