/**
 * Ethantheme 文章详情页样式
 * ----------------------------------------------------
 * 适用：single（post）文章详情页
 * 复用：.eth-toc 通用 TOC 样式（定义在 product.css）
 * 设计：头部背景区 + 三栏内容区 + 作者信息条
 */

/* =========================================================
 * 1. 头部背景区
 * ========================================================= */
.eth-article-header {
    position: relative;
    padding-block: var(--eth-space-xl) var(--eth-space-l);
    background-color: var(--eth-bg-muted);
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid var(--eth-border);
}

.eth-article-header--has-bg {
    color: #fff;
    background-color: var(--eth-text-title);
}

.eth-article-header--has-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.6) 100%);
    z-index: 0;
}

.eth-article-header__inner {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: var(--eth-space-l) var(--eth-space-xl);
    background: color-mix(in srgb, var(--eth-primary) 6%, var(--eth-bg-surface));
    border: 1px solid color-mix(in srgb, var(--eth-primary) 15%, transparent);
    border-radius: var(--eth-radius-l);
}

/* 面包屑 */
.eth-article-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--eth-space-2xs);
    font-size: var(--eth-fs-small);
    margin-bottom: var(--eth-space-m);
    opacity: 0.9;
}

.eth-article-breadcrumb a {
    color: inherit;
    text-decoration: none;
    transition: opacity var(--eth-transition-s);
}

.eth-article-breadcrumb a:hover { opacity: 0.7; }

.eth-article-breadcrumb__sep { opacity: 0.5; }

.eth-article-breadcrumb__current { font-weight: var(--eth-fw-medium); }

/* 标题 */
.eth-article-header__title {
    font-size: calc(var(--eth-fs-h2) - 0.4rem);
    font-weight: var(--eth-fw-bold);
    line-height: var(--eth-lh-tight);
    margin: 0 0 var(--eth-space-s);
}

.eth-article-header__subtitle {
    font-size: var(--eth-fs-h4);
    font-weight: var(--eth-fw-regular);
    opacity: 0.85;
    margin: 0 0 var(--eth-space-m);
    line-height: var(--eth-lh-body);
}

/* 元信息 */
.eth-article-header__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--eth-space-m);
    font-size: var(--eth-fs-small);
    opacity: 0.9;
}

.eth-article-header__author {
    display: flex;
    align-items: center;
    gap: var(--eth-space-2xs);
}

.eth-article-header__author a {
    color: inherit;
    text-decoration: none;
    font-weight: var(--eth-fw-medium);
}

.eth-article-header__author a:hover { text-decoration: underline; }

.eth-article-header__avatar {
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.eth-article-header__date time { font-weight: var(--eth-fw-medium); }

.eth-article-header__cats a {
    color: inherit;
    text-decoration: none;
    transition: opacity var(--eth-transition-s);
}

.eth-article-header__cats a:hover { opacity: 0.7; }

@media (max-width: 768px) {
    .eth-article-header__title { font-size: var(--eth-fs-h2); }
    .eth-article-header__meta { gap: var(--eth-space-s); }
}

/* =========================================================
 * 2. 内容区三栏布局（复用 product.css 的 .eth-toc 样式）
 * ========================================================= */
.eth-article-content {
    padding-block: var(--eth-space-l);
}

.eth-article-content__container {
    display: grid;
    gap: var(--eth-space-l);
    align-items: start;
    grid-template-columns: 1fr;
}

/* 有 TOC */
.eth-article-content.has-toc .eth-article-content__container {
    grid-template-columns: 260px 1fr;
}
/* 有侧边栏 */
.eth-article-content.has-sidebar .eth-article-content__container {
    grid-template-columns: 1fr 300px;
}
/* TOC + 侧边栏（三栏）：突破 1350px 限制，加宽容器 + 减小 gap */
.eth-article-content.has-toc.has-sidebar .eth-article-content__container {
    grid-template-columns: 260px 1fr 300px;
    gap: var(--eth-space-m);
    max-width: 1600px;
}
/* 侧边栏在左 + TOC */
.eth-article-content--sidebar-left.has-toc.has-sidebar .eth-article-content__container {
    grid-template-columns: 260px 300px 1fr;
    gap: var(--eth-space-m);
    max-width: 1600px;
}
.eth-article-content--sidebar-left:not(.has-toc).has-sidebar .eth-article-content__container {
    grid-template-columns: 300px 1fr;
}

/* 文章页独立加载，因此在此提供完整 TOC 样式。 */
.eth-article-content__toc {
    position: sticky;
    top: var(--eth-space-l);
    max-height: calc(100vh - var(--eth-space-xl) * 2);
    overflow-y: auto;
    align-self: start;
}
.eth-article-content__toc .eth-toc__inner {
    padding: var(--eth-space-m);
    background: var(--eth-bg-surface);
    border: 1px solid var(--eth-border);
    border-radius: var(--eth-radius-m);
    box-shadow: var(--eth-shadow-s);
}
.eth-article-content__toc .eth-toc__title {
    margin: 0 0 var(--eth-space-xs);
    padding-bottom: var(--eth-space-2xs);
    border-bottom: 1px solid var(--eth-border);
    color: var(--eth-text-title);
    font-size: var(--eth-fs-small);
}
.eth-article-content__toc .eth-toc__list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.eth-article-content__toc .eth-toc__list a {
    display: block;
    padding: var(--eth-space-3xs) var(--eth-space-2xs);
    border-left: 2px solid transparent;
    color: var(--eth-text-muted);
    font-size: var(--eth-fs-small);
    text-decoration: none;
}
.eth-article-content__toc .eth-toc__list a:hover,
.eth-article-content__toc .eth-toc__list a.is-active {
    color: var(--eth-primary);
    border-left-color: var(--eth-primary);
}
.eth-article-content__toc .eth-toc__sub-item a {
    padding-left: var(--eth-space-m);
    font-size: var(--eth-fs-xs);
}

/* 主内容 */
.eth-article-content__main {
    min-width: 0; /* 防止 grid 子元素溢出 */
}

/* 特色图片 */
.eth-article-featured {
    margin-bottom: var(--eth-space-m);
    border-radius: var(--eth-radius-l);
    overflow: hidden;
}

.eth-article-featured__img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--eth-radius-l);
}

/* 文章正文排版 */
.eth-article-entry {
    font-size: var(--eth-fs-body);
    color: var(--eth-text-body);
    line-height: var(--eth-lh-body);
}

.eth-article-entry > *:first-child { margin-top: 0; }
.eth-article-entry > *:last-child { margin-bottom: 0; }

.eth-article-entry h2 {
    font-size: var(--eth-fs-h2);
    font-weight: var(--eth-fw-semibold);
    color: var(--eth-text-title);
    margin: var(--eth-space-l) 0 var(--eth-space-s);
    scroll-margin-top: 80px;
}

.eth-article-entry h3 {
    font-size: var(--eth-fs-h3);
    font-weight: var(--eth-fw-semibold);
    color: var(--eth-text-title);
    margin: var(--eth-space-m) 0 var(--eth-space-xs);
    scroll-margin-top: 80px;
}

.eth-article-entry p { margin: 0 0 var(--eth-space-s); }

.eth-article-entry img {
    max-width: 100%;
    height: auto;
    border-radius: var(--eth-radius-m);
}

.eth-article-entry ul,
.eth-article-entry ol {
    margin: 0 0 var(--eth-space-s);
    padding-left: 1.5em;
}

.eth-article-entry li { margin-bottom: var(--eth-space-3xs); }

.eth-article-entry blockquote {
    margin: var(--eth-space-m) 0;
    padding: var(--eth-space-s) var(--eth-space-m);
    border-left: 4px solid var(--eth-primary);
    background: var(--eth-bg-muted);
    border-radius: 0 var(--eth-radius-s) var(--eth-radius-s) 0;
    font-style: italic;
    color: var(--eth-text-muted);
}

.eth-article-entry a {
    color: var(--eth-primary);
    text-decoration: underline;
    transition: color var(--eth-transition-s);
}

.eth-article-entry a:hover { color: var(--eth-primary-d-1); }

.eth-article-entry table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--eth-space-m) 0;
    border-radius: var(--eth-radius-m);
    overflow: hidden;
}

.eth-article-entry table th,
.eth-article-entry table td {
    padding: var(--eth-space-xs) var(--eth-space-s);
    border: 1px solid var(--eth-border);
    text-align: left;
}

.eth-article-entry table th {
    background: var(--eth-bg-muted);
    font-weight: var(--eth-fw-semibold);
}

/* 分页 */
.eth-article-pagination {
    margin: var(--eth-space-m) 0;
    padding: var(--eth-space-s) 0;
    border-top: 1px solid var(--eth-border);
    border-bottom: 1px solid var(--eth-border);
}

/* 标签 */
.eth-article-tags {
    margin-top: var(--eth-space-m);
    display: flex;
    flex-wrap: wrap;
    gap: var(--eth-space-2xs);
}

.eth-article-tags a {
    display: inline-block;
    padding: 0.3em 0.8em;
    background: var(--eth-bg-muted);
    color: var(--eth-text-muted);
    text-decoration: none;
    border-radius: var(--eth-radius-full);
    font-size: var(--eth-fs-small);
    transition: background var(--eth-transition-s), color var(--eth-transition-s);
}

.eth-article-tags a:hover {
    background: var(--eth-primary);
    color: #fff;
}

/* 侧边栏 widget */
.eth-article-content__sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--eth-space-m);
}

.eth-article-widget {
    background: var(--eth-bg-surface);
    border-radius: var(--eth-radius-m);
    padding: var(--eth-space-m);
    box-shadow: var(--eth-shadow-s);
}

.eth-article-widget__title {
    font-size: var(--eth-fs-h4);
    font-weight: var(--eth-fw-semibold);
    color: var(--eth-text-title);
    margin: 0 0 var(--eth-space-s);
    padding-bottom: var(--eth-space-xs);
    border-bottom: 2px solid var(--eth-primary);
}

/* =========================================================
 * 3. 作者信息条
 * ========================================================= */
.eth-article-author-bar {
    padding-block: var(--eth-space-l);
    background: var(--eth-bg-muted);
}

.eth-article-author-bar__inner {
    display: flex;
    gap: var(--eth-space-m);
    align-items: flex-start;
    max-width: 900px;
    margin: 0 auto;
}

.eth-article-author-bar__avatar img {
    border-radius: 50%;
    border: 3px solid var(--eth-bg-surface);
    box-shadow: var(--eth-shadow-s);
}

.eth-article-author-bar__info { flex: 1; }

.eth-article-author-bar__name {
    font-size: var(--eth-fs-h4);
    font-weight: var(--eth-fw-semibold);
    color: var(--eth-text-title);
    margin-bottom: var(--eth-space-xs);
}

.eth-article-author-bar__name a {
    color: var(--eth-primary);
    text-decoration: none;
}

.eth-article-author-bar__name a:hover { text-decoration: underline; }

.eth-article-author-bar__desc {
    color: var(--eth-text-body);
    line-height: var(--eth-lh-body);
    margin-bottom: var(--eth-space-xs);
}

.eth-article-author-bar__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--eth-space-m);
    font-size: var(--eth-fs-small);
    color: var(--eth-text-muted);
}

.eth-article-author-bar__cats a {
    color: var(--eth-primary);
    text-decoration: none;
}

.eth-article-author-bar__cats a:hover { text-decoration: underline; }

@media (max-width: 600px) {
    .eth-article-author-bar__inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* =========================================================
 * 4. 相关文章区（复用 .eth-product-section__title）
 * ========================================================= */
.eth-article-related {
    padding-block: var(--eth-space-xl);
    border-top: 1px solid var(--eth-border);
    background: color-mix(in srgb, var(--eth-bg-muted) 62%, var(--eth-bg-surface));
}

.eth-article-related .eth-loop--post-3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: clamp(1.25rem, 2.2vw, 2rem);
}





/* =========================================================
 * 5. 响应式
 * ========================================================= */
@media (max-width: 992px) {
    /* 三栏 → 两栏：TOC 移到顶部全宽，保留侧边栏 */
    .eth-article-content.has-toc.has-sidebar .eth-article-content__container {
        grid-template-columns: 1fr 300px;
    }
    .eth-article-content--sidebar-left.has-toc.has-sidebar .eth-article-content__container {
        grid-template-columns: 300px 1fr;
    }
    .eth-article-content.has-toc:not(.has-sidebar) .eth-article-content__container {
        grid-template-columns: 1fr;
    }
    .eth-article-content__toc {
        position: static;
        max-height: none;
        grid-column: 1 / -1;
        order: -1;
    }
}

@media (max-width: 768px) {
    .eth-article-content.has-toc .eth-article-content__container,
    .eth-article-content.has-sidebar .eth-article-content__container,
    .eth-article-content--sidebar-left:not(.has-toc).has-sidebar .eth-article-content__container,
    .eth-article-content.has-toc.has-sidebar .eth-article-content__container {
        grid-template-columns: 1fr;
    }
    .eth-article-content__toc,
    .eth-article-content__sidebar {
        position: static;
        max-height: none;
        grid-column: auto;
    }
}

/* 鏂囩珷鎽樿锛圵P 鍐呯疆 excerpt锛?*/
.eth-article-header__excerpt {
    margin: 0 0 var(--eth-space-m);
    padding: var(--eth-space-xs) var(--eth-space-m);
    border-left: 3px solid color-mix(in srgb, var(--eth-primary) 40%, transparent);
    color: var(--eth-text-body);
    font-size: var(--eth-fs-body);
    line-height: var(--eth-lh-body);
    opacity: 0.85;
}

/* =========================================================
 * 3.5 Author card (sidebar position)
 * ========================================================= */
.eth-article-author-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--eth-space-s);
    padding: var(--eth-space-l) var(--eth-space-m);
    background: var(--eth-bg-surface);
    border: 1px solid var(--eth-border);
    border-radius: var(--eth-radius-m);
    box-shadow: var(--eth-shadow-s);
    margin-bottom: var(--eth-space-m);
}

.eth-article-author-card__avatar img {
    border-radius: 50%;
    border: 3px solid color-mix(in srgb, var(--eth-primary) 20%, var(--eth-bg-surface));
}

.eth-article-author-card__body {
    width: 100%;
}

.eth-article-author-card__name {
    font-size: var(--eth-fs-h4);
    font-weight: var(--eth-fw-semibold);
    margin-bottom: var(--eth-space-2xs);
}

.eth-article-author-card__name a {
    color: var(--eth-text-title);
    text-decoration: none;
}

.eth-article-author-card__name a:hover {
    color: var(--eth-primary);
}

.eth-article-author-card__desc {
    font-size: var(--eth-fs-small);
    color: var(--eth-text-muted);
    line-height: var(--eth-lh-body);
    margin: 0 0 var(--eth-space-xs);
}

.eth-article-author-card__meta {
    font-size: var(--eth-fs-xs);
    color: var(--eth-text-muted);
}

/* =========================================================
 * 6. Inline TOC（短代码模式）
 * ----------------------------------------------------
 * 当 TOC 方式选择「短代码 [eth_toc]」时，
 * TOC 通过短代码插入内容流中，使用 inline 样式
 * ========================================================= */
.eth-toc--inline {
    margin: var(--eth-space-l) 0;
    max-width: 100%;
}

.eth-toc--inline .eth-toc__inner {
    padding: var(--eth-space-m);
    background: var(--eth-bg-surface);
    border: 1px solid var(--eth-border);
    border-radius: var(--eth-radius-m);
    box-shadow: var(--eth-shadow-s);
}

.eth-toc--inline .eth-toc__title {
    margin: 0 0 var(--eth-space-xs);
    padding-bottom: var(--eth-space-2xs);
    border-bottom: 1px solid var(--eth-border);
    font-size: var(--eth-fs-h4);
    font-weight: var(--eth-fw-semibold);
    color: var(--eth-text-title);
}

.eth-toc--inline .eth-toc__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.eth-toc--inline .eth-toc__list a {
    display: block;
    padding: var(--eth-space-3xs) var(--eth-space-2xs);
    border-left: 2px solid transparent;
    color: var(--eth-text-body);
    text-decoration: none;
    font-size: var(--eth-fs-small);
    line-height: var(--eth-lh-body);
    transition: color var(--eth-transition-s), border-color var(--eth-transition-s);
}

.eth-toc--inline .eth-toc__list a:hover,
.eth-toc--inline .eth-toc__list a.is-active {
    color: var(--eth-primary);
    border-left-color: var(--eth-primary);
}

.eth-toc--inline .eth-toc__sub-item a {
    padding-left: var(--eth-space-m);
    font-size: var(--eth-fs-xs);
}
