/* Reel 首屏：真实的面板截图（按页面语言各一张，浅色与深色各一张，放在 media/panel<语言><light|dark>.jpg）。
   截图用独立的临时数据和虚构内容拍摄，背景是自绘的渐变。换图时七种语言一起换，尺寸保持 2304×480。
   页面先用同名的 .avif（node shared/images.mjs 生成，约为 jpg 的三分之一），不支持 AVIF 的浏览器用 jpg；
   浅色那张是首屏最大的元素（LCP），带 fetchpriority="high"、不延迟加载。
   本文件只在 Reel 首页加载，所以功能区开头的面板演示（features.html）的样式也写在这里。 */

.reel-screen {
  height: auto;
  background: none;
  line-height: 0;
}
.reel-shot {
  display: block;
  width: 100%;
  height: auto;
}
.reel-shot-dark {
  display: none;
}
:root[data-theme="dark"] .reel-shot-light {
  display: none;
}
:root[data-theme="dark"] .reel-shot-dark {
  display: block;
}
/* 窄屏：保持截图里的文字可读，只显示左侧一段 */
@media (max-width: 760px) {
  .reel-shot {
    width: 230%;
    max-width: none;
  }
}

/* ---------- 首屏：购买按钮下的三条事实（buy-note.html，在 .hero-buy 里、按钮之后） ---------- */
.reel-facts {
  display: grid;
  gap: 6px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.94rem;
}
.reel-facts li {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.reel-facts svg {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--accent);
  transform: translateY(2px);
}

/* ---------- 功能区：探索 Reel（参照苹果产品页的「探索」交互） ----------
   features.html：上面一排条目（⇧⌘V、搜索、空格预览、收藏夹、外观），选中的条目展开成一张说明卡片，卡片里有控件；
   下面是整条面板的真实截图（media/<状态><语言><light|dark>.jpg，10 个状态，都在屏幕同一区域、以页面底色为背景截取），
   随控件原地切换：面板本身不动，只有内容在变。截图与正文区等宽（product.json 的 wrap）。
   hero.js 给 .reel-explore 加 data-live 后才有条目与控件；没有脚本时五段说明依次排列，画面停在默认状态。 */
.reel-explore {
  /* 截图区域 1728 × 617 点，面板上方的留白 289 点 = 宽度的 16.72%：截图上提「留白 − 12px」，
     卡片在它上面的文档流里，所以无论卡片多高，卡片下沿离面板顶边都是 12px，不会挡住面板 */
  --ex-band: 16.72%;
  margin: 0 0 64px;
}
.ex-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.ex-bar[hidden] {
  display: none;
}
.ex-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 0 1 auto;
  min-width: 0;
}
.ex-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 18px 0 12px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 6%, var(--page));
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease;
}
.ex-tab:hover {
  background: color-mix(in srgb, var(--ink) 10%, var(--page));
}
.ex-tab:active {
  transform: scale(0.98);
}
.ex-plus {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  flex: none;
}
.ex-plus::before,
.ex-plus::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 1.5px;
  background: currentColor;
  transform: translate(-50%, -50%);
}
.ex-plus::after {
  transform: translate(-50%, -50%) rotate(90deg);
  transition: transform 220ms ease;
}
.ex-tab[aria-selected="true"] {
  background: var(--ink);
  color: var(--page);
}
/* 自动演示的进度：当前条目的药丸由左往右填上浅一级的底色（--fill 由 hero.js 写，0–1） */
.ex-tab {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.ex-tab::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--page) 26%, var(--ink));
  transform: scaleX(var(--fill, 0));
  transform-origin: left center;
  opacity: 0;
}
.reel-explore[data-auto] .ex-tab[aria-selected="true"]::before {
  opacity: 1;
}
/* 选中的条目：加号的竖线收起，变成减号 */
.ex-tab[aria-selected="true"] .ex-plus::after {
  transform: translate(-50%, -50%) rotate(0deg);
}
.ex-tab:focus-visible,
.ex-play:focus-visible,
.ex-segment button:focus-visible,
.ex-key:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* 播放 / 暂停：紧跟在最后一个条目后面，与条目同高、同底色；自动演示进行中显示暂停图标 */
.ex-play {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 6%, var(--page));
  color: var(--ink);
  cursor: pointer;
  transition: background-color 180ms ease;
}
.ex-play:hover {
  background: color-mix(in srgb, var(--ink) 10%, var(--page));
}
.ex-play:active {
  transform: scale(0.96);
}
.ex-play svg {
  width: 14px;
  height: 14px;
}
.ex-play .ex-icon-play,
.reel-explore[data-auto] .ex-play .ex-icon-pause {
  display: block;
}
.ex-play .ex-icon-pause,
.reel-explore[data-auto] .ex-play .ex-icon-play {
  display: none;
}

/* 说明卡片：选中的一张显示；几张叠在同一格里，切换时版面高度不变 */
.ex-cards {
  display: grid;
  gap: 28px;
}
.ex-card {
  position: relative;
  z-index: 1;
  max-width: 640px;
}
.ex-text {
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.65;
}
.ex-text strong {
  color: var(--ink);
  font-weight: 650;
}
.ex-text strong::after {
  content: ". ";
}
:lang(zh) .ex-text strong::after,
:lang(ja) .ex-text strong::after {
  content: "。";
}
.reel-explore[data-live] .ex-cards {
  gap: 0;
}
.reel-explore[data-live] .ex-card {
  grid-area: 1 / 1;
  align-self: end;
  width: 52%;
  max-width: none;
  padding: 22px 24px;
  border-radius: 24px;
  background: color-mix(in srgb, var(--ink) 5%, var(--page));
  visibility: hidden;
  opacity: 0;
  transition: opacity 220ms ease, visibility 0s linear 220ms;
}
.reel-explore[data-live] .ex-card.is-active {
  visibility: visible;
  opacity: 1;
  transition: opacity 220ms ease;
}
.ex-control {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.ex-control[hidden] {
  display: none;
}
.ex-hint {
  color: var(--muted);
  font-size: 0.84rem;
}
/* 分段控件：一块浅色底上的几段，选中的一段是白色滑块（深色模式下是浅一级的灰） */
.ex-segment {
  display: inline-flex;
  justify-self: start;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--ink) 8%, var(--page));
}
.ex-segment button {
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.ex-segment button:hover {
  color: var(--ink);
}
.ex-segment button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(20, 30, 50, 0.12), 0 2px 8px -2px rgba(20, 30, 50, 0.12);
}
:root[data-theme="dark"] .ex-segment button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--ink) 16%, var(--page));
}
.ex-code {
  font-family: var(--mono);
  font-size: 0.9em;
}
/* 键帽：按下即下沉 */
.ex-stepper {
  display: flex;
  gap: 8px;
}
.ex-key {
  min-width: 48px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 3px;
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font: 500 1rem/1 system-ui, -apple-system, sans-serif;
  cursor: pointer;
  transition: transform 80ms ease-out, border-bottom-width 80ms ease-out;
}
.ex-key:active {
  transform: translateY(1px);
  border-bottom-width: 2px;
}

/* 画面：10 个状态叠在一起，当前的不透明；截图上提「留白 − 12px」 */
.ex-stage {
  position: relative;
  margin: 20px 0 0;
  line-height: 0;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 10%);
  mask-image: linear-gradient(to bottom, transparent, #000 10%);
}
.reel-explore[data-live] .ex-stage {
  margin-top: calc(12px - var(--ex-band));
  /* 横向手势归 hero.js（翻到上一步 / 下一步），竖向仍交给浏览器滚动页面；画面可以按住横向拖动 */
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.reel-explore[data-live] .ex-stage:active {
  cursor: grabbing;
}
.reel-explore[data-live] .ex-stage img {
  -webkit-user-drag: none;
  pointer-events: none;
}
.reel-explore[data-live] .ex-cards {
  touch-action: pan-y;
}
/* 在这一块上横滑不触发浏览器的「后退一页」 */
.reel-explore[data-live] {
  overscroll-behavior-x: contain;
}
.ex-shot {
  display: none;
}
.ex-shot.is-active {
  display: block;
}
.reel-explore[data-live] .ex-shot {
  display: block;
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 260ms ease;
}
.reel-explore[data-live] .ex-shot.is-active {
  position: relative;
  opacity: 1;
}
.ex-shot img {
  display: block;
  width: 100%;
  height: auto;
}
.ex-shot .ex-dark {
  display: none;
}
:root[data-theme="dark"] .ex-shot .ex-light {
  display: none;
}
:root[data-theme="dark"] .ex-shot .ex-dark {
  display: block;
}

/* 功能清单：第 2–5 条与第 9 条已在「探索 Reel」里展开，这里不再重复；剩下四条排成一行 */
.reel-explore + .features > li:nth-child(n + 2):nth-child(-n + 5),
.reel-explore + .features > li:nth-child(9) {
  display: none;
}
@media (min-width: 1101px) {
  .reel-explore + .features {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* 窄屏：条目横向滑动；卡片占满宽度、不再叠在截图上；截图放大到 190%，按状态露出要看的那一块 */
@media (max-width: 900px) {
  .ex-bar {
    margin-right: calc(var(--gutter) * -1);
  }
  .ex-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-right: var(--gutter);
  }
  .ex-tabs::-webkit-scrollbar {
    display: none;
  }
  .ex-tab {
    flex: none;
  }
  .ex-tabs {
    flex: 1 1 auto;
  }
  .reel-explore[data-live] .ex-card {
    width: auto;
  }
  .reel-explore[data-live] .ex-stage {
    margin-top: 16px;
  }
  .ex-stage {
    overflow: hidden;
  }
  .ex-shot img {
    width: 190%;
    max-width: none;
  }
  /* 没有气泡的状态：面板上方的留白（放大后约为宽度的 32%）收掉大半 */
  .ex-stage:not([data-state^="pv"]) {
    margin-top: -14% !important;
  }
  /* 有气泡的状态：露出右边的气泡与对应卡片（Markdown 在第 5 张） */
  .ex-stage[data-state="pvmd"] img,
  .ex-stage[data-state="pvsrc"] img {
    margin-left: -70%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .reel-explore[data-live] .ex-card,
  .reel-explore[data-live] .ex-card.is-active,
  .reel-explore[data-live] .ex-shot,
  .ex-tab,
  .ex-segment button,
  .ex-plus::after {
    transition: none;
  }
}
