/* =========================================================
   Tutorial Studio · 随机推荐

   桌面端：四张横版卡片固定一排
   手机端：四张竖版卡片固定一排

   预览规则：
   1. 推荐区域独立预览
   2. 桌面端 16:9
   3. 手机端 3:4
   4. iframe 独立缩放和居中
   5. 超出容器的内容直接裁切
   ========================================================= */


/* =========================================================
   推荐区域
   ========================================================= */

.recommendation-section {
    width: 100%;
    margin: 34px 0 42px;
}

.recommendation-section[hidden] {
    display: none !important;
}


/* =========================================================
   标题区域
   ========================================================= */

.recommendation-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.recommendation-heading {
    min-width: 0;
}

.recommendation-eyebrow {
    display: block;
    margin-bottom: 7px;
    color: #818cf8;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
}

.recommendation-heading h2 {
    margin: 0;
    color: #20243a;
    font-size: 23px;
    font-weight: 750;
    line-height: 1.4;
}

.recommendation-heading h2 span {
    color: #f2ad55;
}

.recommendation-heading p {
    margin: 6px 0 0;
    color: #85899a;
    font-size: 13px;
}

.recommendation-caption {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    color: #9296a6;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.recommendation-caption-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #818cf8;
}


/* =========================================================
   桌面端：固定四列
   ========================================================= */

.recommendation-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    width: 100%;
    min-width: 0;
}

.recommendation-card {
    min-width: 0;
    width: 100%;
    overflow: hidden;
    cursor: pointer;
    border-radius: 13px;
    background: #fff;
    border: 1px solid #eceef4;
    transition:
        transform .22s ease,
        box-shadow .22s ease,
        border-color .22s ease;
}

.recommendation-card:hover {
    transform: translateY(-4px);
    border-color: #d9dcff;
    box-shadow: 0 12px 28px rgba(39, 45, 90, .09);
}


/* =========================================================
   推荐区域独立预览容器

   桌面端固定 16:9
   ========================================================= */

.recommendation-cover {
    position: relative;
    isolation: isolate;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f1f2f7;
}


/* =========================================================
   推荐区域独立 iframe

   尺寸、缩放、位置由 random_template.js 控制
   CSS 不重复设置宽高和 transform
   ========================================================= */

.recommendation-cover > .recommendation-preview-iframe {
    position: absolute;
    display: block;
    border: 0;
    pointer-events: none;
}


/* =========================================================
   加载占位
   ========================================================= */

.recommendation-placeholder {
    position: absolute;
    inset: 0;
    z-index: 2;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;

    padding: 12px;
    text-align: center;

    background:
        radial-gradient(
            circle at 50% 40%,
            #fff 0,
            #f5f5ff 65%,
            #eff0f8 100%
        );
}

.recommendation-placeholder[hidden] {
    display: none !important;
}


/* =========================================================
   卡片文字信息
   ========================================================= */

.recommendation-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    min-width: 0;
}

.recommendation-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: #292d40;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.recommendation-description {
    display: none;
}

.recommendation-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    color: #6366f1;
    font-size: 12px;
    font-weight: 650;
}


/* =========================================================
   中小屏幕：仍然保持四张一排
   ========================================================= */

@media (max-width: 900px) {

    .recommendation-grid {
        gap: 12px;
    }

    .recommendation-content {
        padding: 10px;
    }

    .recommendation-title {
        font-size: 12px;
    }

    .recommendation-action {
        font-size: 11px;
    }

}


/* =========================================================
   手机端：四张竖版卡片固定一排

   不换行
   不横向滚动
   每张卡片使用 3:4 预览框
   ========================================================= */

@media (max-width: 600px) {

    .recommendation-section {
        margin: 26px 0 32px;
    }

    .recommendation-header {
        margin-bottom: 14px;
    }

    .recommendation-heading h2 {
        font-size: 19px;
    }

    .recommendation-heading p {
        font-size: 11px;
    }

    .recommendation-caption {
        display: none;
    }

    .recommendation-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 7px;
        width: 100%;
        overflow: visible;
    }

    .recommendation-card {
        width: 100%;
        min-width: 0;
        border-radius: 8px;
    }

    .recommendation-cover {
        aspect-ratio: 3 / 4;
    }

    .recommendation-content {
        display: block;
        padding: 7px 5px;
    }

    .recommendation-title {
        display: block;
        width: 100%;
        font-size: 10px;
        line-height: 1.45;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .recommendation-action {
        display: none;
    }

}


/* =========================================================
   极窄屏幕
   ========================================================= */

@media (max-width: 380px) {

    .recommendation-grid {
        gap: 5px;
    }

    .recommendation-card {
        border-radius: 6px;
    }

    .recommendation-content {
        padding: 6px 3px;
    }

    .recommendation-title {
        font-size: 9px;
    }

}