@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Crimson+Text:wght@400;600&display=swap');

/* ============================================================
   縮時森林 GROVYN — Sections Inline (抽自 pages/index.html 內聯 style)
   涵蓋：
     1. Hero → Stack 融合轉場（黑底 + 打字機 + 強調底線）
     2. Stack 3D 卡片堆疊 + 第 6 張放大滿版的新文字 layer
   注意：上面的 @import 必須維持在檔案最上面，否則瀏覽器會 ignore（CSS 規範）
   ============================================================ */


/* ============================================================
   1. Hero → Stack 融合轉場
   ============================================================ */
.hero-stack-transition {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 50;
  opacity: 0;
  pointer-events: none; /* 全螢幕 overlay 不擋滑鼠；文字 child 強制 auto 見檔尾 v0.3 規則 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  will-change: opacity;
}

.hero-stack-transition__text {
  font-family: var(--ts-font-serif-zh, 'Noto Serif TC', serif);
  font-size: clamp(22px, 3vw, 38px);
  color: var(--ts-cream, #EEEAE7);
  letter-spacing: 0.2em;
  text-align: center;
  opacity: 0;
  font-weight: 500;
  line-height: 1.6;
  will-change: opacity;
}

.hero-stack-transition__text .char {
  display: inline-block;
  opacity: 0;
  transform: translate(-2px, 4px) scale(0.9);
  filter: blur(6px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out, filter 0.5s ease-out;
  will-change: opacity, transform, filter;
}

.hero-stack-transition__text .char.is-on {
  opacity: 1;
  transform: translate(0, 0) scale(1);
  filter: blur(0);
}

.hero-stack-transition__text .emphasis {
  position: relative;
  display: inline-block;
}

.hero-stack-transition__text .emphasis::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -8px;
  width: var(--emph-w, 0%);
  height: 2px;
  border-radius: 1px;
  background: var(--ts-sun, #EEE78D);
  box-shadow:
    0 0 8px rgba(238, 231, 141, 0.8),
    0 0 18px rgba(238, 231, 141, 0.45);
  pointer-events: none;
  will-change: width;
}


/* ============================================================
   2. Stack 3D 卡片堆疊（含第 6 張卡放大滿版 zoomed layer）
   ============================================================ */
/* Google Fonts Inter @import 已移到本檔最上面（CSS 規範要求） */

.stack-section {
  position: relative;
  width: 100%;
  background: #000;
  /* 高度 = 卡片數 × 100vh，由 JS 設定 */
}

.stack-pin {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  perspective: 1100px;        /* 3D 透視，數值越小越強 */
  perspective-origin: 50% 75%;/* 觀察點下移，模擬曲面螢幕從觀眾視角看的弧度暗示 */
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stack-card {
  position: absolute;
  width: 88vw;
  height: 82vh;
  max-width: 1400px;
  border-radius: 12px;
  overflow: hidden;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.stack-card__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.stack-card__overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      rgba(15, 17, 24, 0.32) 0%,
      rgba(15, 17, 24, 0.12) 45%,
      rgba(15, 17, 24, 0.28) 100%);
}

.stack-card__content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: clamp(32px, 4vw, 64px);
  color: #fff;
  gap: clamp(20px, 3vw, 48px);
}

.stack-card__top {
  display: flex;
  justify-content: flex-start;
  align-items: baseline;
  gap: 24px;
}

.stack-card__eyebrow {
  font-family: 'Inter', 'Noto Sans TC', sans-serif;
  font-size: clamp(11px, 0.9vw, 13px);
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  opacity: 0.85;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.80),
    0 2px 12px rgba(0, 0, 0, 0.50);
}

.stack-card__middle {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(8px, 0.8vw, 14px);
}

.stack-card__title {
  font-family: 'Fraunces', 'Noto Serif TC', serif;
  font-weight: 500;
  font-size: clamp(56px, 8vw, 128px);
  line-height: 1.0;
  letter-spacing: -0.01em;
  margin: 0;
  max-width: 14ch;
  color: #fff;
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.65),
    0 3px 24px rgba(0, 0, 0, 0.55);
}

.stack-card__title-en {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(16px, 1.5vw, 24px);
  letter-spacing: 0.10em;
  color: var(--ts-cream, #EEEAE7);
  opacity: 0.88;
  margin: 0 0 clamp(24px, 2.6vw, 40px) 0;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.80),
    0 2px 14px rgba(0, 0, 0, 0.50);
}

.stack-card__copy {
  max-width: min(620px, 58%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stack-card__lead {
  font-family: 'Noto Sans TC', sans-serif;
  font-size: clamp(18px, 1.45vw, 22px);
  line-height: 1.8;
  letter-spacing: 0.03em;
  color: rgba(238, 234, 231, 0.95);
  margin: 0;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.85),
    0 2px 16px rgba(0, 0, 0, 0.55);
}

.stack-card__note {
  font-family: 'Noto Serif TC', serif;
  font-size: clamp(15px, 1.15vw, 18px);
  line-height: 1.75;
  letter-spacing: 0.06em;
  color: rgba(238, 234, 231, 0.95);
  margin: 0;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.80),
    0 2px 14px rgba(0, 0, 0, 0.50);
}

/* 亮底圖卡片（03/05）：lead+note 區後方鋪輕薄霧暈，加強白字對比 */
.stack-card--light-image .stack-card__copy {
  position: relative;
  isolation: isolate;
}
.stack-card--light-image .stack-card__copy::before {
  content: '';
  position: absolute;
  inset: -16px -24px;
  background: radial-gradient(
    ellipse at 30% 50%,
    rgba(15, 17, 24, 0.30) 0%,
    rgba(15, 17, 24, 0.18) 45%,
    rgba(15, 17, 24, 0) 88%
  );
  filter: blur(2px);
  z-index: -1;
  pointer-events: none;
}

@media (max-width: 720px) {
  .stack-card__title { font-size: clamp(44px, 10vw, 68px); max-width: 10ch; }
  .stack-card__title-en { font-size: 16px; margin-bottom: 18px; }
  .stack-card__copy { max-width: 100%; }
  .stack-card__lead { font-size: 17px; }
  .stack-card__note { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .stack-card { transition: none !important; }
  .hero-stack-transition__text .char { transition: none !important; filter: none !important; }
}

/* 第 6 張卡放大滿版時用的「新文字 layer」（疊在 .stack-card__content 上方）*/
.stack-card__content--zoomed {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 6vw;
  color: #FFFFFF;
  opacity: 0;
  pointer-events: none; /* zoomed 容器不擋；child 文字強制 auto 見檔尾 v0.3 規則 */
  text-shadow:
    0 2px 10px rgba(0, 0, 0, 0.95),
    0 8px 32px rgba(0, 0, 0, 0.7);
  will-change: opacity;
}

.stack-card__zoomed-eyebrow {
  font-family: var(--ts-font-mono, 'JetBrains Mono', monospace);
  font-size: 13px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--ts-sun, #EEE78D);
  margin: 0 0 28px;
}

.stack-card__zoomed-title {
  font-family: var(--ts-font-serif-zh, 'Noto Serif TC', serif);
  font-size: clamp(28px, 4vw, 56px);
  font-weight: 500;
  letter-spacing: 0.20em;
  line-height: 1.7;
  margin: 0 0 24px;
  color: #FFFFFF;
}

.stack-card__zoomed-sub {
  font-family: var(--ts-font-serif-zh, 'Noto Serif TC', serif);
  font-size: clamp(15px, 1.6vw, 22px);
  letter-spacing: 0.32em;
  line-height: 1.7;
  opacity: 0.85;
  margin: 0;
  color: #FFFFFF;
}

/* ============================================================
   3. （已移除：stack-timeline-fadeout + timeline-section — 2026-05-16 刪除首頁 timeline 區塊）
   ============================================================ */

/* ============================================================
   v0.3：父層 fixed overlay 維持 pointer-events: none（避免擋滑鼠），
   給內部「文字 child」強制 pointer-events: auto，讓 elementsFromPoint
   能直接命中文字本體（hero / transition / zoomed / fadeout / timeline-aside）。
   ============================================================ */
.hero-stack-transition__text,
.hero-stack-transition__text *,
.stack-card__content--zoomed > * {
  pointer-events: auto;
}


/* ============================================================
   4. FIVE-SENSES Slider（demo 1:1 移植，.five-senses-section scope 前綴）
   ============================================================ */
.five-senses-section {
  position: relative;
  width: 100%;
  height: calc(600vh + 2500px); /* 5 卡 + 1 viewport 緩衝；第 1 卡拉長 1000px + 末段 1500px tail buffer */
  background: #000;
  --header-edge: max(32px, calc((100vw - 1240px) / 2)); /* 對齊頁首左右邊：min(100% - 64px, 1240px) 置中 */
}

.five-senses-section .slider-stage {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
  background: #000;
}

.five-senses-section .slider {
  position: relative;
  width: 100%;
  height: 100%;
  list-style: none;
  margin: 0;
  padding: 0;
}

.five-senses-section .item {
  width: 200px;
  height: 300px;
  list-style-type: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  background-position: center;
  background-size: cover;
  border-radius: 20px;
  box-shadow: 0 20px 30px rgba(255,255,255,0.3) inset;
  transition:
    transform 0.1s,
    left 0.75s,
    top 0.75s,
    width 0.75s,
    height 0.75s;
}

.five-senses-section .item:nth-child(1),
.five-senses-section .item:nth-child(2) {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  transform: none;
  border-radius: 0;
  box-shadow: none;
  opacity: 1;
}

.five-senses-section .item:nth-child(3) { left: calc(100% - 420px - var(--header-edge)); }
.five-senses-section .item:nth-child(4) { left: calc(100% - 200px - var(--header-edge)); }
.five-senses-section .item:nth-child(5) {
  left: calc(50% + 660px);
  opacity: 0;
}

.five-senses-section .content {
  width: min(34vw, 460px);
  position: absolute;
  top: 50%;
  left: var(--header-edge);
  transform: translateY(-50%);
  font: 400 1rem var(--ts-font-sans-zh, "Noto Sans TC"), helvetica, sans-serif;
  color: #fff;
  text-shadow: 0 3px 12px rgba(0,0,0,0.55);
  opacity: 0;
  display: none;
}

.five-senses-section .content .title {
  font-family: var(--ts-font-serif-zh, "Noto Serif TC"), serif;
  font-size: clamp(1.75rem, 2.4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.25;
  color: #fff;
}

.five-senses-section .content .description {
  line-height: 1.85;
  margin: 1.25rem 0 1.75rem;
  font-size: 1rem;
}

.five-senses-section .content .read-more {
  display: inline-block;
  width: fit-content;
  background-color: rgba(0,0,0,0.15);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.85);
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.28s ease, border-color 0.28s ease, transform 0.28s ease;
}

.five-senses-section .content .read-more:hover {
  background-color: rgba(255,255,255,0.18);
  border-color: #fff;
  transform: translateY(-1px);
}

.five-senses-section .item:nth-of-type(2) .content {
  display: block;
  animation: fs-show 0.75s ease-in-out 0.3s forwards;
}

@keyframes fs-show {
  0% {
    filter: blur(5px);
    transform: translateY(calc(-50% + 75px));
  }
  100% {
    opacity: 1;
    filter: blur(0);
  }
}

@media (width > 650px) and (width < 900px) {
  .five-senses-section .content              { width: min(48vw, 380px); }
  .five-senses-section .content .title       { font-size: 1.5rem; }
  .five-senses-section .content .description { font-size: 0.95rem; }
  .five-senses-section .content .read-more   { font-size: 0.85rem; padding: 0.55rem 1.2rem; }
  /* 縮圖縮小 + 位置左移避免右側切出 viewport（平板 768 修正） */
  .five-senses-section .item { width: 130px; height: 210px; }
  .five-senses-section .item:nth-child(3) { left: calc(100% - 290px - var(--header-edge)); }
  .five-senses-section .item:nth-child(4) { left: calc(100% - 140px - var(--header-edge)); }
  .five-senses-section .item:nth-child(5) { left: calc(50% + 510px); opacity: 0; }
}

@media (width < 650px) {
  .five-senses-section .content              { width: min(86vw, 360px); }
  .five-senses-section .content .title       { font-size: 1.5rem; }
  .five-senses-section .content .description { font-size: 0.95rem; line-height: 1.75; }
  .five-senses-section .content .read-more   { font-size: 0.85rem; padding: 0.55rem 1.2rem; }
  /* 手機隱藏右側縮圖（避免擠在內文上） */
  .five-senses-section .item:nth-child(3),
  .five-senses-section .item:nth-child(4),
  .five-senses-section .item:nth-child(5) { display: none; }
}

/* 平板（iPad 直/橫 650–1024px）：原本縮小卡片仍會被右緣裁切（第 2 張卡半截+疊到 scrollbar）。
   依設計決定，平板比照手機隱藏右側預覽卡，文字主體在左側、空間充足。2026-06-01 新增。
   置於上方各 @media 之後以覆蓋 (650–900) 的卡片顯示規則。 */
@media (min-width: 650px) and (max-width: 1024px) {
  .five-senses-section .item:nth-child(3),
  .five-senses-section .item:nth-child(4),
  .five-senses-section .item:nth-child(5) { display: none; }
}
