/* =========================================================
   个人博客 · 苹果风白色简约设计系统
   ========================================================= */

:root {
  /* 配色 */
  --bg: #ffffff;
  --bg-soft: #fbfbfd;        /* 苹果式极浅灰背景 */
  --ink: #1d1d1f;            /* 标题近黑 */
  --text: #6e6e73;           /* 正文灰 */
  --text-light: #86868b;     /* 更浅的辅助文字 */
  --line: #d2d2d7;           /* 分隔线 */
  --line-soft: #ededf0;
  --accent: #0071e3;         /* 苹果同款蓝 */
  --accent-hover: #0077ed;
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --card-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.10);

  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Helvetica Neue", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "微软雅黑", Arial, sans-serif;

  /* 圆角 / 间距 */
  --radius: 18px;
  --radius-lg: 28px;
  --nav-h: 56px;
  --maxw: 1024px;
  --ease: cubic-bezier(0.28, 0.11, 0.32, 1);
}

/* ---------- 基础重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

img { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; transition: color 0.3s var(--ease); }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 { color: var(--ink); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- 顶部导航（毛玻璃） ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line-soft);
}
.nav-inner {
  max-width: var(--maxw); height: 100%; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 600; color: var(--ink);
}
.nav-brand img { width: 28px; height: 28px; border-radius: 50%; }
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; }
.nav-links a {
  display: inline-block; padding: 8px 14px; border-radius: 999px;
  color: var(--ink); font-size: 14px; font-weight: 400;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
.nav-links a:hover { background: rgba(0,0,0,0.04); }
.nav-links a.active { color: var(--accent); font-weight: 500; }

/* 汉堡菜单（移动端） */
.nav-toggle {
  display: none; width: 40px; height: 40px; border: none; background: none;
  cursor: pointer; position: relative;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  content: ""; position: absolute; left: 9px; width: 22px; height: 1.5px;
  background: var(--ink); transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.nav-toggle span { top: 19px; }
.nav-toggle span::before { top: -7px; }
.nav-toggle span::after { top: 7px; }
.nav-toggle.open span { background: transparent; }
.nav-toggle.open span::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span::after { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 通用区块 ---------- */
.section { padding: 96px 0; }
.section--soft { background: var(--bg-soft); }
/* 日志区：允许点击后整条滑出屏幕右侧而不产生横向滚动条（clip 不破坏 sticky 导航） */
.section--journal { overflow-x: clip; }
.section-head { text-align: center; margin-bottom: 56px; }
.section-head .eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 12px;
}
.section-head h2 { font-size: clamp(28px, 5vw, 44px); }
.section-head p { margin-top: 14px; font-size: 18px; color: var(--text); }

/* ---------- 首页日志列表 ---------- */
.journal-list { list-style: none; max-width: 760px; margin: 0 auto; }
.journal-item { border-top: 1px solid var(--line-soft); }
.journal-item:last-child { border-bottom: 1px solid var(--line-soft); }
.journal-item a {
  display: grid; grid-template-columns: 124px 1fr 22px; align-items: center; gap: 22px;
  padding: 22px 6px; text-decoration: none; color: inherit;
  transition: background 0.25s var(--ease);
}
.journal-item a:hover { background: rgba(0, 0, 0, 0.02); }
.journal-date {
  font-size: 14px; color: var(--text-light);
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
.journal-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.journal-title { font-size: 19px; font-weight: 600; color: var(--ink); }
.journal-excerpt {
  font-size: 15px; color: var(--text); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden;
}
.journal-arrow {
  color: var(--accent); font-size: 18px;
  transition: transform 0.25s var(--ease);
}
.journal-item a:hover .journal-arrow { transform: translateX(4px); }
/* 点击后整条右移出屏幕的过渡（由 JS 添加 .slide-out 触发） */
.journal-item {
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
  will-change: transform;
}
.journal-item.slide-out {
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
}
.journal-more { text-align: center; margin-top: 40px; }
.btn--ghost {
  background: transparent; color: var(--accent);
  border: 1px solid var(--line-soft);
}
.btn--ghost:hover { background: rgba(0, 113, 227, 0.06); border-color: var(--accent); }

/* ---------- 首页 Hero（实时随机风景背景） ---------- */
.hero {
  position: relative;
  min-height: calc(100vh - var(--nav-h));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 80px 24px;
  overflow: hidden;
  background: var(--bg);
}
/* 背景层 */
.hero-bg { position: absolute; inset: 0; z-index: 0; }
.hero-photo {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}
.hero-photo.loaded {
  opacity: 1;
  animation: kenburns 26s ease-in-out infinite alternate;
}
@keyframes kenburns {
  from { transform: scale(1.02); }
  to   { transform: scale(1.14); }
}
/* 极淡白色遮罩，保证深色文字可读，同时保留空气感 */
.hero-scrim {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.74) 0%,
    rgba(255,255,255,0.56) 45%,
    rgba(255,255,255,0.80) 100%);
}
/* 文字浮层 */
.hero-inner {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
}
.hero .avatar { width: 112px; height: 112px; border-radius: 50%; box-shadow: var(--card-shadow); margin-bottom: 28px; }

/* 尊重“减少动态”偏好 */
@media (prefers-reduced-motion: reduce) {
  .hero-photo.loaded { animation: none; }
}
.hero h1 { font-size: clamp(36px, 8vw, 72px); margin-bottom: 18px; }
.hero .tagline { font-size: clamp(18px, 3vw, 24px); color: var(--text); max-width: 620px; }
.hero .scroll-cue {
  margin-top: 64px; font-size: 13px; color: var(--text-light);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  animation: floaty 2.4s ease-in-out infinite;
}
.hero .scroll-cue svg { width: 20px; height: 20px; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
/* 减少动态：关闭装饰性动画 */
@media (prefers-reduced-motion: reduce) {
  .hero .scroll-cue { animation: none; }
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block; padding: 12px 26px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 500;
  border: none; cursor: pointer; transition: background 0.3s var(--ease), transform 0.2s var(--ease);
}
.btn:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn--ghost:hover { background: rgba(0,113,227,0.06); color: var(--accent-hover); }

/* ---------- 模块入口卡片（首页） ---------- */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.card {
  display: block; background: var(--bg); border-radius: var(--radius-lg);
  padding: 40px 36px; box-shadow: var(--card-shadow); color: var(--ink);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.card:hover { transform: translateY(-6px); box-shadow: var(--card-shadow-hover); color: var(--ink); }
.card .icon {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: var(--bg-soft); color: var(--accent); margin-bottom: 22px;
}
.card .icon svg { width: 28px; height: 28px; }
.card h3 { font-size: 24px; margin-bottom: 10px; }
.card p { font-size: 15px; color: var(--text); }
.card .more { margin-top: 18px; font-size: 14px; color: var(--accent); font-weight: 500; }

/* ---------- 简介 ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 48px; align-items: center; }
.about-grid .avatar { width: 100%; max-width: 240px; border-radius: var(--radius-lg); box-shadow: var(--card-shadow); }
.about-text h2 { font-size: clamp(26px, 4vw, 38px); margin-bottom: 18px; }
.about-text p { font-size: 17px; color: var(--text); margin-bottom: 14px; }

/* ---------- 日记列表 ---------- */
.diary-list { display: flex; flex-direction: column; gap: 20px; max-width: 760px; margin: 0 auto; }
.diary-item {
  display: block; text-decoration: none; color: inherit;
  background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 28px 30px; box-shadow: var(--card-shadow);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.diary-item:hover { transform: translateY(-3px); box-shadow: var(--card-shadow-hover); }
.diary-date {
  display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--accent); background: rgba(0,113,227,0.08); padding: 4px 12px; border-radius: 999px;
  margin-bottom: 14px;
}
.diary-item h3 { font-size: 22px; margin-bottom: 10px; color: var(--ink); }
.diary-item .excerpt { color: var(--text); font-size: 16px; }
.diary-more {
  display: inline-block; margin-top: 16px; color: var(--accent);
  font-size: 14px; font-weight: 500;
}
.diary-item:hover .diary-more { text-decoration: underline; }

/* ---------- 日记详情 ---------- */
.post { padding: 64px 0 96px; }
.post-inner { max-width: 720px; }
.post-back {
  display: inline-block; color: var(--accent); font-size: 14px; font-weight: 500;
  text-decoration: none; margin-bottom: 28px;
}
.post-back:hover { text-decoration: underline; }
.post-head { text-align: center; margin-bottom: 36px; }
.post-date {
  display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--accent); background: rgba(0,113,227,0.08); padding: 4px 12px; border-radius: 999px;
  margin-bottom: 16px;
}
.post-title { font-size: clamp(28px, 5vw, 42px); line-height: 1.25; color: var(--ink); }
.post-meta { margin-top: 14px; font-size: 14px; color: var(--text-light); }
.post-cover {
  width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius-lg);
  background-size: cover; background-position: center; margin: 8px 0 40px;
  box-shadow: var(--card-shadow);
}
.post-body { font-size: 17px; line-height: 1.9; color: #2c2c2e; }
.post-body p { margin-bottom: 22px; }
.post-body blockquote {
  margin: 28px 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--accent);
  color: var(--ink); font-size: 19px; font-weight: 500; line-height: 1.6;
}
.post-body h2 { font-size: 22px; margin: 32px 0 14px; color: var(--ink); }
.post-empty a { color: var(--accent); }
.post-foot { margin-top: 48px; text-align: center; }

/* ---------- 相册网格 + 灯箱 ---------- */
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gallery-grid figure {
  margin: 0; border-radius: var(--radius); overflow: hidden; cursor: pointer;
  box-shadow: var(--card-shadow); transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.gallery-grid figure:hover { transform: translateY(-4px) scale(1.01); box-shadow: var(--card-shadow-hover); }
.gallery-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

.lightbox {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
}
.lightbox.open { display: flex; animation: fade 0.3s var(--ease); }
.lightbox img { max-width: 90vw; max-height: 84vh; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.lightbox .close {
  position: absolute; top: 24px; right: 28px; width: 44px; height: 44px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.9); color: #1d1d1f; font-size: 22px; cursor: pointer;
  display: grid; place-items: center;
}
.lightbox .cap { position: absolute; bottom: 28px; left: 0; right: 0; text-align: center; color: #fff; font-size: 14px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* 加载更多 */
.gallery-more { text-align: center; margin-top: 40px; }
.gallery-end { margin-top: 28px; font-size: 14px; color: var(--text-light); }

/* 灯箱前后翻页 */
.lightbox .lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.9); color: #1d1d1f; font-size: 20px; cursor: pointer;
  display: grid; place-items: center; transition: background 0.2s var(--ease), opacity 0.2s var(--ease);
}
.lightbox .lb-nav:hover { background: #fff; }
.lightbox .lb-prev { left: 24px; }
.lightbox .lb-next { right: 24px; }
.lightbox .lb-nav:disabled { opacity: 0.3; cursor: default; }

/* ---------- 留言板 ---------- */
.guestbook-form {
  max-width: 620px; margin: 0 auto 56px; background: var(--bg); border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--card-shadow);
}
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 8px; }
.field input, .field textarea {
  width: 100%; padding: 13px 16px; font-size: 15px; font-family: var(--font); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft);
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease); resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0,113,227,0.12); background: #fff;
}
.messages { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.message {
  display: flex; gap: 16px; background: var(--bg); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--card-shadow);
  animation: pop 0.4s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.message .ava { width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto; box-shadow: var(--card-shadow); }
.message .body { flex: 1; }
.message .meta { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.message .name { font-weight: 600; color: var(--ink); font-size: 15px; }
.message .time { font-size: 12px; color: var(--text-light); }
.message .text { color: var(--text); font-size: 15px; }

/* 子对话：左侧蓝色竖线归拢，只缩进一层（避免套娃） */
.msg-thread {
  margin: 14px 0 0; border-left: 3px solid var(--accent);
  padding: 2px 0 2px 16px; display: flex; flex-direction: column; gap: 14px;
}
.msg-reply .meta { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.msg-reply .name { font-weight: 600; font-size: 14px; color: var(--ink); }
.msg-reply.host .name { color: var(--accent); }
.msg-reply .time { font-size: 12px; color: var(--text-light); }
.msg-reply .text { color: var(--text); font-size: 14px; line-height: 1.6; }
.badge-host {
  display: inline-block; font-size: 11px; font-weight: 600; line-height: 1;
  color: #fff; background: var(--accent); border-radius: 999px; padding: 3px 8px; flex: 0 0 auto;
}
/* 回复按钮 */
.reply-btn {
  margin-top: 12px; background: none; border: none; cursor: pointer;
  color: var(--accent); font-size: 13px; font-weight: 500; padding: 0;
}
.reply-btn:hover { text-decoration: underline; }
/* 内联回复编辑器 */
.reply-composer {
  margin: 14px 0 4px; border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; background: var(--bg-soft); animation: pop 0.3s var(--ease);
}
.reply-composer .rc-name,
.reply-composer .rc-text {
  width: 100%; padding: 11px 14px; font-size: 14px; font-family: var(--font); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; background: #fff; resize: vertical;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.reply-composer .rc-name { margin-bottom: 10px; }
.reply-composer .rc-text { min-height: 60px; }
.reply-composer .rc-name:focus,
.reply-composer .rc-text:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0,113,227,0.12);
}
.reply-composer .row { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.role-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.role-toggle button {
  border: none; background: transparent; cursor: pointer; font-size: 13px; color: var(--text);
  padding: 6px 14px; transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.role-toggle button.active { background: var(--accent); color: #fff; }
.reply-composer .rc-cancel { color: var(--text-light); }
.reply-composer .rc-send { margin-left: auto; padding: 9px 20px; }

/* ---------- 个人成就（时间轴） ---------- */
.timeline { max-width: 760px; margin: 0 auto; position: relative; padding-left: 28px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line);
}
.timeline-item { position: relative; margin-bottom: 36px; }
.timeline-item::before {
  content: ""; position: absolute; left: -28px; top: 6px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; border: 3px solid var(--accent);
}
.timeline-item .date { font-size: 13px; font-weight: 600; color: var(--accent); letter-spacing: 0.04em; }
.timeline-item .date .d-year { font-size: 16px; margin-right: 2px; }
.timeline-item h3 { font-size: 21px; margin: 6px 0 8px; }
.timeline-item p { color: var(--text); font-size: 16px; }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--line-soft); padding: 48px 0; text-align: center; color: var(--text-light); font-size: 13px; }
.footer a { color: var(--text-light); }
.footer .links { margin-bottom: 14px; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.footer .links a:hover { color: var(--accent); }

/* ---------- 滚动淡入 ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero .scroll-cue { animation: none; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: rgba(255,255,255,0.96); backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--line-soft);
    max-height: 0; overflow: hidden; transition: max-height 0.35s var(--ease);
  }
  .nav-links.open { max-height: 320px; }
  .nav-links a { padding: 14px 24px; border-radius: 0; }
  .section { padding: 64px 0; }
  .cards { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; gap: 28px; text-align: center; }
  .about-grid .avatar { margin: 0 auto; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: 1fr; }
  .container { padding: 0 18px; }
}
