/**
 * Object library: category rail, card grid, lock chests. Load order is significant: keep this file's <link> position in index.html.
 */

/*
 * A fixed width, so the library is the same shape in every theme and on every
 * tab. Without it the panel shrink-wraps its cards: a category holding one
 * building collapsed to a single narrow column, and the window jumped size
 * with each tab. Sized to hold three card columns beside the rail.
 */
.modal-panel--build {
    width: min(860px, 92vw);
}

.build-layout {
    display: flex;
    gap: 26px;
    min-height: 0;
    width: 100%;
}

.build-rail {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: none;
    width: 200px;
}

.build-tab {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 3px solid var(--edge);
    background: linear-gradient(var(--tab-top), var(--tab-bottom));
    color: var(--text);
    font-family: inherit;
    font-size: 19px;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
}

.build-tab.is-active {
    background: linear-gradient(var(--tab-active-top), var(--tab-active-bottom));
    color: var(--tab-active-text);
}

.build-tab:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.build-tab__icon {
    width: 42px;
    height: 42px;
    object-fit: contain;
    flex: none;
}


.build-tab__slots {
    margin-left: auto;
    padding-left: 10px;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    color: inherit;
    opacity: 0.7;
}

.build-tab__slots.is-full {
    opacity: 1;
    font-weight: 700;
}

.build-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    overflow-y: auto;
    padding-right: 8px;
    flex: 1;
    min-height: 0;
    align-content: start;
}

.build-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 18px 14px 18px;
    border-radius: 12px;
    background: var(--card);
    border: 3px solid var(--card-edge);
    min-height: 190px;
}

.build-card__info {
    position: static;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: var(--text-strong);
    font-family: inherit;
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    z-index: 1;
}

.build-card__heading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
}

.build-card__info:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.build-card__info-panel {
    display: none;
    width: 100%;
    gap: 3px;
    flex-direction: column;
    padding: 6px 8px;
    color: var(--text);
    font-size: 12px;
    line-height: 1.2;
}

.build-card.is-info-open .build-card__info-panel {
    display: flex;
}

.build-card.is-locked {
    filter: saturate(0.6);
}

.build-card__label {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
}

/*
 * A definite height, not a flexible one. The sprite inside is sized in
 * percentages, and a percentage against an `auto` height does not resolve —
 * the image then took its width instead and was cropped by the overflow
 * below. The card grows for a longer price; the art box does not move.
 */
.build-card__art {
    flex: none;
    height: 88px;
    display: grid;
    place-items: center;
    width: 100%;
    overflow: hidden;
}

.build-card__art img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.build-card__swatch {
    width: 64px;
    height: 40px;
    border-radius: 4px;
    /* A flat isometric diamond, matching the world's placeholder language. */
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.build-card__build {
    margin: 6px 0 4px;
    flex: none;
    align-self: stretch;
    padding: 8px 22px;
    border-radius: 8px;
    border: 3px solid var(--cta-edge);
    background: linear-gradient(var(--cta-top), var(--cta-bottom));
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.build-card__build:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.build-card__cost {
    flex: none;
    font-size: 13px;
    line-height: 1.2;
    color: var(--text-dim);
    text-align: center;
}

/*
 * Real padlock art per theme, rather than the 🔒 emoji this used to render —
 * an emoji picks up the reader's system font and never matched either theme.
 */
.build-card__lock {
    /* The card is a flex column, so without this the badge gets squashed flat. */
    flex: none;
    width: 40px;
    height: 32px;
    background-image: var(--lock-art);
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.build-empty {
    color: var(--text-muted);
    opacity: 0.8;
    font-size: 17px;
}
