/* Base Layout & Page Setup */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    margin: 0;
    padding: 0;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

#journey {
    text-align: center;
    margin-bottom: 2rem;
    color: #1a1a1a;
    font-size: 2rem;
}

/* Keyrings Grid Container */
section > div {
    display: grid;
    grid-template-columns: 1fr; /* Default: 1 column on mobile */
    gap: 1.5rem;
}

/* Tablet Layout: 2 Columns */
@media (min-width: 600px) {
    section > div {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop Layout: Exactly 3 Columns Max */
@media (min-width: 992px) {
    section > div {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Card Styling */
.keyring-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e9ecef;
}

.keyring-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.keyring-card > div {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.25rem;
}

/* Header / Title */
.card-title-full {
    margin: 0 0 1rem 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
}

/* Card Details & Image Container */
.details {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

.card-image-container {
    margin: 0 0 1rem 0;
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: #f1f3f5; /* Provides a nice background for padded/letterboxed images */
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keyring-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Displays the FULL image without cropping any edges */
    display: block;
}

/* Bottom Stats Row */
.card-stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid #f1f3f5;
    font-size: 0.9rem;
    color: #6c757d;
}

.card-stats-row p {
    margin: 0;
}

/* Project ID Badge */
.card-header-row {
    margin-bottom: 0.5rem;
}

.project-id {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #495057;
    background-color: #e9ecef;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* Card Running Total Row */
.card-total-row {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    font-size: 0.85rem;
    color: #495057;
    text-align: right;
    border-top: 1px dashed #e9ecef;
}

.card-total-row strong {
    color: #0d6efd;
}

/* Card Meta Table (2-Column Layout) */
.card-meta-table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
    font-size: 0.85rem;
    color: #495057;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.meta-left {
    text-align: left;
}

.meta-right {
    text-align: right;
}

/* Project Badge Styling */
.project-id {
    font-weight: 600;
    font-size: 0.8rem;
    color: #343a40;
    background-color: #e9ecef;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

/* Values Styling */
.meta-right strong {
    color: #0d6efd;
}

/* Image Slider Container */
.card-image-container {
    position: relative;
    margin: 0 0 1rem 0;
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: #f1f3f5;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Slider Navigation Buttons */
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: bold;
    transition: background 0.2s ease, opacity 0.2s ease;
    z-index: 2;
    user-select: none;
}

.slider-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.prev-btn { left: 8px; }
.next-btn { right: 8px; }

/* Hide arrows when there is only 1 image */
.card-image-container[data-single="true"] .slider-btn,
.card-image-container[data-single="true"] .image-counter {
    display: none;
}

/* Image Counter Badge */
.image-counter {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
}