/* ══════════════════════════════════════════════════════════════════════
   CAI-TOPOLOGY · 時間之網 · 立軸首頁（horizons.html）
   · 黑屏卷首 → 古紙卷身
   · 圖片 slot 由 CSS custom property 注入，方便後期替換
   · 不堆砌特效：只用 background / mix-blend / mask 三招融圖
   ══════════════════════════════════════════════════════════════════════ */

:root {
  /* 色系 · 與 academy.html 對齊 */
  --hzh-night:       #050403;
  --hzh-night-2:     #0e0906;
  --hzh-night-3:     #1a120b;
  --hzh-paper-1:     #ede3d0;
  --hzh-paper-2:     #e8dcc6;
  --hzh-paper-3:     #d1bd99;
  --hzh-ink:         #23180f;
  --hzh-ink-soft:    rgba(44, 32, 20, .68);
  --hzh-gold:        #d4af37;
  --hzh-gold-soft:   rgba(212, 175, 55, .22);
  --hzh-line-dark:   rgba(212, 175, 55, .16);
  --hzh-line-paper:  rgba(85, 61, 34, .18);

  /* ── 圖片 slot ───────────────────────────────────────────
     你只需替換這幾個路徑，其它不用動。
     建議格式：WebP / JPG，長寬比 5:4，尺寸 1600×1280 以上。
     找圖清單見 horizons-images-guide.md
     ─────────────────────────────────────────────────────── */
  --hz-img-hero:    url("../images/track-record-tree-ring.webp");          /* 已提供 · 年輪 */
  --hz-img-market:  url("../images/horizons/card-market.jpg");
  --hz-img-earth:   url("../images/horizons/card-earth.jpg");
  --hz-img-cycles:  url("../images/horizons/card-cycles.jpg");
  --hz-img-body:    url("../images/horizons/card-body.jpg");
}

/* ══════════════════════════════════════════════════════════════════════
   Body / Page 基底
   ══════════════════════════════════════════════════════════════════════ */

html, body {
  background: var(--hzh-night);
  color: #e5e7eb;
}

body.hzh-page {
  min-height: 100vh;
  font-family: "Noto Serif SC", "Noto Serif TC", "Songti SC", serif;
  letter-spacing: .02em;
}

.hzh-main {
  position: relative;
  overflow: hidden;
}

.hzh-wrap {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  position: relative;
}

.hzh-kicker {
  margin: 0;
  font-family: "JetBrains Mono", "Inter", monospace;
  font-size: .64rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: rgba(212, 175, 55, .64);
}

/* ══════════════════════════════════════════════════════════════════════
   卷首 · Hero · 黑屏年輪
   ══════════════════════════════════════════════════════════════════════ */

.hzh-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: calc(var(--nav-h, 92px) + 34px) 0 116px;
  background:
    radial-gradient(ellipse 62% 40% at 50% 16%, rgba(212, 175, 55, .22), transparent 68%),
    linear-gradient(180deg, var(--hzh-night) 0%, var(--hzh-night-2) 58%, var(--hzh-night-3) 100%);
  overflow: hidden;
  isolation: isolate;
}

/* 年輪圖 · 大尺度 · 低對比 · 融入背景 */
.hzh-hero-bg {
  position: absolute;
  inset: -2%;
  z-index: 0;
  background: var(--hz-img-hero) center / cover no-repeat;
  opacity: .48;
  filter: saturate(.5) brightness(.56) contrast(1.06);
  mix-blend-mode: screen;
  transform: scale(1.12);
  will-change: transform;
}

/* 暈影：邊緣壓暗，讓視覺聚中 */
.hzh-hero-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 72% 58% at 50% 46%, transparent 36%, rgba(5, 4, 3, .7) 88%),
    linear-gradient(180deg, rgba(5, 4, 3, .3) 0%, transparent 20%, transparent 74%, rgba(5, 4, 3, .92) 100%);
}

.hzh-hero-wrap {
  position: relative;
  z-index: 2;
  text-align: center;
}

.hzh-brand {
  margin: 0 0 28px;
  font-family: "Cinzel", "JetBrains Mono", serif;
  font-weight: 500;
  font-size: .82rem;
  letter-spacing: .38em;
  color: rgba(212, 175, 55, .78);
  text-indent: .38em;
}

/* 主標 · 書法 PNG（汉隶 蔡氏拓撲）· 透明 alpha
   保留 <h1> 語義；圖片承擔視覺，alt 承擔 SEO 與無障礙 */
.hzh-title {
  margin: 0;
  padding: 0;
  line-height: 0;
  font-size: 0;
  text-align: center;
}
.hzh-title picture {
  display: inline-block;
  line-height: 0;
}
.hzh-title-img {
  display: block;
  width: clamp(280px, 52vw, 680px);
  height: auto;
  max-width: 100%;
  user-select: none;
  -webkit-user-drag: none;
  /* 雙層陰影：深陰影壓場 + 極淡暖白外發光，讓白字浮於年輪之上 */
  filter:
    drop-shadow(0 14px 40px rgba(0, 0, 0, .55))
    drop-shadow(0 2px 12px rgba(255, 240, 200, .14));
}

.hzh-couplet {
  margin: clamp(36px, 5vw, 56px) auto 0;
  max-width: 640px;
  font-family: "Noto Serif SC", serif;
  color: rgba(218, 198, 156, .55);
}
.hzh-couplet p {
  display: flex;
  justify-content: center;
  gap: clamp(28px, 4vw, 48px);
  margin: 0 0 10px;
  font-size: clamp(.96rem, 1.32vw, 1.1rem);
  letter-spacing: .14em;
  font-weight: 300;
}
.hzh-couplet span {
  display: inline-block;
  text-indent: .14em;
}

/* 引言 · 上方加金色短分隔，作為視覺收口（題跋意） */
.hzh-lead-wrap {
  margin: clamp(28px, 4.2vw, 42px) auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.hzh-rule {
  display: block;
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, .72), transparent);
}
.hzh-lead {
  margin: 0;
  max-width: 540px;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(.92rem, 1.2vw, 1.02rem);
  line-height: 1.9;
  letter-spacing: .13em;
  text-align: center;
  color: rgba(218, 204, 178, .68);
}

/* 向下指引 · 僅金線 + 箭頭，去掉「舒卷」二字以求克制 */
.hzh-scroll {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  padding: 16px 24px 8px;
  z-index: 3;
  transition: transform .3s ease, opacity .3s ease;
  opacity: .82;
}
.hzh-scroll:hover {
  opacity: 1;
  transform: translate(-50%, 3px);
}
.hzh-scroll-arrow {
  width: 1px;
  height: 40px;
  background: linear-gradient(180deg, rgba(212, 175, 55, .08), rgba(212, 175, 55, .82));
  position: relative;
  animation: hzh-scroll-pulse 2.6s ease-in-out infinite;
}
.hzh-scroll-arrow::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translateX(-50%) rotate(45deg);
  width: 7px;
  height: 7px;
  border-right: 1px solid rgba(212, 175, 55, .82);
  border-bottom: 1px solid rgba(212, 175, 55, .82);
}
@keyframes hzh-scroll-pulse {
  0%, 100% { opacity: .4; transform: translateY(0); }
  50%      { opacity: 1;  transform: translateY(6px); }
}
@media (prefers-reduced-motion: reduce) {
  .hzh-scroll-arrow { animation: none; }
}

/* ══════════════════════════════════════════════════════════════════════
   過渡帶 · 黑 → 古紙黃
   · 去掉中段棕帶（太顯），改為極短直接過渡
   ══════════════════════════════════════════════════════════════════════ */

.hzh-transition {
  height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

/* ══════════════════════════════════════════════════════════════════════
   卷身 · Gallery · 古紙黃 · 學術方向錯位
   ══════════════════════════════════════════════════════════════════════ */

.hzh-gallery {
  position: relative;
  padding: clamp(72px, 10vw, 120px) 0 clamp(100px, 13vw, 150px);
  color: var(--hzh-ink);
  background:
    linear-gradient(180deg, var(--hzh-paper-1) 0%, var(--hzh-paper-2) 48%, var(--hzh-paper-3) 100%);
}
.hzh-gallery::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 18%, rgba(212, 175, 55, .1), transparent 32%),
    radial-gradient(circle at 88% 76%, rgba(169, 71, 43, .06), transparent 34%);
}
/* 極淡紙紋 */
.hzh-gallery::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  background-image:
    repeating-linear-gradient(90deg, rgba(59, 40, 22, .028) 0 1px, transparent 1px 140px),
    repeating-linear-gradient(180deg, rgba(59, 40, 22, .022) 0 1px, transparent 1px 96px);
}

.hzh-gallery-head {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-bottom: clamp(44px, 6.5vw, 84px);
}

/* 卷身略放寬，讓四卷配圖有更多橫向尺度 */
.hzh-gallery .hzh-wrap {
  width: min(1390px, calc(100% - 24px));
}
.hzh-gallery-head .hzh-kicker {
  color: rgba(139, 101, 43, .72);
  margin-bottom: 18px;
}
.hzh-gallery-head h2 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 500;
  letter-spacing: .32em;
  text-indent: .32em;
  color: var(--hzh-ink);
}
.hzh-gallery-lead {
  max-width: 760px;
  margin: 24px auto 0;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(.96rem, 1.3vw, 1.1rem);
  line-height: 2.05;
  letter-spacing: .06em;
  color: var(--hzh-ink-soft);
}

/* ── 四卷 · 錯位網格 ───────────────────────────────────────────────── */

.hzh-volumes {
  position: relative;
  z-index: 2;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(40px, 6vw, 80px) 0;
}

.hzh-volume {
  position: relative;
  min-width: 0;
}

/* 錯位佈局（桌面）：
   市：左側大塊  · col 1-7
   地：右偏中    · col 5-12（向下錯位）
   世：左下      · col 2-8
   身：右下      · col 6-12（最後錯位） */
.hzh-v-market { grid-column: 1 / span 7; }
.hzh-v-earth  { grid-column: 5 / span 8; margin-top: clamp(40px, 6vw, 80px); }
.hzh-v-cycles { grid-column: 2 / span 7; margin-top: clamp(20px, 3vw, 40px); }
.hzh-v-body   { grid-column: 6 / span 7; margin-top: clamp(30px, 5vw, 60px); }

/* 圖文列：圖片欄略大於正文欄；皆使用 minmax(0, …) 避免撐破網格 */
.hzh-volume-link {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(0, .9fr);
  gap: clamp(22px, 3.2vw, 48px);
  align-items: center;
  text-decoration: none;
  color: inherit;
  padding: clamp(18px, 2.4vw, 28px);
  border-top: 1px solid rgba(85, 61, 34, .18);
  border-bottom: 1px solid rgba(85, 61, 34, .08);
  transition: background .4s ease, border-color .4s ease;
  background: transparent;
  min-width: 0;
}
.hzh-volume-link:hover {
  background: rgba(255, 250, 232, .26);
  border-top-color: rgba(212, 175, 55, .44);
}

/* 奇數卷（市、世）圖在左、文在右；偶數卷（地、身）反過來 */
.hzh-v-earth .hzh-volume-link,
.hzh-v-body .hzh-volume-link {
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.38fr);
}
.hzh-v-earth .hzh-volume-art,
.hzh-v-body .hzh-volume-art {
  order: 2;
}
.hzh-v-earth .hzh-volume-text,
.hzh-v-body .hzh-volume-text {
  order: 1;
  text-align: right;
}

/* ── 圖片區 · 融入背景 ─────────────────────────────────────────────── */

/* 高度僅由「欄寬 × aspect-ratio」決定，勿再加 min-height（會與 ratio 競合撐破排版） */
.hzh-volume-art {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  isolation: isolate;
  min-width: 0;
  aspect-ratio: 10 / 9;
}

/* 羽化邊緣 · 墨色融入紙底 */
.hzh-volume-img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(.12) saturate(.96) contrast(1.14) brightness(.98);
  mix-blend-mode: normal;
  opacity: .94;
  -webkit-mask-image: radial-gradient(ellipse 94% 96% at 50% 50%, #000 72%, transparent 100%);
          mask-image: radial-gradient(ellipse 94% 96% at 50% 50%, #000 72%, transparent 100%);
  transition: transform 1.2s cubic-bezier(.22, 1, .36, 1), filter .8s ease;
}
.hzh-volume-link:hover .hzh-volume-img {
  transform: scale(1.035);
  filter: sepia(.08) saturate(1) contrast(1.2) brightness(1);
}

/* 淡淡暖色疊層 · 讓圖和紙基調統一 */
.hzh-volume-wash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 82% 62% at 50% 46%, transparent 58%, rgba(232, 220, 198, .2)),
    linear-gradient(180deg, rgba(237, 227, 208, 0) 52%, rgba(209, 189, 153, .14) 100%);
  pointer-events: none;
}

/* ── 文字區 ─────────────────────────────────────────────────────────── */

.hzh-volume-text {
  padding: 4px 0;
  min-width: 0;
}
.hzh-volume-text .hzh-kicker {
  color: rgba(139, 101, 43, .68);
  margin-bottom: 18px;
}

/* 主標 · 4 字學術名（金融時序 / 山河紀年 / 世運長波 / 形神節律）
   保留印章紅點作為文化視覺記號 */
.hzh-volume-title {
  margin: 0 0 12px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-weight: 500;
  font-size: clamp(2rem, 3.2vw, 2.8rem);
  line-height: 1.15;
  letter-spacing: .14em;
  color: var(--hzh-ink);
  position: relative;
  display: inline-block;
}
.hzh-volume-title::after {
  content: "";
  position: absolute;
  right: -16px;
  top: 8px;
  width: 10px;
  height: 10px;
  background: #a9472b;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .22);
}
.hzh-v-earth .hzh-volume-title::after,
.hzh-v-body  .hzh-volume-title::after {
  right: auto;
  left: -16px;
}

/* 副標 · 詩化句（市場有時 / 大地有音 / 周期有輪 / 身體有律） */
.hzh-volume-sub {
  margin: 0 0 22px;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  font-weight: 400;
  letter-spacing: .26em;
  color: rgba(85, 61, 34, .68);
  text-indent: .26em;
}

.hzh-volume-desc {
  margin: 0 0 28px;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(.96rem, 1.3vw, 1.08rem);
  line-height: 1.85;
  letter-spacing: .04em;
  color: var(--hzh-ink-soft);
  max-width: 44em;
}
.hzh-v-earth .hzh-volume-desc,
.hzh-v-body .hzh-volume-desc {
  margin-left: auto;
}

.hzh-volume-cta {
  display: inline-block;
  font-family: "Noto Serif SC", serif;
  font-size: .96rem;
  letter-spacing: .26em;
  padding: 10px 0 8px;
  border-bottom: 1px solid rgba(139, 101, 43, .56);
  color: var(--hzh-ink);
  transition: color .3s ease, border-color .3s ease, transform .3s ease;
}
.hzh-volume-link:hover .hzh-volume-cta {
  color: #a9472b;
  border-bottom-color: #a9472b;
  transform: translateX(4px);
}
.hzh-v-earth .hzh-volume-link:hover .hzh-volume-cta,
.hzh-v-body  .hzh-volume-link:hover .hzh-volume-cta {
  transform: translateX(-4px);
}

/* ══════════════════════════════════════════════════════════════════════
   Reveal 動畫（進入視口淡入）
   ══════════════════════════════════════════════════════════════════════ */

[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .9s cubic-bezier(.22, 1, .36, 1), transform .9s cubic-bezier(.22, 1, .36, 1);
}
[data-reveal].is-revealed {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* ══════════════════════════════════════════════════════════════════════
   響應式
   ══════════════════════════════════════════════════════════════════════ */

/* 平板：縮小錯位幅度 */
@media (max-width: 980px) {
  .hzh-v-market { grid-column: 1 / span 10; }
  .hzh-v-earth  { grid-column: 3 / span 10; margin-top: 48px; }
  .hzh-v-cycles { grid-column: 1 / span 10; margin-top: 32px; }
  .hzh-v-body   { grid-column: 3 / span 10; margin-top: 40px; }
  .hzh-volume-link {
    grid-template-columns: 1fr;
    min-width: 0;
  }
  .hzh-v-earth .hzh-volume-link,
  .hzh-v-body .hzh-volume-link {
    grid-template-columns: 1fr;
  }
  .hzh-v-earth .hzh-volume-art,
  .hzh-v-body .hzh-volume-art { order: 0; }
  .hzh-v-earth .hzh-volume-text,
  .hzh-v-body .hzh-volume-text { order: 1; text-align: left; }
  .hzh-v-earth .hzh-volume-title::after,
  .hzh-v-body .hzh-volume-title::after { left: auto; right: -16px; }
  .hzh-v-earth .hzh-volume-desc,
  .hzh-v-body .hzh-volume-desc { margin-left: 0; }
}

/* 手機 · 全部拉平 */
@media (max-width: 640px) {
  .hzh-hero { min-height: 100vh; padding-top: calc(var(--nav-h, 74px) + 24px); padding-bottom: 84px; }
  .hzh-brand { margin-bottom: 22px; letter-spacing: .32em; text-indent: .32em; }
  .hzh-title-img { width: min(78vw, 520px); }
  .hzh-couplet { margin-top: 38px; }
  .hzh-couplet p { flex-direction: row; flex-wrap: wrap; gap: 18px; justify-content: center; letter-spacing: .1em; }
  .hzh-couplet p span { font-size: .96rem; }
  .hzh-lead-wrap { margin-top: 32px; gap: 16px; }
  .hzh-scroll { bottom: 28px; }
  .hzh-scroll-arrow { height: 36px; }

  .hzh-gallery { padding: 72px 0 96px; }
  .hzh-gallery-head { margin-bottom: 48px; }

  .hzh-volumes { gap: 26px 0; }
  .hzh-v-market, .hzh-v-earth, .hzh-v-cycles, .hzh-v-body {
    grid-column: 1 / -1;
    margin-top: 0;
  }
  .hzh-volume-link {
    padding: 16px 4px 20px;
    gap: 20px;
  }
  .hzh-volume-title { font-size: 1.7rem; letter-spacing: .14em; }
  .hzh-volume-sub { font-size: .98rem; letter-spacing: .22em; margin-bottom: 18px; }
}
