/* ============================================================
   worldview.css — 世界觀導覽頁（長滾動）專用樣式
   調性：索多（暗）→ 鏡園（赤褐）→ 鏡都（亮）
   ============================================================ */


/* ============================================================
   A — 字體大小三檔（A+/A- 控制器）
   ============================================================ */

html.font-lg { font-size: 18px; }
html.font-xl { font-size: 20px; }


/* ============================================================
   B — 字體大小控制器（右下角固定）
   ============================================================ */

.font-sizer {
  position: fixed;
  bottom: 4.5rem;
  right: 1.5rem;
  z-index: 80;
  display: flex;
  gap: 0.4rem;
}

.font-sizer button {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--sodo-text-secondary);
  background: rgba(26, 26, 29, 0.7);
  border: 1px solid var(--sodo-line);
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  transition: color var(--transition-smooth), border-color var(--transition-smooth);
}

.font-sizer button:hover {
  color: var(--sodo-accent-bright);
  border-color: var(--sodo-accent-bright);
}


/* ============================================================
   C — 共用容器
   ============================================================ */

.worldview-container {
  position: relative;
  z-index: 1;
  margin: 0 auto;
  padding: 5rem 2rem;
}

.section-header {
  margin-bottom: 2rem;
}

.section-title {
  font-family: var(--font-genyo);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--sodo-text-primary);
  margin: 0.4rem 0 0.2rem;
  letter-spacing: 0.05em;
}

.section-en {
  color: var(--sodo-accent-bright);
  margin-top: 0.2rem;
}

.section-header--mirror .section-title {
  font-family: var(--font-sacred);
  color: var(--mirror-text-primary);
}

.section-header--mirror .section-en {
  color: var(--mirror-text-secondary);
}


/* ============================================================
   D — 區塊 A：索多
   ============================================================ */

#section-sodo {
  background-color: var(--sodo-bg-primary);
  min-height: 100vh;
  padding-bottom: 4rem;
}

.worldview-container--sodo {
  max-width: 760px;
}

.sodo-block {
  margin-bottom: 0.5rem;
  position: relative;
}

.sodo-block p {
  font-family: var(--font-genyo);
  font-size: 1rem;
  line-height: 1.85;
  color: var(--sodo-text-primary);
  margin: 0;
}

.sodo-subtitle {
  font-family: var(--font-genyo);
  font-weight: 600;
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--sodo-text-primary);
  margin-bottom: 0.25rem;
  letter-spacing: 0.08em;
}

.sodo-tag {
  color: var(--sodo-accent-bright);
  display: block;
  margin: 0.4rem 0;
  opacity: 0.8;
}

/* 段落掃描線（由 JS 注入） */
.sodo-scanline {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}


/* ============================================================
   E — 區塊 A→B：過渡段落
   ============================================================ */

#section-transition-ab {
  min-height: 30vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--academy-bg); /* JS scrub: academy → mirror */
  overflow: hidden;
}

.transition-text-wrap {
  text-align: center;
  padding: 4rem 2rem;
}

.transition-text {
  font-family: var(--font-scripture);
  font-style: italic;
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  writing-mode: vertical-rl;
  letter-spacing: 0.3em;
  opacity: 0; /* GSAP 控制 */
}


/* ============================================================
   F — 區塊 B：鏡都
   ============================================================ */

#section-mirror {
  position: relative;
  background-color: #f0ece6;
  min-height: 100vh;
}

.worldview-container--mirror {
  max-width: 700px;
  position: relative;
  z-index: 1;
  padding-bottom: 6rem;
}

/* 鏡都1.png 獨立展示圖 */
.mirror-hero-figure {
  display: block;
  margin: 0 auto 3rem;
  max-width: 600px;
}

.mirror-hero-img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  opacity: 0.85;
}

.mirror-para {
  margin-bottom: 3rem;
  position: relative;
  overflow: hidden;
}

.mirror-para h3 {
  font-family: var(--font-sacred);
  font-weight: 400;
  font-size: clamp(1rem, 2vw, 1.3rem);
  color: var(--mirror-text-secondary);
  letter-spacing: 0.1em;
  margin-bottom: 0.6rem;
}

.mirror-para p {
  font-family: var(--font-sacred);
  font-size: 1rem;
  line-height: 1.9;
  letter-spacing: 0.05em;
  color: var(--mirror-text-primary);
}

/* 鏡面反光 overlay（GSAP 控制 background-position） */
.mirror-para::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.35) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  background-position: -100% 0;
  pointer-events: none;
  z-index: 1;
}


/* ============================================================
   G — 鏡園 階段一：制服展示
   ============================================================ */

#section-academy-uniform {
  background-color: var(--mirror-bg-secondary);
  min-height: 100vh;
  padding-bottom: 5rem;
}

.worldview-container--uniform {
  max-width: 900px;
}

.uniform-grid {
  display: flex;
  gap: 4%;
  margin: 2.5rem 0 1.5rem;
}

.uniform-item {
  flex: 1;
}

.uniform-img {
  width: 100%;
  height: auto;
  display: block;
  clip-path: polygon(50% 0, 50% 0, 50% 100%, 50% 100%); /* GSAP 展開 */
}

.uniform-label {
  display: block;
  color: var(--mirror-text-secondary);
  margin-top: 1rem;
  text-align: center;
}


/* ============================================================
   I — 區塊 D 階段二：GIF 分割線
   ============================================================ */

#section-academy-gif {
  background-color: var(--mirror-bg-secondary); /* JS scrub → academy-bg */
  padding: 5rem 2rem;
}

.gif-divider-wrap {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.gif-label-top {
  color: var(--academy-accent);
  opacity: 0.6;
  display: block;
  margin-bottom: 2rem;
}

.gif-label-bottom {
  font-family: var(--font-scripture);
  font-style: italic;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: var(--academy-text);
  opacity: 0.5;
  display: block;
  margin-top: 2rem;
}

.gif-line-track {
  display: flex;
  align-items: center;
}

.gif-line {
  height: 1px;
  background-color: var(--academy-line);
  opacity: 0.5;
  flex: 1;
  /* Initial width 0, GSAP expands */
  transform: scaleX(0);
  transform-origin: center;
}

.gif-line--left  { transform-origin: right; }
.gif-line--right { transform-origin: left; }

.gif-figure {
  flex-shrink: 0;
}

.gif-img {
  /* CMS 可調整大小：使用 width 而非 transform，避免與 GSAP 入場動畫衝突 */
  width: min(calc(360px * var(--gif-scale, 1)), 80vw);
  height: auto;
  display: block;
  opacity: 0;
  transform: scale(0.85);
}


/* ============================================================
   J — 區塊 D 階段三：鏡園制度（索多密排）
   ============================================================ */

#section-academy-rules {
  background-color: var(--academy-bg);
  min-height: 100vh;
  padding-bottom: 0;
}

.worldview-container--academy {
  max-width: 900px;
  padding-top: 4rem;
}

.worldview-container--academy.noise-overlay::after {
  opacity: 0.05;
}

.academy-para {
  margin-bottom: 0.5rem;
}

.academy-para p {
  font-family: var(--font-genyo);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--academy-text);
  margin: 0;
}

.academy-tag {
  color: var(--academy-tag);
  display: block;
  margin: 0.4rem 0;
  opacity: 0.9;
}

.academy-end {
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.academy-end-text {
  opacity: 0.2;
  font-size: 11px;
  color: var(--academy-text);
}


/* ============================================================
   K' — 章節跳轉按鈕（敘事路徑：地獄 → 煉獄 → 天堂）
   ============================================================ */

.chapter-jump-wrap {
  display: flex;
  justify-content: center;
  margin-top: 4rem;
  padding-bottom: 1rem;
}

.chapter-jump {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 2.4rem;
  background: transparent;
  border: 1px solid currentColor;
  font-family: var(--font-genyo);
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  letter-spacing: 0.3em;
  cursor: pointer;
  transition: padding 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              background-color 0.4s, color 0.4s;
}

.chapter-jump__hint {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  opacity: 0.5;
}

.chapter-jump__arrow {
  display: inline-block;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.chapter-jump:hover .chapter-jump__arrow {
  transform: translateX(0.6rem);
}

.chapter-jump:hover {
  padding-left: 3rem;
  padding-right: 3rem;
}

.chapter-jump--sodo {
  color: var(--sodo-text-primary);
  border-color: var(--sodo-accent-bright);
}

.chapter-jump--sodo:hover {
  color: #fff;
  background-color: rgba(204, 51, 51, 0.12);
}

.chapter-jump--academy {
  color: var(--academy-text);
  border-color: var(--academy-accent);
}

.chapter-jump--academy:hover {
  color: #fff;
  background-color: rgba(200, 184, 150, 0.18);
}


/* ============================================================
   K — 響應式
   ============================================================ */

@media (max-width: 767px) {
  .worldview-container {
    padding: 3rem 1.25rem;
  }

  .worldview-container--sodo {
    max-width: 100%;
  }

  .uniform-grid {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
  }

  .uniform-item {
    width: 80%;
    flex: none;
  }

  .gif-img {
    width: min(calc(240px * var(--gif-scale, 1)), 80vw);
  }

  .worldview-container--academy {
    max-width: 100%;
    padding: 3rem 1.25rem 0;
  }

  .font-sizer {
    bottom: 5rem;
    right: 1rem;
    z-index: 160;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  /* tablet-specific rules */
}
