:root {
  --bg: #ffffff;
  --text: #0a0a0a;
  --muted: #666666;
  --border: #e5e5e5;
  --accent: #0ea5e9; /* 蓝色强调 */
  --card: #f9f9f9;
}

[data-theme="dark"] {
  --bg: #0b0b0c;
  --text: #eaeaea;
  --muted: #a0a0a0;
  --border: #1f1f22;
  --accent: #38bdf8;
  --card: #151517;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Inter, Noto Sans, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { font-weight: 600; color: var(--text); text-decoration: none; }
.nav { display: flex; gap: 16px; flex: 1; }
.nav-link { color: var(--muted); text-decoration: none; padding: 8px 4px; display: inline-block; }
.nav-link::after { content: ""; display: block; width: 0; height: 2px; background: var(--accent); margin: 4px auto 0; border-radius: 2px; transition: width .2s ease; }
.nav-link.active { color: var(--text); }
.nav-link.active::after { width: 16px; }
.actions { display: flex; align-items: center; gap: 8px; }

.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); height: 36px; padding: 0 12px; border-radius: 8px; cursor: pointer; }
.ghost svg { display: inline-block; vertical-align: middle; }
/* 根据主题切换显示的图标：浅色显示月亮，深色显示太阳 */
#theme-toggle .sun { display: none; }
[data-theme="dark"] #theme-toggle .sun { display: inline-block; }
[data-theme="dark"] #theme-toggle .moon { display: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); padding: 10px 16px; border-radius: 10px; text-decoration: none; color: var(--text); transition: all .2s ease; line-height: 1; gap: 8px; }
.btn .icon { display: block; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.06); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.small { padding: 6px 10px; font-size: 14px; }

/* Primary anchor buttons follow theme: dark=black/white, light=white/black */
a.btn.primary { background: var(--card); color: var(--text); border: none; }
a.btn.primary:hover { transform: translateY(-1px); }
a.btn.primary:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* 深色主题下按钮保持接近纯黑背景以增强对比 */
[data-theme="dark"] a.btn.primary { background: var(--bg); color: var(--text); }

/* Div-scoped hover emphasis for anchor primary buttons */
div a.btn.primary { transition: transform .2s ease, box-shadow .2s ease, filter .2s ease; }
/* 浅色：轻微阴影（无边框） */
div a.btn.primary:hover { box-shadow: 0 8px 20px rgba(0,0,0,.08); }
/* 深色：轻微亮度提升 + 稍深阴影 */
[data-theme="dark"] div a.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 8px 20px rgba(0,0,0,.45); }

/* Photography section: force the view-more button to white background */
#photo-view-more { background: #ffffff; }
/* Night theme: only this button uses black background with white text */
[data-theme="dark"] #photo-view-more { background: #000000; color: #ffffff; }
.btn.small { padding: 6px 10px; font-size: 14px; }

.section { padding: 64px 0; border-top: 1px solid var(--border); scroll-margin-top: 72px; }
.section:first-of-type { border-top: none; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section h2 { margin: 0; font-size: 24px; }
.filters input { height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); padding: 0 12px; }

.hero { padding-top: 32px; padding-bottom: 24px; min-height: 56vh; display: grid; place-items: center; position: relative; }
.hero + .section { padding-top: 32px; }
.hero::before { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.3); pointer-events: none; }
.hero-inner { text-align: center; position: relative; z-index: 1; }
/* 暗色主题下：遮罩切换为 30% 黑色，提高对比度 */
[data-theme="dark"] .hero::before { background: rgba(0,0,0,.3); }
.headline { font-size: 32px; margin: 0 0 12px; }
.subhead { margin: 0 0 20px; color: #000; font-size: 18px; }
/* 暗色模式下确保可读性 */
[data-theme="dark"] .subhead { color: #fff; }
.cta { display: inline-flex; gap: 12px; }

/* Section actions: center-aligned button row (for 查看更多) */
.section-actions { display: flex; justify-content: center; margin-top: 16px; }
.section-actions.right { justify-content: flex-end; }

/* 视频背景（AI 动态效果占位） */
/* 已恢复为静态背景，移除视频样式 */

/* 移除动态背景与小船的样式（恢复静态背景） */

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 1024px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

.photo-card { position: relative; overflow: hidden; border-radius: 12px; background: var(--card); border: 1px solid var(--border); min-height: 200px; }
.photo-card::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 -80px 80px -60px rgba(0,0,0,.6); pointer-events: none; }
.photo-card img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transform: translateY(6px); transition: opacity .3s ease, transform .3s ease; }
.photo-card img.visible { opacity: 1; transform: translateY(0); }
.photo-meta { position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.5); color: #fff; padding: 6px 8px; border-radius: 8px; font-size: 12px; backdrop-filter: blur(4px); }
.photo-tags { position: absolute; left: 8px; bottom: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag-chip { border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.55); color: #fff; padding: 4px 8px; border-radius: 999px; font-size: 12px; line-height: 1; cursor: pointer; }
.tag-chip:hover { background: rgba(0,0,0,.7); }
[data-theme="dark"] .tag-chip { border-color: rgba(255,255,255,.25); }

.skeleton .skeleton-box { height: 200px; border-radius: 12px; background: linear-gradient(90deg, var(--card), rgba(0,0,0,.03), var(--card)); border: 1px solid var(--border); animation: shimmer 1.2s infinite; }
@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }

.list { display: grid; grid-template-columns: 1fr; gap: 12px; }
.article-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: var(--card); }
.article-title { margin: 0 0 4px; font-size: 18px; }
.article-meta { color: var(--muted); font-size: 13px; }
.article-actions { margin-top: 10px; }
.article-actions a { color: var(--accent); }

.timeline { display: grid; grid-template-columns: 1fr; gap: 12px; }
.timeline-item { border-left: 2px solid var(--accent); padding-left: 12px; }
.skills { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.skill { border: 1px solid var(--border); background: var(--card); color: var(--text); padding: 6px 10px; border-radius: 999px; font-size: 13px; }

.socials { display: flex; gap: 12px; margin-bottom: 16px; }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }

.feedback-card { max-width: 680px; margin: 0 auto; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: none; }
.feedback-head h2 { margin: 0 0 8px; display: flex; align-items: baseline; gap: 8px; }
.feedback-head small { color: var(--muted); font-weight: 400; font-size: 14px; }
.contact-form { display: grid; grid-template-columns: 1fr; gap: 14px; }
.contact-form label { display: grid; gap: 6px; color: var(--muted); }
.contact-form input, .contact-form textarea { border: 1px solid var(--border); background: rgba(255,255,255,.04); color: var(--text); border-radius: 10px; padding: 12px 14px; }
.contact-form input::placeholder, .contact-form textarea::placeholder { color: var(--muted); }
.feedback-actions { display: flex; justify-content: flex-end; }

.back-to-top { position: fixed; right: 24px; bottom: 24px; height: 40px; width: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); display: none; align-items: center; justify-content: center; cursor: pointer; }
.back-to-top.show { display: flex; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: none; align-items: center; justify-content: center; z-index: 100; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 80vh; border-radius: 12px; }
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute; top: 16px; background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.3);
  padding: 8px 12px; border-radius: 8px; cursor: pointer;
}
.lightbox-close { right: 16px; }
.lightbox-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 16px; top: 50%; transform: translateY(-50%); }

/* Utility */
.hidden { display: none !important; }

/* Resume layout with right-side avatar */
.resume-content { display: grid; grid-template-columns: 1fr max-content; gap: 16px; align-items: start; }
.resume-aside { justify-self: end; }
.avatar-card { border: 1px solid var(--border); background: var(--card); border-radius: 12px; padding: 12px; position: relative; width: fit-content; }
.avatar-img { width: clamp(180px, 22vw, 260px); aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; display: block; }
.avatar-note { color: var(--muted); font-size: 12px; text-align: center; margin-top: 8px; }

/* 侧边照片左右切换按钮 */
.avatar-nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.35); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .2s ease, transform .2s ease;
  backdrop-filter: saturate(120%) blur(6px);
}
.avatar-nav-btn:hover { background: rgba(0,0,0,.5); }
.avatar-nav-btn:active { transform: translateY(-50%) scale(.96); }
.avatar-prev { left: 8px; }
.avatar-next { right: 8px; }

@media (max-width: 600px) {
  .avatar-nav-btn { width: 40px; height: 40px; }
}

@media (max-width: 900px) {
  .resume-content { grid-template-columns: 1fr; }
  .resume-aside { order: -1; }
}

/* 个人照片欣赏区（全宽） */
.resume-gallery { position: relative; border: 1px solid var(--border); background: var(--card); border-radius: 14px; margin-bottom: 16px; overflow: hidden; }
.resume-gallery .gallery-stage { display: grid; place-items: center; height: clamp(220px, 34vw, 360px); position: relative; z-index: 1; }
.resume-gallery .gallery-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }
.gallery-nav-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.35); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; backdrop-filter: blur(6px) saturate(120%); z-index: 2; pointer-events: auto; user-select: none; }
.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }
.gallery-nav-btn:hover { background: rgba(0,0,0,.5); }
.gallery-nav-btn:active { transform: translateY(-50%) scale(.96); }

/* 空状态：没有可用图片时的提示与隐藏导航 */
.resume-gallery.empty .gallery-nav-btn { display: none; }
.resume-gallery.empty .gallery-stage::after {
  content: '未找到图片：请将照片放到 public/photos/ 目录或更新 data-images';
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 12px 16px;
  color: var(--muted); font-size: 14px;
}

/* Section background with overlay */
.section.has-bg { position: relative; }
.section.has-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .3); /* 30% 白色叠罩（浅色模式） */
  z-index: 0;
}
.section.has-bg .container { position: relative; z-index: 1; }
[data-theme="dark"] .section.has-bg::before { background: rgba(0, 0, 0, .3); /* 30% 黑色叠罩（深色模式） */ }

/* Footer */
.site-footer { padding: 16px 0; border-top: 1px solid var(--border); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.footer-icons { display: flex; gap: 12px; }
.footer-icon { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: var(--card); border-radius: 10px; color: var(--text); text-decoration: none; }
.footer-icon span { font-size: 18px; line-height: 1; }

.footer-contact { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.footer-contact-text { display: grid; gap: 6px; }
.footer-contact-text div { color: var(--muted); font-size: 14px; }
.footer-contact-text strong { color: var(--text); font-weight: 600; }
.footer-divider { width: 1px; height: 52px; background: var(--border); }
.footer-qr { width: 100px; height: 100px; border: 1px solid var(--border); background: var(--card); border-radius: 8px; position: relative; display: grid; place-items: center; overflow: hidden; }
.footer-qr img { width: 100%; height: 100%; object-fit: cover; display: block; }
.footer-qr.placeholder::after { content: '二维码'; color: var(--muted); font-size: 14px; }

@media (max-width: 720px) {
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 16px; }
  .footer-contact { width: 100%; justify-content: space-between; }
  .footer-divider { display: none; }
  .footer-qr { width: 88px; height: 88px; }
}
