/* ════════════════════════════════════════════════════════════════════
   教师卡片网格 + Profile 模态（点击卡片打开详情，含课堂实拍轮播）
   用法：require_once 'assets/components/teacherCards/teacherCards.php';
         然后用 renderTeacherCards($teachers) 输出卡片网格
   依赖：sheetModal（openModal/closeModal）、photoModal（openPhotoCarousel）
   ════════════════════════════════════════════════════════════════════ */

/* ── Grid ──────────────────────────────────────────────────── */
.teacher-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.teacher-card {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.teacher-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.10);
}

.teacher-card .thumb {
    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: #e8e8e8;
}

.teacher-card .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    transition: transform 0.4s ease;
}

.teacher-card:hover .thumb img {
    transform: scale(1.04);
}

.teacher-card .info {
    padding: 14px 16px 18px;
    text-align: left;
}

.teacher-card .info h3 {
    font-size: var(--font-size-16);
    font-weight: 600;
    margin: 0 0 6px;
    color: #222;
}

.teacher-card .info .title-tag {
    display: inline-block;
    font-size: var(--font-size-14);
    color: var(--clr-primary);
    border: 1px solid rgba(var(--clr-primary-rgb), 0.5);
    padding: 1px 8px 2px;
    border-radius: 2px;
    margin-bottom: 10px;
    letter-spacing: 0.03em;
}

.teacher-card .info p {
    font-size: var(--font-size-14);
    color: #888;
    line-height: 1.75;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.teacher-card .card-cta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: var(--font-size-14);
    color: var(--clr-primary);
    letter-spacing: 0.04em;
    margin-top: 10px;
}

/* ── Profile Modal ─────────────────────────────────────────── */
#modal-teacher .modal-inner {
    max-width: 820px;
    height: 70vh;
    padding: 0;
    overflow: hidden;
}

#tm-body {
    display: flex;
    height: 100%;
}

#tm-portrait {
    flex: 0 0 340px;
    background: #111;
    overflow: hidden;
}

#tm-portrait-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    transform: scale(1.005); /* 消除亚像素渲染间隙导致的黑边 */
}

#tm-info {
    flex: 1;
    padding: 36px 32px 28px;
    overflow-y: auto;
}

#tm-info h3 {
    font-size: 26px;
    font-weight: 700;
    color: #111;
    margin: 0 0 12px;
}

.tm-tags {
    margin-bottom: 20px;
}

#tm-bio {
    font-size: var(--font-size-16);
    color: #555;
    line-height: 1.9;
    margin: 0 0 26px;
}

.tm-shots-label {
    font-size: var(--font-size-14);
    color: #bbb;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.tm-shots {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.tm-shots img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    cursor: pointer;
    display: block;
    border-radius: 6px;
    transition: opacity 0.2s;
}

.tm-shots img:hover {
    opacity: 0.82;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1280px) {
    .teacher-cards { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .teacher-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .teacher-card {
        border-radius: 14px;
        min-width: 0;
    }
    .teacher-card img {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 5;
        object-fit: cover;
    }
    .teacher-card .info {
        padding: 10px 12px 14px;
    }

    /* modal-inner 自身作为整体滚动容器，portrait + info 一起在内部滚 */
    #modal-teacher .modal-inner {
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
        overflow-y: auto;
        overflow-x: hidden;
    }
    #tm-body {
        flex-direction: column;
        height: auto;
        min-height: 0;
    }
    /* 人像：按原图比例显示，不再裁切 */
    #tm-portrait {
        flex: none;
        height: auto;
        background: transparent;
    }
    #tm-portrait-img {
        width: 100%;
        height: auto;
        object-fit: initial;
        object-position: initial;
        transform: none;
    }
    /* info 段不再单独滚动，跟着 modal-inner 整体流 */
    #tm-info {
        flex: none;
        overflow: visible;
        padding: 22px 20px 24px;
        min-height: 0;
    }
    #tm-info h3 {
        font-size: 22px;
    }
}
