/* =========================================================
   作品集 · 首页
   轻量、淡雅、无外部字体。所有动效只使用 transform / opacity。
   ========================================================= */

:root {
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --ink: #2c2d29;
  --paper: #f7f4ed;
  --edge: clamp(12px, 1.9vw, 28px);
  --gap: clamp(10px, 1.4vw, 19px);
  --radius: clamp(18px, 2.1vw, 30px);
  --ui: 1;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 253, 248, 0.36) transparent;
}

html::-webkit-scrollbar {
  width: 6px;
}

html::-webkit-scrollbar-track {
  background: transparent;
}

html::-webkit-scrollbar-thumb {
  background: rgba(255, 253, 248, 0.36);
  border-radius: 999px;
}

body {
  margin: 0;
  min-height: 100%;
  background: #f7f4ed;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.home {
  overflow-x: hidden;
  background: #c9c4b8;
}

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

a {
  color: inherit;
}

button {
  font: inherit;
}

::selection {
  background: rgba(154, 160, 140, 0.35);
  color: #20211e;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 16px;
  color: var(--ink);
  background: var(--paper);
  border-radius: 999px;
  font-size: 12px;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- 首屏画面 ---------- */

.hero {
  --soft: 0;
  --veil: 0;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(75% 65% at 68% 30%, rgba(226, 207, 173, 0.7), rgba(226, 207, 173, 0) 62%),
    radial-gradient(90% 80% at 22% 82%, rgba(92, 108, 89, 0.65), rgba(92, 108, 89, 0) 65%),
    linear-gradient(145deg, #d7cfc0 0%, #adb1a2 44%, #5e6a5e 100%);
}

.hero__layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  opacity: 0;
}

.hero__layer--sharp {
  transition: opacity 0.9s ease;
}

.hero.is-loaded .hero__layer--sharp {
  opacity: 1;
}

.hero__layer--soft {
  transform: scale(1.075);
  filter: blur(12px) saturate(0.96) brightness(0.95);
  opacity: 0;
  pointer-events: none;
}

.hero.is-loaded .hero__layer--soft {
  opacity: var(--soft);
}

.hero__tone,
.hero__veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero__tone {
  background:
    linear-gradient(180deg, rgba(24, 25, 21, 0.38) 0%, rgba(24, 25, 21, 0) 20%),
    linear-gradient(0deg, rgba(24, 25, 21, 0.22) 0%, rgba(24, 25, 21, 0) 24%);
}

.hero__veil {
  background: linear-gradient(180deg, rgba(29, 30, 26, 0.32), rgba(29, 30, 26, 0.62));
  opacity: var(--veil);
}

/* 点击换图时叠加的淡入层 */
.hero__crossfade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}

.hero__crossfade.is-in {
  opacity: 1;
}

/* ---------- 鼠标粒子发光 ---------- */

.particles {
  position: fixed;
  inset: 0;
  z-index: 22;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.low-power .particles {
  display: none;
}

/* ---------- 顶部标识 ---------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding:
    calc(clamp(18px, 2.6vw, 34px) + env(safe-area-inset-top))
    calc(clamp(20px, 3.2vw, 50px) + env(safe-area-inset-right))
    18px
    calc(clamp(20px, 3.2vw, 50px) + env(safe-area-inset-left));
  color: #fffdf8;
  opacity: var(--ui);
  pointer-events: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
  text-shadow: 0 1px 16px rgba(16, 17, 14, 0.32);
}

.brand__seal {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 253, 248, 0.55);
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.12);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1;
}

.brand__copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand__title {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.22em;
  line-height: 1;
}

.brand__sub {
  font-size: 8px;
  letter-spacing: 0.26em;
  opacity: 0.72;
  line-height: 1;
}

.topbar__meta {
  margin: 0;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.3em;
  opacity: 0.72;
  text-shadow: 0 1px 16px rgba(16, 17, 14, 0.32);
}

.topbar.is-hidden,
.topbar.is-hidden .brand {
  pointer-events: none;
}

/* ---------- 半透明分类面板 ---------- */

.categories {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  padding:
    calc(var(--edge) + env(safe-area-inset-top))
    calc(var(--edge) + env(safe-area-inset-right))
    calc(var(--edge) + env(safe-area-inset-bottom))
    calc(var(--edge) + env(safe-area-inset-left));
  pointer-events: none;
}

.glass {
  --o: 0;
  --y: 64px;
  --s: 0.985;
  --tint: 238, 240, 232;
  position: relative;
  display: grid;
  grid-template-columns: minmax(48px, 6.5%) minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(16px, 3.2vw, 52px);
  min-height: 0;
  padding: clamp(19px, 2.4vw, 36px) clamp(22px, 3.2vw, 48px);
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: var(--radius);
  background-color: rgba(var(--tint), 0.55);
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0));
  box-shadow:
    0 10px 24px rgba(18, 21, 17, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  pointer-events: auto;
}

.js .glass {
  transform: translate3d(0, var(--y), 0) scale(var(--s));
  opacity: var(--o);
  pointer-events: none;
}

.js .glass.is-live {
  pointer-events: auto;
}

.glass--painting {
  --tint: 218, 226, 213;
}

.glass--photography {
  --tint: 230, 222, 209;
}

.glass--diy {
  --tint: 232, 219, 216;
}

.glass__no {
  align-self: start;
  padding-top: 0.45em;
  color: rgba(44, 45, 41, 0.6);
  font-size: 10px;
  letter-spacing: 0.16em;
  font-variant-numeric: tabular-nums;
}

.glass__copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.glass__title {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3.45vw, 3.2rem);
  font-weight: 400;
  letter-spacing: 0.07em;
  line-height: 1.05;
  white-space: nowrap;
}

.glass__en {
  margin-top: 0.9em;
  color: rgba(44, 45, 41, 0.62);
  font-family: var(--sans);
  font-size: clamp(8px, 0.68vw, 10px);
  letter-spacing: 0.32em;
  line-height: 1;
}

.glass__side {
  display: flex;
  align-items: center;
  gap: clamp(15px, 2.8vw, 34px);
}

.glass__count {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: rgba(44, 45, 41, 0.68);
  font-size: 10px;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.glass__count [data-count] {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0;
}

.glass__unit {
  font-size: 9px;
}

.glass__arrow {
  display: grid;
  place-items: center;
  width: clamp(38px, 4vw, 52px);
  height: clamp(38px, 4vw, 52px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(44, 45, 41, 0.8);
  transition: background 0.35s ease, border-color 0.35s ease;
}

.glass__arrow svg {
  width: 42%;
  height: 42%;
  transition: transform 0.35s ease;
}

@media (hover: hover) and (pointer: fine) {
  .glass.is-live:hover .glass__arrow {
    background: rgba(255, 255, 255, 0.34);
    border-color: rgba(255, 255, 255, 0.78);
  }

  .glass.is-live:hover .glass__arrow svg {
    transform: translate(2px, -2px);
  }
}

.glass:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.95);
  outline-offset: 4px;
}

/* ---------- 滚动提示 ---------- */

.scroll-cue {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  color: rgba(255, 253, 248, 0.8);
  opacity: var(--ui);
  transform: translateX(-50%);
  pointer-events: none;
}

.scroll-cue span {
  font-size: 20px;
  line-height: 1.8;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  text-align: center;
  text-shadow: 0 1px 14px rgba(16, 17, 14, 0.45);
  white-space: nowrap;
}

.scroll-cue i {
  position: relative;
  width: 1px;
  height: 42px;
  overflow: hidden;
  background: rgba(255, 253, 248, 0.18);
}

.scroll-cue i::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  width: 1px;
  height: 16px;
  background: rgba(255, 253, 248, 0.85);
  animation: cue-line 2.4s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
}

@keyframes cue-line {
  0% {
    transform: translateY(-18px);
    opacity: 0;
  }
  32% {
    opacity: 1;
  }
  100% {
    transform: translateY(44px);
    opacity: 0;
  }
}

/* 撑开滚动距离，让首屏图像保持 fixed，不跟着滚走 */
.scroll-track {
  width: 1px;
  height: 235vh;
  pointer-events: none;
}

/* 没有 JS 时仍然可用的降级 */
.no-js .scroll-track {
  height: 100vh;
}

.no-js .glass {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.no-js .scroll-cue {
  display: none;
}

.noscript-note {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  margin: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.9);
  color: var(--ink);
  font-size: 12px;
  transform: translateX(-50%);
}

/* ---------- 轻量模式 ---------- */

.low-power .hero__layer--soft {
  filter: blur(8px) saturate(0.96) brightness(0.95);
}

/* ---------- 窄屏与小高度 ---------- */

@media (max-width: 700px) {
  .topbar__meta {
    display: none;
  }

  .glass {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    padding: 20px 21px;
  }

  .glass__no {
    position: absolute;
    top: 14px;
    right: 18px;
    padding: 0;
    font-size: 9px;
  }

  .glass__title {
    font-size: clamp(1.45rem, 6vw, 2rem);
    letter-spacing: 0.06em;
  }

  .glass__en {
    margin-top: 0.7em;
    font-size: 7px;
  }

  .glass__side {
    gap: 12px;
  }

  .glass__count [data-count] {
    font-size: 16px;
  }

  .glass__unit {
    font-size: 8px;
  }

  .glass__arrow {
    width: 38px;
    height: 38px;
  }
}

@media (max-height: 500px) {
  :root {
    --edge: 9px;
    --gap: 8px;
    --radius: 15px;
  }

  .glass {
    padding: 12px 18px;
  }

  .glass__title {
    font-size: clamp(1.15rem, 3.5vw, 1.65rem);
  }

  .glass__en {
    margin-top: 0.45em;
  }

  .glass__arrow {
    width: 32px;
    height: 32px;
  }

  .scroll-cue {
    display: none;
  }
}

@media (max-width: 420px) {
  .brand {
    gap: 9px;
  }

  .brand__seal {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .brand__title {
    font-size: 13px;
  }
}

/* ---------- 动效偏好与页面转场 ---------- */

@media (prefers-reduced-motion: reduce) {
  .scroll-cue i::after {
    animation: none;
  }

  .hero__layer--sharp {
    transition: none;
  }

  .js .glass {
    transform: none !important;
  }

  .glass__arrow svg {
    transition: none;
  }
}

@keyframes page-fade-out {
  to {
    opacity: 0;
  }
}

@keyframes page-fade-in {
  from {
    opacity: 0;
  }
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: page-fade-out 0.22s ease both;
}

::view-transition-new(root) {
  animation: page-fade-in 0.4s ease both;
}
