.tainacan-grid-container {
    display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));    gap: 24px;
    width: 100%;
    padding: 30px 4.166666667%;
    box-sizing: border-box;
}

/* =========================================
   CARD
   ========================================= */

.tainacan-grid-item {
    width: 100%;
	height: auto;
	min-height: 100px;
    background: #fff;
    overflow: hidden;
    border-radius: 8px;
    box-sizing: border-box;
}

/* =========================================
   IMAGE
   ========================================= */

.tainacan-grid-image-box {
    width: 100%;
}

.tainacan-grid-image {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    background: #e5e5e5;
    overflow: hidden;

    display: flex;
    align-items: center;
    justify-content: center;
}

.tainacan-grid-image img {
    display: block;
    width: auto;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0 auto;
}

/* Landscape and square images */
.tainacan-grid-image img.is-wide {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* =========================================
   METADATA
   ========================================= */

.tainacan-grid-metadata {
    padding: 12px 14px;
    background: #fff;
    box-sizing: border-box;
}

/*
 * Reserve space for up to two lines of 件名.
 * The empty element is intentionally kept in the PHP template,
 * so items without a title still receive the same reserved space.
 */
.tainacan-grid-subject {
    height: 1.3em;
    min-height: 1.3em;
    font-size: 0.9em;
    line-height: 1.3;
    font-weight: 700;
    margin-bottom: 0;
    box-sizing: border-box;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tainacan-grid-reference {
    font-size: 0.8em;
    line-height: 1.4;
}

.tainacan-grid-reference a {
    text-decoration: none;
}

.tainacan-grid-date {
    font-size: 0.8em;
    line-height: 1.4;
    color: #666;
    margin-bottom: 12px;
}

/* =========================================
   RESPONSIVE
   ========================================= */

/*
 * On smaller screens, allow the card to grow naturally if
 * text wraps beyond the desktop two-line title reservation.
 * The 300px minimum preserves the standard card proportions.
 */
@media (max-width: 768px) {
    .tainacan-grid-item {
        height: auto;
        min-height: 300px;
    }
}

/* Preserve the original grid title appearance. */
.tainacan-grid-title-value,
.tainacan-grid-title-value:visited {
    color: #111 !important;
    text-decoration: none;
}

.tainacan-grid-title-value:hover {
    color: #111 !important;
    text-decoration: underline;
}
