/* ==========================================================
   拍照姿势参考 · 日系清新
   设计原则：界面退后，图片在前。米白底、细字、大留白。
   ========================================================== */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #33302b;
  --ink-2: #6e6862;
  --ink-3: #a8a199;
  --line: #eae6de;
  --line-2: #f2efe9;
  --accent: #6e7b68;
  --accent-bg: #eef1ec;
  --radius: 4px;
  --pad: 22px;
  --maxw: 1080px;
  --topbar-h: 54px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.85;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* ── 骨架 / 载入 ───────────────────────────────────────── */
.boot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 70vh;
  color: var(--ink-3);
  font-size: 13px;
  letter-spacing: 0.18em;
}

.boot-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

/* ── 布局容器 ──────────────────────────────────────────── */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.page {
  min-height: 100vh;
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
}

/* ── 顶栏 ──────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
  background: rgba(251, 250, 247, 0.94);
  border-bottom: 1px solid var(--line-2);
  backdrop-filter: saturate(140%) blur(8px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.topbar-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--ink);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-sub {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  white-space: nowrap;
}

.back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-left: -8px;
  color: var(--ink-2);
  border-radius: 50%;
}

.back:active {
  background: var(--line-2);
}

.back svg {
  width: 17px;
  height: 17px;
}

/* ── 首页 前言 ─────────────────────────────────────────── */
.hero {
  padding: 46px 0 30px;
}

.hero h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 400;
  letter-spacing: 0.16em;
  line-height: 1.5;
  text-indent: -0.16em; /* 抵消末字多余字距，视觉更居中 */
}

.hero p {
  margin: 12px 0 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  line-height: 1.9;
}

.hero-meta {
  margin-top: 22px;
  display: flex;
  gap: 18px;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ink-3);
}

.hero-meta b {
  font-weight: 400;
  color: var(--ink-2);
  font-size: 15px;
  letter-spacing: 0.04em;
  margin-right: 3px;
}

/* ── 搜索 ──────────────────────────────────────────────── */
.search {
  position: relative;
  margin: 4px 0 26px;
}

.search input {
  width: 100%;
  height: 42px;
  padding: 0 38px 0 36px;
  font-size: 14px;
  font-family: inherit;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 100px;
  outline: none;
  -webkit-appearance: none;
  transition: border-color 0.2s ease;
}

.search input::placeholder {
  color: var(--ink-3);
  letter-spacing: 0.06em;
}

.search input:focus {
  border-color: var(--accent);
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  border-radius: 50%;
}

.search.has-value .search-clear {
  display: flex;
}

/* ── 标签 ──────────────────────────────────────────────── */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin: 0 calc(var(--pad) * -1) 30px;
  padding: 2px var(--pad) 2px;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  padding: 6px 13px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 100px;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.chip.on,
.chip:active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-bg);
}

.chip em {
  font-style: normal;
  color: var(--ink-3);
  margin-left: 4px;
  font-size: 10px;
}

/* ── 分区小标 ──────────────────────────────────────────── */
.sec {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 6px 0 22px;
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--ink-3);
}

.sec::before,
.sec::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ── 分类卡 ────────────────────────────────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 14px;
  margin-bottom: 44px;
}

.cat-card {
  display: block;
}

.cat-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--line-2);
}

.cat-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.6s ease;
}

.cat-cover img.loaded {
  opacity: 1;
}

.cat-card:active .cat-cover img {
  transform: scale(1.02);
}

.cat-body {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 1px 0;
}

.cat-no {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.cat-name {
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.cat-count {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.cat-desc {
  margin: 2px 0 0;
  padding: 0 1px;
  font-size: 11.5px;
  line-height: 1.7;
  letter-spacing: 0.03em;
  color: var(--ink-3);
}

/* ── 瀑布流 ────────────────────────────────────────────── */
.masonry {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 40px;
}

.masonry-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  display: block;
}

.card-img {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--line-2);
}

.card-img img {
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.card-img img.loaded {
  opacity: 1;
}

.card-cap {
  padding: 8px 1px 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.card-title {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card-n {
  flex: 0 0 auto;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ── 详情 ──────────────────────────────────────────────── */
.detail-head {
  padding: 26px 0 20px;
}

.detail-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.1em;
  line-height: 1.55;
}

.detail-head .kicker {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
}

/* 横向滑动的图集 */
.gallery {
  position: relative;
  margin: 0 calc(var(--pad) * -1) 26px;
}

.slides {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.slides::-webkit-scrollbar {
  display: none;
}

.slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  padding: 0 var(--pad);
}

.slide-inner {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--line-2);
}

.slide-inner img {
  width: 100%;
  height: auto;
  max-height: 76vh;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.slide-inner img.loaded {
  opacity: 1;
}

.gallery-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 26px;
  margin-top: 10px;
}

.dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.2s ease, transform 0.2s ease;
}

.dot.on {
  background: var(--accent);
  transform: scale(1.25);
}

.gal-count {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  display: none;
}

.gal-tip {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin: -6px 0 26px;
}

/* 要点 */
.panel {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.24em;
  color: var(--ink-3);
}

.tips {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: tip;
}

.tips li {
  position: relative;
  counter-increment: tip;
  padding: 0 0 0 26px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.95;
  letter-spacing: 0.03em;
  color: var(--ink);
}

.tips li:last-child {
  margin-bottom: 0;
}

.tips li::before {
  content: counter(tip, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 2.55;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 5px 12px;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  background: var(--accent-bg);
  border-radius: 100px;
}

.src {
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--ink-3);
  line-height: 1.8;
  margin: 0;
}

/* 上一个 / 下一个 */
.pager {
  display: flex;
  gap: 10px;
  margin: 8px 0 30px;
}

.pager a {
  flex: 1;
  min-width: 0;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.2s ease;
}

.pager a:active {
  border-color: var(--accent);
}

.pager span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  margin-bottom: 3px;
}

.pager strong {
  display: block;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pager .next {
  text-align: right;
}

/* ── 空状态 ────────────────────────────────────────────── */
.empty {
  padding: 60px 0 80px;
  text-align: center;
  color: var(--ink-3);
}

.empty p {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.06em;
  line-height: 2;
}

.empty code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  padding: 2px 6px;
  background: var(--line-2);
  border-radius: 3px;
  color: var(--ink-2);
}

/* ── 页脚 ──────────────────────────────────────────────── */
.foot {
  padding: 30px 0 46px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  line-height: 1.9;
  text-align: center;
}

/* ── 宽屏 ──────────────────────────────────────────────── */
@media (min-width: 700px) {
  :root {
    --pad: 32px;
  }

  .hero {
    padding: 64px 0 36px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .cat-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 26px 20px;
  }

  .detail-head {
    padding: 36px 0 24px;
  }

  .detail-head h1 {
    font-size: 27px;
  }

  .slides {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 12px;
    overflow: visible;
  }

  .slide {
    flex: initial;
    padding: 0;
  }

  .gallery {
    margin: 0 0 26px;
  }

  .gallery-bar {
    display: none;
  }

  .gal-tip {
    display: none;
  }
}

@media (min-width: 1000px) {
  .cat-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
