/* ===== 基础与主题 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --text: #141414;
  --muted: #8a8a8a;
  --line: #e6e6e6;
  --surface: #f6f6f6;
  --lightbox: rgba(0, 0, 0, 0.94);
  --radius: 2px;
}
html[data-theme="dark"] {
  --bg: #0d0d0d;
  --text: #f2f2f2;
  --muted: #7d7d7d;
  --line: #262626;
  --surface: #171717;
  --lightbox: rgba(0, 0, 0, 0.97);
}
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}
img, video { display: block; width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
.hidden { display: none !important; }

/* ===== 顶部 ===== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px 28px;
  border-bottom: 1px solid var(--line);
}
.site-title { font-size: 20px; font-weight: 600; letter-spacing: .35em; text-indent: .35em; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line); border-radius: 50%;
  transition: border-color .2s ease, color .2s ease;
}
.theme-toggle:hover { border-color: var(--text); color: var(--text); }
html[data-theme="dark"] .icon-sun { display: none; }
html:not([data-theme="dark"]) .icon-moon { display: none; }

/* ===== 容器 / 分区 ===== */
.page { max-width: 1280px; margin: 0 auto; padding: 0 32px 80px; }
.section { margin-top: 56px; }
.section-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 28px; }
.section-head h2 { font-size: 13px; font-weight: 500; letter-spacing: .3em; text-indent: .3em; }
.section-head .count { font-size: 12px; color: var(--muted); letter-spacing: .1em; }
.section-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ===== 网格 / 卡片 ===== */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px 28px; }
.work-card { cursor: pointer; }
.cover {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--surface); border-radius: var(--radius);
}
.cover img, .cover video {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s ease, opacity .3s ease;
}
.work-card:hover .cover img,
.work-card:hover .cover video { transform: scale(1.04); }
.cover::after {
  content: ""; position: absolute; inset: 0;
  border: 1px solid var(--line); pointer-events: none;
}
.work-meta { display: flex; align-items: center; justify-content: space-between; padding: 12px 2px 0; }
.work-meta h3 { font-size: 14px; font-weight: 500; letter-spacing: .08em; }
.work-meta .type-tag { font-size: 11px; color: var(--muted); letter-spacing: .15em; }

/* ===== 详情 ===== */
.detail-view { padding-top: 40px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; letter-spacing: .2em; color: var(--muted); margin-bottom: 28px;
}
.back-btn:hover { color: var(--text); }
.detail-title { font-size: 26px; font-weight: 600; letter-spacing: .12em; margin-bottom: 14px; }
.detail-desc {
  color: var(--muted); font-size: 14px; max-width: 760px;
  margin-bottom: 32px; padding-left: 14px; border-left: 2px solid var(--line);
}
.player { width: 100%; background: #000; border-radius: var(--radius); margin-bottom: 40px; }
.player video { max-height: 78vh; }
.detail-image-main { margin-bottom: 40px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.frames-title { font-size: 12px; letter-spacing: .3em; color: var(--muted); margin-bottom: 18px; }
.frames-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.frames-grid button {
  aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
}
.frames-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.frames-grid button:hover img { transform: scale(1.06); }

/* ===== 灯箱 ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: var(--lightbox);
  display: flex; align-items: center; justify-content: center;
}
.lightbox-img { max-width: 92vw; max-height: 88vh; width: auto; height: auto; object-fit: contain; }
.lightbox button {
  position: absolute; color: #fff; font-size: 34px; line-height: 1;
  width: 56px; height: 56px; display: flex; align-items: center; justify-content: center;
  opacity: .7; transition: opacity .2s ease;
}
.lightbox button:hover { opacity: 1; }
.lightbox-close { top: 18px; right: 18px; font-size: 40px; }
.lightbox-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 12px; top: 50%; transform: translateY(-50%); }

.loading { color: var(--muted); letter-spacing: .25em; font-size: 13px; padding: 80px 0; text-align: center; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%);
  z-index: 120; padding: 11px 22px; font-size: 13px; letter-spacing: .08em;
  border-radius: var(--radius); background: var(--text); color: var(--bg);
}

/* ===== 平板 ===== */
@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 30px 22px; }
  .frames-grid { grid-template-columns: repeat(3, 1fr); }
}
/* ===== 手机 ===== */
@media (max-width: 640px) {
  .site-header { padding: 26px 20px 20px; }
  .site-title { font-size: 17px; }
  .page { padding: 0 20px 60px; }
  .section { margin-top: 40px; }
  .grid { grid-template-columns: 1fr; gap: 28px; }
  .frames-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-title { font-size: 21px; }
  .lightbox-prev { left: 0; }
  .lightbox-next { right: 0; }
  .lightbox button { width: 48px; }
}


/* ===== 王琛皓 iPad 离线版 ===== */
.site-brand { display: flex; align-items: baseline; gap: 16px; }
.site-author {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .22em;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .site-brand { display: block; }
  .site-author { margin-top: 4px; }
}
