/**
 * OPC 详情页共享分片：相关文章网格。
 * 任务 #10（相关文章重排为整齐网格）。
 *
 * 评论区（#comments）不再覆盖：六个 CPT detail 页统一回落父主题原生评论样式，
 * 与 OPC资讯（single.php）评论区 1:1 一致（含表单与回复）。
 *
 * 约定：本文件只覆盖 .entry-related-posts / .entry-related 作用域，
 * 不触碰 components.css / 其他 opc-*.css，避免与并行 Wave 冲突。
 * 视觉对齐 OPC 现有卡片（radius-card 16px、accent 蓝、pill 按钮）。
 */

/* ============================================================
 * 范式B 共享详情布局（case / sop / idea 统一）
 * 取代范式A 的 get_sidebar() 默认小工具栏 + wpcom 相关文章，
 * 与 opc_list / opc_community / opc_ai_tool 详情页视觉对齐。
 * 作用域 .opc-detailB，仅命中挂载该 class 的详情模板。
 * ============================================================ */
.detail-page.opc-detailB {
    max-width: 1180px;
    margin: 34px auto 72px;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 56px;
    padding: 0 32px;
}
.opc-detailB .detail-main { min-width: 0; }

.opc-detailB .back-link {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 22px;
    transition: color .15s ease, gap .15s ease;
}
.opc-detailB .back-link:hover { color: var(--accent); gap: 9px; }

.opc-detailB .opc-detail-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.opc-detailB .entry-title {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--text);
}
.opc-detailB .opc-detail-subtitle {
    font-size: 15px;
    color: var(--muted);
    line-height: 1.75;
    max-width: none;
    margin-bottom: 20px;
}

/* 封面（案例可选） */
.opc-detailB .opc-detail-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-card);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    margin: 4px 0 26px;
}
.opc-detailB .opc-detail-cover img { width: 100%; height: 100%; object-fit: cover; }

/* 字段网格：自适应列，发丝上下边框 */
.opc-detailB .opc-detail-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 22px 28px;
    padding: 22px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    margin-bottom: 28px;
}
.opc-detailB .opc-detail-fields .field-item .k {
    font-size: 10.5px;
    color: var(--muted-2);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 5px;
}
.opc-detailB .opc-detail-fields .field-item .v {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.5;
}

/* 正文排版：与名录详情统一（15px / 1.85 / 深板岩） */
.opc-detailB .entry-content {
    font-size: 15px;
    line-height: 1.85;
    color: #35373b;
}
.opc-detailB .entry-content > p { margin: 0 0 16px; }
.opc-detailB .entry-content > p:last-child { margin-bottom: 0; }
.opc-detailB .entry-content img { border-radius: 12px; margin: 8px 0; }

/* 内容标签 */
.opc-detailB .opc-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}
.opc-detailB .opc-detail-tags span { font-size: 12.5px; color: var(--accent); font-weight: 600; }

/* 点赞行 */
.opc-detailB .entry-action { margin-top: 28px; }
.opc-detailB .btn-zan {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-soft-line);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}
.opc-detailB .btn-zan:hover { background: #e4eaff; transform: translateY(-1px); }

/* ---- 右侧 sticky 品牌推荐栏（取代默认小工具）---- */
.opc-detailB aside.detail-aside {
    position: sticky;
    top: 84px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-self: start;
}
.opc-detailB .aside-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    padding: 20px 22px;
}
.opc-detailB .aside-card .sb-label {
    font-size: 13px;
    color: var(--accent);
    letter-spacing: .05em;
    margin-bottom: 8px;
}
.opc-detailB .aside-card .sb-list-item {
    padding: 13px 0;
    transition: transform .15s ease;
}
.opc-detailB .aside-card .sb-list-item:first-of-type { padding-top: 6px; }
.opc-detailB .aside-card .sb-list-item:hover { transform: translateX(3px); }
.opc-detailB .aside-card .sb-list-item:hover .name { color: var(--accent); }
.opc-detailB .aside-card .sb-list-item .name { transition: color .15s ease; }
.opc-detailB .aside-card .sb-list-item .desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.opc-detailB .aside-empty { font-size: 12px; color: var(--muted); padding: 6px 0 10px; }

@media (max-width: 920px) {
    .detail-page.opc-detailB { grid-template-columns: 1fr; gap: 32px; padding: 0 24px; }
    .opc-detailB aside.detail-aside { position: static; order: 2; }
    .opc-detailB .detail-main { order: 1; }
}
@media (max-width: 768px) {
    .detail-page.opc-detailB { margin-top: 20px; padding: 0 18px; }
    .opc-detailB .entry-title { font-size: 25px; }
    .opc-detailB .opc-detail-fields { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .opc-detailB .opc-detail-fields { grid-template-columns: 1fr; }
}

/* ============================================================
 * 任务 #10 · 相关文章区块（父主题 loop-default 结构重排为网格）
 * 结构：.entry-related-posts > h3.entry-related-title
 *        + ul.entry-related.post-loop.post-loop-list.cols-3 > li.item
 * ============================================================ */

.entry-related-posts {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--line);
}

/* 区块标题：统一为 OPC 风格的小节标题 */
.entry-related-posts .entry-related-title {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text);
    margin: 0 0 20px;
    padding-left: 12px;
    position: relative;
    line-height: 1.3;
}

.entry-related-posts .entry-related-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 3px;
    border-radius: var(--radius-pill);
    background: var(--accent);
}

/* 卡片网格容器：覆盖父主题 post-loop-list 的竖排列表 */
.entry-related-posts .entry-related.post-loop {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* 单张卡片 */
.entry-related-posts .entry-related .item {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: #fff;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.entry-related-posts .entry-related .item:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 10px 24px -12px rgba(var(--accent-rgb), .35);
}

/* 缩略图统一比例 */
.entry-related-posts .entry-related .item-img {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    margin: 0;
    background: var(--surface);
    overflow: hidden;
}

.entry-related-posts .entry-related .item-img,
.entry-related-posts .entry-related .item-img-inner {
    display: block;
}

.entry-related-posts .entry-related .item-img-inner {
    width: 100%;
    height: 100%;
}

.entry-related-posts .entry-related .item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}

.entry-related-posts .entry-related .item:hover .item-img img {
    transform: scale(1.04);
}

/* 图内分类角标 */
.entry-related-posts .entry-related .item-category {
    position: absolute;
    left: 10px;
    bottom: 10px;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, .55);
    color: #fff;
    text-decoration: none;
    backdrop-filter: blur(2px);
}

/* 文字区 */
.entry-related-posts .entry-related .item-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px 16px;
    flex: 1 1 auto;
}

/* 标题两行截断 */
.entry-related-posts .entry-related .item-title {
    margin: 0;
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.45;
}

.entry-related-posts .entry-related .item-title a {
    color: var(--text);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .15s ease;
}

.entry-related-posts .entry-related .item:hover .item-title a {
    color: var(--accent);
}

/* 摘要两行截断，弱化 */
.entry-related-posts .entry-related .item-excerpt {
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.entry-related-posts .entry-related .item-excerpt p {
    margin: 0;
}

/* meta 行压缩为一行小字 */
.entry-related-posts .entry-related .item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    margin-top: auto;
    padding-top: 4px;
    font-size: 11.5px;
    color: var(--muted-2);
}

.entry-related-posts .entry-related .item-meta a,
.entry-related-posts .entry-related .item-meta .item-meta-li {
    color: var(--muted-2);
    text-decoration: none;
    font-size: 11.5px;
}

.entry-related-posts .entry-related .item-meta .avatar img {
    width: 18px;
    height: 18px;
    border-radius: var(--radius-pill);
    vertical-align: middle;
    margin-right: 4px;
}

/* 无缩略图卡片：占位高度对齐 */
.entry-related-posts .entry-related .item-no-thumb .item-content {
    padding-top: 16px;
}

/* ============================================================
 * 响应式
 * ============================================================ */
@media (max-width: 900px) {
    .entry-related-posts .entry-related.post-loop {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .entry-related-posts .entry-related.post-loop {
        grid-template-columns: 1fr;
    }
}
