/* ============================================
   胎教故事屋 — 暖米白 v4
   安静、温暖、有层次；优先手机端孕期阅读
   全站唯一强调色：暖豆沙 #a8846b
   ============================================ */

:root {
  /* 底色与文字 */
  --bg: #faf7f2;
  --card: #fffdf9;
  --card-pure: #ffffff;
  --ink: #3d3a36;
  --ink-2: #8a837a;
  --ink-3: #b0a79c;
  --line: #ece5da;
  --line-2: #e2d9cc;

  /* 唯一强调色 */
  --accent: #a8846b;
  --accent-deep: #93725c;
  --accent-bg: rgba(168, 132, 107, .09);
  --accent-line: rgba(168, 132, 107, .32);

  /* 圆角：只允许 9 / 14 两种 */
  --r-btn: 9px;
  --r-card: 14px;

  /* 间距 */
  --sp-title: 8px;
  --sp-card: 16px;
  --sp-gap: 16px;
  --sp-sec: 24px;
  --pad-x: 20px;

  /* 底栏 */
  --nav-h: 56px;
  --nav-h-total: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));

  --serif: Georgia, "Songti SC", "Source Han Serif SC", "Noto Serif SC", serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;

  --shadow-s: 0 1px 2px rgba(120, 100, 80, .04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--nav-h-total);
}

a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--accent-bg); }

.wrap {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

/* 标题统一走衬线 */
h1, h2, h3, .serif {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: .01em;
}

/* ============================================
   顶部导航（桌面用；手机隐藏链接，交给底栏）
   ============================================ */
.nav {
  position: sticky; top: 0; z-index: 90;
  background: rgba(250, 247, 242, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }

.brand { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 17px; font-weight: 600; letter-spacing: .04em; }
.brand-mark {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); opacity: .9;
  flex: none;
}

.nav-links { display: flex; gap: 28px; font-size: 15px; color: var(--ink-2); }
.nav-links a { padding: 4px 0; transition: color .2s; }
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--accent); font-weight: 600; }

/* ============================================
   首屏
   ============================================ */
.hero { padding: 40px 0 28px; }
.hero h1 {
  font-size: 30px;
  line-height: 1.42;
  margin-bottom: var(--sp-title);
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--ink-2); font-size: 15.5px; line-height: 1.75; margin-bottom: var(--sp-sec); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 20px; border-radius: var(--r-btn);
  font-size: 15px; transition: all .2s; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); }
.btn-ghost { border-color: var(--line-2); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--accent-line); color: var(--accent); }

/* ============================================
   区块通用
   ============================================ */
.sec { padding: var(--sp-sec) 0; }
.sec-head { margin-bottom: var(--sp-gap); }
.sec-title { font-size: 20px; line-height: 1.4; }
.sec-sub { color: var(--ink-2); font-size: 14.5px; margin-top: 4px; line-height: 1.7; }
.sec-more { display: inline-block; margin-top: 12px; font-size: 14px; color: var(--accent); }

/* ============================================
   首页：孕周（大卡 + 横向 chip）
   ============================================ */
.week-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--sp-card);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.week-card .wc-left { min-width: 0; }
.week-num {
  font-family: var(--serif);
  font-size: 26px; font-weight: 600; line-height: 1.3;
  color: var(--ink);
}
.week-num.is-empty { font-size: 20px; color: var(--ink-2); }
.week-hint { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.week-cta {
  flex: none;
  padding: 9px 16px; border-radius: var(--r-btn);
  background: var(--accent); color: #fff; font-size: 14px;
  white-space: nowrap;
}
.week-cta:hover { background: var(--accent-deep); }

.week-more {
  display: block; margin-top: 12px;
  font-size: 14px; color: var(--ink-2);
}
.week-more:hover { color: var(--accent); }

.week-strip {
  display: flex; gap: 8px;
  margin-top: 12px; padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.week-strip::-webkit-scrollbar { display: none; }
.week-strip[hidden] { display: none; }

.ws-chip {
  flex: none;
  min-width: 62px;
  padding: 9px 12px;
  border-radius: var(--r-card);
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink-3);
  font-size: 14px;
  text-align: center;
  scroll-snap-align: start;
  transition: all .18s;
}
.ws-chip.has {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600;
}
.ws-chip.has:hover { background: var(--accent-deep); }
.ws-chip:not(.has) { border-style: dashed; cursor: default; }
.ws-chip.on { box-shadow: 0 0 0 2px var(--accent-bg), 0 0 0 1px var(--accent); }

/* ============================================
   卡片（故事 / 分类统一规格）
   ============================================ */
.card {
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--sp-card);
  transition: border-color .2s, box-shadow .2s;
}
.card:hover { border-color: var(--line-2); box-shadow: var(--shadow-s); }

.card h3, .card-title {
  font-family: var(--serif);
  font-size: 19px; font-weight: 600; line-height: 1.45;
}
.card p, .card-desc {
  color: var(--ink-2); font-size: 14.5px; line-height: 1.7;
  margin-top: var(--sp-title);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { font-size: 12.5px; color: var(--ink-3); margin-top: var(--sp-title); }
.card-link {
  font-size: 14px; color: var(--accent);
  margin-top: 12px; align-self: flex-start;
}
.card-link:hover { color: var(--accent-deep); }

.card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tag {
  font-size: 12px; color: var(--ink-2);
  background: var(--accent-bg);
  padding: 2px 8px; border-radius: 6px;
}

.grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-gap); }
.grid-single { grid-template-columns: minmax(280px, 420px); }

/* 一句话补充（替代占位卡） */
.grid-note { color: var(--ink-3); font-size: 14px; margin-top: 12px; }

/* ============================================
   分类卡（首页 / 分类总览）
   ============================================ */
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-gap); }
.cat-item {
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 84px;
  padding: var(--sp-card);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  transition: border-color .2s;
}
.cat-item:hover { border-color: var(--accent-line); }
.cat-name { font-family: var(--serif); font-size: 16px; font-weight: 600; }
.cat-count { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.cat-item.is-empty { background: transparent; border-style: dashed; }
.cat-item.is-empty .cat-name { color: var(--ink-2); }

/* ============================================
   页面标题 / 筛选
   ============================================ */
.page-head { padding: 32px 0 20px; }
.page-head h1 { font-size: 26px; line-height: 1.4; }
.page-head p { color: var(--ink-2); font-size: 15px; margin-top: var(--sp-title); line-height: 1.75; }

.search-box { position: relative; margin-bottom: var(--sp-gap); }
.search-box input {
  width: 100%; padding: 12px 14px 12px 40px;
  border-radius: var(--r-btn); border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); font-size: 16px;
  outline: none; transition: border-color .2s;
}
.search-box input::placeholder { color: var(--ink-3); }
.search-box input:focus { border-color: var(--accent-line); }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); opacity: .3; }

.filters { margin-bottom: var(--sp-sec); }
.filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.filter-label { font-size: 13px; color: var(--ink-3); margin-right: 2px; }
.chip {
  padding: 7px 13px; border-radius: var(--r-card);
  font-size: 13.5px; border: 1px solid var(--line-2);
  background: transparent; color: var(--ink-2);
  transition: all .18s;
}
.chip:hover { border-color: var(--accent-line); color: var(--ink); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.chip.dim { opacity: .45; }

.week-select {
  appearance: none; -webkit-appearance: none;
  padding: 7px 30px 7px 13px;
  border-radius: var(--r-card); border: 1px solid var(--line-2);
  background: var(--card) url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a837a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--ink-2); font-size: 13.5px; outline: none;
  max-width: 150px;
}

/* 空状态 */
.empty-state { text-align: center; padding: 48px 8px; }
.empty-state h3 { font-size: 17px; margin-bottom: var(--sp-title); }
.empty-state p { color: var(--ink-2); font-size: 14.5px; line-height: 1.75; margin-bottom: 18px; }

/* ============================================
   阅读页
   ============================================ */
.reader { padding-top: 24px; padding-bottom: 40px; max-width: 760px; margin: 0 auto; }
.crumb { font-size: 13px; color: var(--ink-3); margin-bottom: 18px; }
.crumb a:hover { color: var(--accent); }
.crumb span { margin: 0 6px; opacity: .5; }

.reader-head { margin-bottom: var(--sp-sec); }
.reader-head .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.reader-head h1 { font-size: 25px; line-height: 1.45; }
.reader-meta { font-size: 13px; color: var(--ink-2); margin-top: var(--sp-title); }

.reader-tools {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: var(--sp-gap);
  padding-top: var(--sp-gap); border-top: 1px solid var(--line);
}
.fav-btn { font-size: 14px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.fav-btn:hover { color: var(--accent); }
.fav-btn.on { color: var(--accent); font-weight: 600; }

.fontsize-bar { display: flex; align-items: center; gap: 8px; }
.fontsize-bar span { font-size: 13px; color: var(--ink-3); }
.fs-btn {
  width: 30px; height: 30px; border-radius: var(--r-btn);
  border: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2);
  display: grid; place-items: center;
}
.fs-btn:hover { border-color: var(--accent-line); color: var(--accent); }

.reader-body { font-size: 17px; line-height: 1.8; color: var(--ink); }
.reader-body p { margin-bottom: 1em; }

.tip-box {
  margin: var(--sp-sec) 0;
  padding: var(--sp-card);
  background: var(--accent-bg);
  border-radius: var(--r-card);
}
.tip-box .label { font-size: 13px; color: var(--accent); margin-bottom: var(--sp-title); font-weight: 600; }
.tip-box p { font-size: 15px; color: var(--ink); line-height: 1.8; }

.pager { display: grid; gap: var(--sp-gap); margin-top: var(--sp-sec); }
.pager a {
  padding: var(--sp-card);
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card);
}
.pager a:hover { border-color: var(--accent-line); }
.pager .dir { font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }
.pager .ttl { font-family: var(--serif); font-size: 16px; font-weight: 600; }

.progress-bar {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--accent); z-index: 120;
}

/* ============================================
   指南页
   ============================================ */
.prose { max-width: 720px; margin: 0 auto; }
.prose h2 {
  font-size: 19px; margin: var(--sp-sec) 0 var(--sp-title);
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.prose h2:first-of-type { margin-top: 0; }
.prose p { color: var(--ink-2); font-size: 16px; line-height: 1.8; margin-bottom: 1em; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul { margin: 0 0 1em 20px; color: var(--ink-2); }
.prose li { font-size: 16px; line-height: 1.8; margin-bottom: 6px; }
.qa { border-top: 1px solid var(--line); padding: 16px 0; margin-top: 0; }
.qa h3 { font-size: 16px; margin-bottom: 4px; }
.qa p { font-size: 15px; margin: 0; }

/* ============================================
   我的页
   ============================================ */
.me-block {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: var(--sp-card);
  margin-bottom: var(--sp-gap);
}
.me-block h2 { font-size: 17px; margin-bottom: 6px; }
.me-block p { color: var(--ink-2); font-size: 14.5px; line-height: 1.7; }
.me-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.me-week { font-family: var(--serif); font-size: 22px; font-weight: 600; }

/* ============================================
   页脚 + 底部固定导航
   ============================================ */
.footer { padding: var(--sp-sec) 0 20px; border-top: 1px solid var(--line); margin-top: var(--sp-sec); }
.footer p { font-size: 13px; color: var(--ink-3); text-align: center; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 110;
  height: var(--nav-h-total);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; align-items: center; justify-content: center;
  background: rgba(250, 247, 242, .96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.bottom-nav-inner { display: flex; width: 100%; max-width: 480px; height: var(--nav-h); }
.bottom-nav a {
  flex: 1; display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--ink-2);
  transition: color .2s;
}
.bottom-nav a.active { color: var(--accent); font-weight: 600; }

/* ============================================
   平板 / 桌面
   ============================================ */
@media (min-width: 560px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .grid-single { grid-template-columns: minmax(280px, 420px); }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 860px) {
  body { font-size: 16.5px; }
  .hero { padding: 56px 0 36px; }
  .hero h1 { font-size: 38px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .grid-single { grid-template-columns: minmax(280px, 420px); }
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .pager { grid-template-columns: 1fr 1fr; }
  .reader-head h1 { font-size: 29px; }
  .sec-title { font-size: 22px; }
  .week-num { font-size: 30px; }
}

/* 手机端：顶部导航只留品牌，导航交给底栏 */
@media (max-width: 559px) {
  .nav-links { display: none; }
}
