/* ============================================================
   縮時森林 GROVYN — ROOT Section (scroll-driven timeline)
   全視窗沉浸：N slides × 100vh，GSAP ScrollTrigger 驅動
   ============================================================ */

.root-section {
  position: relative;
  background: #000;
  /* height 由 JS 設定：N × 100vh */
}

.root-pin {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* ── Slides ── */
.root-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none; /* 非 active slide 不擋滑鼠；JS 給 active 的設 auto */
  will-change: opacity;
}

.root-slide__bg {
  position: absolute;
  inset: 0;
  background-image: var(--bg-desktop);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

@media (max-width: 768px) {
  .root-slide__bg {
    background-image: var(--bg-mobile);
  }
}

.root-slide__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(15, 17, 24, 0.72) 0%,
    rgba(15, 17, 24, 0.38) 55%,
    rgba(15, 17, 24, 0.14) 100%
  );
}

.root-slide__content {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-align: left;
  padding: 0 max(32px, calc((100% - 1240px) / 2));
  color: #fff;
}

.root-slide__year {
  font-family: var(--ts-font-serif-en-display, 'Fraunces', serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(56px, 8vw, 100px);
  line-height: 1.0;
  color: var(--ts-sun, #EEE78D);
  margin: 0 0 8px;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55);
}

/* year 大字下方的中文副標（六百萬年前 / 一萬兩千年前 / 工業革命 …） */
.root-slide__year-sub {
  font-family: var(--ts-font-serif-zh, 'Noto Serif TC', serif);
  font-weight: 400;
  font-size: clamp(13px, 1.1vw, 17px);
  letter-spacing: 0.15em;
  color: rgba(238, 231, 141, 0.75);
  margin: -4px 0 12px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
}

.root-slide__title {
  font-family: var(--ts-font-serif-zh, 'Noto Serif TC', serif);
  font-weight: 500;
  font-size: clamp(22px, 2.8vw, 40px);
  letter-spacing: 0.10em;
  line-height: 1.5;
  color: #fff;
  margin: 0 0 16px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

/* title 下方的副標（百萬年的緩慢雕刻 / 兩百年的節奏暴衝 …） */
.root-slide__subtitle {
  font-family: var(--ts-font-serif-zh, 'Noto Serif TC', serif);
  font-weight: 400;
  font-size: clamp(14px, 1.4vw, 20px);
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.78);
  margin: -6px 0 18px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.root-slide__text {
  font-family: var(--ts-font-sans-zh, 'Noto Sans TC', sans-serif);
  font-weight: 400;
  font-size: clamp(14px, 1.2vw, 18px);
  line-height: 1.8;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.88);
  max-width: 560px;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* ── 右側年份指示器（右側對齊 header 浮島的右邊、垂直在右上、字級放大兩倍） ── */
.root-year-nav {
  position: absolute;
  right: max(32px, calc((100% - 1240px) / 2));
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 14px;
  pointer-events: none;
}

.root-year-nav__item {
  font-family: var(--ts-font-serif-en-display, 'Fraunces', serif);
  font-style: italic;
  font-size: 22px;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.30);
  transition: color 0.4s ease, font-size 0.3s ease;
  user-select: none;
}

.root-year-nav__item.is-active {
  color: var(--ts-sun, #EEE78D);
  font-size: 26px;
}

/* ── 底部進度條 ── */
.root-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--ts-sun, #EEE78D);
  opacity: 0.6;
  width: 0%;
  will-change: width;
  pointer-events: none;
  z-index: 10;
}

/* ── 區塊轉場遮罩（Stack → ROOT 淡黑過渡，蓋掉橫線） ── */
/* 純黑 #000：opacity=1 時 100% 不透，後方 stack-card 動畫不會透出來 */
.page-veil {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #000;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: none;
  opacity: 0;
  will-change: opacity;
}

/* ── 滾動提示（僅第一個 slide） ── */
.root-scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-family: var(--ts-font-sans-zh, 'Noto Sans TC', sans-serif);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.root-scroll-hint.is-hidden {
  opacity: 0;
}

.root-scroll-hint__line {
  width: 1px;
  height: 32px;
  background: rgba(255, 255, 255, 0.35);
  animation: root-scroll-pulse 1.8s ease-in-out infinite;
}

@keyframes root-scroll-pulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.7); }
  50%       { opacity: 1;   transform: scaleY(1);   }
}

/* ── 響應式 ── */
@media (max-width: 767px) {
  .root-year-nav {
    /* 手機隱藏 year-nav 浮島（避免疊在 ROOT 內文上；桌機保留） */
    display: none;
  }
  .root-slide__content {
    padding: clamp(24px, 5vw, 48px);
  }
}

/* 平板（iPad 768–1024px）：year-nav 浮島在 820 寬被右緣裁切（標籤被切半）。
   依設計決定，平板比照手機隱藏浮島；不動 content padding（保留桌機行為）。2026-06-01 新增。 */
@media (min-width: 768px) and (max-width: 1024px) {
  .root-year-nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .root-slide { transition: none !important; }
  .root-scroll-hint__line { animation: none; }
}
