/* style.css - 支持日夜模式 */

:root {
    /* --- 默认：白天模式 (羊皮纸暖色) --- */
    --bg-color: #F9F5F1;
    --text-color: #433E3B;
    --link-color: #9A5B4A;
    --accent-color: #D6CFC7;
    --code-bg: #EFEBE4;
    
    /* 字体保持不变 */
    --font-serif: "Georgia", "Times New Roman", "Songti SC", serif;
    --font-mono: "Courier New", monospace;
}

/* --- 黑夜模式 (深夜阅读模式) --- */
/* 当网页标签上有 data-theme="dark" 时生效 */
[data-theme="dark"] {
    --bg-color: #252423;       /* 深炭灰，不刺眼 */
    --text-color: #C0B6AD;     /* 灰白色文字 */
    --link-color: #D48872;     /* 亮一点的铁锈红 */
    --accent-color: #4A4643;   /* 深色分割线 */
    --code-bg: #302E2C;
}

/* 基础样式 (引用上面的变量) */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-serif);
    line-height: 1.8;
    max-width: 650px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    transition: background-color 0.5s ease, color 0.5s ease; /* 切换时有柔和的过渡动画 */
}

/* 头部布局 */
header {
    display: flex;
    justify-content: space-between; /* 让标题和按钮分居左右 */
    align-items: center;
    margin-bottom: 4rem;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 1rem;
}

header h1 { margin: 0; font-size: 1.5rem; font-weight: normal; }

/* 切换按钮样式 */
#theme-toggle {
    background: none;
    border: 1px solid var(--accent-color);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-family: var(--font-serif);
    font-size: 0.9rem;
    transition: all 0.3s;
}

#theme-toggle:hover {
    background-color: var(--accent-color);
}

/* 其他链接和文章样式保持一致 */
a { color: var(--link-color); text-decoration: none; border-bottom: 1px dashed var(--link-color); transition: all 0.2s; }
a:hover { background-color: rgba(154, 91, 74, 0.1); border-bottom-style: solid; }
.post-item { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; border-bottom: 1px dotted var(--accent-color); padding-bottom: 0.5rem; }
.post-date { font-family: var(--font-mono); font-size: 0.85rem; color: #888; }
footer { margin-top: 5rem; padding-top: 2rem; border-top: 1px solid var(--accent-color); font-size: 0.8rem; text-align: center; color: #999; }

/* 打字机动画 */
.typewriter {
  overflow: hidden; /* 隐藏超出部分 */
  border-right: .15em solid orange; /* 光标 */
  white-space: nowrap; /* 不换行 */
  margin: 0 auto;
  letter-spacing: .15em;
  animation: 
    typing 3.5s steps(40, end),
    blink-caret .75s step-end infinite;
}

/* 动画定义 */
@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}
@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: orange; }
}

/* 给图片加拍立得效果 */
article img {
  border: 10px solid #fff; /* 白边框 */
  box-shadow: 3px 3px 10px rgba(0,0,0,0.2); /* 阴影 */
  transform: rotate(-2deg); /* 微微倾斜，很俏皮 */
  transition: transform 0.3s; /* 动效过渡 */
}

/* 鼠标放上去摆正 */
article img:hover {
  transform: rotate(0deg) scale(1.02);
}

/* 文章第一个段落的第一个字 */
article p:first-of-type::first-letter {
  font-size: 1.5rem;
  float: left;
  margin-right: 0rem;
  line-height: 1;
  color: var(--link-color); /* 用我们的铁锈红 */
  font-family: "Times New Roman", serif;
}

/* style.css - 导航和按钮右侧对齐的样式 */

.nav-container {
    display: flex; /* 使用 Flexbox 布局 */
    align-items: center; /* 垂直居中对齐 */
    gap: 1.5rem; /* 设置导航和按钮之间的间距 (1.5rem ≈ 24px) */
}

/* 优化导航链接的间距 (如果你的链接是放在 <nav> 里的) */
nav a {
    /* 保持链接之间的间隔 */
    margin-left: 1rem; 
}
