/* ============================================================
   content.css — 正文区（中间栏）样式

   覆盖三块：
     .content-pane  已选中条目时的正文面板（含锁面板态）
     .landing       匿名首页的公开面板
     .empty-state   已登录但没有正文时的空状态

   共享原子类（.card / .btn* / .form-* / .field-error）由 layout.css 定义，
   本文件只引用；需要改宽度这类页面级差异时用后代选择器提高优先级，
   不重写原子类本身。本文件不定义任何 :root 令牌。
   ============================================================ */

/* ------------------------------------------------------------
   1. 正文面板
   ------------------------------------------------------------ */
.content-pane {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;                /* 裁掉头部装饰线溢出 */
    animation: contentPaneIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes contentPaneIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.content-pane__header {
    padding: 30px 32px 0;
}

/* 面包屑：一级分类 / 条目标题 */
.content-pane__breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.content-pane__breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}
.content-pane__breadcrumb a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.content-pane__breadcrumb-sep {
    color: var(--text-light);
}

.content-pane__breadcrumb-current {
    color: var(--text-muted);
}

/* 标题 */
.content-pane__title {
    font-size: 1.62rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.015em;
    color: var(--text);
    margin: 0;
}

/* 与 .md h2::after、.card-header::after 同源的渐变装饰线，只是左对齐 */
.content-pane__title::after {
    content: "";
    display: block;
    width: 56px;
    height: 2px;
    margin-top: 14px;
    border-radius: 2px;
    background: var(--primary-gradient);
    opacity: 0.45;
}

/* 日期 + 标签 */
.content-pane__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: 16px;
    font-size: 0.84rem;
    color: var(--text-muted);
}

.content-pane__date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

.content-pane__tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.content-pane__tag {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.76rem;
    line-height: 1.7;
    letter-spacing: 0.01em;
}

/* 「这篇没有当前语言的版本」提示（多语言回退）。
   一行话，压在标题区末尾、正文分隔线之上：先说清楚读的是什么，
   再往下看正文。比 meta 还轻一档 —— 这是补充说明不是警告，
   所以不上红黄配色、不加图标，只用一条左侧竖线标出这是附注。 */
.content-pane__notice {
    margin: 16px 0 0;
    padding: 8px 14px;
    border-left: 2px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.82rem;
    line-height: 1.7;
}

/* 正文容器：头部与锁面板/正文之间的分隔 */
.content-pane__body {
    padding: 24px 32px 40px;
    border-top: 1px solid var(--border);
    margin-top: 26px;
}

/* ------------------------------------------------------------
   2. 锁面板（匿名访问正文）
   ------------------------------------------------------------ */
.lock-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    padding: 48px 24px 56px;
}

.lock-panel__icon {
    width: 62px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.lock-panel__icon svg {
    width: 27px;
    height: 27px;
}

.lock-panel__title {
    font-size: 1.14rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
    margin: 0;
}

.lock-panel__text {
    max-width: 360px;
    font-size: 0.89rem;
    line-height: 1.75;
    color: var(--text-muted);
    margin: 0;
}

/* 页面级覆盖：共享的 .btn-primary 是通栏按钮，这里只要一颗普通尺寸的 */
.lock-panel .lock-panel__action {
    width: auto;
    min-width: 150px;
    margin-top: 8px;
}

/* ------------------------------------------------------------
   3. 空状态（已登录但无正文）
   ------------------------------------------------------------ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 72px 32px 84px;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
}

.empty-state__icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text-light);
    margin-bottom: 6px;
}

.empty-state__icon svg {
    width: 26px;
    height: 26px;
}

.empty-state__title {
    font-size: 1.04rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.empty-state__text {
    max-width: 420px;
    font-size: 0.87rem;
    line-height: 1.75;
    color: var(--text-muted);
    margin: 0;
}

/* 空状态 / 错误页底部的操作入口（回首页、登录等） */
.empty-state__action {
    margin-top: 10px;
}

.empty-state__action .btn {
    width: auto;
}

/* ------------------------------------------------------------
   4. Landing（匿名首页公开面板）
   ------------------------------------------------------------ */
.landing {
    display: flex;
    flex-direction: column;
    gap: 34px;
}

.landing__hero {
    padding: 22px 0 0;
}

.landing__title {
    font-size: 2.05rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.02em;
    /* 沿用站内既有的渐变文字，保持首页观感统一 */
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--primary-dark);     /* 不支持背景裁剪时的兜底色 */
}

.landing__tagline {
    margin-top: 12px;
    max-width: 540px;
    font-size: 1.02rem;
    line-height: 1.75;
    color: var(--text-muted);
}

/* 联系方式 */
.landing__contact {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 22px;
    list-style: none;
    margin: 22px 0 0;
    padding: 0;
}

.landing__contact a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.87rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: var(--transition);
}

.landing__contact a:hover {
    color: var(--primary-dark);
    border-color: #cdd9ed;
    background: var(--surface-hover);
}

.landing__contact-icon {
    color: var(--text-light);
    font-size: 0.8rem;
    line-height: 1;
}

/* 分类卡片：网格自适应，窄屏自然折成一列 */
.landing__cats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 卡片沿用 .feature-card 那种克制的悬浮感（上移 3px + 阴影加深 + 几何角落） */
.landing__cat {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 22px 20px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    overflow: hidden;
    transition: var(--transition);
}

.landing__cat:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #d5dff0;
}

/* 右下角几何装饰 */
.landing__cat::after {
    content: "";
    position: absolute;
    right: -20px;
    bottom: -20px;
    width: 76px;
    height: 76px;
    border: 2px solid #eef2f8;
    border-radius: 20px;
    transform: rotate(20deg);
    pointer-events: none;
    transition: var(--transition);
}
.landing__cat:hover::after {
    border-color: #dde4f0;
}

/* 当前选中的分类 */
.landing__cat.is-active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(107, 140, 191, 0.10);
}

.landing__cat-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.landing__cat-icon svg {
    width: 19px;
    height: 19px;
}

.landing__cat-label {
    font-size: 1.01rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

.landing__cat-count {
    font-size: 0.79rem;
    color: var(--text-light);
}

/* 登录提示条 */
.landing__note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 24px;
    background: var(--surface);
    border: 1px dashed #cdd9ed;
    border-radius: var(--radius-md);
}

.landing__note-text {
    min-width: 0;
}

.landing__note-title {
    font-size: 0.96rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 3px;
}

.landing__note-desc {
    font-size: 0.84rem;
    line-height: 1.7;
    color: var(--text-muted);
    margin: 0;
}

/* 页面级覆盖：共享的 .btn-primary 是通栏按钮，这里要一颗不拉伸的 */
.landing__note .landing__note-action {
    width: auto;
    flex: 0 0 auto;
    min-width: 118px;
    white-space: nowrap;
}

/* ------------------------------------------------------------
   5. 正文独立缩放（配合 js/zoom.js）

   缩放挂在**整个正文栏 .app-main** 上，不是挂在正文面板或 .md 上：
   等于「只对正文栏做一次 Edge 的整页缩放」，页头和左右栏目不动。

   为什么必须挂在这一层：zoom 元素里的百分比是按缩放后的坐标空间
   解析的，挂在里面的元素写 width:100% 在 zoom:2 下会算成「可用空间的
   一半」，渲染出来还是原来那么宽，只有文字在长个儿。要让底板真的变宽，
   只能让更外层那个宽度写死的容器去放大。.app-main 的渲染宽度是

       min(两侧栏目之间的空隙, 1100px × zoom)

   屏幕够宽时它先把空隙占满，空隙不够了才停在 1100 × zoom；缩小时
   因为是 1100 × zoom 小于空隙，底板渲染得比默认窄，而 margin:auto
   仍然居中，不会贴左。

   之前挂在 .content-pane 上的写法做不到这一点：面板放大到 2072px，
   可上一层 .app-main 只有 1100px 并且是横向滚动容器，多出来的部分
   全被裁掉，看上去「底板最大就是默认大小」，就是这个原因。

   挂在这一层，缩放倍率同时带上栏宽、栏内边距、标题、正文、图片、
   表格；屏幕不够宽时退化成「CSS 视口变窄」的整页缩放，字变大、
   每行字数变少、排版重排，和浏览器自己的放大是一回事。

   只在正文页生效（:has(.md)），锁面板、空状态、匿名首页不受影响。
   ------------------------------------------------------------ */
.app-main:has(.md) {
    zoom: var(--md-zoom, 1);

    /* min-height 要除回 zoom：zoom 会把算式里的 100vh 当成普通长度一起
       放大，不除的话 z=2 时正文栏至少两屏高，短文章下面凭空多出一大块
       空白，页脚也被推到很下面。除回去，渲染出来恒等于「一屏减页头」。 */
    min-height: calc((100vh - var(--header-h) - 72px) / var(--md-zoom, 1));
}

/* ------------------------------------------------------------
   6. 响应式
   ------------------------------------------------------------ */
@media (max-width: 960px) {
    .content-pane__header { padding: 24px 24px 0; }
    .content-pane__body   { padding: 22px 24px 32px; margin-top: 22px; }
}

@media (max-width: 768px) {
    .content-pane { border-radius: var(--radius-md); }
    .content-pane__title { font-size: 1.32rem; }
    .content-pane__title::after { margin-top: 12px; }
    .content-pane__breadcrumb { font-size: 0.78rem; }
    .content-pane__meta { font-size: 0.8rem; gap: 8px 12px; }

    .lock-panel { padding: 38px 18px 46px; }
    .lock-panel__icon { width: 54px; height: 54px; }
    .lock-panel__icon svg { width: 23px; height: 23px; }

    .empty-state { padding: 54px 22px 62px; }

    .landing { gap: 26px; }
    .landing__title { font-size: 1.62rem; }
    .landing__tagline { font-size: 0.96rem; }
    .landing__cats { gap: 14px; }
    .landing__note { padding: 18px 20px; }
}

@media (max-width: 600px) {
    .content-pane__header { padding: 20px 18px 0; }
    .content-pane__body   { padding: 20px 18px 28px; }
    .content-pane__title { font-size: 1.2rem; }

    /* 卡片满宽 */
    .landing__cats { grid-template-columns: 1fr; }
    .landing__cat { padding: 18px 16px; }

    /* 提示条改为上下排布，按钮满宽更好点 */
    .landing__note {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        text-align: left;
    }
    .landing__note .landing__note-action {
        width: 100%;
    }

    .lock-panel .lock-panel__action { width: 100%; }
}
