/**
 * 主题名称：Word（鸽子窝 · 暖色米白博客主题）
 * 版本：1.0.1
 * 描述：米白纸纹背景、赭石强调色、双栏布局（左侧文章网格 + 右侧关于我）、
 *       双侧落叶与底部鸽子动效、右下角悬浮按钮、卡片放大弹窗。
 * 目录：/usr/themes/word/
 *
 * 说明：
 *   normalize.css → 基础重置
 *   grid.css      → 布局骨架
 *   style.css     → 视觉样式（本文件）
 */

/* ==========================================================================
   0. CSS 变量：集中管理色彩 / 字体 / 圆角 / 层级
   ========================================================================== */
:root {
  --bg:          #F8F5F0;   /* 米白背景 */
  --card:        #FCFAF8;   /* 卡片浅色背景 */
  --ink:         #3d3832;   /* 正文深灰 */
  --ink-soft:    #6f675f;   /* 次级文字 */
  --ink-muted:   #a39a8f;   /* 弱化文字 */
  --accent:      #B86B3D;   /* 赭石强调色 */
  --accent-soft: #d7a27c;   /* 赭石浅色 */
  --line:        #e8e0d5;   /* 极细边框 */
  --radius:      12px;

  --serif: Georgia, "Nimbus Roman", "Songti SC", "STSong", "SimSun", serif; /* 衬线 */
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
           "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; /* 无衬线 */

  /* 层级：动效层最底，内容层在上，顶栏 / 悬浮按钮更高 */
  --z-fx:     0;
  --z-page:   1;
  --z-top:    10;
  --z-fab:    20;
}

/* ==========================================================================
   1. 基础排版与纸纹背景
   ========================================================================== */
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  /* 护眼暖色底 + 内联 SVG 噪点（纸纹质感，不加载任何外部图片） */
  background-color: var(--bg);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==========================================================================
   2. 背景动效层（最底层 / pointer-events:none，绝不阻挡点击）
   ========================================================================== */
.fx-layer {
  position: fixed;
  inset: 0;
  z-index: var(--z-fx);
  pointer-events: none;
  overflow: hidden;
}

/* —— 迷你落叶：仅出现在屏幕左右边缘（0–15vw / 85–100vw） —— */
.leaf {
  position: absolute;
  top: -6%;
  color: var(--accent);
  opacity: .82;
  line-height: 1;
  will-change: transform, opacity;
  animation-name: leafFall;
  animation-timing-function: linear;
  animation-iteration-count: 1;
  animation-fill-mode: backwards;
}
@keyframes leafFall {
  0%   { transform: translate3d(0,     0, 0)    rotate(0deg);   opacity: 0; }
  8%   { transform: translate3d(5px,   8vh, 0)  rotate(60deg);  opacity: .82; }
  30%  { transform: translate3d(-5px, 28vh, 0)  rotate(150deg); }
  55%  { transform: translate3d(5px,  52vh, 0)  rotate(240deg); }
  80%  { transform: translate3d(-5px, 78vh, 0)  rotate(320deg); opacity: .82; }
  100% { transform: translate3d(4px, 112vh, 0)  rotate(400deg); opacity: 0; }
}

/* —— 迷你鸽子：只在屏幕下半部分（60–90vh）横向飞过 —— */
.dove {
  position: absolute;
  left: 0;
  line-height: 1;
  opacity: .9;
  will-change: transform;
  animation-timing-function: linear;
  animation-iteration-count: 1;
  animation-fill-mode: backwards;
}
.dove-icon { display: inline-block; will-change: transform; }
.dove.l2r .dove-icon { transform: scaleX(-1); }
.dove.r2l .dove-icon { transform: scaleX(1);  }

@keyframes doveL2R {
  0%   { transform: translate3d(-12vw, 0, 0); }
  25%  { transform: translate3d( 18vw, -9px, 0); }
  50%  { transform: translate3d( 48vw,  7px, 0); }
  75%  { transform: translate3d( 78vw, -9px, 0); }
  100% { transform: translate3d(112vw,  0, 0); }
}
@keyframes doveR2L {
  0%   { transform: translate3d(112vw, 0, 0); }
  25%  { transform: translate3d( 78vw, -9px, 0); }
  50%  { transform: translate3d( 48vw,  7px, 0); }
  75%  { transform: translate3d( 18vw, -9px, 0); }
  100% { transform: translate3d(-12vw, 0, 0); }
}
.dove.l2r { animation-name: doveL2R; }
.dove.r2l { animation-name: doveR2L; }

/* ==========================================================================
   3. 顶边栏（不吸顶，随页面一起滚走）
   ========================================================================== */
.topbar {
  position: relative;
  z-index: var(--z-top);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* 左侧导航 */
.nav { position: relative; display: flex; align-items: center; }
.nav-list { display: flex; gap: 30px; }
.nav-list a {
  color: var(--ink-soft);
  font-size: .95rem;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}
.nav-list a:hover { color: var(--accent); text-decoration: none; }
.nav-list a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* 汉堡菜单：默认隐藏，仅移动端显示 */
.hamburger {
  display: none;
  font-size: 1.4rem;
  line-height: 1;
  padding: 6px 8px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

/* 右侧：落叶开关 */
.fx-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.fx-toggle:hover { border-color: var(--accent-soft); box-shadow: 0 2px 10px rgba(184,107,61,.12); }
.fx-icon {
  font-size: 1.05rem;
  line-height: 1;
  transition: filter .3s ease, opacity .3s ease;
}
.fx-toggle.off .fx-icon { filter: grayscale(1); opacity: .55; }

/* 悬停提示由 header.php 里的 .toggle-tip 真实元素实现，这里不再使用伪元素 */

/* ==========================================================================
   4. Hero 区
   ========================================================================== */
.hero { padding: 24px 0 40px; }
.hero-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  letter-spacing: .5px;
  color: var(--ink);
}
.hero-sub {
  margin-top: 14px;
  font-family: var(--serif);
  font-size: 1.18rem;
  color: var(--ink-soft);
}
/* 模拟光标竖线 */
.cursor {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 6px;
  background: var(--accent);
  vertical-align: -0.18em;
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.hero-bio {
  margin-top: 20px;
  max-width: 46em;
  color: var(--ink-soft);
  line-height: 1.8;
  font-size: .98rem;
}

/* ==========================================================================
   5. 文章展示区
   ========================================================================== */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.section-title {
  font-family: var(--serif);
  font-size: 1.45rem;
  position: relative;
  padding-bottom: 6px;
}
.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -12px;
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.section-more { font-size: .9rem; color: var(--ink-muted); transition: color .2s ease; }
.section-more:hover { color: var(--accent); text-decoration: none; }

/* 文章卡片（<div>：避免分类链接的 <a> 嵌套在卡片 <a> 内导致浏览器提前闭合、排版错位） */
.article-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 22px 22px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  color: inherit;
  box-sizing: border-box;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
/* 清除 Typecho 输出可能带入的空 <p> / 多余间距 */
.article-card > * { margin: 0; }
.article-card:hover {
  z-index: 2;
  transform: translateY(-3px) scale(1.015);
  border-color: var(--accent-soft);
  box-shadow: 0 10px 28px rgba(184, 107, 61, .10);
  text-decoration: none;
}
.article-card:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}
.article-title {
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.4;
  font-weight: 700;
  color: var(--ink);
  transition: color .2s ease;
}
.article-card:hover .article-title { color: var(--accent); }
.article-excerpt {
  flex: 1;
  color: var(--ink-muted);
  font-size: .9rem;
  line-height: 1.7;
}
.article-excerpt p { margin: 0; }
.article-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--ink-muted);
  font-size: .8rem;
}
/* 左侧分类用赭石色，右侧日期保持弱化灰 */
.article-meta span:first-child { color: var(--accent); }
.article-meta span:last-child { white-space: nowrap; }

/* ==========================================================================
   6. 右侧侧边栏「关于我」卡片
   ========================================================================== */
.about-card {
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.about-head {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}
.about-head h2 { font-family: var(--serif); font-size: 1.2rem; }
.about-en {
  font-size: .72rem;
  letter-spacing: .18em;
  color: var(--ink-muted);
}
.about-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;          /* 图片等比缩放填满 60×60，多余部分自动裁切 */
  object-position: center;
  display: block;
  background: var(--card);
  box-shadow: 0 4px 14px rgba(184, 107, 61, .28);
}
.nick {
  margin-top: 14px;
  font-weight: 600;
  font-size: 1.05rem;
}
.signature {
  margin-top: 8px;
  color: var(--ink-muted);
  font-size: .88rem;
  line-height: 1.6;
}
.about-links {
  margin-top: 20px;
  padding-top: 16px;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 18px;
  border-top: 1px dashed var(--line);
  font-size: .88rem;
}
.about-links a { color: var(--ink-soft); transition: color .2s ease; }
.about-links a:hover { color: var(--accent); text-decoration: none; }

/* ==========================================================================
   7. 页脚
   ========================================================================== */
.footer {
  padding: 12px 0 36px;
  text-align: center;
  color: var(--ink-muted);
  font-size: .82rem;
}
.footer a { color: var(--ink-muted); }
.footer a:hover { color: var(--accent); }

/* ==========================================================================
   8. 右下角悬浮按钮（刷新 + 回到顶部，均始终显示）
   ========================================================================== */
.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: var(--z-fab);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fab-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--card);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(61, 56, 50, .10);
  transition: color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.fab-btn:hover { color: var(--accent); border-color: var(--accent-soft); box-shadow: 0 6px 18px rgba(184,107,61,.16); }
.fab-btn svg { width: 18px; height: 18px; }

/* ==========================================================================
   9. 卡片放大弹窗
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;                    /* 盖过顶栏(10)与悬浮按钮(20) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s ease, visibility .25s ease;
}
.modal.open { opacity: 1; visibility: visible; pointer-events: auto; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(61, 56, 50, .42);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(620px, 100%);
  max-height: 82vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 34px 34px 26px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 28px 70px rgba(61, 56, 50, .28);
  transform: scale(.9) translateY(16px);
  transition: transform .28s cubic-bezier(.2, .8, .3, 1.15);
}
.modal.open .modal-card { transform: scale(1) translateY(0); }

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 1rem;
  line-height: 1;
  transition: color .2s ease, border-color .2s ease;
}
.modal-close:hover { color: var(--accent); border-color: var(--accent-soft); }

.modal-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 44px;
}
.modal-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.modal-tags span,
.modal-tags a { color: var(--accent); font-size: .82rem; }
.modal-date { color: var(--ink-muted); font-size: .82rem; white-space: nowrap; }

.modal-title {
  font-family: var(--serif);
  font-size: 1.55rem;
  line-height: 1.35;
  color: var(--ink);
}
.modal-summary {
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.85;
}

.modal-footer {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
}
.modal-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff7ef;
  font-size: .92rem;
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.modal-jump:hover {
  background: #9f5a2f;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(184, 107, 61, .28);
}

/* ==========================================================================
   10. 文章 / 独立页面正文
   ========================================================================== */
.post {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 0 24px;
}
.post-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  line-height: 1.3;
  letter-spacing: .3px;
  color: var(--ink);
}
.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: .88rem;
}
.post-meta a { color: var(--accent); }

.post-body {
  margin-top: 28px;
  font-size: 1.02rem;
  line-height: 1.9;
  color: var(--ink-soft);
}
.post-body p { margin: 0 0 1.4em; }
.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
  font-family: var(--serif);
  color: var(--ink);
  margin: 1.8em 0 .7em;
}
.post-body h2 {
  font-size: 1.4rem;
  padding-left: 14px;
  position: relative;
}
/* 小节标题左侧的赭石短竖线 */
.post-body h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: .16em;
  bottom: .16em;
  width: 4px;
  border-radius: 2px;
  background: var(--accent);
}
.post-body h3 { font-size: 1.18rem; }
.post-body img { border-radius: var(--radius); }
.post-body a { text-decoration: underline; }
.post-body code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .9em;
  padding: 2px 6px;
  border-radius: 5px;
  background: #f3ede4;
  color: #9f5a2f;
}
.post-body pre {
  margin: 1.4em 0;
  padding: 18px 20px;
  overflow-x: auto;
  background: #f3ede4;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  line-height: 1.6;
}
.post-body pre code {
  background: none;
  padding: 0;
  color: var(--ink);
  font-size: .86rem;
}
.post-body blockquote {
  margin: 1.6em 0;
  padding: 14px 22px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--card);
  color: var(--ink-soft);
  font-style: italic;
}
.post-body ul,
.post-body ol { margin: 0 0 1.4em 1.4em; }
.post-body ul { list-style: disc; }
.post-body ol { list-style: decimal; }
.post-body li { margin-bottom: .4em; }

.post-foot {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: .85rem;
}
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.post-nav a { font-size: .9rem; }

/* ==========================================================================
   11. 评论
   ========================================================================== */
.comments {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.comment-title {
  font-family: var(--serif);
  font-size: 1.2rem;
  margin-bottom: 18px;
  color: var(--ink);
}

.comment-list,
.comment-list ol { list-style: none; margin: 0; padding: 0; }
.comment-list ol { margin-left: 22px; }

.comment-body {
  padding: 16px 0;
  border-bottom: 1px dashed var(--line);
}
.comment-author {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: .9rem;
}
.comment-author .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.comment-author .fn {
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
}
.comment-meta { color: var(--ink-muted); font-size: .8rem; }
.comment-reply { font-size: .82rem; }
.comment-content {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: .95rem;
  line-height: 1.8;
}
.comment-content p { margin: 0 0 .8em; }

.respond { margin-top: 36px; }
.cancel-comment-reply { font-size: .85rem; margin-bottom: 8px; }
.comment-login { font-size: .9rem; color: var(--ink-soft); }

#comment-form p { margin-bottom: 14px; }
#comment-form label {
  display: block;
  margin-bottom: 6px;
  font-size: .9rem;
  color: var(--ink-soft);
}
#comment-form .required::after { content: " *"; color: var(--accent); }
#comment-form input.text,
#comment-form textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: .95rem;
}
#comment-form input.text:focus,
#comment-form textarea:focus {
  outline: none;
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(184, 107, 61, .10);
}
#comment-form textarea { min-height: 140px; resize: vertical; }
#comment-form .submit {
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff7ef;
  font-size: .92rem;
  transition: background .2s ease;
}
#comment-form .submit:hover { background: #9f5a2f; }

/* ==========================================================================
   12. 404 页面
   ========================================================================== */
.error-404 {
  max-width: 600px;
  margin: 60px auto;
  text-align: center;
}
.error-404 .error-code {
  font-family: var(--serif);
  font-size: clamp(4rem, 14vw, 7rem);
  color: var(--accent);
  line-height: 1;
}
.error-404 h1 {
  font-family: var(--serif);
  font-size: 1.6rem;
  margin-top: 16px;
  color: var(--ink);
}
.error-404 p {
  color: var(--ink-muted);
  margin-top: 12px;
}
.error-404 .button {
  display: inline-block;
  margin-top: 24px;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff7ef;
  font-size: .92rem;
  transition: background .2s ease;
}
.error-404 .button:hover { background: #9f5a2f; text-decoration: none; }

/* ==========================================================================
   13. 响应式：移动端（≤768px，布局栅格见 grid.css）
   ========================================================================== */
@media (max-width: 768px) {
  .hamburger { display: inline-flex; }
  .nav-list {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 160px;
    flex-direction: column;
    gap: 0;
    padding: 8px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(61,56,50,.12);
  }
  .nav.open .nav-list { display: flex; }
  .nav-list a { padding: 10px 12px; border-bottom: none; border-radius: 8px; }
  .nav-list a:hover { background: var(--bg); }
  .nav-list a.active { background: var(--bg); border-bottom: none; }

  .post { padding: 4px 0 16px; }
  .modal { padding: 16px; }
  .modal-card { padding: 26px 20px 20px; }
  .modal-title { font-size: 1.3rem; }
}

/* ==========================================================================
   14. 无障碍：尊重系统“减少动态效果”偏好
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .leaf, .dove, .cursor { animation: none !important; }
}
