/* ============================================================
   Frank's Notes · 侧边栏布局 · 砖橙主题
   参考 zhangbingxue.com 学术 CV 风格（亮色，无深色模式）
   改主题色请改 :root 中的 --accent 变量
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root {
  --bg:          #ffffff;
  --bg-soft:     #f7f8fa;
  --card:        #ffffff;
  --text:        #222222;
  --text-soft:   #555555;
  --text-faint:  #888888;
  --border:      #e5e7eb;
  --border-dark: #d1d5db;

  --accent:      #bd5d38;   /* 砖橙（侧边栏底色 + 强调色） */
  --accent-hover:#9e4c2e;
  --accent-soft: #f9ede8;

  --font-head: "Saira Extra Condensed", "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", -apple-system, sans-serif;
  --font: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Courier New", monospace;

  --radius:      6px;
  --shadow:      0 1px 3px rgba(0,0,0,0.06), 0 4px 14px rgba(0,0,0,0.05);

  --sidebar-w:   220px;
  --measure:     46rem;
  --measure-wide: 72rem;
}

/* 不使用深色模式 —— 始终亮色白底，与参考站一致 */

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  padding-left: var(--sidebar-w);
}

img { max-width: 100%; display: block; }

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

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p { margin-bottom: 1em; }

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}
pre {
  font-family: var(--font-mono);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 1.2em 0;
}
pre code { background: none; border: none; padding: 0; }

blockquote {
  margin: 1.4em 0;
  padding: 0.4em 1.2em;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  color: var(--text-soft);
}

ul, ol { margin: 0; padding-left: 1.5em; }
li { margin-bottom: 0.3em; }

hr { border: none; border-top: 1px solid var(--border); margin: 2.5em 0; }

/* ---------- 布局 ---------- */
.container {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 clamp(1.2rem, 4vw, 2.5rem);
}
.measure { max-width: var(--measure); margin: 0 auto; }

/* ---------- 侧边栏（砖橙底 + 白字） ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--accent);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 200;
  transition: transform 0.3s ease;
}

.sidebar-top {
  padding: 2rem 1.2rem 1.4rem;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.2);
}

.avatar-wrap {
  width: 84px;
  height: 84px;
  margin: 0 auto 0.9rem;
  border-radius: 50%;
  border: 3px solid #fff;
  overflow: hidden;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.avatar-wrap .avatar-placeholder {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.sidebar-name {
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  margin-bottom: 0.25rem;
}
.sidebar-sub {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.85);
  line-height: 1.4;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}
.sidebar-links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar-links li { margin: 0; }
.sidebar-links a {
  display: block;
  padding: 0.62rem 1.4rem;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 500;
  color: rgba(255,255,255,0.82);
  border-left: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.sidebar-links a:hover {
  color: #fff;
  background: rgba(255,255,255,0.15);
  text-decoration: none;
}
.sidebar-links a.active {
  color: #fff;
  border-left-color: #fff;
  background: rgba(255,255,255,0.2);
}

.sidebar-bottom {
  padding: 1rem 1.2rem 1.4rem;
  border-top: 1px solid rgba(255,255,255,0.2);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  align-items: flex-start;
}

.lang-toggle {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 4px;
  padding: 0.22rem 0.6rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.lang-toggle:hover {
  color: #fff;
  border-color: #fff;
  background: rgba(255,255,255,0.22);
}

.sidebar-copy {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.6);
  line-height: 1.5;
  margin: 0;
}

/* 汉堡按钮（移动端，白底内容区上） */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.8rem;
  left: 0.9rem;
  z-index: 300;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.sidebar-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sidebar-toggle.open span:nth-child(2) { opacity: 0; }
.sidebar-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 150;
}
.sidebar-overlay.show { display: block; }

/* ---------- 区块标题（纯英文大写） ---------- */
.section { padding: clamp(1.8rem, 4vw, 3rem) 0; }
.section + .section { padding-top: 0; }

.section-title {
  margin-bottom: 1.6rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
}
.section-title .en {
  display: block;
  font-family: var(--font-head);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}
.section-title .zh { display: none; }

/* ---------- 首页头部 ---------- */
.hero {
  padding: clamp(2.2rem, 6vw, 4rem) 0 1rem;
  margin-bottom: 0.8rem;
}
.hero h1 { font-size: clamp(2.4rem, 5vw, 3.2rem); margin-bottom: 0.4rem; }
.hero .subtitle { color: var(--text-soft); font-size: 1.05rem; margin-bottom: 0.7rem; }
.hero .contact-line { font-size: 0.9rem; color: var(--text-faint); }
.hero .contact-line a { margin-right: 1rem; }

/* ---------- 技能标签 ---------- */
.skills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.skill-tag {
  font-size: 0.88rem;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3em 0.9em;
  transition: border-color 0.15s, color 0.15s;
}
.skill-tag:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 经历（三栏 CV 式：职位 / 描述 / 时间） ---------- */
.timeline { list-style: none; padding: 0; }
.timeline-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-item h3 {
  order: 1;
  flex: 0 0 11rem;
  font-size: 1.05rem;
  margin: 0;
}
.timeline-item p {
  order: 2;
  flex: 1 1 18rem;
  color: var(--text-soft);
  font-size: 0.95rem;
  margin: 0;
}
.timeline-item .date {
  order: 3;
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ---------- 文章列表 ---------- */
.post-list { list-style: none; padding: 0; }

/* 分类筛选标签 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.6rem;
}
.filter-btn {
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text-soft);
  background: var(--bg);
  border: 1px solid var(--border-dark);
  border-radius: 999px;
  padding: 0.3rem 1rem;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.filter-btn:hover { color: var(--accent); border-color: var(--accent); }
.filter-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.post-item {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}
.post-item:last-child { border-bottom: none; }
.post-item .date {
  flex: none;
  width: 6.5rem;
  font-size: 0.85rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.post-item h3 { font-size: 1.02rem; }
.post-item h3 a { color: var(--text); }
.post-item h3 a:hover { color: var(--accent); text-decoration: none; }
.post-item .cat {
  flex: none;
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 3px;
  padding: 0.1em 0.5em;
}

/* ---------- 项目卡片 ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 1.2rem;
}
.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.project-card:hover { box-shadow: var(--shadow); border-color: var(--accent); }
.project-card .tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.7rem; }
.project-card .tags span {
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 3px;
  padding: 0.15em 0.55em;
}
.project-card h3 { margin-bottom: 0.4rem; }
.project-card h3 a { color: var(--text); }
.project-card h3 a:hover { color: var(--accent); }
.project-card .desc { font-size: 0.92rem; color: var(--text-soft); margin-bottom: 0.8rem; }
.project-card .links { font-size: 0.88rem; display: flex; gap: 1rem; }

/* ---------- 文章页 ---------- */
.article { padding: clamp(2rem, 5vw, 3rem) 0; }
.article-header { margin-bottom: 2.2rem; }
.article-header h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin-bottom: 0.6rem; }
.article-meta { font-size: 0.88rem; color: var(--text-faint); }
.article-meta .sep { margin: 0 0.6em; }

.article-body { font-size: 1.02rem; }
.article-body h2 { margin: 1.8em 0 0.5em; font-size: 1.35rem; }
.article-body h3 { margin: 1.4em 0 0.4em; font-size: 1.1rem; }

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}
.post-nav .next { margin-left: auto; text-align: right; }

/* ---------- 关于页 ---------- */
.about-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem 2rem;
  margin: 1.5rem 0 2rem;
  padding: 1.2rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.about-facts .fact .label {
  font-size: 0.78rem;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.about-facts .fact .value { font-size: 1rem; font-weight: 500; }

/* ---------- 页脚（隐藏，版权在侧边栏） ---------- */
.footer { display: none; }

/* ---------- 返回顶部 ---------- */
.back-top {
  position: fixed;
  right: 1.4rem;
  bottom: 1.4rem;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-dark);
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.3s ease;
  z-index: 50;
}
.back-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-top:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  body { padding-left: 0; }

  .sidebar { transform: translateX(-100%); }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  }

  .sidebar-toggle { display: flex; }

  .post-item { flex-wrap: wrap; gap: 0.3rem 1rem; }
  .post-item .date { width: auto; }
  .post-nav { flex-direction: column; }
  .post-nav .next { margin-left: 0; text-align: left; }

  /* 经历在移动端竖向堆叠 */
  .timeline-item h3,
  .timeline-item p,
  .timeline-item .date { flex-basis: 100%; margin-left: 0; }
  .timeline-item h3 { order: 1; }
  .timeline-item .date { order: 2; }
  .timeline-item p { order: 3; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .sidebar, .sidebar-toggle, .back-top { display: none !important; }
  body { padding-left: 0; }
}

/* ============================================================
   交互增强：滚动入场动画 / 按钮反馈 / 链接动画
   ============================================================ */

/* ---------- 滚动入场动画（仅 JS 启用时隐藏，关 JS 即正常显示） ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: opacity, transform;
}
.js .reveal.in {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- 全局点击 / 焦点反馈 ---------- */
a, button, .skill-tag, .project-card {
  -webkit-tap-highlight-color: transparent;
}

/* 键盘焦点轮廓（无障碍） */
a:focus-visible,
button:focus-visible,
.skill-tag:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* 按下按压感 */
button:active,
.skill-tag:active,
.lang-toggle:active,
.back-top:active { transform: scale(0.96); }
.sidebar-links a:active { transform: scale(0.98); }

/* ---------- 带箭头的文字链接 ---------- */
.link-more {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  position: relative;
  transition: color 0.2s ease, transform 0.2s ease;
}
.link-more::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.link-more:hover {
  transform: translateX(5px);
  text-decoration: none;
}
.link-more:hover::after { transform: scaleX(1); }

/* ---------- hover 增强 ---------- */
.skill-tag {
  transition: border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.skill-tag:hover { transform: translateY(-2px); }

.project-card {
  transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1), 0 2px 6px rgba(0,0,0,0.06);
  border-color: var(--accent);
}

.post-item {
  transition: padding-left 0.2s ease;
}
.post-item:hover { padding-left: 0.4rem; }
.post-item h3 a { transition: color 0.18s ease; }
.post-item:hover h3 a { color: var(--accent); }

.back-top { transition: opacity 0.3s ease, transform 0.25s ease, border-color 0.2s ease, color 0.2s ease; }
.back-top:hover { transform: translateY(-2px); }

/* 侧边栏导航：hover 时左侧指示条滑入 */
.sidebar-links a {
  border-left: 3px solid transparent;
}
.sidebar-links a:not(.active):hover {
  border-left-color: rgba(255,255,255,0.5);
}
