/* ==========================================================================
   文章詳細頁 article.css（影音知識文章與部分案例共用）
   標題區 → 封面 → 目錄（左側固定）與內文 → 延伸閱讀
   ========================================================================== */

/* ---------- 文章標題 ---------- */
.post-header {
    position: relative;
    padding-top: 90px;
    overflow: hidden;
}

/* 標題區後方淡淡的金色光暈 */
.post-header::before {
    content: "";
    position: absolute;
    top: -30%;
    left: 50%;
    width: 1100px;
    height: 700px;
    background: radial-gradient(ellipse at center, rgba(184, 154, 112, 0.12), transparent 65%);
    transform: translateX(-50%);
    pointer-events: none;
}

.post-header__inner {
    position: relative;
    max-width: 1000px;
}

.post-header__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    margin-bottom: 22px;
    font-size: 12px;
    letter-spacing: 0.18em;
    color: var(--color-gold);
}

.post-header__meta time {
    font-family: var(--font-en);
    font-size: 15px;
    letter-spacing: 0.06em;
    color: var(--color-muted);
}

.post-header__meta span {
    padding: 4px 14px;
    border: 1px solid rgba(184, 154, 112, 0.4);
    border-radius: 20px;
}

.post-header__title {
    font-size: clamp(30px, 3.8vw, 50px);
    line-height: 1.5;
}

.post-header__media {
    position: relative;
    max-width: 1240px;
    margin: 60px auto 0;
    padding: 0 var(--gutter);
    overflow: hidden;
}

.post-header__media img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* ---------- 內容版面 ---------- */
.post__layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 760px);
    justify-content: center;
    gap: 80px;
    padding-top: 90px;
    padding-bottom: 130px;
}

/* 沒有目錄的短文章：內文置中 */
.post__layout--single {
    grid-template-columns: minmax(0, 760px);
}

.post-toc {
    position: sticky;
    top: calc(var(--header-h) + 32px);
    align-self: start;
}

.post-toc__title {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(237, 229, 216, 0.4);
    font-size: 12px;
    letter-spacing: 0.28em;
    color: var(--color-gold);
}

.post-toc__list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
}

.post-toc__list a {
    display: block;
    padding: 9px 0 9px 16px;
    border-left: 1px solid var(--color-line);
    color: var(--color-muted);
    transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.post-toc__list a:hover,
.post-toc__list a.is-current {
    border-color: var(--color-gold);
    color: var(--color-text);
}

/* ---------- 文章內文 ---------- */
.post-body {
    font-size: 17px;
    line-height: 2.05;
    color: rgba(237, 229, 216, 0.84);
}

.post-body strong {
    color: var(--color-text);
}

/* 文章內文字連結；按鈕（.btn）維持按鈕本身的顏色，不套用 */
.post-body a:not(.btn) {
    border-bottom: 1px solid rgba(184, 154, 112, 0.5);
    color: var(--color-accent);
}

.post-body h2 {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 72px 0 22px;
    font-size: 26px;
    color: var(--color-text);
    scroll-margin-top: calc(var(--header-h) + 24px);
}

.post-body h2::before {
    content: "";
    flex-shrink: 0;
    width: 28px;
    height: 1px;
    background: var(--color-gold);
}

.post-body h3 {
    margin: 40px 0 12px;
    font-size: 20px;
    color: var(--color-text);
}

.post-body h4 {
    margin: 28px 0 10px;
    font-size: 17px;
    color: var(--color-text);
}

.post-body ul,
.post-body ol {
    margin: 0 0 1.2em;
    padding-left: 1.4em;
}

.post-body ul {
    list-style: disc;
}

.post-body ol {
    list-style: decimal;
}

.post-body li {
    margin-bottom: 6px;
}

.post-body li::marker {
    color: var(--color-gold);
}

.post-figure {
    margin: 44px 0;
}

.post-figure img {
    width: 100%;
}

/* 直式或方形圖片：縮小置中，避免整張撐滿版面 */
.post-figure--narrow {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.post-figure figcaption {
    margin-top: 12px;
    font-size: 14px;
    color: var(--color-muted);
}

.post-body blockquote {
    position: relative;
    margin: 32px 0;
    padding: 28px 32px;
    border-left: 1px solid var(--color-gold);
    font-family: var(--font-serif);
    color: var(--color-text);
    background: var(--color-bg-alt);
}

.post-body blockquote p:last-child {
    margin-bottom: 0;
}

/* 長網址、程式碼與未包外框的表格：不撐破手機版面 */
.post-body a,
.post-body code {
    overflow-wrap: anywhere;
}

.post-body code,
.post-body pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.post-body > table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

/* 表格：手機可左右滑動 */
.post-table {
    margin: 32px 0;
    overflow-x: auto;
}

.post-table table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 15px;
    line-height: 1.7;
}

.post-table th,
.post-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-line);
    text-align: left;
    vertical-align: top;
}

.post-table tr:first-child th,
.post-table tr:first-child td {
    border-top: 1px solid rgba(237, 229, 216, 0.4);
}

.post-table th,
.post-table td:first-child {
    white-space: nowrap;
    font-weight: 500;
}

.post-table th {
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--color-gold);
    background: var(--color-bg-alt);
}

.post-table tr:hover td {
    background: rgba(237, 229, 216, 0.03);
}

/* 常見問題（摺疊） */
.post-body details {
    margin: 0 0 12px;
    border: 1px solid var(--color-line);
    background: var(--color-bg-alt);
    transition: border-color 0.3s var(--ease);
}

.post-body details[open] {
    border-color: rgba(184, 154, 112, 0.5);
}

.post-body summary {
    padding: 18px 22px;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
}

.post-body summary::marker {
    color: var(--color-gold);
}

.post-body details > :not(summary) {
    padding: 0 22px;
}

.post-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 56px;
    padding-top: 44px;
    border-top: 1px solid var(--color-line);
}

/* ---------- RWD ---------- */
@media (max-width: 960px) {
    .post-header {
        padding-top: 60px;
    }

    .post__layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 44px;
        padding-top: 56px;
        padding-bottom: 90px;
    }

    .post-toc {
        position: static;
        padding: 26px;
        border: 1px solid var(--color-line);
        background: var(--color-bg-alt);
    }
}

@media (max-width: 640px) {
    .post-header {
        padding-top: 40px;
    }

    .post-header__media {
        margin-top: 36px;
        padding: 0;
    }

    .post-body {
        font-size: 16px;
    }

    .post-body h2 {
        margin-top: 56px;
        font-size: 21px;
    }
}
