/* ============================================================
   山河行摄 · 摄影作品集
   深色画廊风格 · PC 与移动端响应式
   ============================================================ */

:root {
  --bg: #0e0f12;            /* 页面底色 */
  --bg-soft: #16171b;       /* 卡片底色 */
  --line: rgba(255, 255, 255, .08);
  --text: #eceae4;
  --text-dim: #9b998f;
  --accent: #c9a35f;        /* 落日金 */
  --topbar-h: 64px;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --sans: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; } /* 平滑滚动全部由 main.js 的 rAF 动画控制，避免与 CSS smooth 冲突 */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

::selection { background: var(--accent); color: #14100a; }

/* ---------------- 顶部导航 ---------------- */
#topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 48px);
  z-index: 50;
  background: linear-gradient(rgba(10, 10, 12, .72), rgba(10, 10, 12, .28) 80%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.brand { display: flex; flex-direction: column; line-height: 1.25; }
.brand-cn { font-family: var(--serif); font-size: 19px; letter-spacing: 6px; font-weight: 600; }
.brand-en { font-size: 9px; letter-spacing: 3.5px; color: var(--text-dim); }
.mainnav { display: flex; gap: clamp(18px, 3vw, 40px); }
.mainnav a {
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--text-dim);
  padding: 6px 2px;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.mainnav a:hover { color: var(--text); }
.mainnav a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------------- 主体容器 ---------------- */
#app { min-height: 60vh; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px); }

/* ---------------- 首页 Hero（5 秒自动轮播） ---------------- */
.hero {
  position: relative;
  height: min(78vh, 820px);
  min-height: 480px;
  overflow: hidden;
}
.hero-slides, .hero-slide { position: absolute; inset: 0; }
.hero-slide { opacity: 0; transition: opacity 1.6s ease; }
.hero-slide.on { opacity: 1; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(rgba(8, 8, 10, .18) 40%, rgba(14, 15, 18, .92) 96%);
}
.hero-copy {
  position: absolute;
  left: 0; right: 0; bottom: clamp(40px, 9vh, 96px);
  z-index: 2;
  text-align: center;
  padding: 0 20px;
}
.hero-copy h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(30px, 5.4vw, 58px);
  letter-spacing: clamp(8px, 1.6vw, 18px);
  text-shadow: 0 2px 24px rgba(0, 0, 0, .55);
}
.hero-cap {
  margin-top: 14px;
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 6px;
  transition: opacity .35s ease;
}
.hero-cap.fade { opacity: 0; }
.hero-cta {
  display: inline-block;
  margin-top: 30px;
  padding: 10px 38px;
  border: 1px solid rgba(236, 234, 228, .45);
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 5px;
  color: var(--text);
  transition: border-color .25s, color .25s, background .25s;
}
.hero-cta:hover { border-color: var(--accent); color: var(--accent); }
.hero-dots {
  position: absolute;
  left: 0; right: 0; bottom: 16px;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 10px;
}
.hero-dots button {
  width: 9px; height: 9px;
  padding: 0; border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .35);
  transition: width .3s, background .3s;
}
.hero-dots button.on { width: 24px; background: var(--accent); }

/* ---------------- 分区标题 ---------------- */
/* 只用上下 padding：写成 padding 简写会把 .wrap 的左右内边距清零，导致 ≤1280px 时内容贴边 */
.section { padding-top: clamp(56px, 9vh, 104px); }
.section:last-of-type { padding-bottom: clamp(56px, 9vh, 104px); }
.sec-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: clamp(24px, 4vh, 40px); }
.sec-head h2 {
  font-family: var(--serif);
  font-size: clamp(22px, 2.6vw, 30px);
  letter-spacing: 8px;
  font-weight: 600;
}
.sec-head .en {
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--text-dim);
}
.sec-head .rule { flex: 1; height: 1px; background: var(--line); }

/* ---------------- 瀑布流照片墙（JS 分列装箱，不用 CSS columns） ---------------- */
.masonry { display: flex; align-items: flex-start; gap: 14px; }
.masonry-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.masonry figure {
  margin: 0;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: var(--bg-soft);
  cursor: zoom-in;
}
.masonry figure img {
  width: 100%;
  opacity: 0;
  transition: transform .5s ease, opacity .45s ease;
}
.masonry figure img.ld { opacity: 1; }
.masonry figure:hover img { transform: scale(1.045); }
.masonry figure.img-broken::after {
  content: "照片加载失败，请刷新重试";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-dim);
}
.masonry figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 26px 14px 12px;
  font-size: 12px;
  letter-spacing: 2px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .62));
  opacity: 0;
  transition: opacity .3s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.masonry figure:hover figcaption { opacity: 1; }

/* ---------------- 臻选（横向滑动卡片） ---------------- */
.featured-sec .feat-nav { display: flex; gap: 8px; }
.featured-sec .feat-nav button {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  transition: border-color .25s, color .25s;
}
.featured-sec .feat-nav button:hover { border-color: var(--accent); color: var(--accent); }
.feat-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.feat-row::-webkit-scrollbar { display: none; }
.feat-card {
  position: relative;
  flex: 0 0 auto;
  width: clamp(250px, 24vw, 360px);
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-soft);
  scroll-snap-align: start;
  cursor: zoom-in;
}
.feat-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.feat-card:hover img { transform: scale(1.05); }

/* ---------------- 色卡筛选行 ---------------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 2px;
  transition: border-color .25s, color .25s, background .25s;
}
.chip .sw {
  width: 14px; height: 14px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
  flex: 0 0 auto;
}
.chip .sw-all { background: linear-gradient(135deg, #c4543c, #d2a24c 30%, #4f7a58 55%, #3f6ea8 80%, #e8e6df); }
.chip .sw-plain {
  width: 13px; height: 13px;
  border-radius: 3px;
  background: transparent;
  border: 1.5px solid currentColor;
  box-shadow: none;
}
.chip .sw-rect-h, .chip .sw-rect-v {
  border-radius: 2px;
  background: transparent;
  border: 1.5px solid currentColor;
  box-shadow: none;
}
.chip .sw-rect-h { width: 16px; height: 10px; }
.chip .sw-rect-v { width: 10px; height: 16px; }
.chip .n { font-style: normal; font-size: 11px; opacity: .55; }
.chip:hover { border-color: rgba(201, 163, 95, .5); color: var(--text); }
.chip.active { border-color: var(--accent); color: var(--accent); background: rgba(201, 163, 95, .08); }
.chips-label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 4px;
  margin: 2px 0 8px;
}
.chips + .chips-label { margin-top: 16px; }

.empty-tip {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 56px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 2px;
}

/* 瀑布流底部：滚动加载提示 */
.masonry-more {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 2px;
  padding: 30px 0 6px;
  opacity: .75;
}

/* ---------------- 关于 ---------------- */
.about-box {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}
.about-text p { color: var(--text-dim); letter-spacing: 1px; }
.about-text p b { color: var(--text); font-weight: 500; }
.about-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stat { background: var(--bg-soft); padding: 22px 10px; text-align: center; }
.stat b { display: block; font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--accent); }
.stat span { font-size: 12px; color: var(--text-dim); letter-spacing: 2px; }
.about-routes { margin-top: 22px; font-size: 12px; color: var(--text-dim); letter-spacing: 1.5px; line-height: 2.1; }

/* ---------------- 页脚 ---------------- */
#site-footer {
  margin-top: clamp(56px, 9vh, 104px);
  border-top: 1px solid var(--line);
  padding: 48px 20px 120px;
  text-align: center;
}
.foot-brand { font-family: var(--serif); font-size: 20px; letter-spacing: 10px; font-weight: 600; }
.foot-slogan { margin-top: 8px; color: var(--text-dim); font-size: 13px; letter-spacing: 4px; }
.foot-links { margin-top: 20px; display: flex; justify-content: center; gap: 14px; font-size: 13px; letter-spacing: 2px; }
.foot-links a { color: var(--text-dim); transition: color .2s; }
.foot-links a:hover { color: var(--accent); }
.foot-links span { color: var(--line); }
.foot-copy { margin-top: 26px; font-size: 11px; color: rgba(155, 153, 143, .6); letter-spacing: 1px; }

/* ---------------- 留言 ---------------- */
.contact-box { max-width: 640px; }
.contact-lead { color: var(--text-dim); font-size: 14px; letter-spacing: 1px; margin-bottom: 24px; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field input, .field textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 11px 14px;
  font: inherit;
  letter-spacing: 1px;
  transition: border-color .25s;
}
.field input::placeholder, .field textarea::placeholder { color: rgba(155, 153, 143, .55); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { min-height: 110px; resize: vertical; }
.btn-send {
  padding: 11px 40px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: rgba(201, 163, 95, .08);
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 5px;
  transition: background .25s, color .25s;
}
.btn-send:hover { background: var(--accent); color: #14100a; }
.contact-status { min-height: 22px; margin-top: 12px; font-size: 13px; letter-spacing: 1px; }
.contact-status.ok { color: #96c288; }
.contact-status.err { color: #d98a7f; }
.contact-note { font-size: 12px; color: var(--text-dim); letter-spacing: 1px; }

/* ---------------- 移动端底部导航（小程序风格） ---------------- */
#tabbar {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: rgba(16, 17, 20, .92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabbar button {
  background: none; border: 0;
  padding: 9px 0 7px;
  color: var(--text-dim);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
#tabbar button span { font-size: 12px; letter-spacing: 2px; }
#tabbar button i { font-style: normal; font-size: 8px; letter-spacing: 1.5px; opacity: .55; }
#tabbar button.active { color: var(--accent); }

/* ---------------- 右侧锚点：回到风光色彩 ---------------- */
#back-colors {
  position: fixed;
  right: 10px;   /* 距垂直滚动条 10px */
  top: 50%;
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 17, 20, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(20px);
  transition: transform .3s, opacity .3s, color .2s, border-color .2s;
}
#back-colors.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%);
}
#back-colors .arrow { font-size: 13px; line-height: 1; }
#back-colors .txt {
  writing-mode: vertical-rl;
  font-size: 12px;
  letter-spacing: 5px;
}
#back-colors:hover { color: var(--accent); border-color: rgba(201, 163, 95, .5); }

/* ---------------- 灯箱 ---------------- */
#lightbox {
  position: fixed; inset: 0;
  z-index: 100;
  background: rgba(8, 8, 10, .96);
  display: flex; align-items: center; justify-content: center;
}
#lightbox[hidden] { display: none; }
.lb-figure { max-width: min(92vw, 1400px); text-align: center; }
.lb-figure img {
  max-width: 92vw; max-height: 84vh;
  margin: 0 auto;
  box-shadow: 0 12px 60px rgba(0, 0, 0, .6);
}
.lb-figure figcaption {
  margin-top: 16px;
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; letter-spacing: 2px; color: var(--text-dim);
}
#lb-title { color: var(--text); }
.lb-close, .lb-prev, .lb-next {
  position: absolute;
  background: none; border: 0;
  color: var(--text-dim);
  font-size: 34px;
  line-height: 1;
  padding: 12px;
  transition: color .2s;
  z-index: 2;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { color: var(--text); }
.lb-close { top: 10px; right: 18px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }

/* ---------------- 响应式 ---------------- */
/* 瀑布流列数由 main.js 的 colCount() 决定（4 / 3 / 2），这里不再用 CSS columns */
@media (max-width: 900px) {
  .about-box { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  body { padding-bottom: 58px; }              /* 给底部导航留位 */
  .mainnav { display: none; }                  /* 移动端用底部导航 */
  #tabbar { display: grid; }
  .hero { height: 66vh; min-height: 420px; }
  .hero-copy h1 { letter-spacing: 10px; }
  .hero-cap { letter-spacing: 3px; }
  .chips {                                     /* 色卡行横向滑动 */
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }
  .feat-card { width: 66vw; }                  /* 手机端臻选大卡 */
  .featured-sec .feat-nav { display: none; }   /* 手机直接滑动 */
  #back-colors { display: none; }              /* 手机端不需要侧边锚点 */
  .chips-label { letter-spacing: 2px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .lb-prev, .lb-next { font-size: 26px; padding: 20px 8px; }
  #lightbox .lb-figure img { max-width: 88vw; max-height: 76vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-slide { transition: none; }
  * { transition-duration: .01ms !important; }
}
