/* --- 首頁專屬樣式 --- */
#page-index {
  background-color: #F5EFE6;
}

#page-index .mobile-container {
  background-color: #F5EFE6;
}

/* --- 首頁章節導航按鈕 (位於信件卡片下方) --- */
.index-bottom-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
  position: relative;
  z-index: 2;
}

/* 淺藍卡片：左下一塊大圓弧色塊 + 右上 6 顆小圓點，全部用純色 */
.index-bottom-nav-btn {
  --nav-bg: #E4F1FD;
  --nav-shape: #CDE6FB;
  --nav-dot: #B8DAF7;
  --nav-text: #0B4A8E;
  container-type: inline-size;
  position: relative;
  overflow: hidden;
  background-color: var(--nav-bg);
  color: var(--nav-text);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06); /* 同上方故事卡片 */
  padding: 14px 8px 16px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s;
}

/* 大圓弧色塊 (以卡片寬度 cqw 計算，卡片寬窄改變時弧線比例不變) */
.index-bottom-nav-btn::before {
  content: "";
  position: absolute;
  width: 270cqw;
  aspect-ratio: 1;
  left: -182cqw;
  top: -170cqw;
  border-radius: 50%;
  background-color: var(--nav-shape);
}

/* 右上角 2 × 3 小圓點 */
.index-bottom-nav-btn::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--nav-dot);
  box-shadow:
    -10px 0 0 var(--nav-dot), -20px 0 0 var(--nav-dot),
    0 10px 0 var(--nav-dot), -10px 10px 0 var(--nav-dot), -20px 10px 0 var(--nav-dot);
}

.index-bottom-nav-icon {
  position: relative;
  z-index: 1;
  width: auto;
  height: 52px;
  object-fit: contain;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.index-bottom-nav-label {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}

/* 橢圓外框箭頭 */
.index-bottom-nav-arrow {
  position: relative;
  flex-shrink: 0;
  width: 26px;
  height: 20px;
  border: 1.5px solid currentColor;
  border-radius: 99px;
}

.index-bottom-nav-arrow::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: translate(-70%, -50%) rotate(45deg);
}

.index-bottom-nav-btn:hover {
  color: var(--nav-text);
  transform: translateY(-2px);
}

.index-hero {
  /* 縮放單位：Hero 的設計高度為 710px，畫面不夠高時，文字、間距與插圖一起等比縮小 (最小縮到 560px 高)
     --u 相當於「設計稿的 1px」，用法為 calc(數值 * var(--u)) */
  --u: clamp(0.789px, calc(100vh / 710), 1px);
  position: relative;
  background-color: #003c81;
  padding: calc(24 * var(--u) + var(--safe-top)) 20px calc(36 * var(--u)) 20px;
  color: white;
  /* 高度剛好一個手機畫面 (svh 會扣掉瀏覽器工具列) */
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  clip-path: ellipse(160% 100% at 50% 0%);
}

@supports (height: 100svh) {
  .index-hero {
    --u: clamp(0.789px, calc(95svh / 710), 1px);
  }
}

/* 選單按鈕浮在右上角，不佔高度，讓標題區塊與按鈕同高 */
.index-top-nav {
  display: flex;
  justify-content: flex-end;
  position: absolute;
  top: calc(24 * var(--u) + var(--safe-top));
  right: 20px;
  z-index: 20; /* 高於標題區，避免被小標題蓋住而點不到 */
}

.title_ses{
  position: relative;
  left:15px;
  top:5px;
}

.index-subtitle {
  width: fit-content; /* 只佔文字本身的寬度，不延伸到右上角的選單按鈕 */
  max-width: calc(100% - 56px); /* 預留選單按鈕 36px＋間距 */
  font-size: calc(15 * var(--u));
  color: #ff9999;
  letter-spacing: calc(1 * var(--u));
  margin-top: calc(12 * var(--u)); /* 與選單按鈕垂直置中對齊 */
  margin-bottom: calc(6 * var(--u));
  position: relative;
  z-index: 10;
}

.index-title {
  font-family: "Songti TC", "Noto Serif TC", serif;
  font-size: calc(52 * var(--u));
  font-weight: 600;
  color: white;
  line-height: 1.1;
  margin-bottom: calc(8 * var(--u));
  letter-spacing: calc(2 * var(--u));
  position: relative;
  z-index: 10;
}

.index-title-sub {
  font-family: "Songti TC", "Noto Serif TC", serif;
  font-size: calc(26 * var(--u));
  font-weight: 500;
  color: white;
  margin-bottom: calc(16 * var(--u));
  letter-spacing: calc(1 * var(--u));
  position: relative;
  z-index: 10;
}

/* 插圖區：吃掉 Hero 剩下的高度 */
.index-hero-images {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  margin-bottom: calc(12 * var(--u));
  display: flex;
  justify-content: center;
  align-items: center;
  container-type: size;
  z-index: 2;
}

/* 插圖舞台：設計稿 350 x 400，跟著 --u 等比縮放；插圖區不夠時再依可用空間縮小 */
.index-hero-stage {
  position: relative;
  width: min(calc(350 * var(--u)), 100cqw, 87.5cqh);
  aspect-ratio: 350 / 400;
}

/* 以下位置與寬度皆為舞台的百分比 (換算自設計稿 px) */
.img-p2-window {
  position: absolute;
  top: -0.5%;
  right: 5.7%;
  width: 38%;
  z-index: 2;
}

.img-p1-person {
  position: absolute;
  top: 32.5%;
  left: 20%;
  width: 34.3%;
  z-index: 3;
}

.img-5plus5 {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 65.7%;
  z-index: 4;
  animation: img-fade-in 1.2s ease-out 0.4s both; /* 頁面載入後淡入 */
}

@keyframes img-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.index-hero-footer-text {
  text-align: center;
  font-size: calc(15 * var(--u));
  color: white;
  letter-spacing: calc(1.5 * var(--u));
  margin-bottom: calc(16 * var(--u));
  position: relative;
  z-index: 10;
}

.scroll-down-btn {
  margin: 0 auto;
  width: calc(32 * var(--u));
  height: calc(44 * var(--u));
  border-radius: 20px;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  position: relative;
  z-index: 10;
}

/* --- 第二區塊 --- */
.index-content-section {
  background-color: #F5EFE6;
  padding: 60px 20px 40px 20px;
  position: relative;
  z-index: 5;
  overflow: hidden;
}

.content-intro-text {
  font-size: 15px;
  color: #333333;
  line-height: 1.6;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 2;
}

.content-main-title {
  font-family: "Songti TC", "Noto Serif TC", serif;
  font-size: 32px;
  font-weight: 700;
  color: #0B3564;
  margin-bottom: 40px;
  letter-spacing: 1px;
  position: relative;
  z-index: 2;
}

.letter-card {
  background: white;
  border-radius: 12px;
  padding: 0;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  position: relative;
  z-index: 10;
  overflow: hidden;
}

.letter-header {
  background-color: #ff9999;
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 0;
}

.letter-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.letter-icon-left {
  width: 20px;
  height: 20px;
}

.letter-body {
  padding: 20px;
}

.letter-title {
  font-family: "Songti TC", "Noto Serif TC", serif;
  font-size: 22px;
  color: #0B3564;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.4;
}

.letter-text {
  font-size: 14px;
  color: #333333;
  line-height: 1.6;
  margin-bottom: 24px;
}

.letter-btn-wrap {
  text-align: right;
}

/* 有配圖時：標題在左、插圖在右上 (往上超出到信封標題列)，內文跨整欄，按鈕置中放在最下方 */
.letter-main {
  display: grid;
  grid-template-columns: 1fr 44%;
  column-gap: 8px;
  align-items: center;
}

.letter-main-text {
  display: contents; /* 讓標題與內文直接參與 grid 排列 */
}

.letter-main .letter-title {
  grid-column: 1;
  grid-row: 1;
  margin-bottom: 0;
}

.letter-img {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  margin-top: -52px; /* 往上疊到粉紅色標題列 */
}

.letter-main .letter-text {
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: 12px;
}

.letter-main + .letter-btn-wrap {
  text-align: center;
}

.letter-btn-read {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1.5px solid #0B3564;
  border-radius: 99px;
  color: #0B3564;
  font-size: 14px;
  font-weight: 700;
  padding: 6px 16px;
  text-decoration: none;
  transition: background-color 0.3s, color 0.3s;
  /* 首頁信件按鈕改為 <button> 開彈窗，清掉按鈕預設樣式 */
  background: none;
  font-family: inherit;
  cursor: pointer;
}

.letter-btn-read:hover {
  background-color: #0B3564;
  color: white;
}

.index-bottom-illustration {
  margin-top: 40px;
  display: flex;
  justify-content: flex-start;
  position: relative;
  z-index: 10;
  padding-left: 10%;
}

.index-bottom-illustration img {
  width: 240px;
  height: auto;
}

/* 暫時隱藏首頁下方內容區的飛機與航線，hero 的飛機保留 (要恢復時刪除此段) */
.index-content-section .hero-flight-svg {
  display: none;
}

/* 彈窗內 Angel 完整故事 PDF 按鈕 (置中，位於署名與醫師短評之間) */
.story-modal-pdf-wrap {
  text-align: center;
  margin-top: 20px;
}
