/* ==========================================
   Rena Huang · Personal Site — Works Detail
   新版设计系统：Plus Jakarta Sans + Geist
   ========================================== */

:root {
  --paper: #fdfdfd;
  --ink: #0a0806;
  --hairline: #e7e2d9;
  --muted: #827c73;
  --gutter: max(40px, calc((100vw - 1280px) / 2));
}

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

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Geist', -apple-system, 'Helvetica Neue', sans-serif;
  line-height: 1.6;
}

body.nav-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ═══════════════ 导航（与主页面一致）═══════════════ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 80px;
  padding: 0 var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid transparent;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  overflow: visible;
  transition: border-color 0.25s ease;
}
.nav.scrolled { border-bottom-color: var(--hairline); }
.nav a { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; position: relative; }
.nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -3px;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav a.active::after { transform: scaleX(1); transform-origin: left; }
.nav-left { display: flex; gap: 26px; }
.nav-right { display: flex; gap: 26px; justify-content: flex-end; }
.nav-logo { line-height: 0; }
.nav-logo img { display: block; height: 47px; width: auto; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); will-change: transform; }
.nav-logo::after { display: none; }
.nav-logo:hover img { transform: scale(1.05); }
.nav-toggle { display: none; }
.nav-menu { display: none; }

/* ═══════════════ 详情内容 ═══════════════ */
.detail { padding: 64px var(--gutter) 0; }

.detail-hd { text-align: left; margin-bottom: 48px; }

.detail-back {
  display: inline-block;
  font-size: 13px; font-weight: 500;
  color: var(--muted); letter-spacing: -0.01em;
  transition: color .2s;
  margin-bottom: 26px;
}
.detail-back:hover { color: var(--ink); }

.detail-title {
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  font-size: clamp(32px, 4.5vw, 56px);
  font-weight: 700; letter-spacing: -0.03em; line-height: 1.02;
}

.detail-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--muted);
  margin-top: 20px; letter-spacing: -0.01em;
}
.meta-sep { margin: 0 4px; color: var(--hairline); }

.detail-desc {
  font-size: 15px; line-height: 1.7; color: var(--muted);
  margin-top: 22px;
}

/* ═══════════════ 图片画廊（0 间距，与文字对齐）═══════════════ */
.detail-gallery { font-size: 0; line-height: 0; margin: 0; }
.detail-gallery img,
.detail-gallery video {
  display: block; width: 100%; height: auto;
  -webkit-user-drag: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform .6s cubic-bezier(.16, 1, .3, 1), box-shadow .6s cubic-bezier(.16, 1, .3, 1);
}
.detail-gallery img:hover {
  transform: scale(1.02);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .35);
  position: relative;
  z-index: 1;
}

/* ═══════════════ 文章正文 ═══════════════ */
.article-body { margin-bottom: 48px; font-size: 15px; line-height: 1.85; color: var(--ink); }
.article-body h1, .article-body h2 {
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  font-size: 20px; font-weight: 600; margin: 48px 0 16px; letter-spacing: .01em;
}
.article-body p { margin-bottom: 20px; opacity: .85; }
.article-body a { text-decoration: underline; text-underline-offset: 3px; }
.article-body strong { font-weight: 600; opacity: 1; }
.article-body img,
.article-body video { display: block; width: 100%; margin: 28px 0; }
.article-body iframe { display: block; width: 100%; aspect-ratio: 16/9; border: none; margin: 28px 0; }

/* ═══════════════ 底部 ═══════════════ */
.detail-footer { padding: 48px 0 72px; }
.detail-footer .detail-back { margin-bottom: 0; }

.footer { text-align: center; padding: 40px 32px 48px; font-size: 12px; color: var(--muted); letter-spacing: -0.01em; }

/* ═══════════════ 深色 Footer（与主页面一致）═══════════════ */
.footer-dark {
  background: #222222;
  color: #EDEBE6;
  padding: 120px var(--gutter) 0;
  text-align: left;
  font-family: 'Geist', -apple-system, 'Helvetica Neue', sans-serif;
}
.footer-dark .footer-top {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  column-gap: 72px;
  align-items: start;
}
.footer-dark .footer-title {
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  font-size: clamp(40px, 5vw, 72px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: #F5F3EE;
}
.footer-dark .footer-social { display: flex; gap: 12px; margin-top: 36px; }
.footer-dark .social-btn {
  width: 46px; height: 46px;
  border: 1px solid rgba(237, 235, 230, 0.35);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #EDEBE6; text-decoration: none;
  transition: background .25s ease, color .25s ease, border-color .25s ease;
}
.footer-dark .social-btn svg { width: 18px; height: 18px; }
.footer-dark .social-btn:hover { background: #EDEBE6; color: #222222; border-color: #EDEBE6; }
.footer-dark .footer-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 48px;
  row-gap: 40px;
}
.footer-dark .footer-info-item { display: flex; flex-direction: column; gap: 8px; }
.footer-dark .footer-label {
  font-size: 11px; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: #9A968E;
}
.footer-dark .footer-value {
  font-size: 16px; font-weight: 500; letter-spacing: -0.01em;
  color: #EDEBE6; text-decoration: none;
}
.footer-dark a.footer-value:hover { text-decoration: underline; text-underline-offset: 4px; }
.footer-dark .footer-divider { height: 1px; background: rgba(237, 235, 230, 0.16); margin-top: 72px; }
.footer-dark .footer-mid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr 1.6fr;
  column-gap: 48px;
  padding: 64px 0 72px;
}
.footer-dark .footer-col { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.footer-dark .footer-col > a { font-size: 14px; color: #EDEBE6; text-decoration: none; }
.footer-dark .footer-col > a:hover { text-decoration: underline; text-underline-offset: 4px; }
.footer-dark .footer-note { font-size: 14px; line-height: 1.7; color: #B5B1A9; margin: 0; }
.footer-dark .footer-subscribe {
  display: flex; align-items: center;
  border: 1px solid rgba(237, 235, 230, 0.35);
  width: 100%; max-width: 320px;
}
.footer-dark .footer-subscribe input {
  flex: 1; min-width: 0;
  background: transparent; border: none; outline: none;
  padding: 13px 16px;
  font-family: 'Geist', -apple-system, sans-serif;
  font-size: 14px; color: #EDEBE6;
}
.footer-dark .footer-subscribe input::placeholder { color: #7A766E; }
.footer-dark .footer-subscribe button {
  width: 46px; align-self: stretch;
  background: transparent; border: none; cursor: pointer;
  color: #EDEBE6; font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .2s ease, color .2s ease;
}
.footer-dark .footer-subscribe button:hover { background: #EDEBE6; color: #222222; }
.footer-dark .footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding: 28px 0 36px;
  font-size: 13px; color: #9A968E;
}
.footer-dark .footer-bottom a { color: #9A968E; text-decoration: none; }
.footer-dark .footer-bottom a:hover { color: #EDEBE6; text-decoration: underline; }

@media (max-width: 1100px) {
  .footer-dark { padding: 72px 32px 0; }
  .footer-dark .footer-top { grid-template-columns: 1fr; row-gap: 56px; }
  .footer-dark .footer-mid { grid-template-columns: 1fr 1fr; row-gap: 48px; }
}
@media (max-width: 820px) {
  .footer-dark .footer-mid { grid-template-columns: 1fr; }
  .footer-dark .footer-bottom { flex-direction: column; align-items: flex-start; gap: 12px; }
}
@media (max-width: 520px) {
  .footer-dark { padding: 48px 20px 0; }
}

/* Toast 提示 */
.toast {
  position: fixed; left: 50%; bottom: 36px;
  transform: translate(-50%, 16px);
  background: #222222; color: #EDEBE6;
  padding: 14px 24px;
  font-family: 'Geist', -apple-system, sans-serif;
  font-size: 13px; font-weight: 500; letter-spacing: 0.01em;
  border-radius: 0;
  border: 1px solid rgba(237, 235, 230, 0.18);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  opacity: 0; pointer-events: none;
  transition: opacity .32s cubic-bezier(.22,.61,.36,1), transform .32s cubic-bezier(.22,.61,.36,1);
  z-index: 999;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ═══════════════ 响应式 ═══════════════ */
@media (max-width: 820px) {
  .nav { height: 62px; grid-template-columns: 1fr auto; }
  .nav-left, .nav-right { display: none; }
  .nav-logo { grid-column: 1; justify-self: start; align-self: center; position: relative; z-index: 60; }
  .nav-logo img { height: 40px; }
  .nav-toggle {
    display: flex;
    grid-column: 2; justify-self: end; align-self: center;
    flex-direction: column; justify-content: center; gap: 6px;
    width: 28px; height: 28px; padding: 0;
    background: none; border: none; cursor: pointer;
    position: relative; z-index: 60;
    transform: scale(0.8);
    transform-origin: right center;
  }
  .nav-toggle span {
    display: block; width: 100%; height: 2.5px; background: var(--ink);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
  }
  .nav-toggle.open span:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0.2); }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }
  .nav-menu {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 40;
    display: flex;
    flex-direction: column; justify-content: center;
    padding: 0 32px;
    background: var(--paper);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), visibility 0s linear 0.5s;
  }
  .nav-menu.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), visibility 0s linear 0s;
  }
  .nav-menu a::after { display: none; }
  .nav-menu a {
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    font-size: 28px; font-weight: 500; letter-spacing: -0.03em; line-height: 1;
    padding: 20px 0;
    text-decoration: none; color: var(--ink);
    opacity: 0; transform: translateY(18px);
    transition: opacity 0.5s cubic-bezier(0.22, 0.61, 0.36, 1), transform 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  .nav-menu.open a { opacity: 1; transform: translateY(0); }
  .nav-menu a.active {
    background: var(--ink);
    color: var(--paper);
    font-weight: 600;
    padding-left: 20px;
    padding-right: 20px;
    margin-left: -20px;
    margin-right: -20px;
  }
  .nav-menu.open a:nth-child(1) { transition-delay: 0.04s; }
  .nav-menu.open a:nth-child(2) { transition-delay: 0.08s; }
  .nav-menu.open a:nth-child(3) { transition-delay: 0.12s; }
  .nav-menu.open a:nth-child(4) { transition-delay: 0.16s; }
  .nav-menu.open a:nth-child(5) { transition-delay: 0.2s; }
  .detail { padding: 56px 32px 0; }
}

@media (max-width: 520px) {
  .nav { height: 60px; padding: 0 24px; }
  .nav-logo img { height: 38.4px; }
  .detail { padding: 48px 20px 0; }
  .detail-title { font-size: clamp(28px, 8vw, 40px); }
}

.nav-resume-wrap { position: relative; display: flex; align-items: center; }
.nav-resume-wrap::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  height: 14px;
}
.nav-resume {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 15px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink);
  position: relative;
}
.nav-resume::after {
  content: '';
  position: absolute; left: 0; bottom: -3px; width: 100%; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-resume-wrap:hover .nav-resume::after { transform: scaleX(1); transform-origin: left; }
.nav-resume svg { flex: none; }
.resume-menu {
  position: absolute; top: calc(100% + 14px); right: 0;
  min-width: 150px;
  background: #fff;
  box-shadow: 0 16px 40px -16px rgba(10, 8, 6, 0.18);
  padding: 6px 0;
  display: none;
  z-index: 70;
}
.nav-resume-wrap:hover .resume-menu { display: block; }
.resume-menu a {
  display: block;
  padding: 9px 16px;
  font-family: 'Geist', -apple-system, 'Helvetica Neue', 'PingFang SC', sans-serif;
  font-size: 13px; font-weight: 500; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease;
}
.resume-menu a::after { display: none; }
.resume-menu a:hover { background: #F3F4F6; }

#contact { scroll-margin-top: 80px; }
@media (max-width: 820px) { #contact { scroll-margin-top: 62px; } }
@media (max-width: 520px) { #contact { scroll-margin-top: 60px; } }

/* ═══════════════ 图片 Lightbox（iOS Photos 风格：点图放大 · 缩放 · 左右滑 · 缩略图跳转） ═══════════════ */
.lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: blur(26px) saturate(1.15);
  backdrop-filter: blur(26px) saturate(1.15);
  opacity: 0;
  visibility: hidden;
  transition: opacity .32s ease, visibility 0s linear .32s;
}
.lb-overlay.open {
  opacity: 1;
  visibility: visible;
  transition: opacity .32s ease, visibility 0s linear 0s;
}
.lb-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}
.lb-track {
  display: flex;
  height: 100%;
  width: 100%;
  will-change: transform;
}
.lb-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.lb-media {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}
.lb-media.lb-media-block {
  width: 100%;
  height: auto;
}
.lb-media-block .lb-composite {
  width: 100%;
  height: auto;
}
.lb-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.lb-composite,
.lb-composite * { pointer-events: none; }
.lb-composite:hover { transform: none !important; box-shadow: none !important; }
.lb-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: calc(16px + env(safe-area-inset-right));
  z-index: 3;
  width: 40px; height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.lb-counter {
  position: absolute;
  top: calc(22px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  color: #fff;
  font-family: 'Geist', -apple-system, 'Helvetica Neue', sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .03em;
}
.lb-thumbs {
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0.32) 55%, transparent 100%);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.lb-thumbs::-webkit-scrollbar { display: none; }
.lb-thumb {
  flex: none;
  width: 52px; height: 52px;
  object-fit: cover;
  border-radius: 8px;
  opacity: .5;
  cursor: pointer;
  transition: opacity .2s ease, box-shadow .2s ease;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.lb-thumb.active {
  opacity: 1;
  box-shadow: 0 0 0 2px #fff;
}

/* ===== 图片加载：骨架屏 + 真实进度 + 淡入 ===== */
.img-load {
  position: relative;
  background: #f7f7f7;
  overflow: hidden;
}
.img-load img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity .5s cubic-bezier(.16, 1, .3, 1);
}
.img-load img.is-loaded {
  opacity: 1;
}
.img-load .img-load-pct {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .02em;
  transition: opacity .3s;
}
.img-load.is-done { background: transparent; }
.img-load.is-done .img-load-pct {
  opacity: 0;
}
