/* ==========================================================================
   旅拍服装图库 · 样式表
   设计基调：米白纸感 + 墨色文字 + 暖褐点缀，衬线标题，图片优先
   ========================================================================== */

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #221e1a;
  --ink-2: #4b443c;
  --muted: #93897b;
  --line: #ece3d8;
  --accent: #9c6b4d;
  --accent-soft: #f4ebe1;
  --gold: #c0a06a;

  --gap: 3px;
  --cols: 3;
  --topbar-h: 52px;
  --radius: 16px;
  --shadow: 0 8px 28px rgba(58, 42, 28, 0.09);
  --shadow-sm: 0 2px 10px rgba(58, 42, 28, 0.06);

  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

/* 让 hidden 属性优先于 .meta-row 等 display 规则 */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

body.lock { overflow: hidden; }

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  color: #fff;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(20, 15, 10, 0.42), transparent);
  opacity: 1;
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}

.topbar.solid {
  background: rgba(250, 247, 242, 0.9);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--line);
}
.topbar.solid::before { opacity: 0; }

.topbar-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.topbar.solid .brand { opacity: 1; transform: none; }

.brand-name {
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.12em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.16em;
  white-space: nowrap;
}

.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}
.icon-btn:active { transform: scale(0.92); }
.topbar.solid .icon-btn { background: var(--accent-soft); }

/* ---------- 横幅 ---------- */
.hero {
  position: relative;
  height: min(76vh, 640px);
  min-height: 360px;
  overflow: hidden;
  background: #ded4c7;
  touch-action: pan-y;
}

.hero-track {
  display: flex;
  height: 100%;
  will-change: transform;
  transition: transform 0.55s var(--ease);
}
.hero-track.dragging { transition: none; }

.hero-slide {
  flex: 0 0 100%;
  height: 100%;
  position: relative;
}
.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
}

/* 图片轻微上移，滚动时更有层次 */
.hero.is-scrolled .hero-track { transform: translateY(var(--parallax, 0)); }

.hero-overlay {
  position: absolute;
  inset: auto 0 0;
  padding: 90px 22px 34px;
  color: #fff;
  background: linear-gradient(
    to top,
    rgba(24, 18, 12, 0.78) 0%,
    rgba(24, 18, 12, 0.42) 42%,
    rgba(24, 18, 12, 0) 100%
  );
  pointer-events: none;
}

.hero-overlay-inner {
  max-width: 876px;
  margin: 0 auto;
}

@media (min-width: 720px) {
  .hero-overlay { padding: 120px 26px 40px; }
}

.hero-kicker {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  opacity: 0.82;
}

.hero-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(25px, 7vw, 36px);
  font-weight: 400;
  letter-spacing: 0.1em;
  line-height: 1.28;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.28);
}

.hero-sub {
  margin: 10px 0 0;
  font-size: 13px;
  letter-spacing: 0.16em;
  opacity: 0.86;
}

.hero-dots {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 6px;
  z-index: 2;
}
.hero-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transition: width 0.3s var(--ease), background 0.3s var(--ease);
}
.hero-dots i.on { width: 16px; border-radius: 3px; background: #fff; }

/* ---------- 内容容器 ---------- */
.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 12px;
}

/* ---------- 信息卡 ---------- */
.info-card {
  position: relative;
  z-index: 5;
  margin: -30px 12px 0;
  padding: 20px 18px 18px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.info-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.info-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.45;
  flex: 1;
}

.info-count {
  flex: 0 0 auto;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.meta {
  margin: 14px 0 0;
  display: grid;
  gap: 9px;
  font-size: 13px;
  color: var(--ink-2);
}
.meta-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  line-height: 1.55;
}
.meta-row .icon { flex: 0 0 auto; margin-top: 2px; color: var(--accent); width: 15px; height: 15px; }
.meta-row span { flex: 1; min-width: 0; }
.meta-row a { border-bottom: 1px solid var(--line); }

.desc {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.85;
  color: var(--ink-2);
  white-space: pre-line;
}
.desc.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.desc-toggle {
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}
.tags span {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ---------- 筛选栏 ---------- */
.filterbar {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 12px;
  background: var(--bg);
  max-width: 900px;
  margin-inline: auto;
}

/* 底部渐隐，内容滑到筛选栏下方时不会出现硬边 */
.filterbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 14px;
  background: linear-gradient(to bottom, var(--bg), rgba(250, 247, 242, 0));
  pointer-events: none;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  padding-bottom: 2px;
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 40px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 40px), transparent 100%);
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-2);
  font-size: 13px;
  letter-spacing: 0.05em;
  transition: all 0.22s var(--ease);
  white-space: nowrap;
}
.chip .n { margin-left: 5px; font-size: 11px; color: var(--muted); }
.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.chip.on .n { color: rgba(255, 255, 255, 0.6); }

.col-btn {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* 在按钮左侧铺一段与页面同色的遮罩，避免被裁切的分类标签露出半个字 */
.col-btn::before {
  content: "";
  position: absolute;
  left: -18px;
  top: -8px;
  bottom: -8px;
  width: 18px;
  background: linear-gradient(to right, rgba(250, 247, 242, 0), var(--bg) 70%);
  pointer-events: none;
}
.col-btn svg { width: 14px; height: 14px; }

/* ---------- 图片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--gap);
  margin-top: 4px;
}

.card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 2px;
  background: #ece5da;
  padding: 0;
}
.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.5s var(--ease), transform 0.7s var(--ease);
}
.card img.loaded { opacity: 1; transform: scale(1); }
.card:active img { transform: scale(1.03); }

.card.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, #ece5da 30%, #f6f0e7 50%, #ece5da 70%);
  background-size: 220% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer {
  from { background-position: 160% 0; }
  to { background-position: -60% 0; }
}

.card .badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(20, 15, 10, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.06em;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

@media (hover: hover) {
  .card:hover img { transform: scale(1.05); }
  .card:hover .badge { opacity: 1; }
}

/* ---------- 空状态 / 加载失败 ---------- */
.state {
  padding: 64px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
  letter-spacing: 0.04em;
}
.state strong {
  display: block;
  margin-bottom: 6px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: 0.1em;
}
.state code {
  display: inline-block;
  margin-top: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 44px;
  padding: 30px 22px calc(34px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  line-height: 2;
}
.footer .f-brand {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-2);
  letter-spacing: 0.2em;
  margin-bottom: 6px;
}
.footer .f-links { display: flex; justify-content: center; gap: 16px; margin-top: 4px; }
.footer a { border-bottom: 1px solid var(--line); }

/* ---------- 全屏查看器 ---------- */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #0b0a09;
  color: #fff;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s var(--ease);
}
.viewer.open { opacity: 1; pointer-events: auto; }

.viewer-top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
}
.viewer-count {
  font-size: 13px;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.85);
  font-variant-numeric: tabular-nums;
}
.viewer-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.2s var(--ease);
}
.viewer-btn:active { background: rgba(255, 255, 255, 0.22); }
.viewer-btn .icon { width: 20px; height: 20px; }

.viewer-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}
.viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  will-change: transform;
  transform-origin: center center;
  transition: transform 0.28s var(--ease), opacity 0.2s var(--ease);
  user-select: none;
  -webkit-user-drag: none;
}
.viewer-img.instant { transition: none; }
.viewer-img.switching { opacity: 0; }

.viewer-bottom {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
}
.viewer-caption {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-open {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  padding-bottom: 2px;
}

/* 桌面端左右切换箭头 */
.viewer-arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: none;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-top: -23px;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.2s var(--ease);
}
.viewer-arrow:hover { background: rgba(255, 255, 255, 0.22); }
.viewer-arrow.prev { left: 18px; }
.viewer-arrow.next { right: 18px; }
.viewer-arrow[hidden] { display: none !important; }

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(40px + env(safe-area-inset-bottom));
  z-index: 200;
  transform: translate(-50%, 12px);
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(28, 24, 20, 0.9);
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 回到顶部 ---------- */
.to-top {
  position: fixed;
  right: 14px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 50;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- 大屏适配 ---------- */
@media (min-width: 720px) {
  :root { --gap: 4px; }
  body { font-size: 15.5px; }
  .hero { height: min(58vh, 560px); min-height: 420px; }
  .info-card { margin: -34px auto 0; padding: 26px 26px 22px; max-width: 876px; }
  .info-title { font-size: 23px; }
  .grid { --cols: 4; }
  .viewer-arrow { display: grid; }
}

@media (min-width: 1024px) {
  .grid { --cols: 4; }
}

/* 尊重「减少动效」偏好 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
}
