/* ── Full-page snap: 3 sections via CSS transform ── */

html.lt-home-snap,
html.lt-home-snap body {
  height: 100dvh;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

html.lt-home-snap #lt-app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

html.lt-home-snap .lt-app-main {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* Container is the viewport reference */
.lt-home-snap-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Every section stacks at the same spot, moved by transform */
.lt-home-section {
  position: absolute;
  inset: 0;
  will-change: transform;
  transition: none; /* 進場無動畫，由 .lt-home-snap-ready 啟用切換動畫 */
  /* default: below viewport */
  transform: translateY(100%);
}

html.lt-home-snap.lt-home-snap-ready .lt-home-section {
  transition: transform 0.52s cubic-bezier(0.77, 0, 0.175, 1);
}

/* Active section */
.lt-home-section.lhs-active {
  transform: translateY(0);
}

/* Section already passed (above active) */
.lt-home-section.lhs-above {
  transform: translateY(-100%);
}

/* ── Section 0: Search ── */
#section-0 {
  display: flex;
  flex-direction: column;
  background: var(--c1);
}

#section-0 .lt-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 60px; /* nav height */
}

/* ── Section 1: Products ── */
/* 導覽列已在 #lt-app 內佔位，勿再 padding-top:60px 否則頂部重複空 60px */
#section-1 {
  display: flex;
  flex-direction: column;
  background: var(--c1);
  padding-top: 10px;
  /* padding-bottom 由 JS 依 .lt-home-dots 真實位置動態設定，避免圓點擋住第二列 */
  padding-bottom: var(--lhs-dots-reserve, 80px);
  overflow: hidden;
}

.lt-sec1-block {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 0 10px 20px;
}

/* 商品橫列區：只佔必要高度，剩餘給論壇預留區 */
.lt-sec1-block:has(#lt-home-merged-row) {
  flex: 0 1 auto;
  max-height: min(42dvh, 280px);
  min-height: 0;
}

.lt-sec1-block:has(#lt-home-merged-row) .lt-prod-row {
  flex: 1 1 auto;
  min-height: 120px;
  max-height: min(36dvh, 240px);
}

/* 論壇 / Topic 預留：吃滿 section-1 剩餘垂直空間 */
#lt-topic-dynamic-slot {
  flex: 1 1 0%;
  min-height: 0;
}

.lt-sec1-block + .lt-sec1-block {
  border-top: 1px solid var(--border);
}

.lt-sec1-block-hd {
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 8px;
  padding-right: 20px;
}

.lt-sec1-block-hd-title {
  font-size: .9rem;
  font-weight: 800;
  color: var(--txt);
}

.lt-sec1-block-hd-desc {
  font-size: .75rem;
  color: var(--muted);
}

/* Horizontal scroll row */
.lt-prod-row {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-right: 20px;
  /* desktop drag cue */
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.lt-prod-row::-webkit-scrollbar { display: none; }
.lt-prod-row.is-dragging { cursor: grabbing; }

/* Cards inside horizontal row */
.lt-prod-row .lt-card {
  flex: 0 0 140px;
  width: 140px;
  height: 100%;
  display: flex;
  flex-direction: column;
  /* Reset any outside overrides */
  min-width: 0;
}

/* Image fills available vertical space */
.lt-prod-row .lt-card .lt-card-img,
.lt-prod-row .lt-card .lt-card-img-placeholder {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 0; /* forces flex sizing */
  aspect-ratio: unset;
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
}

.lt-prod-row .lt-card .lt-card-body {
  flex-shrink: 0;
  padding: 8px 10px;
}

.lt-prod-row .lt-card .lt-card-name {
  font-size: .8rem;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lt-prod-row .lt-card .lt-card-store {
  font-size: .7rem;
}

.lt-prod-row .lt-card .lt-card-price {
  font-size: .88rem;
}

@media (min-width: 768px) {
  .lt-prod-row .lt-card {
    flex: 0 0 180px;
    width: 180px;
  }
}

/* ── Section 2: Live TV ── */
#section-2 {
  background: #000;
}

#section-2 #lt-tv {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* CRITICAL: 允許 flex 子項可捲動（不撐破容器） */
#section-2 .lt-tv-slides {
  min-height: 0;
}

/* section-2 內每個 slide 與容器同高即可（不依賴 100dvh 計算） */
#section-2 .lt-tv-slide {
  height: 100dvh;
  min-height: 0;
}

/* Hide nav when in live section */
body.in-section-2 .lt-nav {
  transform: translateY(-100%);
}

.lt-nav {
  transition: transform 0.3s ease;
}

/* ── Bottom Dots Navigation ── */
.lt-home-dots {
  position: fixed;
  bottom: max(12px, env(safe-area-inset-bottom, 12px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 10, 18, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 14px;
  border-radius: 50px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,.45);
  max-width: 40vw;
}

.lt-home-dots a.dot {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  text-decoration: none;
  background: rgba(255,255,255,.08);
  color: var(--txt);
  transition: background .2s, transform .2s, box-shadow .2s;
  flex-shrink: 0;
}

.lt-home-dots a.dot.active {
  background: var(--acc);
  transform: scale(1.12);
  box-shadow: 0 0 14px rgba(0,212,255,.45);
}

/* Hide footer on snap homepage */
html.lt-home-snap body > .lt-footer {
  display: none;
}

/* TEMP_LT_PLATFORM_LEGAL — 刪 templates/temp_lt_platform_legal.php + index.php 兩處 */
#lt-app .lt-temp-platform-legal {
  position: fixed;
  bottom: max(90px, calc(24px + 52px + env(safe-area-inset-bottom)));
  right: max(12px, env(safe-area-inset-right));
  left: auto;
  z-index: 60;
  max-width: min(70vw, 280px);
  text-align: right;
  font-size: 11px;
  line-height: 1.3;
  color: rgba(180, 180, 195, 0.8);
  pointer-events: none;
}
#lt-app .lt-temp-platform-legal a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  pointer-events: auto;
}
#lt-app .lt-temp-platform-legal-sep {
  margin: 0 4px;
  opacity: 0.6;
  user-select: none;
}
