.shelf-link-button-grid {
    box-sizing: border-box;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
}

.shelf-link-button-card {
    box-sizing: border-box;
    width: 25%;
    padding: 0.2rem;
    flex: 0 0  auto;
    aspect-ratio: 1 / 1;
    display: grid;
    grid-template-rows: 4fr 1fr;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
    align-items: stretch;
    justify-items: stretch;
    color: var(--sd-color-card-text);
    font-size: 1em;
}

.shelf-link-button-main {
    grid-row: 1;
    grid-column: 1 / span 2;
}

.shelf-link-button-sub {
    grid-row: 2;
}

.shelf-link-button {
    padding: 1px 6px;
    border: 1px solid var(--pst-color-border);
    background-color: var(--pst-color-on-background);
    position: relative;
    min-width: 0;
    min-height: 0;
}

.shelf-link-button:hover {
    border-color: var(--pst-color-link-hover);
}

.shelf-link-button-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: space-between;
    gap: 0.25rem;
    min-width: 0;
    min-height: 0;
}

.shelf-link-button-main {
    padding: 0.3rem 0 0.4rem 0;
}

.shelf-link-button-sub {
    padding: 0.2rem 0 0.2rem 0;
}

.shelf-link-button-content > img {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    flex: 1 1 auto;
    align-self: stretch;
    display: block;
    min-width: 0;
    min-height: 0;
}

.shelf-stretched-link::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    content: "";
}
