/* =========================================================
   04-post · 文章与评论
   承载范围：原 style.css 第 936-1678 行
   本节包含：
     - 文章正文排版
     - 文章内通用组件（图片框/并排图/媒体卡/对话气泡/提示框）
     - 博客详情与评论
   ========================================================= */

/* ============= 文章正文排版 ============= */
.post-content {
    font-size: 15px;
    line-height: 1.9;
    color: var(--text-primary);
    word-break: break-word;
}

.post-content p {
    margin: 14px 0;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
    color: var(--pink-700);
    line-height: 1.5;
    margin: 26px 0 12px;
}

.post-content h1 { font-size: 24px; }
.post-content h2 { font-size: 21px; }
.post-content h3 { font-size: 18px; }
.post-content h4 { font-size: 16px; }

.post-content ul,
.post-content ol {
    margin: 14px 0 14px 24px;
}

.post-content li {
    margin: 6px 0;
}

.post-content a {
    color: var(--pink-500);
    text-decoration: none;
    border-bottom: 1px dashed var(--pink-300);
    transition: color var(--transition), border-color var(--transition);
}

.post-content a:hover {
    color: var(--pink-700);
    border-bottom-color: var(--pink-600);
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    transition: transform var(--transition), box-shadow var(--transition);
}

.post-content img:hover {
    transform: scale(1.01);
    box-shadow: var(--shadow-md);
}

.post-content hr {
    border: none;
    height: 1px;
    margin: 24px 0;
    background: linear-gradient(90deg, transparent, var(--pink-300), transparent);
}

.post-content blockquote {
    margin: 16px 0;
    padding: 12px 18px;
    border-left: 4px solid var(--pink-400);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--surface-highlight-strong);
    color: var(--text-secondary);
}

.post-content table {
    width: 100%;
    margin: 16px 0;
    border-collapse: collapse;
    font-size: 14px;
}

.post-content th,
.post-content td {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    text-align: left;
}

.post-content th {
    background: var(--pink-100);
    color: var(--pink-700);
    font-weight: 600;
}

/* 行内代码 */
.post-content code {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--code-inline-bg);
    color: var(--pink-700);
    font-family: 'JetBrains Mono', 'Cascadia Code', Consolas, 'Courier New', monospace;
    font-size: 0.9em;
}

/* 代码块（highlight.js 粉色主题） */
.post-content pre {
    position: relative;
    margin: 18px 0;
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: var(--code-bg);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.post-content pre code {
    display: block;
    padding: 0;
    background: none;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.7;
    white-space: pre;
}

.post-content pre::-webkit-scrollbar {
    height: 8px;
}

.post-content pre::-webkit-scrollbar-thumb {
    background: var(--pink-300);
    border-radius: 4px;
}

.post-content pre::-webkit-scrollbar-track {
    background: transparent;
}

.post-content .hljs-comment,
.post-content .hljs-quote {
    color: var(--code-comment);
    font-style: italic;
}

.post-content .hljs-keyword,
.post-content .hljs-selector-tag,
.post-content .hljs-literal,
.post-content .hljs-section,
.post-content .hljs-doctag,
.post-content .hljs-name,
.post-content .hljs-meta .hljs-keyword {
    color: var(--code-keyword);
    font-weight: 600;
}

.post-content .hljs-string,
.post-content .hljs-regexp,
.post-content .hljs-addition,
.post-content .hljs-attribute,
.post-content .hljs-meta .hljs-string {
    color: var(--code-meta);
}

.post-content .hljs-number,
.post-content .hljs-symbol,
.post-content .hljs-bullet,
.post-content .hljs-link,
.post-content .hljs-variable,
.post-content .hljs-template-variable {
    color: var(--code-template);
}

.post-content .hljs-title,
.post-content .hljs-title.class_,
.post-content .hljs-title.function_,
.post-content .hljs-built_in,
.post-content .hljs-type {
    color: var(--pink-600);
}

.post-content .hljs-attr,
.post-content .hljs-selector-id,
.post-content .hljs-selector-class,
.post-content .hljs-selector-attr,
.post-content .hljs-selector-pseudo {
    color: var(--code-pseudo);
}

.post-content .hljs-tag {
    color: var(--pink-600);
}

.post-content .hljs-deletion {
    color: var(--pink-700);
}

.post-content .hljs-emphasis {
    font-style: italic;
}

.post-content .hljs-strong {
    font-weight: 700;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0;
    font-size: 13px;
}

.post-content table th,
.post-content table td {
    border: 1px solid var(--border-light);
    padding: 10px 12px;
    text-align: left;
}

.post-content table th {
    background: var(--accent-soft);
    color: var(--text-heading);
    font-weight: 600;
}

/* 手机端：代码块与表格不再被挤成一条窄缝，改为块内横向滚动 */
@media (max-width: 768px) {
    .post-content pre {
        margin: 14px 0;
        padding: 12px 12px;
        border-radius: 12px;
    }

    .post-content pre code {
        font-size: 12px;
    }

    .post-content table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .post-content table th,
    .post-content table td {
        padding: 8px 10px;
        white-space: nowrap;
    }

    .post-content table::-webkit-scrollbar {
        height: 8px;
    }

    .post-content table::-webkit-scrollbar-track {
        background: transparent;
    }

    .post-content table::-webkit-scrollbar-thumb {
        background: var(--pink-300);
        border-radius: 4px;
    }
}

/* ============= 文章内通用组件 =============
   统一图片框 / 多图并排 / 媒体卡 / 对话气泡 / 提示框。
   全部只引用主题变量，樱花·暗色·雪景·冬夜 四种皮肤自动适配，无需再写内联 <style>。
   复制即用的调用示例见 data/posts/how.html。
*/

/* 浮动图片的高度归位 */
.post-content::after {
    content: '';
    display: block;
    clear: both;
}

/* ---- 统一图片框 ---- */
.post-content .post-figure {
    position: relative;
    max-width: 760px;
    margin: 26px auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--surface-card);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}

.post-content .post-figure:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.post-content .post-figure > img {
    display: block;
    width: 100%;
    margin: 0;
    border-radius: 0;
    cursor: zoom-in;
}

/* 卡片已经提供边框和阴影，图片本身不再重复叠加 */
.post-content .post-figure > img:hover {
    transform: none;
    box-shadow: none;
}

.post-content .post-figure figcaption {
    padding: 11px 18px;
    border-top: 1px dashed var(--border-light);
    background: var(--surface-soft);
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.7;
    text-align: center;
}

/* 悬停时右上角提示"可点击放大" */
.post-content .post-figure::after {
    content: '🔍';
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    background: var(--glass-85);
    font-size: 14px;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity var(--transition), transform var(--transition);
    pointer-events: none;
}

.post-content .post-figure:hover::after {
    opacity: 1;
    transform: scale(1);
}

.post-content .post-figure.is-no-zoom::after {
    content: none;
}

/* 尺寸修饰：窄图 / 通栏图 */
.post-content .post-figure.is-narrow { max-width: 420px; }
.post-content .post-figure.is-wide { max-width: 100%; }

/* 左右浮动，手机上自动还原为居中大图 */
@media (min-width: 769px) {
    .post-content .post-figure.is-left,
    .post-content .post-figure.is-right {
        max-width: 46%;
        margin-top: 6px;
        margin-bottom: 12px;
    }

    .post-content .post-figure.is-left { float: left; margin-right: 22px; }
    .post-content .post-figure.is-right { float: right; margin-left: 22px; }
}

/* 纯图无边框（截图自带边框、或透明 PNG） */
.post-content .post-figure.is-plain {
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.post-content .post-figure.is-plain > img {
    border-radius: var(--radius-sm);
}

.post-content .post-figure.is-plain figcaption {
    border-top: 0;
    background: transparent;
}

.post-content .post-figure.is-plain:hover {
    transform: none;
    box-shadow: none;
}

/* 等高裁切，多图并排时更整齐；可用 --post-ratio 改比例 */
.post-content .post-figure.is-cover > img {
    aspect-ratio: var(--post-ratio, 4 / 3);
    object-fit: cover;
}

/* ---- 多图并排 ---- */
.post-content .post-figure-grid {
    display: grid;
    grid-template-columns: repeat(var(--post-cols, 2), minmax(0, 1fr));
    gap: 14px;
    align-items: start;
    clear: both;
    margin: 26px 0;
}

.post-content .post-figure-grid.cols-1 { --post-cols: 1; }
.post-content .post-figure-grid.cols-2 { --post-cols: 2; }
.post-content .post-figure-grid.cols-3 { --post-cols: 3; }
.post-content .post-figure-grid.cols-4 { --post-cols: 4; }

.post-content .post-figure-grid .post-figure {
    float: none;
    max-width: none;
    margin: 0;
}

@media (max-width: 768px) {
    .post-content .post-figure-grid {
        gap: 10px;
    }

    .post-content .post-figure-grid.cols-3,
    .post-content .post-figure-grid.cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .post-content .post-figure-grid .post-figure figcaption {
        padding: 8px 10px;
        font-size: 0.78rem;
    }
}

/* ---- 媒体卡（视频 / 大图展示） ---- */
.post-content .media-card,
.post-content .video-showcase {
    max-width: 960px;
    margin: 28px auto;
    padding: 24px;
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-md);
    background: var(--surface-highlight-strong);
    box-shadow: var(--shadow-sm);
    text-align: center;
    clear: both;
}

.post-content .media-card-title,
.post-content .video-showcase-title {
    margin: 0 0 16px;
    color: var(--pink-600);
    font-size: 1.1rem;
    font-weight: 600;
}

.post-content .media-card video,
.post-content .media-card img,
.post-content .video-showcase video,
.post-content .video-showcase img {
    display: block;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.post-content .media-card video {
    cursor: pointer;
}

.post-content .media-card img:hover,
.post-content .video-showcase img:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
    .post-content .media-card,
    .post-content .video-showcase {
        padding: 16px;
        margin: 20px auto;
    }

    .post-content .media-card-title,
    .post-content .video-showcase-title {
        font-size: 1rem;
    }
}

/* ---- 对话气泡 ---- */
.post-content .dialogue-box {
    margin: 20px 0;
    clear: both;
}

.post-content .dialogue-me,
.post-content .dialogue-her {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.post-content .dialogue-me {
    flex-direction: row-reverse;
}

.post-content .dialogue-avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    background: var(--accent-gradient-soft);
    font-size: 18px;
    overflow: hidden;
}

.post-content .dialogue-avatar img {
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 50%;
    object-fit: cover;
    cursor: zoom-in;
}

.post-content .dialogue-avatar img:hover {
    transform: none;
    box-shadow: none;
}

.post-content .dialogue-bubble {
    position: relative;
    max-width: 72%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.7;
}

.post-content .dialogue-bubble p {
    margin: 0 0 8px;
}

.post-content .dialogue-bubble p:last-child {
    margin-bottom: 0;
}

/* 自己：主题色气泡，右上角收角 */
.post-content .dialogue-me .dialogue-bubble {
    border: 1px solid var(--accent-border);
    border-top-right-radius: 4px;
    background: var(--accent-soft);
}

/* 对方：中性气泡，左上角收角 */
.post-content .dialogue-her .dialogue-bubble {
    border: 1px solid var(--border-light);
    border-top-left-radius: 4px;
    background: var(--bubble-bg);
}

@media (max-width: 768px) {
    .post-content .dialogue-bubble {
        max-width: 85%;
        font-size: 0.9rem;
    }
}

/* ---- 提示框 ---- */
.post-content .post-note {
    margin: 22px 0;
    padding: 14px 18px 14px 20px;
    border: 1px solid var(--accent-border);
    border-left: 4px solid var(--pink-400);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--surface-highlight-strong);
    color: var(--text-primary);
    font-size: 0.94rem;
    line-height: 1.75;
}

.post-content .post-note > :first-child { margin-top: 0; }
.post-content .post-note > :last-child { margin-bottom: 0; }

.post-content .post-note.is-warn {
    border-color: var(--danger-border);
    border-left-color: var(--danger);
    background: var(--danger-soft);
}

.post-content .post-note.is-ok {
    border-color: rgba(80, 180, 130, 0.35);
    border-left-color: rgba(60, 165, 115, 0.9);
    background: rgba(80, 190, 140, 0.1);
}

.post-content .post-note-title {
    display: block;
    margin-bottom: 6px;
    color: var(--text-heading);
    font-size: 0.95rem;
    font-weight: 600;
}


/* ============= 博客详情 & 评论 ============= */
.comment-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.comment-section h3 {
    color: var(--pink-600);
    font-size: 16px;
    margin-bottom: 14px;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
    max-height: 400px;
    overflow-y: auto;
}

.comment-item {

    border-radius: var(--radius-sm);
    padding: 12px 16px;
    border: 1px solid var(--surface-highlight-strong);
}

.comment-author {
    font-weight: 700;
    color: var(--pink-700);
    font-size: 13px;
    margin-bottom: 4px;
}

.comment-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.comment-img {
    max-width: 240px;
    max-height: 200px;
    border-radius: 10px;
    margin-top: 6px;
    cursor: pointer;
    border: 1px solid var(--border-light);
    display: block;
    object-fit: cover;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-form-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.comment-form-row input[type="text"] {
    flex: 1;
    min-width: 140px;
    background: var(--surface-input);
    border: 1.5px solid var(--border-light);
    border-radius: 30px;
    padding: 10px 16px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.comment-form-row input[type="text"]:focus {
    border-color: var(--pink-400);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.comment-form-row input::placeholder {
    color: var(--text-muted);
}

.comment-img-upload {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.comment-img-upload label {
    cursor: pointer;
    font-size: 13px;
    color: var(--pink-500);
    padding: 6px 14px;
    border: 1px dashed var(--pink-300);
    border-radius: 20px;
    transition: 0.2s;
    font-weight: 500;
}

.comment-img-upload label:hover {
    background: var(--surface-highlight-strong);
}

.comment-img-preview {
    max-width: 80px;
    max-height: 50px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border-light);
}

.comment-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
