/* =========================
   律师详情页（单字段 / 纯文本解析版）完整 CSS
   ✅ 已修复：右侧「目录」+「需要帮助」滚动时互相覆盖
   方案：让整个 .lawyer-side 变成一个 sticky 容器（占满视口高度）
        目录区域内部滚动，CTA 永远在下方不被盖住
   依赖变量：
   --primary-color, --text-dark, --text-light, --shadow
   ========================= */

.lawyer-detail{ width: 100%; }

/* ===== 顶部 Hero ===== */
.lawyer-hero{ padding: 26px 0 10px; }

.lawyer-hero-card{
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 20px;
    align-items: center;

    background: #fff;
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 22px;
    position: relative;
    overflow: hidden;
}

.lawyer-hero-card::before{
    content:"";
    position:absolute;
    inset:-40% -30% auto auto;
    width:520px;
    height:520px;
    background: radial-gradient(circle, rgba(196,30,58,.14), transparent 60%);
    pointer-events:none;
}

.lawyer-hero-avatar{
    width: 140px;
    height: 140px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(0,0,0,.03);
    border: 1px solid rgba(0,0,0,.10);
    box-shadow: 0 18px 40px rgba(0,0,0,.10);
    position: relative;
    z-index: 1;
}

.lawyer-hero-avatar img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display:block;
}

.lawyer-hero-main{ position: relative; z-index: 1; }

.lawyer-hero-top{
    display:flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.lawyer-hero-name{
    margin: 0;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: .2px;
}

.lawyer-hero-badge{
    display:inline-flex;
    align-items:center;
    height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    color: var(--primary-color);
    background: rgba(196,30,58,.08);
    border: 1px solid rgba(196,30,58,.18);
}

.lawyer-hero-brief{
    margin-top: 10px;
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.85;
    max-width: 760px;
}

.lawyer-hero-actions{
    display:flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* ===== Buttons ===== */
.btn-primary{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    height: 44px;
    padding: 0 18px;
    border-radius: 14px;
    background: var(--primary-color);
    color: #fff;
    font-weight: 900;
    text-decoration: none;
    border: 1px solid rgba(196,30,58,.20);
    box-shadow: 0 16px 34px rgba(196,30,58,.18);
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn-primary:hover{
    transform: translateY(-1px);
    box-shadow: 0 20px 42px rgba(196,30,58,.22);
}
.btn-primary:active{ transform: translateY(0); }

.btn-ghost{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    height: 44px;
    padding: 0 18px;
    border-radius: 14px;
    background: #fff;
    color: var(--primary-color);
    font-weight: 900;
    text-decoration: none;
    border: 1px solid rgba(196,30,58,.22);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-ghost:hover{
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(0,0,0,.08);
    background: rgba(196,30,58,.06);
}
.btn-full{ width: 100%; }

.muted{ color: var(--text-light); }

/* ===== 主体布局 ===== */
.lawyer-body{
    margin-top: 18px;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 22px;
    align-items: start;
}

/* ===== Card ===== */
.lawyer-card{
    background:#fff;
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 18px;
}

.lawyer-card-title{
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 900;
}

/* ===== 正文（纯文本解析后的结构） ===== */
.lawyer-rich{
    color: var(--text-dark);
    line-height: 1.95;
    font-size: 15px;
    word-break: break-word;
}

.lawyer-rich h2{
    font-size: 20px;
    margin: 22px 0 10px;
    font-weight: 900;
}

.lawyer-rich h3{
    font-size: 17px;
    margin: 18px 0 10px;
    font-weight: 900;
    position: relative;
    padding-left: 12px;
}

.lawyer-rich h3::before{
    content:"";
    position:absolute;
    left:0;
    top: .55em;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgba(196,30,58,.65);
}

.lawyer-rich p{
    margin: 0 0 12px;
    line-height: 1.95;
    color: var(--text-dark);
}

.lawyer-rich ul,
.lawyer-rich ol{
    margin: 0 0 14px;
    padding-left: 18px;
}

.lawyer-rich li{
    margin: 6px 0;
    line-height: 1.85;
}

.lawyer-rich blockquote{
    margin: 14px 0;
    padding: 12px 14px;
    border-left: 4px solid rgba(196,30,58,.35);
    background: rgba(196,30,58,.06);
    border-radius: 12px;
}

.lawyer-rich a{
    color: var(--primary-color);
    font-weight: 800;
    text-decoration: none;
}
.lawyer-rich a:hover{ text-decoration: underline; }

.lawyer-rich img{
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.lawyer-rich table{
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,.06);
    margin: 14px 0;
}
.lawyer-rich th,
.lawyer-rich td{
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0,0,0,.06);
    text-align: left;
}
.lawyer-rich th{
    background: rgba(0,0,0,.02);
    font-weight: 900;
}

/* =========================================================
   ✅ 右侧：不覆盖的 sticky 方案（重点）
   - 让 .lawyer-side 自己 sticky + 固定视口高度
   - 上方目录区域占剩余高度并内部滚动
   - 下方 CTA 永远在目录下面，不会被盖住
   ========================================================= */

.lawyer-side{
    position: sticky;
    top: 18px;
    align-self: start;

    height: calc(100vh - 36px); /* 视口高度 - top*2 */
    display: flex;
    flex-direction: column;
    gap: 16px;

    /* 防止内部滚动时出现页面“抖动” */
    overscroll-behavior: contain;
}

/* 目录卡片：占满剩余空间 */
.toc-card{
    flex: 1;
    min-height: 0;              /* ✅ 允许内部滚动关键 */
    display: flex;
    flex-direction: column;
}

/* 目录列表内部滚动（内容再长也不会推走 CTA） */
.toc{
    flex: 1;
    min-height: 0;              /* ✅ 允许滚动关键 */
    overflow: auto;
    display:flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 2px;
}

.toc-item{
    text-decoration: none;
    color: rgba(0,0,0,.72);
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,.06);
    background: rgba(0,0,0,.02);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.toc-item:hover{
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(0,0,0,.08);
    border-color: rgba(196,30,58,.18);
}
.toc-item.active{
    background: rgba(196,30,58,.08);
    border-color: rgba(196,30,58,.22);
    color: var(--primary-color);
    font-weight: 900;
}
.toc-h3{ padding-left: 18px; }

/* CTA 固定在下方（普通流即可） */
.side-cta{
    flex: 0 0 auto;
}
.side-cta p{ margin: 0 0 12px; }

/* ===== 响应式：小屏取消 sticky，避免体验怪异 ===== */
@media (max-width: 1024px){
    .lawyer-body{ grid-template-columns: 1fr; }

    .lawyer-side{
        position: static;
        top: auto;
        height: auto;
    }

    .toc{
        overflow: visible;
    }
}

@media (max-width: 768px){
    .lawyer-hero-card{
        grid-template-columns: 90px 1fr;
        padding: 16px;
        gap: 14px;
    }

    .lawyer-hero-avatar{ width: 90px; height: 90px; }
    .lawyer-hero-name{ font-size: 22px; }

    .btn-primary, .btn-ghost{
        height: 42px;
        padding: 0 14px;
        border-radius: 12px;
    }
}
/* 目录：不要硬撑高度，随内容变化；内容多时再滚动 */
#lawyerTocWrap,
.lawyer-side{
    align-self: start;
    height: auto !important;
    min-height: 0 !important;
}

/* 目录卡片本身也不要固定高度 */
#lawyerTocWrap .toc-card{
    height: auto !important;
    min-height: 0 !important;
}

/* 目录列表容器：默认自适应；最多到视口一定高度后滚动 */
#lawyerToc{
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 6px;

    height: auto !important;
    min-height: 0 !important;
    max-height: min(420px, calc(100vh - 220px));
    overflow: auto;
}

/* 可选：侧栏做 sticky，更像“目录导航” */
@media (min-width: 1025px){
    #lawyerTocWrap{
        position: sticky;
        top: 110px; /* 你有顶部导航就调大点 */
    }
}
/* 手机端隐藏目录 */
@media (max-width: 768px){
    #lawyerTocWrap{ display: none !important; }

    /* 如果你的详情页是左右两栏布局，手机端强制一列 */
    .lawyer-detail-layout,
    .lawyer-detail-main{
        grid-template-columns: 1fr !important;
    }
}
