/* 商品短影音（首頁橫滑列／/videos 探索頁／商品頁播放器）
   和紙綠 Warm-Washi：沿用 site.css 的 --bg / --surface / --accent 等變數；零 inline script / style。 */

.reel-rail, .reels-page, .reel-item {
  --reel-radius: 18px;
  --reel-ink: #fffdf8;
  --reel-shade: linear-gradient(180deg, rgba(14, 22, 18, 0) 38%, rgba(14, 22, 18, .55) 68%, rgba(10, 16, 13, .88) 100%);
  --reel-washi: radial-gradient(120% 80% at 20% 0%, #eef4ef 0%, #e3ede6 45%, #d6e4da 100%);
}

/* ── 共用：9:16 播放框 ───────────────────────────── */
.reel-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: var(--reel-radius);
  overflow: hidden;
  background: #101613;
  box-shadow: var(--elev, 0 8px 24px rgba(20, 22, 20, .1));
}
.reel-video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  background: #101613;
}
.reel-card-sec {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(12, 18, 15, .58);
  color: var(--reel-ink);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}

/* ── 1. 首頁「精選開箱短影音」橫向滑動列 ─────────── */
.reel-rail {
  margin: 28px 0 8px;
  padding: 18px 0 6px;
  border-radius: var(--radius, 16px);
  background: var(--reel-washi);
  border: 1px solid var(--line, #e7e5df);
}
.reel-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px 12px;
}
.reel-rail-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink, #1b1c1e);
}
.reel-rail-badge {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent, #1f6b57);
}
.reel-rail-badge svg { width: 13px; height: 13px; fill: var(--accent-ink, #fff); margin-left: 2px; }
.reel-rail-all {
  flex: none;
  font-size: .92rem;
  font-weight: 600;
  color: var(--accent, #1f6b57);
  text-decoration: none;
  white-space: nowrap;
}
.reel-rail-all:hover, .reel-rail-all:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

.reel-track {
  display: flex;
  gap: 12px;
  margin: 0;
  padding: 4px 18px 16px;
  list-style: none;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 18px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(31, 107, 87, .35) transparent;
}
.reel-track::-webkit-scrollbar { height: 6px; }
.reel-track::-webkit-scrollbar-thumb { background: rgba(31, 107, 87, .3); border-radius: 999px; }
.reel-track:focus-visible { outline: 2px solid var(--accent, #1f6b57); outline-offset: -2px; border-radius: 12px; }

/* 手機一排約 2.2 張：(100% − 左右內距 − 兩道間距) / 2.2 */
.reel-card {
  flex: 0 0 calc((100% - 36px - 24px) / 2.2);
  max-width: 220px;
  scroll-snap-align: start;
}
.reel-card-link {
  position: relative;
  display: block;
  aspect-ratio: 9 / 16;
  border-radius: var(--reel-radius);
  overflow: hidden;
  background: #1a221e;
  color: var(--reel-ink);
  text-decoration: none;
  box-shadow: var(--elev, 0 6px 18px rgba(20, 22, 20, .12));
  transition: transform .2s ease, box-shadow .2s ease;
  isolation: isolate;
}
.reel-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--reel-shade);
  z-index: 1;
  pointer-events: none;
}
.reel-card-link:hover { transform: translateY(-2px); box-shadow: var(--elev-hover, 0 12px 26px rgba(20, 22, 20, .18)); }
.reel-card-link:focus-visible { outline: 3px solid var(--accent, #1f6b57); outline-offset: 2px; }
.reel-card-poster, .reel-card-ph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.reel-card-ph { background: linear-gradient(160deg, #2c4a3e, #16241e); }
.reel-card-play {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 253, 248, .22);
  border: 1px solid rgba(255, 253, 248, .45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.reel-card-play svg { width: 12px; height: 12px; fill: var(--reel-ink); margin-left: 2px; }
.reel-card-link .reel-card-sec { z-index: 2; }
.reel-card-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: grid;
  gap: 4px;
  padding: 10px 11px 12px;
}
.reel-card-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: .86rem;
  font-weight: 600;
  line-height: 1.35;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.reel-card-price {
  font-size: .95rem;
  font-weight: 700;
  color: #c9f0dd;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 720px) {
  .reel-card { flex-basis: 196px; }
  .reel-rail-head { padding-inline: 22px; }
  .reel-track { padding-inline: 22px; scroll-padding-inline: 22px; gap: 14px; }
}

/* ── 2. /videos 短影音探索頁 ─────────────────────── */
.reels-page-head { margin-bottom: 20px; }
.reels-eyebrow {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft, #e6f1ec);
  color: var(--accent, #1f6b57);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.reels-page-head h1 { margin: 8px 0 4px; }
.reels-page-sub { margin: 0; color: var(--muted, #6b6b67); }

.reels-feed {
  display: grid;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.reels-post {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: calc(var(--reel-radius) + 6px);
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e7e5df);
  box-shadow: var(--shadow, 0 6px 24px rgba(20, 22, 20, .05));
}
.reels-post-media {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin-inline: auto;
}
.reels-post-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.reels-tag {
  align-self: flex-start;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2, #f3f2ee);
  color: var(--ink-2, #4a4b4f);
  font-size: .78rem;
  font-weight: 600;
}
.reels-tag.is-partner { background: var(--accent-soft, #e6f1ec); color: var(--accent, #1f6b57); }
.reels-tag + .reels-tag { margin-top: -2px; }
.reels-post-title { margin: 4px 0 0; font-size: 1.12rem; line-height: 1.4; }
.reels-post-title a { color: var(--ink, #1b1c1e); text-decoration: none; }
.reels-post-title a:hover, .reels-post-title a:focus-visible { color: var(--accent, #1f6b57); text-decoration: underline; text-underline-offset: 3px; }
.reels-post-price {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent, #1f6b57);
  font-variant-numeric: tabular-nums;
}
.reels-post-shop { margin: 0; font-size: .88rem; color: var(--muted, #6b6b67); }
.reels-post-caption { margin: 4px 0 0; color: var(--ink-2, #4a4b4f); line-height: 1.6; }
.reels-post-acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.reels-btn { flex: 1 1 180px; justify-content: center; text-align: center; min-height: 44px; }

/* 手機：整頁直滑、一次停一支，像 Reels */
@media (max-width: 719px) {
  .reels-feed { scroll-snap-type: y proximity; }
  .reels-entry { scroll-snap-align: start; scroll-margin-top: 12px; }
  .reels-post { padding: 10px; }
  .reels-post-media { max-width: min(100%, 62vh * 9 / 16); }
}

/* 桌機：左影片、右商品資訊 */
@media (min-width: 720px) {
  .reels-feed { gap: 28px; max-width: 880px; margin-inline: auto; }
  .reels-post {
    grid-template-columns: minmax(260px, 360px) 1fr;
    align-items: center;
    gap: 28px;
    padding: 20px;
  }
  .reels-post-media { max-width: none; margin: 0; }
  .reels-post-acts { flex-direction: column; align-items: stretch; max-width: 320px; }
  .reels-btn { flex: none; }
}

/* ── 3. 商品頁播放器 ─────────────────────────────── */
.reel-item { scroll-margin-top: 72px; }
.reel-item-head h2 { display: flex; align-items: center; gap: 8px; }
.reel-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, #1f6b57);
  box-shadow: 0 0 0 4px var(--accent-soft, #e6f1ec);
}
.reel-item-stage {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: calc(var(--reel-radius) + 6px);
  background: var(--reel-washi);
  border: 1px solid var(--line, #e7e5df);
}
.reel-item-stage .reel-frame { width: min(100%, 360px, 70vh * 9 / 16); }
.reel-item-caption {
  max-width: 560px;
  margin: 0;
  color: var(--ink-2, #4a4b4f);
  line-height: 1.65;
  text-align: center;
}

/* ── 3a. 賣家專屬：下載分享列（只有 is_listing_owner 才渲染） ── */
.reel-owner-bar {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(100%, 360px);
  padding-top: 12px;
  border-top: 1px dashed color-mix(in srgb, var(--brass, #7d6438) 35%, var(--line, #e7e5df));
}
.reel-owner-dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 22px 0 18px;
  border-radius: 999px;
  background: var(--accent, #1f6b57);
  color: var(--accent-ink, #fff);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .04em;
  text-decoration: none;
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent, #1f6b57) 70%, transparent);
  -webkit-tap-highlight-color: transparent;
  transition: background-color .18s ease, transform .18s ease;
}
.reel-owner-dl:hover { text-decoration: none; color: var(--accent-ink, #fff); background: color-mix(in srgb, var(--accent, #1f6b57) 88%, var(--ink, #1b1c1e)); }
.reel-owner-dl:active { transform: translateY(1px); }
.reel-owner-dl svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.reel-owner-note {
  margin: 0;
  max-width: 30em;
  color: var(--muted, #6b6b67);
  font-size: 12.5px;
  line-height: 1.65;
  text-align: center;
  overflow-wrap: anywhere;
}

/* ── 3b. 賣家專屬：免費 AI 短影音排隊中（無影片、已 opt-in） ── */
.reel-pending { margin-top: 28px; }
.reel-pending-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius, 4px);
  background: linear-gradient(180deg, color-mix(in srgb, var(--warn-soft, #fbf0e1) 60%, var(--surface-2, #f3f2ee)), var(--surface-2, #f3f2ee));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brass, #7d6438) 26%, var(--hair, rgba(28, 29, 26, .12)));
}
.reel-pending-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface, #fff);
  color: var(--brass, #7d6438);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brass, #7d6438) 30%, transparent);
}
.reel-pending-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}
.reel-pending-body { display: grid; gap: 4px; min-width: 0; }
.reel-pending-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink, #1b1c1e);
  font-size: 15.5px;
  font-weight: 500;
  line-height: 1.55;
}
.reel-pending-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brass, #7d6438);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brass, #7d6438) 18%, transparent);
}
.reel-pending-text { margin: 0; color: var(--ink-2, #4a4b4f); font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
.reel-pending-meta { margin: 2px 0 0; color: var(--muted, #6b6b67); font-size: 12px; letter-spacing: .08em; }
@media (prefers-reduced-motion: no-preference) {
  .reel-pending-dot { animation: reel-pending-pulse 2.4s ease-in-out infinite; }
  @keyframes reel-pending-pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
}
@media (max-width: 419px) {
  .reel-pending-card { gap: 12px; padding: 14px; }
  .reel-pending-icon { width: 34px; height: 34px; }
  .reel-pending-icon svg { width: 18px; height: 18px; }
  .reel-pending-title { font-size: 15px; }
  .reel-owner-dl { width: 100%; }
}

@media (prefers-color-scheme: dark) {
  .reel-owner-dl { box-shadow: none; }
  .reel-rail, .reels-page, .reel-item {
    --reel-washi: radial-gradient(120% 80% at 20% 0%, #1d2a24 0%, #18221e 50%, #141b18 100%);
  }
  .reel-rail-all { color: var(--accent, #6cc4a6); }
}

@media (prefers-reduced-motion: reduce) {
  .reel-card-link, .reel-owner-dl { transition: none; }
  .reel-card-link:hover, .reel-owner-dl:active { transform: none; }
}
