/* ============================================================
   screen.css — 一屏一章
   章节页不再纵向滚动：整页固定为「左侧章号 + 右侧展台 + 底部章轨」，
   所有内容在 100dvh 内排完，翻章靠底部章轨 / 左右键 / INDEX。

   结构：
     body[data-chapter] > .view > main
       ├─ .chapter-hero         左栏：章号、标题、导语、注释
       ├─ .chapter-body         右栏：本页展台（每章一套排布）
       └─ .chapterbar           底部：12 段刻度 + 前/后章
   ============================================================ */

:root {
  --id-col: clamp(292px, 29vw, 440px);
  --bar-h: 52px;
}

/* ------------------------------------------------------------
   一、全局：整站不再有纵向滚动
   ------------------------------------------------------------ */

html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

/* 原来的 body 是贴底 flex 布局，一屏模式改回普通块级，高度交给 .site / #main */
body {
  display: block;
  min-height: 0;
}

body > main {
  flex: none;
}

body[data-chapter] .read-bar,
body[data-chapter] .foot {
  display: none;
}

/* 没有滚动，导航栏直接常驻描边，不用等 is-stuck */
body[data-chapter] .nav {
  background: var(--paper);
  border-bottom-color: var(--line);
}

/* ------------------------------------------------------------
   二、章节页骨架
   ------------------------------------------------------------ */

/* 左栏标题块已移除：章节页改为整幅单栏，版块名放在顶栏左侧标签 */
body[data-chapter] > .view > main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) var(--bar-h);
  height: 100dvh;
  padding-top: var(--nav-h);
  overflow: hidden;
}

/* 左栏底部的一排氛围图：填进删掉简介后空出的区域，不占额外高度 */
.hero-shots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 clamp(12px, 2vh, 22px);
  padding: 0;
}

.hero-shots__cell {
  display: block;
  width: 100%;
  height: clamp(78px, 13vh, 148px);
  object-fit: cover;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.07), 0 10px 24px -16px rgb(0 0 0 / 0.9);
  filter: brightness(0.82) saturate(0.9);
  transition: filter var(--t2) var(--ease), transform var(--t2) var(--ease);
}

.hero-shots__cell:hover {
  filter: brightness(1) saturate(1);
  transform: translateY(-2px);
}

/* ---------------- 右栏展台 ---------------- */

body[data-chapter] .chapter-body {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  /* 左栏删掉后版面变宽，纵向改为撑满分布，避免内容缩在中间、上下大片留白 */
  justify-content: space-evenly;
  gap: clamp(12px, 2vh, 22px);
  min-height: 0;
  max-width: none;
  margin: 0;
  /* 左右内边距对称：单栏之后内容（含下方居中的按钮）才真的居中 */
  padding: clamp(20px, 4vh, 52px) var(--pad) clamp(18px, 3.2vh, 40px);
  overflow: hidden;
}

body[data-chapter] .chapter-body > * {
  min-width: 0;
}

/* 展台里的列表统一收一档，一屏才排得下 */
body[data-chapter] .list__row {
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 16px;
  padding: clamp(10px, 1.9vh, 18px) 0;
}

body[data-chapter] .list__date {
  font-size: 10px;
  letter-spacing: 0.12em;
}

body[data-chapter] .list__title {
  font-size: clamp(14px, 1.1vw, 17px);
}

body[data-chapter] .list__meta {
  font-size: 11px;
}

/* ------------------------------------------------------------
   三、底部章轨
   ------------------------------------------------------------ */

.chapterbar {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-width: 0;
  padding: 0 var(--pad);
  border-top: 1px solid var(--line);
  background: var(--paper);
  font-family: var(--font-latin);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.chapterbar__ticks {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chapterbar__tick {
  position: relative;
  display: block;
  width: clamp(16px, 1.6vw, 24px);
  height: var(--bar-h);
}

.chapterbar__tick::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1px;
  height: 9px;
  background: var(--line);
  transform: translate(-50%, -50%);
  transition: height var(--t1) var(--ease), background-color var(--t1) var(--ease);
}

.chapterbar__tick:hover::before {
  height: 16px;
  background: var(--ink);
}

.chapterbar__tick.is-on::before {
  height: 20px;
  background: var(--ember);
}

.chapterbar__jumps {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.6vw, 40px);
  min-width: 0;
}

.chapterbar__jump {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  transition: color var(--t1) var(--ease);
}

.chapterbar__jump b {
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--ink-2);
  transition: color var(--t1) var(--ease);
}

.chapterbar__jump small {
  font-family: var(--font-cn);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted-2);
}

.chapterbar__jump:hover {
  color: var(--ink);
}

.chapterbar__jump:hover b {
  color: var(--ember);
}

.chapterbar__jump svg {
  width: 13px;
  height: 13px;
  flex: none;
}

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

/* ------------------------------------------------------------
   四、逐章展台
   ------------------------------------------------------------ */

/* ---- 01 MUSIC · 唱片架 ---- */
/* 唱片放大一档：横向按视口宽、纵向按视口高取小值，保证矮屏也不溢出 */
body[data-chapter="music"] .rail {
  --sleeve: clamp(180px, min(24vw, 34vh), 330px);
  /* 整幅独占，扇形可以铺开 */
  --spread: 0.62;
  --stack: 0.6;
}

body[data-chapter="music"] .rail__stage {
  height: calc(var(--sleeve) * 1.28);
}

body[data-chapter="music"] .rail__caption {
  margin-top: clamp(8px, 1.6vh, 16px);
}

body[data-chapter="music"] .rail__controls {
  margin-top: clamp(10px, 1.8vh, 18px);
}

/* ---- 02 FITNESS · 三项 PR + 最近训练 ---- */
body[data-chapter="fitness"] .stats {
  padding-bottom: clamp(14px, 2.2vh, 26px);
}

body[data-chapter="fitness"] .list {
  align-content: center;
}

body[data-chapter="fitness"] .list__row {
  padding: clamp(14px, 2.6vh, 28px) 0;
}

/* ---- 03 MOVIES · 六格海报墙（三列两行，按高度撑满） ---- */
body[data-chapter="movies"] .grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(12px, 1.4vw, 24px);
  align-content: center;
}

body[data-chapter="movies"] .card {
  display: flex;
  flex-direction: column;
}

body[data-chapter="movies"] .media {
  aspect-ratio: 4 / 5;
}

body[data-chapter="movies"] .card__cat {
  margin-top: clamp(10px, 1.6vh, 16px);
  font-size: 9px;
  letter-spacing: 0.14em;
}

body[data-chapter="movies"] .card__title {
  margin-top: 6px;
  font-size: clamp(12px, 0.95vw, 15px);
  line-height: 1.4;
}

@media (min-width: 901px) {
  body[data-chapter="movies"] .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: clamp(16px, 1.8vw, 30px);
    height: 100%;
    min-height: 0;
    align-content: stretch;
  }

  body[data-chapter="movies"] .card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 0;
    text-align: center;
  }

  body[data-chapter="movies"] .media {
    flex: 1 1 auto;
    width: auto;
    max-width: 100%;
    min-height: 0;
    aspect-ratio: 4 / 5;
  }
}

/* ---- 04 PEOPLE · 四格人物 ---- */
body[data-chapter="people"] .grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 34px);
  align-content: center;
}

body[data-chapter="people"] .card {
  display: flex;
  flex-direction: column;
}

body[data-chapter="people"] .media {
  aspect-ratio: 4 / 5;
}

body[data-chapter="people"] .card__cat {
  margin-top: clamp(10px, 1.6vh, 16px);
  font-size: 9px;
}

body[data-chapter="people"] .card__title {
  margin-top: 6px;
  font-size: clamp(14px, 1.15vw, 17px);
}

body[data-chapter="people"] .now__meta {
  margin-top: 5px;
  font-size: 11px;
}

/* ---- 06 ART · 三列两行图片墙 ---- */
body[data-chapter="art"] .masonry {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 1.2vw, 18px);
  column-count: auto;
  column-gap: 0;
  height: 100%;
  min-height: 0;
}

body[data-chapter="art"] .masonry > * {
  margin-bottom: 0;
  break-inside: auto;
}

body[data-chapter="art"] .masonry .media {
  height: 100%;
  aspect-ratio: auto;
}

/* ---- 07 TRAVEL · 地图 + 行程 ---- */
body[data-chapter="travel"] .chapter-body {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 56px);
  align-items: center;
}

body[data-chapter="travel"] .map {
  width: 100%;
  height: auto;
  max-height: 100%;
  aspect-ratio: 4 / 3;
  align-self: center;
}

body[data-chapter="travel"] .list__row {
  padding: clamp(14px, 2.8vh, 30px) 0;
}

/* ---- 08 FOOD · 数字 / 口味 / 榜单 ---- */
body[data-chapter="food"] .chapter-body {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  grid-template-rows: auto auto;
  align-content: center;
  column-gap: clamp(24px, 3vw, 60px);
  row-gap: clamp(14px, 2.4vh, 28px);
}

body[data-chapter="food"] .stats {
  grid-column: 1 / -1;
  grid-row: 1;
  padding-bottom: clamp(12px, 2vh, 22px);
}

body[data-chapter="food"] .chapter-body > div:nth-child(2) {
  grid-column: 1;
  grid-row: 2;
  align-self: center;
}

body[data-chapter="food"] .list {
  grid-column: 2;
  grid-row: 2;
  align-content: center;
}

/* ---- 09 MOMENTS · 一大四小 ---- */
body[data-chapter="moments"] .masonry {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 1.2vw, 18px);
  column-count: auto;
  column-gap: 0;
  height: 100%;
  min-height: 0;
}

body[data-chapter="moments"] .masonry > * {
  margin-bottom: 0;
  break-inside: auto;
}

body[data-chapter="moments"] .masonry > :first-child {
  grid-column: span 2;
  grid-row: span 2;
}

body[data-chapter="moments"] .masonry .media {
  height: 100%;
  aspect-ratio: auto;
}

/* ---- 10 FAVORITES · 双列榜单 ---- */
body[data-chapter="favorites"] .list {
  grid-template-columns: 1fr 1fr;
  column-gap: clamp(28px, 4vw, 72px);
  align-content: center;
}

body[data-chapter="favorites"] .list__row {
  padding: clamp(14px, 3vh, 32px) 0;
}

body[data-chapter="favorites"] .list__title {
  font-size: clamp(15px, 1.25vw, 19px);
}

body[data-chapter="favorites"] .list__row:nth-child(1),
body[data-chapter="favorites"] .list__row:nth-child(2) {
  border-top: 1px solid var(--line);
}

body[data-chapter="favorites"] .list__row:nth-child(1) .list__title {
  color: var(--ember);
}

/* ---- 11 TIMELINE · 横向年份轴 ---- */
body[data-chapter="timeline"] .list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-content: center;
}

body[data-chapter="timeline"] .list__row {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: clamp(22px, 3.4vh, 34px) clamp(10px, 1.4vw, 26px) 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

body[data-chapter="timeline"] .list__row::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 3px var(--paper);
}

body[data-chapter="timeline"] .list__row:first-child::before {
  background: var(--ember);
}

body[data-chapter="timeline"] .list__date {
  font-family: var(--font-latin);
  font-size: clamp(24px, 2.6vw, 40px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

body[data-chapter="timeline"] .list__title {
  font-size: clamp(13px, 1.05vw, 16px);
  line-height: 1.5;
}

/* ---- 12 PLACES · 地图 + 地点清单（缩略图行） ---- */
body[data-chapter="places"] .chapter-body {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  justify-content: stretch;
  align-items: center;
  gap: clamp(24px, 3vw, 56px);
}

body[data-chapter="places"] .map {
  width: 100%;
  height: auto;
  max-height: 100%;
  aspect-ratio: 4 / 3;
}

body[data-chapter="places"] .grid {
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(12px, 2.2vh, 22px);
  align-content: center;
}

body[data-chapter="places"] .card {
  display: grid;
  grid-template-columns: clamp(96px, 8.2vw, 136px) minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: center;
  column-gap: 18px;
}

body[data-chapter="places"] .media {
  grid-row: 1 / span 2;
  grid-column: 1;
  aspect-ratio: 3 / 2;
}

body[data-chapter="places"] .card__cat {
  grid-column: 2;
  margin: 0;
  font-size: 9px;
}

body[data-chapter="places"] .card__title {
  grid-column: 2;
  margin-top: 4px;
  font-size: clamp(13px, 1.05vw, 16px);
}

/* ------------------------------------------------------------
   五、首页 · 进入后直接呈现 12 章节索引（一屏）
   ------------------------------------------------------------ */

body.is-home .site,
body.is-home .site > main {
  height: 100dvh;
  min-height: 0;
}

body.is-home .site {
  overflow: hidden;
}

body.is-home .nav {
  background: var(--paper);
  border-bottom-color: var(--line);
}

body.is-home .site > main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  overflow: hidden;
}

body.is-home .index-sec {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  padding: calc(var(--nav-h) + clamp(16px, 4vh, 44px)) var(--pad) clamp(24px, 4vh, 48px);
  overflow: hidden;
}

body.is-home .index-sec__inner {
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: var(--content);
  margin-inline: auto;
}

body.is-home .index-sec__title {
  margin-top: clamp(14px, 2.4vh, 28px);
  font-size: clamp(22px, 3vw, 40px);
  line-height: 1.25;
}

body.is-home .chapters {
  margin-top: clamp(20px, 4vh, 48px);
  gap: 0 clamp(24px, 3vw, 48px);
}

body.is-home .chapter-row {
  padding: clamp(12px, 2.4vh, 24px) 0;
}

body.is-home .chapter-row__en {
  font-size: clamp(17px, 1.6vw, 24px);
}

body.is-home .foot {
  padding: 0 var(--pad) clamp(12px, 2.2vh, 26px);
}

body.is-home .foot__inner {
  padding-top: clamp(12px, 1.8vh, 22px);
}

/* ------------------------------------------------------------
   六、响应式
   ------------------------------------------------------------ */

/* 中等屏：左栏收窄，字号再降一档 */
@media (max-width: 1180px) {
  :root {
    --id-col: clamp(252px, 26vw, 300px);
  }

  body[data-chapter="movies"] .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body[data-chapter="art"] .masonry {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 窄屏 / 竖屏：左栏变成页头，内容占满剩余高度 */
@media (max-width: 900px) {
  :root {
    --bar-h: 46px;
  }

  body[data-chapter] > .view > main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) var(--bar-h);
  }

  body[data-chapter] .chapter-hero {
    grid-column: 1;
    grid-row: 1;
    padding: 14px var(--pad) 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  body[data-chapter] .chapter-hero__num {
    font-size: 9px;
    letter-spacing: 0.22em;
  }

  body[data-chapter] .chapter-hero__title {
    flex-direction: row;
    align-items: baseline;
    gap: 12px;
    margin: 8px 0 0;
    font-size: clamp(24px, 7vw, 34px);
  }

  body[data-chapter] .chapter-hero__title .cn {
    font-size: 11px;
  }

  body[data-chapter] .chapter-body {
    grid-column: 1;
    grid-row: 2;
    padding: 14px var(--pad);
  }

  body[data-chapter] .chapterbar {
    grid-column: 1;
    grid-row: 3;
    gap: 10px;
    padding: 0 var(--pad);
    overflow: hidden;
  }

  body[data-chapter] .chapterbar__tick {
    width: 13px;
  }

  body[data-chapter] .chapterbar__jump {
    gap: 6px;
    font-size: 9px;
  }

  body[data-chapter] .chapterbar__jump span {
    display: none;
  }

  body[data-chapter] .chapterbar__jump b {
    letter-spacing: 0.1em;
    white-space: nowrap;
  }

  body[data-chapter] .chapterbar__jump small {
    display: none;
  }

  /* 各章展台：列数收一档，保证单屏排得下 */
  body[data-chapter="movies"] .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body[data-chapter="people"] .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-chapter="art"] .masonry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
  }

  body[data-chapter="moments"] .masonry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
  }

  body[data-chapter="moments"] .masonry > :first-child {
    grid-column: span 2;
    grid-row: span 1;
  }

  body[data-chapter="travel"] .chapter-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: stretch;
  }

  body[data-chapter="travel"] .list {
    align-content: start;
  }

  body[data-chapter="food"] .chapter-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  body[data-chapter="food"] .stats {
    grid-column: 1;
    grid-row: 1;
  }

  body[data-chapter="food"] .chapter-body > div:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
  }

  body[data-chapter="food"] .list {
    grid-column: 1;
    grid-row: 3;
    align-content: start;
  }

  body[data-chapter="food"] .list__row {
    padding: 9px 0;
  }

  body[data-chapter="favorites"] .list {
    column-gap: 24px;
  }

  body[data-chapter="favorites"] .list__row {
    padding: 9px 0;
  }

  body[data-chapter="timeline"] .list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
  }

  body[data-chapter="timeline"] .list__row {
    flex-direction: row;
    align-items: baseline;
    gap: 16px;
    padding: 10px 0;
    border-top: 0;
    border-bottom: 1px solid var(--line);
  }

  body[data-chapter="timeline"] .list__row::before {
    display: none;
  }

  body[data-chapter="timeline"] .list__date {
    width: 54px;
    flex: none;
    font-size: 14px;
    letter-spacing: 0.04em;
  }

  body[data-chapter="timeline"] .list__title {
    flex: 1;
  }

  body[data-chapter="places"] .chapter-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 14px;
  }

  body[data-chapter="places"] .grid {
    gap: 10px;
  }

  body.is-home .index-sec__title {
    font-size: 18px;
  }

  body.is-home .chapters {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(6, auto);
    grid-auto-flow: column;
    column-gap: 20px;
  }

  body.is-home .chapter-row {
    padding: 7px 0;
  }

  body.is-home .chapter-row__en {
    font-size: 14px;
  }

  body.is-home .chapter-row__cn {
    font-size: 9px;
  }
}

@media (max-width: 560px) {
  body.is-home .chapter-row__cn {
    display: none;
  }
}

/* 矮屏（笔记本半屏 / 横屏手机）：继续压 */
@media (max-width: 900px) and (max-height: 720px) {
  body[data-chapter] .chapter-hero__title {
    margin-top: 4px;
  }

  body[data-chapter="movies"] .card__cat,
  body[data-chapter="people"] .card__cat,
  body[data-chapter="places"] .card__cat {
    display: none;
  }
}

@media (max-height: 780px) and (min-width: 901px) {
  body[data-chapter] .chapter-hero__title {
    font-size: clamp(26px, min(3.2vw, 4.8vh), 46px);
  }
}

@media (max-height: 660px) and (min-width: 901px) {
  body[data-chapter="movies"] .card__cat,
  body[data-chapter="people"] .card__cat,
  body[data-chapter="places"] .card__cat {
    display: none;
  }
}


.chapter-row--soon { cursor: default; }
.chapter-row--soon .chapter-row__en { color: rgb(244 242 238 / .34); }
.chapter-row--soon .chapter-row__cn { color: rgb(244 242 238 / .3); }
