/* ============================================
   m.xingjia.cn 移动端样式
   方案A+C：瀑布流首页 + 全屏竖滑/横滑查看器
   ============================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0a;
  --bg-card: #141414;
  --bg-elevated: #1a1a1a;
  --text: #e8e0d4;
  --text-secondary: #a89f90;
  --text-muted: #6b6357;
  --accent: #8B7355;
  --accent-light: #a0876a;
  --border: #2a2520;
  --frame-color: #8B7355;
  --shadow: 0 2px 12px rgba(0,0,0,0.5);
  --radius: 8px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- 底部导航栏 ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(56px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(10,10,10,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 11px;
  transition: color 0.2s;
}

.bottom-nav-item.active { color: var(--accent-light); }
.bottom-nav-item:active { color: var(--accent); }

.bottom-nav-icon { font-size: 22px; line-height: 1; }
.bottom-nav-label { font-size: 10px; letter-spacing: 0.05em; }

/* ============================================
   首页：瀑布流
   ============================================ */

.page-home {
  min-height: 100vh;
  padding-bottom: 60px;
}

/* Hero 区 */
.hero {
  padding: calc(60px + var(--safe-top)) 20px 32px;
  text-align: center;
  background: linear-gradient(180deg, #1a1510 0%, var(--bg) 100%);
}

.hero-eyebrow {
  display: block;
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.hero-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  color: var(--text);
}

.hero-link {
  color: var(--text);
  text-decoration: none;
  margin: 0 6px;
}

.hero-link:active {
  opacity: 0.6;
}

.hero-link-ink {
  color: var(--text-secondary);
}

.hero-motto {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 280px;
  margin: 0 auto;
}

/* 展厅标签栏 */
.hall-tabs {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10,10,10,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.hall-tabs::-webkit-scrollbar { display: none; }

.hall-tabs-inner {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  white-space: nowrap;
}

.hall-tab {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all 0.2s;
  flex-shrink: 0;
}

.hall-tab.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

/* 展厅描述 */
.hall-description {
  padding: 16px 20px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  text-align: center;
  max-width: 360px;
  margin: 0 auto;
}

/* 作品列表（单列，宽度对齐） */
.masonry {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.masonry-item {
  margin-bottom: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  cursor: pointer;
  position: relative;
  transition: transform 0.15s;
}

.masonry-item:active { transform: scale(0.98); }

.masonry-item img {
  width: 100%;
  height: auto;
  display: block;
  background: #1a1a1a;
}

.masonry-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 14px 10px;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.8) 100%);
  pointer-events: none;
}

.masonry-item-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}

.masonry-item-meta {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
}

/* 加载指示器 */
.load-indicator {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ============================================
   全屏查看器：竖屏上下滑 / 横屏左右滑
   ============================================ */

.page-viewer {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
}

/* 竖屏：上下滑动 */
.viewer-scroll {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.viewer-scroll::-webkit-scrollbar { display: none; }

/* 横屏：左右滑动 */
@media (orientation: landscape) {
  .viewer-scroll {
    overflow-y: hidden;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    display: flex;
  }
}

.viewer-slide {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

@media (orientation: landscape) {
  .viewer-slide {
    width: 100vw;
    height: 100%;
    flex-shrink: 0;
  }
}

/* 作品+边框容器 */
.artwork-frame {
  position: relative;
  border: 2px solid var(--frame-color);
  box-shadow: 0 4px 30px rgba(0,0,0,0.6), 0 0 0 1px rgba(139,115,85,0.2);
  background: #111;
  box-sizing: border-box;
}

.artwork-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 卡纸层（render_form.padding > 0 时启用） */
.artwork-mat {
  background: #f5f3ee;
  box-sizing: border-box;
  line-height: 0;
}

.artwork-mat img {
  width: 100%;
  height: auto;
}

/* 竖屏作品尺寸 */
@media (orientation: portrait) {
  .artwork-frame {
    max-width: 92vw;
    max-height: 72vh;
  }

  /* 横幅题跋式布局：作品占满宽度，上下放文字 */
  .viewer-slide-scroll {
    flex-direction: column;
    justify-content: center;
    padding: calc(48px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
    gap: 16px;
  }

  .viewer-slide-scroll .artwork-frame {
    max-width: 94vw;
    max-height: 50vh;
    width: 100%;
  }

  .viewer-scroll-top {
    text-align: center;
    flex-shrink: 0;
  }

  .viewer-scroll-title {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    letter-spacing: 0.05em;
  }

  .viewer-scroll-poem {
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    font-style: italic;
    line-height: 1.6;
  }

  .viewer-scroll-poem-source {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    margin-top: 2px;
  }

  .viewer-scroll-bottom {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    text-align: center;
    flex-shrink: 0;
    letter-spacing: 0.05em;
  }
}

/* 横屏作品尺寸：作品优先占满横向视口，文字改为底部覆盖 */
@media (orientation: landscape) {
  .artwork-frame {
    max-height: 84vh;
    max-width: 94vw;
  }
}

/* 顶部进度条 */
.viewer-progress {
  position: fixed;
  top: var(--safe-top);
  left: 0;
  right: 0;
  z-index: 210;
  padding: 8px 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 12px;
}

.viewer-back {
  font-size: 20px;
  color: #fff;
  padding: 4px 8px;
}

.viewer-progress-text {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  flex: 1;
}

.viewer-progress-bar {
  position: fixed;
  top: calc(40px + var(--safe-top));
  left: 16px;
  right: 16px;
  height: 2px;
  background: rgba(255,255,255,0.15);
  z-index: 210;
  border-radius: 1px;
}

.viewer-progress-fill {
  height: 100%;
  background: var(--accent-light);
  border-radius: 1px;
  transition: width 0.3s;
}

/* 底部文字区（竖屏）— 紧贴作品下方 */
.viewer-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 20px calc(16px + var(--safe-bottom));
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.85) 40%);
  pointer-events: none;
}

.viewer-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.viewer-meta {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 6px;
}

.viewer-poem {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  font-style: italic;
  line-height: 1.5;
}

.viewer-poem-source {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

/* 横屏文字区：覆盖在底部，不占用作品横向展示空间 */
@media (orientation: landscape) {
  .viewer-info {
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px 24px 16px;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.86) 45%);
  }

  .viewer-title { font-size: 18px; }
  .viewer-meta { font-size: 12px; margin-bottom: 4px; }
  .viewer-poem { font-size: 12px; }
}

/* 右侧浮动操作栏 */
.viewer-actions {
  position: absolute;
  right: 12px;
  bottom: calc(100px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 5;
}

.viewer-action-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  transition: all 0.2s;
}

.viewer-action-btn:active {
  background: rgba(255,255,255,0.25);
  transform: scale(0.9);
}

.viewer-action-btn.liked {
  color: #e74c3c;
}

.viewer-action-count {
  position: absolute;
  bottom: -16px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}

@media (orientation: landscape) {
  .viewer-actions {
    right: calc(35vw + 12px);
    bottom: 30px;
    flex-direction: row;
  }
}

/* 底部抽屉 */
.viewer-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 75vh;
  background: var(--bg-elevated);
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 220;
  padding: 20px 24px calc(24px + var(--safe-bottom));
  overflow-y: auto;
}

.viewer-drawer.open { transform: translateY(0); }

.viewer-drawer-handle {
  width: 36px;
  height: 4px;
  background: var(--text-muted);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.viewer-drawer-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.viewer-drawer-meta {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.viewer-drawer-section {
  margin-bottom: 20px;
}

.viewer-drawer-label {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.viewer-drawer-poem {
  font-size: 16px;
  line-height: 2;
  color: var(--text);
  white-space: pre-wrap;
}

.viewer-drawer-poem-source {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.viewer-drawer-text {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.viewer-drawer-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 22px;
  color: var(--text-muted);
  padding: 4px 8px;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 215;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.drawer-overlay.open { opacity: 1; pointer-events: auto; }

/* ============================================
   文化卡片流
   ============================================ */

.page-culture {
  min-height: 100vh;
  padding: calc(56px + var(--safe-top)) 16px 60px;
}

.page-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: rgba(10,10,10,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-back {
  font-size: 20px;
  color: var(--text);
  padding: 4px 8px;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
}

.culture-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.culture-card-header {
  padding: 20px;
}

.culture-card-eyebrow {
  font-size: 12px;
  color: var(--accent-light);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.culture-card-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.culture-card-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.culture-card-summary {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.culture-card-expand {
  padding: 0 20px 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.culture-card.expanded .culture-card-expand {
  max-height: 2000px;
}

.culture-card-section {
  margin-bottom: 16px;
}

.culture-card-section h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.culture-card-section p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.culture-card-quote {
  border-left: 2px solid var(--accent);
  padding-left: 12px;
  margin-bottom: 12px;
}

.culture-card-quote-text {
  font-size: 15px;
  font-style: italic;
  line-height: 1.8;
  color: var(--text);
}

.culture-card-quote-source {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.culture-card-toggle {
  padding: 8px 20px 16px;
  font-size: 13px;
  color: var(--accent-light);
}

/* ============================================
   艺术家页
   ============================================ */

.page-artist {
  min-height: 100vh;
  padding: calc(56px + var(--safe-top)) 20px 60px;
}

.artist-hero {
  text-align: center;
  padding: 32px 0 40px;
}

.artist-hero-eyebrow {
  font-size: 12px;
  color: var(--accent-light);
  letter-spacing: 0.15em;
  margin-bottom: 12px;
}

.artist-hero-heading {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.4;
}

.artist-hero-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 320px;
  margin: 0 auto;
}

.artist-section {
  margin-bottom: 40px;
}

.artist-section-eyebrow {
  font-size: 12px;
  color: var(--accent-light);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.artist-section-heading {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

.artist-bio {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* 时间线 */
.timeline {
  position: relative;
  padding-left: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}

.timeline-year {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-light);
  margin-bottom: 2px;
}

.timeline-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 笔墨之道 */
.practice-item {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}

.practice-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.practice-desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* 收藏服务 */
.service-item {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
}

.service-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.service-desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* 联系方式 */
.contact-block {
  text-align: center;
  padding: 24px;
  background: var(--bg-card);
  border-radius: var(--radius);
}

.contact-heading {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.contact-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.contact-email {
  font-size: 16px;
  color: var(--accent-light);
  text-decoration: none;
}

.contact-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
}

/* 文化链接 */
.culture-link {
  display: block;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: background 0.2s;
}

.culture-link:active { background: var(--bg-elevated); }

.culture-link-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.culture-link-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}
