/* ============================================================
   个人作品集 · 设计系统（依据设计稿还原）
   色板采样自原始素材：ink #5e5e5e / bg #ededed
   pink #f46c94 / yellow #f4e46c / green #6cf4ae
   ============================================================ */
:root {
  --ink: #5e5e5e;
  --ink-light: #9a9a9a;
  --ink-faint: #c9c9c9;
  --bg: #ededed;
  --pink: #f46c94;
  --yellow: #f4e46c;
  --green: #6cf4ae;
  --nav-left: 36px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg) url('/assets/bg.png') repeat;
  background-size: 1280px 600px;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img { user-select: none; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; border-radius: 4px; }

/* ---------------- 导航 ---------------- */
.side-nav {
  position: fixed; left: var(--nav-left); top: 44px; z-index: 60;
  display: flex; flex-direction: column; gap: 26px;
}
.nav-item { position: relative; width: 88px; height: 88px; display: block; }
.nav-item img { width: 100%; height: 100%; object-fit: contain; transition: transform .25s ease; display: block; }
.nav-item:hover img, .nav-item:focus-visible img { transform: scale(1.07); }
.nav-tab {
  position: absolute; left: calc(-1 * var(--nav-left)); top: 50%;
  transform: translateY(-50%);
  width: 25px; height: 71px;
  background-size: contain; background-repeat: no-repeat;
  opacity: 0; transition: opacity .25s ease;
}
.nav-item.is-active .nav-tab { opacity: 1; }

.bottom-nav { display: none; }

/* ---------------- 首页 ---------------- */
.home-main { position: relative; min-height: 100vh; padding-left: 190px; overflow: hidden; }
.home-text { padding-top: 8vh; max-width: 560px; position: relative; z-index: 2; }
.home-text h1 {
  font-size: 46px; font-weight: 900; letter-spacing: 6px;
  color: #585858; margin: 0 0 6vh;
}
.home-text h2 { font-size: 32px; font-weight: 900; letter-spacing: 4px; margin: 0 0 3.2vh; color: #585858; }
.home-text p { font-size: 19px; font-weight: 600; letter-spacing: 1.5px; margin: 1.1vh 0; color: #666; }
.home-owner {
  margin-top: 6vh !important; font-size: 26px !important; font-weight: 900 !important;
  letter-spacing: 10px !important; color: #5a5a5a !important;
}
.home-art {
  position: absolute; right: 1%; top: 5%; width: 55%; max-width: 1060px; z-index: 1;
  pointer-events: none;
}
.home-art img { width: 100%; height: auto; display: block; will-change: transform; }
.home-bottom-line {
  position: fixed; left: 0; bottom: 0; width: 100%; height: auto;
  pointer-events: none; z-index: 1;
}

/* 首页右侧的呼吸感动效：轻微漂浮 + 鼠标视差（JS），克制优先 */
@keyframes floaty {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
  50%  { transform: translate3d(0, -10px, 0) rotate(.5deg); }
  100% { transform: translate3d(0, 0, 0) rotate(0deg); }
}
.home-art img { animation: floaty 9s ease-in-out infinite; }

/* ---------------- 列表页 ---------------- */
.list-main {
  margin-left: 200px; margin-right: 320px;
  padding: 42px 0 160px; position: relative; z-index: 2;
}
.mode-switch { display: flex; gap: 16px; margin: 0 0 26px 6px; }
.mode-btn {
  border: 2.5px solid var(--ink); background: transparent; color: var(--ink);
  border-radius: 999px; padding: 6px 26px; font-size: 16px; font-weight: 800; letter-spacing: 3px;
  transition: background .2s ease, transform .2s ease;
}
.mode-btn:hover { transform: translateY(-2px); }
.mode-btn.is-active { background: var(--yellow); }

.commas-row { display: block; width: 100%; max-width: 900px; height: 22px; object-fit: fill; object-fit: cover; margin-bottom: 34px; }
.dots-row { display: block; width: 100%; max-width: 900px; height: 16px; object-fit: cover; margin: 30px 0; }

.card-grid { display: flex; flex-wrap: wrap; gap: 52px 48px; align-items: flex-start; }

.card { position: relative; display: block; background-image: var(--frame); background-size: 100% 100%; background-repeat: no-repeat; aspect-ratio: var(--ratio, 204/230); transition: transform .25s ease; }
.card:hover { transform: translateY(-4px); }
.card-cover { position: absolute; overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-cover video { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-title {
  position: absolute; left: 2%; bottom: -2em;
  font-size: 15px; font-weight: 700; letter-spacing: 1px; color: #7d7d7d;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

/* 时间模式卡片（封面位置按素材实测：square 21.1/17.4/54.9/53，wide 13.9/17.4/71.3/53） */
.time-card { width: 206px; }
.time-card.card--wide { width: 320px; }
.time-card .card-cover { left: 21.1%; top: 17.4%; width: 54.9%; height: 53%; }
.time-card.card--wide .card-cover { left: 13.9%; top: 17.4%; width: 71.3%; height: 53%; }

/* 类别模式卡片（封面位置实测：38.4/13.7/46.3/49.2） */
.cat-card { width: 226px; --ratio: 242/248; }
.cat-card .card-cover { left: 38.4%; top: 13.7%; width: 46.3%; height: 49.2%; }
.cat-card.is-hidden { display: none; }

.year-section { scroll-margin-top: 10vh; }
body[data-mode="category"] .year-rail { display: none; }

.empty-hint { font-size: 17px; color: var(--ink-light); letter-spacing: 2px; padding: 40px 0; }

/* 年份大数字 */
.year-rail { position: fixed; right: 220px; top: 34vh; z-index: 40; pointer-events: none; }
.year-display {
  display: flex; flex-direction: column; align-items: flex-start;
  font-weight: 900; font-size: 108px; line-height: .82; letter-spacing: -2px;
  color: transparent; -webkit-text-stroke: 2.5px #ababab;
  transition: opacity .3s ease;
}
@supports not (-webkit-text-stroke: 1px black) {
  .year-display { color: #d8d8d8; }
}

/* 沙漏（滚动进度） */
.hourglass-rail {
  position: fixed; right: 30px; top: 4vh; height: 92vh; z-index: 40; pointer-events: none;
}
.hourglass { height: 100%; width: auto; display: block; }

/* 右下角工具图标 */
.utility-icons {
  position: fixed; right: 196px; bottom: 42px; z-index: 55;
  display: flex; gap: 26px; align-items: center;
}
.util-btn {
  border: 0; background: transparent; padding: 4px;
  transition: transform .2s ease;
}
.util-btn img { width: 40px; height: 40px; object-fit: contain; display: block; }
.util-btn:hover { transform: translateY(-3px) scale(1.06); }

/* 类别导航（类别模式底部居中） */
.cat-nav {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  display: flex; gap: 34px; z-index: 55;
  padding: 6px 10px;
}
.cat-nav-item {
  position: relative; border: 0; background: transparent; padding: 4px 6px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.cat-nav-item img { width: 44px; height: 44px; object-fit: contain; transition: transform .2s ease; }
.cat-nav-item:hover img { transform: translateY(-3px); }
.cat-label { font-size: 13px; font-weight: 800; letter-spacing: 2px; color: var(--ink); opacity: 0; transition: opacity .2s; }
.cat-highlight {
  position: absolute; left: 50%; bottom: -2px; transform: translateX(-50%);
  width: 46px; height: 10px; background-size: contain; background-repeat: no-repeat; background-position: center;
  opacity: 0; transition: opacity .2s;
}
.cat-nav-item.is-active .cat-label, .cat-nav-item.is-active .cat-highlight { opacity: 1; }

/* 搜索浮层 */
.search-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(237, 237, 237, .9);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 16vh;
}
.search-box {
  display: flex; gap: 12px; align-items: center;
  border: 3px solid var(--ink); border-radius: 999px; background: #f4f4f4;
  padding: 10px 22px; width: min(560px, 84vw);
}
.search-box input {
  flex: 1; border: 0; background: transparent; font-size: 20px; font-family: var(--font);
  color: var(--ink); letter-spacing: 1px; outline: none;
}
.search-box button { border: 0; background: transparent; font-size: 30px; color: var(--ink); line-height: 1; }

/* ---------------- 详情页 ---------------- */
.detail-main {
  margin-left: 200px; margin-right: 130px;
  padding: 6vh 0 18vh; max-width: 980px; position: relative; z-index: 2;
}
.detail-head h1 { font-size: 34px; font-weight: 900; letter-spacing: 3px; margin: 34px 0 6px; color: #585858; }
.detail-sub { font-size: 18px; font-weight: 700; color: #777; margin: 4px 0; letter-spacing: 1px; }
.detail-meta { font-size: 14px; color: var(--ink-light); letter-spacing: 2px; margin: 8px 0 14px; }
.detail-desc { font-size: 16px; line-height: 2; color: #666; letter-spacing: 1px; max-width: 640px; }

/* 布局 A：横向滑动 */
.slider { position: relative; margin-top: 1vh; }
.slider-stage {
  border: 3px solid var(--ink); border-radius: 3px;
  background: rgba(255, 255, 255, .4);
  aspect-ratio: 16/9.6; overflow: hidden; position: relative;
  touch-action: pan-y;
}
.slider-track { display: flex; height: 100%; transition: transform .45s cubic-bezier(.22, .8, .3, 1); }
.slider-track.is-dragging { transition: none; }
.slide { min-width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.slide img, .slide video { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.slide-btn {
  position: absolute; top: 40%; width: 82px; height: 82px;
  border: 0; border-radius: 50%; background: transparent; padding: 0;
  transition: transform .2s ease; z-index: 5;
}
.slide-btn img { width: 100%; height: 100%; object-fit: contain; display: block; }
.slide-btn:hover { transform: scale(1.08); }
.slide-prev { left: -46px; }
.slide-next { right: -46px; }
.tri { width: 0; height: 0; border-top: 14px solid transparent; border-bottom: 14px solid transparent; }
.tri-left { border-right: 20px solid var(--ink); margin-right: 6px; }
.tri-right { border-left: 20px solid var(--ink); margin-left: 6px; }
.slide-dots { display: flex; gap: 16px; justify-content: center; margin-top: 20px; }
.slide-dot { width: 15px; height: 15px; border: 2.5px solid var(--ink); border-radius: 50%; transition: background .2s; }
.slide-dot.is-active { background: var(--ink); }
.slide-caption { text-align: center; font-size: 13px; color: var(--ink-light); margin-top: 8px; min-height: 18px; letter-spacing: 1px; }

/* 布局 B：纵向内容流 */
.detail-vertical { max-width: 860px; }
.blk { margin: 26px 0; }
.blk-heading { font-size: 26px; font-weight: 900; letter-spacing: 2px; color: #585858; }
.blk-text p { font-size: 16px; line-height: 2.1; color: #666; letter-spacing: 1px; margin: 0; }
.blk-quote {
  border-left: 5px solid var(--yellow); margin: 26px 0; padding: 6px 22px;
  font-size: 18px; font-weight: 700; color: #6a6a6a; letter-spacing: 1px; line-height: 1.9;
}
.blk-media { margin: 30px 0; }
.blk-media img, .blk-media video { width: 100%; height: auto; display: block; border: 3px solid var(--ink); border-radius: 3px; background: rgba(255,255,255,.4); }
.blk-media video { max-height: 70vh; }
.blk-media figcaption { font-size: 13px; color: var(--ink-light); margin-top: 8px; letter-spacing: 1px; }
.blk-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px; }
.gallery-item img { width: 100%; height: auto; display: block; border: 3px solid var(--ink); border-radius: 3px; background: rgba(255,255,255,.4); }
.gallery-item figcaption { font-size: 13px; color: var(--ink-light); margin-top: 6px; }
.blk-divider { border: 0; border-top: 3px dashed var(--ink-faint); margin: 40px 0; }

/* 返回箭头 */
.back-arrow { position: fixed; left: 44px; bottom: 64px; z-index: 55; width: 84px; transition: transform .2s ease; }
.back-arrow:hover { transform: translateX(-5px); }
.back-arrow img { width: 100%; height: auto; display: block; }
.back-link { display: inline-block; margin-top: 20px; border-bottom: 2px solid var(--ink); }

/* 编辑模式（登录管理员在详情页按 Alt+E） */
.edit-pill {
  position: fixed; top: 26px; left: 50%; transform: translateX(-50%); z-index: 95;
  background: #4a4a4a; color: #eee; border-radius: 999px;
  padding: 10px 26px; font-size: 14px; letter-spacing: 1.5px;
}
.edit-toolbar {
  position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%); z-index: 95;
  display: flex; gap: 14px; background: rgba(255, 255, 255, .9);
  border: 2.5px solid var(--ink); border-radius: 999px; padding: 10px 18px;
}
.edit-toolbar button {
  border: 2px solid var(--ink); background: transparent; border-radius: 999px;
  padding: 6px 18px; font-size: 14px; font-weight: 800; color: var(--ink); letter-spacing: 1px;
}
.edit-toolbar button.danger { color: #c4556e; border-color: #c4556e; }
.edit-toolbar button.primary { background: var(--green); }

/* 快速新建作品弹窗（还原“上传”设计稿：折角纸张） */
.quick-add {
  position: fixed; inset: 0; z-index: 96; display: flex; align-items: center; justify-content: center;
  background: rgba(120, 120, 120, .18);
}
.quick-add-paper {
  position: relative; width: min(470px, 92vw);
  background-image: url('/assets/upload/paper.png');
  background-size: 100% 100%; background-repeat: no-repeat;
  aspect-ratio: 884/956; padding: 9% 12% 14% 15%;
}
.quick-add-close {
  position: absolute; top: 4.5%; right: 6.5%; width: 40px; height: 40px;
  border: 0; background: transparent; font-size: 30px; color: var(--ink); line-height: 1;
}
.qa-field { display: flex; align-items: center; gap: 12px; margin-bottom: 4.2%; }
.qa-label { font-size: 17px; font-weight: 900; letter-spacing: 3px; color: var(--ink); flex: 0 0 76px; }
.qa-field input[type="text"], .qa-field input[type="number"] {
  flex: 1; border: 0; border-bottom: 2.5px solid var(--ink-faint); background: transparent;
  font-size: 16px; font-family: var(--font); color: var(--ink); padding: 4px 6px; outline: none;
}
.qa-field input:focus { border-bottom-color: var(--ink); }
.qa-choices { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.qa-choice { border: 0; background: transparent; padding: 2px; opacity: .55; transition: opacity .15s, transform .15s; }
.qa-choice img { width: 34px; height: 34px; object-fit: contain; display: block; }
.qa-choice.is-active { opacity: 1; transform: scale(1.12); }
.qa-choice .qa-choice-label { font-size: 12px; font-weight: 700; color: var(--ink); }
.qa-cover-btn { display: flex; align-items: center; gap: 10px; }
.qa-cover-btn img.add { width: 44px; height: 44px; }
.qa-cover-preview { width: 56px; height: 56px; object-fit: cover; border: 2px solid var(--ink); }
.qa-submit {
  position: absolute; bottom: 5%; left: 50%; transform: translateX(-50%);
  border: 2.5px solid var(--ink); background: var(--yellow); border-radius: 999px;
  font-size: 16px; font-weight: 900; letter-spacing: 4px; padding: 8px 34px; color: var(--ink);
}
.qa-error { color: #c4556e; font-size: 13px; text-align: center; margin-top: 4px; min-height: 16px; }

/* ---------------- 移动端（≤820px，独立布局） ---------------- */
@media (max-width: 820px) {
  .side-nav { display: none; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    background: rgba(244, 244, 244, .96); border-top: 2px solid #dcdcdc;
    justify-content: space-evenly; align-items: center;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .bottom-nav .nav-item { width: 58px; height: 58px; }
  .bottom-nav .nav-tab { display: none; }
  .bottom-nav .nav-item.is-active::after {
    content: ''; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
    width: 38px; height: 9px;
    background: url('/assets/icons/highlight.png') no-repeat center / contain;
  }

  .home-main { padding: 0 22px 120px; min-height: auto; }
  .home-text { padding-top: 7vh; max-width: none; }
  .home-text h1 { font-size: 30px; letter-spacing: 3px; margin-bottom: 4vh; }
  .home-text h2 { font-size: 24px; }
  .home-text p { font-size: 16px; }
  .home-owner { font-size: 20px !important; letter-spacing: 7px !important; }
  .home-art { position: relative; right: auto; top: auto; width: 108%; margin: 4vh -4% 0; }
  .home-bottom-line { display: none; }

  .list-main { margin: 0; padding: 20px 66px 140px 16px; }
  .mode-switch { margin-bottom: 16px; }
  .commas-row, .dots-row { max-width: 100%; }
  .card-grid { gap: 40px 20px; justify-content: flex-start; }
  .time-card { width: calc(50% - 12px); }
  .time-card.card--wide { width: 100%; }
  .cat-card { width: calc(50% - 12px); }
  .card-title { font-size: 13px; }

  .year-rail { right: 8px; top: calc(6vh + 30vh + 8px); }
  .year-display { font-size: 38px; -webkit-text-stroke: 1.4px #ababab; }
  .hourglass-rail { right: 12px; top: 4vh; height: 30vh; }
  .utility-icons { right: 10px; bottom: auto; top: calc(6vh + 30vh + 96px); flex-direction: column; gap: 12px; }
  .util-btn img { width: 32px; height: 32px; }

  .cat-nav { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); gap: 16px; }
  .cat-nav-item img { width: 38px; height: 38px; }

  .detail-main { margin: 0; padding: 18px 16px 160px; max-width: none; }
  .detail-head h1 { font-size: 26px; }
  .slide-prev { left: 8px; }
  .slide-next { right: 8px; }
  .slide-btn { width: 52px; height: 52px; top: 40%; }
  .tri-left { border-right-width: 14px; border-top-width: 10px; border-bottom-width: 10px; }
  .tri-right { border-left-width: 14px; border-top-width: 10px; border-bottom-width: 10px; }
  .blk-gallery { grid-template-columns: 1fr; }
  .back-arrow { width: 60px; left: 16px; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }

  .edit-toolbar { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap; justify-content: center; border-radius: 24px; max-width: 92vw; }
  .edit-pill { width: max-content; max-width: 92vw; font-size: 12px; }

  .quick-add-paper { padding: 12% 10% 16% 12%; }
  .qa-label { flex-basis: 60px; font-size: 15px; letter-spacing: 2px; }
}

/* 小屏高度适配 */
@media (max-height: 560px) and (min-width: 821px) {
  .year-rail { top: 26vh; }
  .year-display { font-size: 84px; }
}

/* 减少动态偏好 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .home-art img { animation: none; }
  .slider-track { transition: none; }
  .card, .nav-item img, .util-btn, .cat-nav-item img { transition: none; }
}
