/* ============================================================
   主题变量 —— 编辑式宣言页：暖纸 / 墨黑 / 朱砂
   ============================================================ */
:root {
    --paper: #f3efe6;
    --paper-deep: #ece5d6;
    --ink: #1c1813;
    --ink-secondary: #6b6358;
    --ink-faint: #a89f8e;
    --accent: #c8392e;
    --accent-deep: #9e2b22;
    --rule: #d6cebd;
    --watermark: rgba(28, 24, 19, 0.045);

    --font-serif: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC", "SimSun", serif;
    --font-sans: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    --font-mono: "SF Mono", "Cascadia Code", "JetBrains Mono", "Consolas", monospace;
}

/* ============================================================
   重置与基础
   ============================================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--paper);
    color: var(--ink);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ============================================================
   纸张颗粒质感 —— SVG 噪点叠加
   ============================================================ */
.grain {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0.5;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.11 0 0 0 0 0.09 0 0 0 0 0.07 0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* 暖光渐变，增加纸张纵深 */
.paper-glow {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 50% at 15% 20%, rgba(200, 57, 46, 0.04) 0%, transparent 60%),
        radial-gradient(ellipse 70% 60% at 85% 90%, rgba(28, 24, 19, 0.05) 0%, transparent 65%);
}

/* ============================================================
   巨幅"网"字水印
   ============================================================ */
.watermark {
    position: fixed;
    top: 50%;
    right: -8vw;
    transform: translateY(-50%);
    z-index: 1;
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 62vw;
    line-height: 1;
    color: var(--watermark);
    user-select: none;
    pointer-events: none;
    opacity: 0;
    animation: watermarkIn 1.6s ease 0.3s forwards;
}

/* ============================================================
   页面骨架 —— 单屏
   ============================================================ */
.page {
    position: relative;
    z-index: 3;
    height: 100dvh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem clamp(1.5rem, 5vw, 4.5rem);
}

/* ============================================================
   顶部 —— 品牌 + mono 标注，下方发丝线
   ============================================================ */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--rule);
    opacity: 0;
    animation: fadeDown 0.7s ease 0.15s both;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.04em;
    color: var(--ink);
}

.brand__mark {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.brand__name {
    font-family: var(--font-sans);
}

.brand__name em {
    font-style: normal;
    color: var(--ink-faint);
    font-weight: 400;
    margin-left: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.14em;
}

.topbar__meta {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.18em;
    color: var(--ink-faint);
    text-transform: uppercase;
}

/* ============================================================
   Hero —— 不对称、左对齐编辑版式
   ============================================================ */
.hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 60rem;
    gap: 1.6rem;
    padding: 1rem 0;
}

/* 章节编号 */
.hero__marker {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.22em;
    color: var(--accent);
    text-transform: uppercase;
    opacity: 0;
    animation: rise 0.7s ease 0.3s both;
}

.hero__marker::before {
    content: "";
    width: 28px;
    height: 1px;
    background: var(--accent);
}

/* 主标题：重型黑体，两行，力量感 */
.hero__title {
    font-family: var(--font-sans);
    font-weight: 800;
    font-size: clamp(3rem, 9.5vw, 7.5rem);
    line-height: 1.05;
    letter-spacing: -0.035em;
    color: var(--ink);
}

.hero__title .line {
    display: block;
    overflow: hidden;
    /* 留出底部空间，避免"。"等字符下沿被 overflow:hidden 裁剪 */
    padding-bottom: 0.12em;
}

.hero__title .line span {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.3em);
    animation: lineRise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.hero__title .line:nth-child(1) span { animation-delay: 0.42s; }
.hero__title .line:nth-child(2) span { animation-delay: 0.58s; }

/* 朱砂句号，记忆点 */
.hero__title .dot {
    color: var(--accent);
}

/* 朱砂下划线，绘制动画 */
.hero__rule {
    width: 0;
    height: 3px;
    background: var(--accent);
    margin-top: 0.3rem;
    animation: drawRule 0.9s ease 0.95s forwards;
}

/* 宋体标语 —— 编辑感的第二声部 */
.hero__tagline {
    font-family: var(--font-serif);
    font-size: clamp(1.05rem, 1.9vw, 1.5rem);
    font-weight: 400;
    line-height: 1.75;
    color: var(--ink-secondary);
    max-width: 34rem;
    letter-spacing: 0.02em;
    opacity: 0;
    animation: rise 0.8s ease 1.05s both;
}

/* ============================================================
   底部 —— 版权 + 备案号
   ============================================================ */
.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.8rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--rule);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    color: var(--ink-faint);
    opacity: 0;
    animation: fadeIn 0.7s ease 1.35s both;
}

.footer__copyright strong {
    color: var(--ink-secondary);
    font-weight: 500;
    font-family: var(--font-sans);
    letter-spacing: 0.02em;
}

/* 当前网址，接在版权信息后 */
.footer__url {
    color: var(--ink-secondary);
    word-break: break-all;
}

/* 备案号链接：由服务端按域名匹配后条件渲染，存在即展示 */
.footer__filing {
    color: var(--ink-faint);
    transition: color 0.2s ease;
    font-family: var(--font-sans);
    letter-spacing: 0.02em;
}

.footer__filing:hover {
    color: var(--accent);
}

/* ============================================================
   动画关键帧
   ============================================================ */
@keyframes lineRise {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes drawRule {
    to { width: 4.5rem; }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes watermarkIn {
    to { opacity: 1; }
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
    .page {
        padding: 1.5rem 1.4rem;
    }

    .topbar__meta {
        display: none;
    }

    .watermark {
        font-size: 90vw;
        right: -20vw;
        opacity: 0.6;
    }

    .footer {
        flex-direction: column;
        text-align: center;
    }

    .hero {
        gap: 1.2rem;
    }
}

/* 尊重减少动态偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    .topbar,
    .hero__marker,
    .hero__tagline,
    .footer,
    .watermark {
        opacity: 1;
    }

    .hero__title .line span {
        opacity: 1;
        transform: none;
    }

    .hero__rule {
        width: 4.5rem;
    }
}
