/* =============================================
   Author Cards – card grid + modal + image viewer
   ============================================= */

/* --- Card Grid --- */
.author-cards-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0;
}

/* --- Card --- */
.author-card {
    --author-card-base: 220px;
    --author-card-scale: 1;
    --card-ratio: 1;
    flex: 0 1 calc(var(--author-card-base) * var(--author-card-scale, 1) * var(--card-ratio, 1));
    min-width: 160px;
    max-width: 320px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
    overflow: hidden;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.author-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
}

.author-card.big {
    --author-card-scale: 1.3;
}

.author-card-image {
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: #eee;
}

.author-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.author-card-content {
    padding: .6rem .8rem .8rem;
}

.author-card-name {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 .3rem;
    text-align: center;
    color: #222;
}

.author-card-description {
    font-size: .82rem;
    line-height: 1.5;
    color: #555;
    margin: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    overflow: hidden;
}

/* --- Placeholder (loading skeleton) --- */
.author-card-placeholder {
    flex: 0 1 220px;
    min-width: 160px;
    max-width: 320px;
    min-height: 300px;
    border-radius: 10px;
    background: linear-gradient(110deg, #eee 30%, #f5f5f5 50%, #eee 70%);
    background-size: 200% 100%;
    animation: placeholder-shimmer 1.4s ease-in-out infinite;
}

@keyframes placeholder-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Modal --- */
.author-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}

.author-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.author-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
}

.author-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 720px;
    width: 92%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 2rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
    z-index: 1;
    transform: translateY(20px);
    transition: transform .3s ease;
}

.author-modal.active .author-modal-content {
    transform: translateY(0);
}

.author-modal-close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: #888;
    line-height: 1;
    z-index: 2;
}

.author-modal-close:hover {
    color: #333;
}

.author-modal-name {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: #222;
}

.author-modal-image {
    float: left;
    max-width: 33%;
    margin: 0 1rem 1rem 0;
}

.author-modal-image img {
    width: 100%;
    border-radius: 8px;
    display: block;
}

.author-modal-description {
    font-size: .95rem;
    line-height: 1.6;
    color: #444;
    margin-bottom: 1rem;
}

.author-modal-bd-container {
    clear: both;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: center;
    padding-top: 1rem;
    border-top: 2px solid #eee;
    margin-top: 1rem;
}

.author-modal-bd-loading {
    font-size: .85rem;
    color: #999;
    text-align: center;
    width: 100%;
}

.author-modal-bd-image {
    height: 150px;
    border-radius: 4px;
    object-fit: cover;
    cursor: pointer;
    transition: transform .15s ease;
}

.author-modal-bd-image:hover {
    transform: scale(1.05);
}

/* --- Full-screen Image Viewer --- */
.image-viewer {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}

.image-viewer.active {
    opacity: 1;
    pointer-events: auto;
}

.image-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .8);
}

.image-viewer-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
}

.image-viewer-close {
    position: absolute;
    top: -2rem;
    right: -1rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
}

.image-viewer-img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 6px;
    display: block;
}

/* --- Responsive tweaks --- */
@media (max-width: 576px) {
    .author-card {
        --author-card-base: 140px;
        min-width: 130px;
    }

    .author-modal-content {
        padding: 1.2rem;
    }

    .author-modal-image {
        float: none;
        max-width: 60%;
        margin: 0 auto 1rem;
    }

    .author-modal-bd-image {
        height: 100px;
    }
}
