@charset "utf-8";

/* ═══════════════════════════════════════════════════════════════
   Markdown 排版 — Phycat × HyperOS 3「霁蓝」
   Adapted from Phycat by sumruler (MIT License)
   https://github.com/sumruler/typora-theme-phycat
   Copyright (c) 2024 徐继龙
   所有色彩统一走 Design Token，保持生命感与现代大气感。
   ═══════════════════════════════════════════════════════════════ */

/* ── 排版衍生变量（从主 Token 派生，仅在 .post-md 内使用）── */
.post-md {
    --md-accent-shallow: color-mix(in srgb, var(--accent) 38%, #fff);
    --md-accent-faint:   color-mix(in srgb, var(--accent) 14%, #fff);
    --md-accent-deep:    color-mix(in srgb, var(--accent) 82%, #000);
    --md-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, Consolas, monospace;
}

.post-md {
    width: 100%;
    font-size: 16.8px;
    letter-spacing: 0.005em;
    line-height: 1.8;
}


/* ── 标题 ─────────────────────────────────────────────────── */

/* H1 — 居中，底部渐变色条 */
.post-md h1 {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 56px 0 24px;
    text-align: center;
    color: var(--font-color-1);
    letter-spacing: -0.02em;
    position: relative;
    padding-bottom: 14px;
}
.post-md h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 3.5px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--md-accent-shallow), var(--accent), var(--md-accent-shallow));
    transition: width 0.4s var(--ease-soft);
}
.post-md h1:hover::after { width: 80%; }

/* H2 — 渐变色带标签 */
.post-md h2 {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 48px 0 16px;
    padding: 5px 14px;
    width: fit-content;
    color: #fff;
    border-radius: var(--radius-s);
    background: linear-gradient(to right, var(--md-accent-shallow), var(--accent), var(--md-accent-shallow));
    background-size: 200% 100%;
    box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 18%, transparent);
    letter-spacing: 0;
    transition: background-position 0.6s var(--ease-soft), box-shadow 0.3s;
}
.post-md h2:hover {
    background-position: 100% 0;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* H3 — 左侧竖条 */
.post-md h3 {
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 40px 0 12px;
    padding-left: 14px;
    position: relative;
    color: var(--font-color-1);
    letter-spacing: -0.01em;
    transition: padding-left 0.3s var(--ease-soft), color 0.3s;
}
.post-md h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 4px;
    border-radius: 3px;
    background: var(--accent);
    transition: width 0.3s var(--ease-soft);
}
.post-md h3:hover { padding-left: 18px; color: var(--accent); }
.post-md h3:hover::before { width: 6px; }

/* H4 — 实心圆点标记 */
.post-md h4 {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 32px 0 10px;
    padding-left: 20px;
    position: relative;
    color: var(--font-color-1);
    letter-spacing: -0.01em;
    transition: color 0.25s, transform 0.25s;
}
.post-md h4::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s;
}
.post-md h4:hover { color: var(--md-accent-deep); }
.post-md h4:hover::before {
    transform: translateY(-50%) scale(1.25);
    box-shadow: 0 0 0 3px var(--md-accent-faint);
}

/* H5 — 空心圆点 */
.post-md h5 {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 24px 0 6px;
    padding-left: 20px;
    position: relative;
    color: var(--font-color-1);
    letter-spacing: -0.01em;
}
.post-md h5::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: var(--bg-paper);
}

/* H6 */
.post-md h6 {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
    margin: 20px 0 6px;
    color: var(--font-color-2);
    letter-spacing: -0.01em;
}


/* ── 段落 & 正文 ──────────────────────────────────────────── */

.post-md p {
    width: 100%;
    margin: 14px 0;
}


/* ── 链接 ─────────────────────────────────────────────────── */
/* 基础色彩；hover 底纹效果由 mark-pen.css 控制 */

.post-md a {
    color: var(--font-color-2);
    font-weight: 500;
    padding: 1px 3px;
    border-radius: var(--radius-xs);
    transition: color 0.25s;
}
.post-md a:hover {
    color: var(--accent);
}


/* ── 行内格式 ─────────────────────────────────────────────── */

/* 加粗 — 主题色点缀 */
.post-md strong {
    font-weight: 600;
    color: var(--md-accent-deep);
    border-bottom: 2px solid transparent;
    transition: border-color 0.25s;
}
.post-md strong:hover {
    border-bottom-color: var(--md-accent-shallow);
}

/* 斜体 */
.post-md em {
    font-style: italic;
    color: var(--font-color-2);
}

/* 数学公式（inline + display）—— 统一灰色，不碰字体/斜体 */
.post-md .math {
    color: var(--font-color-2);
}
.post-md .math * {
    color: inherit;
}

/* 高亮 mark — 荧光笔底色效果 */
.post-md mark {
    background-color: transparent;
    background-image: linear-gradient(to top, var(--md-accent-faint), var(--md-accent-faint));
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 100% 40%;
    border-radius: var(--radius-xs);
    padding: 1px 4px;
    transition: background-size 0.3s var(--ease-soft);
}
.post-md mark:hover {
    background-size: 100% 100%;
    border-radius: 5px;
}

/* 删除线 — 主题色 */
.post-md del {
    text-decoration: line-through;
    text-decoration-color: var(--md-accent-shallow);
    color: var(--font-color-3);
}

/* 键盘按键 — 3D 按压效果 */
.post-md kbd {
    display: inline-block;
    min-width: 1.5em;
    text-align: center;
    padding: 2px 7px;
    font-family: var(--md-mono);
    font-size: 0.88em;
    font-weight: 600;
    color: var(--md-accent-deep);
    background: var(--bg-paper);
    border: 1px solid var(--border-warm);
    border-bottom-width: 3px;
    border-radius: var(--radius-xs);
    box-shadow: 0 1px 0 var(--md-accent-faint);
    transition: border-bottom-width 0.12s, transform 0.12s;
}
.post-md kbd:hover {
    border-bottom-width: 1px;
    transform: translateY(2px);
}


/* ── 列表 ─────────────────────────────────────────────────── */

.post-md ol { list-style: decimal;     padding-left: 24px; }
.post-md ul { list-style: disc;        padding-left: 24px; }
.post-md li { margin: 5px 0; }

.post-md ul ul { list-style-type: circle; }
.post-md ul ul ul { list-style-type: square; }
.post-md ol ol { list-style-type: lower-alpha; }
.post-md ol ol ol { list-style-type: lower-roman; }
.post-md li::marker { color: var(--accent); }


/* ── 图片 ─────────────────────────────────────────────────── */

.post-md img {
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s var(--ease-soft), transform 0.3s var(--ease-soft);
}
.post-md img:hover {
    box-shadow: var(--shadow-md);
    transform: scale(1.015);
}


/* ── 分割线 ───────────────────────────────────────────────── */

.post-md hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line-1) 20%, var(--line-1) 80%, transparent);
    max-width: 60%;
    margin: 40px auto;
}


/* ── 引用块 ───────────────────────────────────────────────── */

.post-md blockquote {
    width: 100%;
    margin: 24px 0;
    padding: 18px 24px;
    background: var(--bg-zebra);
    border: none;
    border-left: 3px solid var(--md-accent-shallow);
    border-radius: var(--radius-m);
    color: var(--font-color-2);
    line-height: 1.7;
    word-wrap: break-word;
    transition: transform 0.25s var(--ease-soft);
}
.post-md blockquote:hover { transform: scale(1.008); }
.post-md blockquote p             { margin: 8px 0; }
.post-md blockquote p:first-child { margin-top: 0; }
.post-md blockquote p:last-child  { margin-bottom: 0; }


/* ── 表格 ─────────────────────────────────────────────────── */

.post-md table {
    width: 100%;
    text-align: left;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border-warm);
    border-radius: var(--radius-m);
    overflow: hidden;
    font-size: 0.94em;
    line-height: 1.6;
}

.post-md table th {
    padding: 10px 14px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--surface);
    color: var(--md-accent-deep);
    border-bottom: 1px solid var(--border-warm);
    border-right: 1px solid var(--surface);
}
.post-md table th:last-child { border-right: none; }

.post-md table tr td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--surface);
    border-right: 1px solid var(--bg-zebra);
    transition: background 0.2s;
}
.post-md table tr td:last-child { border-right: none; }
.post-md table tr:last-child td { border-bottom: none; }
.post-md table tr:nth-child(even) td { background: var(--bg-zebra); }
.post-md table tr:hover td { background: var(--md-accent-faint); }


/* ── 视频 ─────────────────────────────────────────────────── */

.post-md .video-container {
    background: #000;
    border-radius: var(--radius-m);
    overflow: hidden;
}
.post-md iframe,
.post-md .video-container iframe { width: 100%; }


/* ── 行内代码 ─────────────────────────────────────────────── */

.post-md code {
    border-radius: 6px;
    background: var(--md-accent-faint);
    padding: 3px 7px;
    margin: 0 2px;
    color: var(--md-accent-deep);
    font-size: 0.88em;
    letter-spacing: 0.3px;
    border: none;
    font-family: var(--md-mono);
    transition: background 0.2s, color 0.2s;
}
.post-md code:hover {
    background: var(--md-accent-shallow);
    color: #fff;
}

/* 代码块内 code 不走行内样式 */
.post-md pre code {
    background: none;
    padding: 0;
    margin: 0;
    color: inherit;
    font-size: inherit;
    letter-spacing: normal;
    border-radius: 0;
}
.post-md pre code:hover {
    background: none;
    color: inherit;
}

.post-md .hljs-ln-numbers {
    opacity: .5;
    padding-right: 12px;
}


/* ── 代码块容器 ───────────────────────────────────────────── */

.post-md pre {
    border-radius: var(--radius-s);
    overflow: hidden;
    margin: 20px 0;
    box-shadow: var(--shadow-sm);
}


/* ── 脚注 ─────────────────────────────────────────────────── */

.post-md .footnote-ref {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5em;
    height: 1.5em;
    font-size: 0.7em;
    vertical-align: super;
    background: var(--md-accent-faint);
    border-radius: 50%;
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    line-height: 1;
    transition: background 0.2s, color 0.2s;
}
.post-md .footnote-ref sup {
    vertical-align: baseline;
    font-size: inherit;
}
.post-md .footnote-ref:hover {
    background: var(--accent);
    color: #fff;
}

/* ── 脚注展示区 ───────────────────────────────────────────── */

.post-md .footnotes {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px dashed var(--line-1);
    position: relative;
    font-size: 0.88em;
    color: var(--font-color-2);
}
.post-md .footnotes::before {
    content: '注释';
    position: absolute;
    top: -0.7em;
    left: 0;
    padding: 0 8px;
    background: var(--bg-paper);
    font-size: 0.82em;
    font-weight: 500;
    color: var(--font-color-3);
    letter-spacing: 0.1em;
}
.post-md .footnotes > hr {
    display: none;
}
.post-md .footnotes ol {
    padding-left: 20px;
    margin: 0;
}
.post-md .footnotes li {
    margin: 4px 0;
}
.post-md .footnote-back {
    display: none;
}


/* ── 复选框（Task List）── ────────────────────────────────── */

.post-md .task-list { list-style: none; padding-left: 4px; }
.post-md .task-list li { position: relative; padding-left: 28px; }
.post-md .task-list input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    left: 0;
    top: 5px;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-warm);
    border-radius: var(--radius-xs);
    background: var(--bg-paper);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.post-md .task-list input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.post-md .task-list input[type="checkbox"]:checked::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    position: absolute;
    top: 1px;
    left: 4px;
    transform: rotate(45deg);
}


/* ── GFM Alerts ───────────────────────────────────────────── */

.post-md .gfm-alert {
    border-left: 3px solid;
    border-radius: var(--radius-s);
    padding: 14px 20px;
    margin: 20px 0;
}

.post-md .gfm-alert-title {
    font-weight: 600;
    font-size: 0.92em;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.post-md .gfm-alert-title svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* GFM Alert — Token 化颜色，便于维护 */
.post-md .gfm-alert { --_alert-color: var(--accent); }
.post-md .gfm-alert-note      { --_alert-color: var(--alert-note); }
.post-md .gfm-alert-tip       { --_alert-color: var(--alert-tip); }
.post-md .gfm-alert-important { --_alert-color: var(--alert-important); }
.post-md .gfm-alert-warning   { --_alert-color: var(--alert-warning); }
.post-md .gfm-alert-caution   { --_alert-color: var(--alert-caution); }

.post-md .gfm-alert-note,
.post-md .gfm-alert-tip,
.post-md .gfm-alert-important,
.post-md .gfm-alert-warning,
.post-md .gfm-alert-caution {
    border-color: var(--_alert-color);
    background: color-mix(in srgb, var(--_alert-color) 6%, transparent);
}
.post-md .gfm-alert-note .gfm-alert-title,
.post-md .gfm-alert-tip .gfm-alert-title,
.post-md .gfm-alert-important .gfm-alert-title,
.post-md .gfm-alert-warning .gfm-alert-title,
.post-md .gfm-alert-caution .gfm-alert-title {
    color: var(--_alert-color);
}


/* ═══ 代码块头部：语言标签 + 复制按钮 ═══ */

figure.highlight {
    position: relative;
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -16px -20px 10px;
    padding: 6px 14px;
    background: var(--code-header-bg);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    user-select: none;
}

.code-lang {
    color: var(--code-lang-color);
    font-family: var(--md-mono);
    font-size: 12px;
    letter-spacing: 0.03em;
}

.code-copy-btn {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border: none;
    border-radius: 4px;
    background: rgba(255,255,255,0.06);
    color: var(--code-lang-color);
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    font-size: 12px;
    line-height: 1;
}

.code-copy-btn:hover {
    color: var(--code-copy-hover);
    background: rgba(255,255,255,0.12);
}

.code-copy-btn.copied {
    color: var(--code-copy-success);
}
