# 下拉选择器

选择纸张后，已选项、色样和说明同步更新。

## 试一试

选择一种纸张，比较其颜色和说明。

## 交互细节

选中后收起选项列表，并在预览中换用所选纸张。

## 各平台的操作方式

- iOS · 点按纸张名称，选择一种纸材查看色样。
- Android · 点按纸张名称，选择一种纸材查看色样。
- PC · 选择一种纸张，比较其颜色和说明。

## 适用场景

从几种颜色或材质中选择一项。

## 实现要求

> 选用其他纸张时，立即更新色样和按钮状态。

## 独立 HTML 示例

将以下代码保存为 HTML 文件，用浏览器打开即可离线体验。

```html
<!doctype html>
<html lang="zh-Hans"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>下拉选择器 · Motion Lab</title><style>*{box-sizing:border-box}body{margin:0;background:#f4f3ec;color:#24251f;font:15px/1.5 system-ui,sans-serif}main{width:min(1080px,100%);margin:auto}header.sample-heading,footer.sample-tools{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;padding:12px 16px}.sample-heading h1{margin:0;font-size:clamp(20px,3vw,32px)}.sample-tools p{margin:0;flex:1 1 240px;font-size:13px}.sample-tools button{min-height:42px;padding:6px 12px;border:1px solid #666957;background:#fcfbf4;color:#202219;border-radius:3px;font:inherit}#playDemo{background:#272a23;color:white}#stage{width:100%;height:clamp(310px,70dvh,700px);position:relative;overflow:auto}.sample-status{min-height:1.4em;margin:0 16px 12px;font-size:13px}button{cursor:pointer}button:focus-visible,a:focus-visible{outline:3px solid #a64c27;outline-offset:2px}[hidden]{display:none!important}@media(prefers-reduced-motion:reduce){*,*::after,*::before{scroll-behavior:auto!important}}
.demo-scene.foundation-scene{--paper:#f6f0e3;--ink:#292a24;--line:#c8c4b5;--rust:#ac402a;--green:#27453d;position:relative;box-sizing:border-box;display:grid;place-items:safe center;isolation:isolate;overflow:auto;width:100%;height:100%;min-width:0;min-height:0;padding:clamp(14px,3vw,50px);background:#d7d4c7;color:var(--ink);font:500 14px/1.45 Inter,Pretendard,"Malgun Gothic",system-ui,sans-serif;container-type:inline-size}
.demo-scene.foundation-scene{grid-template-columns:minmax(0,1fr)}
.foundation-scene *, .foundation-scene *::before,.foundation-scene *::after{box-sizing:border-box}
.foundation-scene [hidden]{display:none!important}
.foundation-scene .ff-page{position:relative;width:min(100%,790px);max-width:100%;min-width:0;padding:clamp(17px,3.5cqw,44px);background:var(--paper);box-shadow:1px 3px 0 #827d6d2e,0 16px 40px -28px #34382b86}
.foundation-scene button,.foundation-scene summary{color:inherit;font:inherit;cursor:pointer}
.foundation-scene button:focus-visible,.foundation-scene summary:focus-visible,.foundation-scene [tabindex]:focus-visible{outline:3px solid #00778a;outline-offset:3px;z-index:2}
.foundation-scene .ff-image{display:block;object-fit:cover;width:100%;min-width:0;max-width:100%}
.foundation-scene .ff-heading h3,.foundation-scene .ff-hero h3{margin:0;color:inherit;font:700 clamp(24px,4.4cqw,53px)/1.09 Inter,Pretendard,"Malgun Gothic",sans-serif;letter-spacing:-.072em}
.foundation-scene .ff-heading i,.foundation-scene .ff-work i,.foundation-scene .ff-register i,.foundation-scene .ff-drawer-copy>i,.foundation-scene figcaption i,.foundation-scene .ff-hoverwork>span i,.foundation-scene .ff-load>div>i{display:block;margin-top:4px;color:inherit;font:italic 400 clamp(13px,1.8cqw,20px)/1.25 Georgia,serif;letter-spacing:-.035em}
.foundation-scene .ff-heading{margin-bottom:clamp(14px,2.6cqw,27px)}
.foundation-scene .ff-heading i{color:#695f50}
.foundation-scene .ff-stamp,.foundation-scene .ff-kind{display:block;color:inherit;font-size:clamp(10px,1.35cqw,13px);line-height:1.45;font-weight:580}
.foundation-scene .ff-stamp{padding-bottom:8px;margin-bottom:12px;border-bottom:1px solid currentColor}
.foundation-scene .ff-kind{color:#5c5a4e;margin-top:6px}
.foundation-scene .ff-cmd,.foundation-scene .ff-heart{display:inline-flex;align-items:center;justify-content:center;gap:.5em;border:1px solid var(--ink);border-radius:2px;background:var(--ink);color:#fbf7e9;padding:9px 14px;font-size:clamp(12px,1.55cqw,15px);font-weight:620;line-height:1.35}
.foundation-scene p{color:inherit;margin:8px 0 15px;line-height:1.65;font-size:clamp(13px,1.8cqw,17px);word-break:keep-all}
.foundation-scene h4{margin:0;color:inherit;font:700 clamp(16px,2.5cqw,26px)/1.25 Inter,Pretendard,"Malgun Gothic",sans-serif;letter-spacing:-.05em}
.foundation-scene .ff-work{width:100%;min-width:0;overflow:hidden;padding:0;border:0;border-radius:0;background:transparent;color:inherit;text-align:left}
.foundation-scene .ff-work img{aspect-ratio:1/.91;margin-bottom:9px}
.foundation-scene .ff-work strong,.foundation-scene .ff-register strong,.foundation-scene figcaption strong,.foundation-scene .ff-drawer-copy>strong,.foundation-scene .ff-hoverwork>span strong,.foundation-scene .ff-load>div>strong{display:block;line-height:1.22;font-size:clamp(15px,2.2cqw,25px);letter-spacing:-.04em}
.foundation-scene .ff-trio,.foundation-scene .ff-contact{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:clamp(8px,1.4cqw,18px)}
.foundation-scene .ff-underlay,.foundation-scene .ff-over{min-width:0}
.foundation-scene .ff-flexhead{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}.foundation-scene .ff-flexhead .ff-heading{margin:0}
.foundation-scene .ff-viewport{width:100%;height:clamp(175px,30cqw,310px);overflow:auto;padding:5px;transition:width .44s cubic-bezier(.2,.7,.2,1);scrollbar-gutter:stable}
.foundation-scene .ff-viewport.ff-narrow{width:min(58%,225px);margin-inline:auto;border-inline:2px solid #aaa797;background:#eee6d4}
.foundation-scene .ff-narrow .ff-trio{grid-template-columns:1fr}.foundation-scene .ff-narrow .ff-work img{aspect-ratio:1.85}
.foundation-scene[data-demo="1"] .ff-page,.foundation-scene[data-demo="6"] .ff-page,.foundation-scene[data-demo="7"] .ff-page,.foundation-scene[data-demo="15"] .ff-page,.foundation-scene[data-demo="21"] .ff-page,.foundation-scene[data-demo="22"] .ff-page,.foundation-scene[data-demo="23"] .ff-page{padding:0}
.foundation-scene .ff-hero{position:relative;min-height:clamp(245px,41cqw,460px);isolation:isolate;display:flex;align-items:flex-end;padding:clamp(19px,4cqw,46px);color:#fff9e8;background:#171812}
.foundation-scene .ff-hero img,.foundation-scene .ff-glass>img,.foundation-scene .ff-depth>img,.foundation-scene .ff-snap figure>img,.foundation-scene .ff-filmtrack img{position:absolute;inset:0;height:100%;width:100%;z-index:-2}
.foundation-scene .ff-hero::before,.foundation-scene .ff-depth::before,.foundation-scene .ff-snap figure::before,.foundation-scene .ff-filmtrack figure::before{content:'';position:absolute;inset:0;z-index:-1;background:linear-gradient(0deg,#15180fbb,transparent 68%)}
.foundation-scene .ff-hero h3{font-size:clamp(39px,7.5cqw,82px);margin:0 0 19px}
.foundation-scene .ff-hero .ff-cmd{color:#fcf2d9;border-color:#fcf2d9;background:#14161265}
.foundation-scene .ff-index{padding:clamp(18px,3cqw,36px)}.foundation-scene .ff-index .ff-cmd{margin-top:18px}
.foundation-scene .ff-pickgrid .ff-work,.foundation-scene .ff-bento button{position:relative}
.foundation-scene .ff-pickgrid .ff-work{border-bottom:3px solid transparent;padding-bottom:10px}.foundation-scene .ff-pickgrid .ff-work[aria-pressed=true]{border-color:var(--rust)}
.foundation-scene .ff-record{padding-top:14px;border-top:1px solid var(--line)}.foundation-scene .ff-record p{margin-bottom:0}
.foundation-scene .ff-bento{display:grid;grid-template-columns:1.65fr 1fr;grid-template-rows:repeat(2,clamp(95px,14cqw,158px));gap:7px}
.foundation-scene .ff-bento .ff-work{color:white;display:flex;align-items:flex-end;padding:12px;isolation:isolate}.foundation-scene .ff-bento .ff-work[aria-pressed=true]{grid-row:span 2}
.foundation-scene .ff-bento img{position:absolute;inset:0;height:100%;width:100%;z-index:-2}
.foundation-scene .ff-bento button::after{content:'';position:absolute;inset:0;z-index:-1;background:linear-gradient(0deg,#18171196,transparent 68%)}.foundation-scene .ff-bento .ff-work i{display:none}
.foundation-scene .ff-side{display:grid;grid-template-columns:minmax(92px,.72fr) 2fr;gap:clamp(12px,3cqw,32px)}
.foundation-scene .ff-side nav{padding-right:12px;border-right:1px solid var(--line)}
.foundation-scene .ff-nav{display:flex;gap:4px;flex-wrap:wrap}.foundation-scene .ff-nav button{border:1px solid transparent;background:transparent;color:var(--ink);font-size:clamp(11px,1.4cqw,14px)}
.foundation-scene .ff-nav button[aria-pressed=true],.foundation-scene .ff-nav button[aria-selected=true]{background:var(--ink);color:var(--paper)}
.foundation-scene .ff-side .ff-nav{display:grid;justify-content:stretch}
.foundation-scene .ff-register article{display:flex;align-items:center;gap:clamp(10px,2cqw,20px);padding:10px 0;border-bottom:1px solid var(--line)}
.foundation-scene .ff-register article>img{width:clamp(44px,10cqw,104px);aspect-ratio:1.2}.foundation-scene .ff-register article>div{min-width:0}.foundation-scene .ff-register button{margin-left:auto;white-space:nowrap}
.foundation-scene .ff-scroll{height:clamp(235px,37cqw,420px);overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;min-height:0}
.foundation-scene .ff-sticky{position:sticky;top:0;z-index:1;display:flex;align-items:center;justify-content:space-between;padding:13px 19px;background:var(--green);color:#fffae9}
.foundation-scene .ff-sticky .ff-heading,.foundation-scene .ff-sticky .ff-stamp{margin:0;border:0;padding:0}.foundation-scene .ff-sticky h3{font-size:clamp(21px,3.1cqw,34px)}
.foundation-scene .ff-sticky-scroll .ff-register{padding:0 20px}.foundation-scene .ff-sticky-scroll .ff-register article{min-height:clamp(120px,18cqw,186px)}.foundation-scene .ff-sticky-scroll article img{width:28%;max-height:155px}
.foundation-scene .ff-split{display:grid;grid-template-columns:1fr 1fr;transition:grid-template-columns .45s ease;align-items:stretch}
.foundation-scene .ff-split.ff-wide{grid-template-columns:1.65fr 1fr}.foundation-scene .ff-split>img{height:100%;max-height:440px}.foundation-scene .ff-split>div{padding:clamp(14px,3.6cqw,41px);align-self:center;min-width:0}
.foundation-scene .ff-detail,.foundation-scene .ff-proof,.foundation-scene .ff-paper,.foundation-scene .ff-ink-proof{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:center;gap:clamp(13px,4cqw,48px);min-width:0}
.foundation-scene .ff-detail>img,.foundation-scene .ff-proof>img{aspect-ratio:1/1.08;max-height:390px}
.foundation-scene .ff-detail .ff-nav{border-bottom:1px solid var(--line);border-top:1px solid var(--line);padding:4px 0;gap:0}.foundation-scene .ff-detail .ff-nav button{padding:7px 9px}
.foundation-scene .ff-detail [role=tabpanel]{min-height:5.5em}
.foundation-scene .ff-faq details{background:transparent!important;border:0!important;border-top:1px solid var(--line)!important;border-radius:0!important;margin:0!important;padding:0!important}
.foundation-scene .ff-faq summary{display:flex;align-items:center;gap:10px;list-style:none;padding:15px 0;font-size:clamp(13px,2cqw,20px);font-weight:630;color:var(--ink)}
.foundation-scene .ff-faq summary::after{content:'+';margin-left:auto}.foundation-scene .ff-faq details[open] summary::after{content:'−'}
.foundation-scene .ff-faq small,.foundation-scene .ff-contact small{color:var(--rust);font:italic 15px Georgia,serif}
.foundation-scene .ff-faq p{margin:0 0 14px;padding:0 20px}
.foundation-scene .ff-over{position:absolute;inset:0;z-index:4;display:grid;place-items:center;background:#15191270;padding:12px}
.foundation-scene .ff-modal,.foundation-scene .ff-drawer{width:min(100%,430px);max-height:100%;overflow:auto;background:#f9f5e9;color:var(--ink);padding:clamp(14px,2.2cqw,24px);box-shadow:0 8px 42px #25251b41}
.foundation-scene .ff-modal{display:grid;grid-template-columns:.8fr 1fr;gap:16px;align-items:center;animation:ff-popup .24s ease-out}.foundation-scene .ff-modal>img{aspect-ratio:.75}.foundation-scene .ff-modal h3{font-size:clamp(18px,3cqw,30px)}
.foundation-scene .ff-drawer-layer{display:flex;justify-content:flex-end;align-items:stretch;padding:0}
.foundation-scene .ff-drawer{width:min(75%,370px);border-left:1px solid var(--line);animation:ff-drawer .33s cubic-bezier(.2,.72,.22,1)}
.foundation-scene .ff-drawer>.ff-cmd{float:right;padding:5px 8px}.foundation-scene .ff-drawer-copy{clear:both;padding-top:9px}.foundation-scene .ff-drawer-copy img{height:clamp(64px,14cqw,145px);margin-bottom:10px}
.foundation-scene .ff-drawer-copy p{margin-bottom:0}
@keyframes ff-popup{from{opacity:0;transform:scale(.95)}}@keyframes ff-drawer{from{transform:translateX(95%)}}
.foundation-scene .ff-sample-stock,.foundation-scene .ff-ink-swatch{display:flex;flex-direction:column;align-items:center;justify-content:center;background:#efe4ca;aspect-ratio:.94;border:1px solid #b6b09f}
.foundation-scene .ff-sample-stock span{font-size:clamp(9px,1.4cqw,13px)}.foundation-scene .ff-sample-stock b,.foundation-scene .ff-ink-swatch b{color:var(--rust);font:italic 650 clamp(42px,11cqw,126px)/1 Georgia,serif;letter-spacing:-.1em}
.foundation-scene .ff-drop,.foundation-scene .ff-help{position:relative;display:inline-flex;align-items:center;gap:9px}.foundation-scene #ff-papers{position:absolute;z-index:4;top:calc(100% + 3px);left:0;min-width:100%;background:#fffdf5;border:1px solid var(--ink);box-shadow:2px 3px 0 #252a2022}
.foundation-scene #ff-papers button{display:block;width:100%;white-space:nowrap;text-align:left;color:var(--ink);background:transparent;border:0;border-radius:0}.foundation-scene #ff-papers button:is(:hover,:focus-visible){background:#e8dfc9}
.foundation-scene .ff-help button{padding:0;width:27px;height:27px;border-radius:50%}.foundation-scene #ff-tip{position:absolute;z-index:3;bottom:calc(100% + 8px);right:0;width:min(215px,53cqw);padding:11px 14px;background:#222821;color:#fff9e9;font-size:12px;line-height:1.55;box-shadow:0 3px 10px #2223}
.foundation-scene .ff-toast{position:absolute;right:12px;bottom:12px;max-width:calc(100% - 24px);display:flex;align-items:center;gap:12px;padding:9px 12px;background:#26372c;color:#fff8e7;box-shadow:1px 5px 19px #241d173f;animation:ff-popup .2s ease}
.foundation-scene .ff-toast .ff-cmd{padding:4px 7px;color:white;background:transparent;border-color:#b6c4b5}
.foundation-scene .ff-film{overflow:hidden;touch-action:pan-y;cursor:grab}.foundation-scene .ff-filmtrack{display:flex;transition:transform .4s cubic-bezier(.2,.7,.22,1)}
.foundation-scene figure{margin:0}.foundation-scene .ff-filmtrack figure,.foundation-scene .ff-snap figure{position:relative;isolation:isolate;display:flex;align-items:flex-end;color:#fffbee}
.foundation-scene .ff-filmtrack figure{height:clamp(220px,36cqw,400px);min-width:100%;padding:clamp(14px,3cqw,34px)}.foundation-scene[data-demo="15"] .ff-nav{padding:7px;justify-content:center}
.foundation-scene .ff-load{min-height:clamp(125px,24cqw,245px);display:flex;align-items:center;gap:clamp(14px,3cqw,32px)}
.foundation-scene .ff-load>img,.foundation-scene .ff-skeleton span:first-child{width:40%;align-self:stretch;min-height:100%;max-height:245px}
.foundation-scene .ff-skeleton{width:100%;display:grid;grid-template-columns:40% 1fr;grid-template-rows:1fr 1fr;gap:14px;align-self:stretch}
.foundation-scene .ff-skeleton span{background:#d8d2c3;align-self:end;height:13px;animation:ff-pulse .7s ease-in-out alternate infinite}.foundation-scene .ff-skeleton span:first-child{width:100%;grid-row:span 2;height:auto;align-self:stretch}.foundation-scene .ff-skeleton span:last-child{width:65%;align-self:start}
@keyframes ff-pulse{to{opacity:.4}}
.foundation-scene[data-demo="17"] .ff-page{width:min(70%,430px);padding:0;background:none;box-shadow:none}
.foundation-scene .ff-hoverwork{display:block;position:relative;width:100%;padding:0;overflow:hidden;border:0;background:var(--paper);text-align:left;box-shadow:1px 4px 8px #32352a38;transition:transform .32s ease,box-shadow .32s ease}
.foundation-scene .ff-hoverwork>img{aspect-ratio:1.24}.foundation-scene .ff-hoverwork>span{display:block;padding:14px}.foundation-scene .ff-hoverwork small{display:block;max-height:0;opacity:0;overflow:hidden;transition:opacity .25s,max-height .3s;font-weight:500}
.foundation-scene .ff-hoverwork.ff-raised{transform:translateY(-6px) rotate(-1.1deg);box-shadow:2px 13px 18px #32352a40}.foundation-scene .ff-hoverwork.ff-raised small{max-height:5em;opacity:1;margin-top:6px}
.foundation-scene .ff-reveal figure{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);align-items:center;gap:clamp(12px,3cqw,28px);padding:15px 0;border-top:1px solid var(--line);transition:opacity .45s,transform .45s}.foundation-scene .ff-reveal img{height:clamp(120px,20cqw,225px)}
.foundation-scene.ff-live .ff-reveal figure:not(.ff-shown){opacity:0;transform:translateY(18px)}
.foundation-scene .ff-contact figure{padding:6px 6px 10px;background:#fffaf0;box-shadow:1px 3px 6px #3d39292e}.foundation-scene .ff-contact img{aspect-ratio:.78}.foundation-scene .ff-contact figcaption{display:flex;gap:6px;align-items:baseline;margin-top:7px;font-size:clamp(10px,1.6cqw,15px)}
.foundation-scene .ff-ink-swatch{background:#a9442f;border:none;border-radius:2px;position:relative;transition:border-radius .63s,background-color .63s,transform .63s;transform:scale(.89)}
.foundation-scene .ff-ink-swatch b,.foundation-scene .ff-ink-swatch em{color:#fff0ca}.foundation-scene .ff-ink-swatch em{font:14px Georgia,serif}.foundation-scene .ff-ink-swatch.ff-alt{border-radius:48%;background:#345962;transform:scale(.98)}
.foundation-scene .ff-glass,.foundation-scene .ff-depth{isolation:isolate;position:relative;min-height:clamp(245px,39cqw,425px);display:flex;align-items:flex-end;padding:clamp(14px,3cqw,36px)}
.foundation-scene .ff-plaque{padding:clamp(16px,2.8cqw,30px);border:1px solid #e9e4d786;background:#f6f1dcba;backdrop-filter:blur(13px);max-width:70%;transition:background-color .3s}.foundation-scene .ff-plaque.ff-solid{background:#f8f3e4;backdrop-filter:none}
.foundation-scene .ff-depth{overflow:hidden;min-height:100%;color:white}.foundation-scene .ff-depth img{height:125%;top:-12%;will-change:transform}.foundation-scene .ff-depth .ff-heading i{color:#fff4d7}
.foundation-scene .ff-depth-note{padding:clamp(20px,4cqw,45px);min-height:85%}.foundation-scene .ff-snap{scroll-snap-type:y mandatory}
.foundation-scene .ff-snap figure{height:100%;scroll-snap-align:start;padding:clamp(15px,3.6cqw,40px)}
.foundation-scene .ff-heart{background:transparent;color:var(--ink);gap:9px}.foundation-scene .ff-heart b{font-size:1.35em;line-height:1;color:var(--rust)}.foundation-scene .ff-heart em{font:italic 1em Georgia,serif;padding-left:8px;border-left:1px solid #bcb7a3}.foundation-scene .ff-heart[aria-pressed=true]{background:#ead1bc}
.foundation-scene.ff-reduced *, .foundation-scene.ff-reduced *::before{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}
@container(max-width:450px){.foundation-scene .ff-page{padding:15px}.foundation-scene .ff-kind{font-size:10px}.foundation-scene .ff-heading h3{font-size:22px}.foundation-scene .ff-flexhead{gap:6px}.foundation-scene .ff-cmd{padding:8px 9px}.foundation-scene .ff-side{grid-template-columns:74px minmax(0,1fr);gap:9px}.foundation-scene .ff-side nav{padding-right:6px}.foundation-scene .ff-side .ff-register .ff-kind{display:none}.foundation-scene .ff-detail{grid-template-columns:minmax(0,.63fr) minmax(0,1fr);gap:12px}.foundation-scene .ff-detail .ff-nav button{padding:7px 5px}.foundation-scene .ff-register article{gap:7px}.foundation-scene .ff-register article>img{width:42px}.foundation-scene .ff-register .ff-work i{font-size:12px}.foundation-scene .ff-split.ff-wide{grid-template-columns:1.35fr 1fr}.foundation-scene .ff-contact figure{padding:3px 3px 6px}.foundation-scene .ff-toast{font-size:11px}.foundation-scene .ff-contact figcaption{display:block}.foundation-scene .ff-contact small{display:block;font-size:11px}.foundation-scene .ff-sticky-scroll article>img{width:29%}.foundation-scene .ff-hero{min-height:270px}.foundation-scene .ff-glass{min-height:260px}}
@media(prefers-reduced-motion:reduce){.foundation-scene *, .foundation-scene *::before{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}
</style></head><body><main><header class="sample-heading"><h1>下拉选择器</h1><span lang="en">Dropdown</span></header><div id="stage"></div><footer class="sample-tools"><p>选择一种纸张，比较其颜色和说明。</p><button id="playDemo">选择纸张</button><button id="reset">重新开始</button></footer><p class="sample-status" id="sampleStatus" role="status"></p></main><script>window.MotionFoundationMedia={};</script><script>'use strict';
(() => {
  const works = [
    {title:'纸环', en:'Paper Loop', kind:'雕塑', process:'网点印刷 · 纸雕', image:'media/paper-loop.webp', alt:'印着红色网点的纸带卷成了两个环', note:'留意纸带交叠处，那里红得更深。'},
    {title:'潮汐线', en:'Tidal Lines', kind:'版画', process:'双色版画', image:'media/tidal-print.webp', alt:'青绿色的波纹与朱红色的太阳交叠', note:'等距的线条在纸上错落展开，如同涟漪。'},
    {title:'错版漫步', en:'Offset Walk', kind:'版画', process:'三色版画', image:'media/offset-print.webp', alt:'靛蓝色和铁锈色的线条折出一道墙面', note:'三块印版相互错开，为画面增添了纵深。'}
  ];
  const guides = [
    ['点击“查看作品”，打开展览作品列表。','以一件主视觉作品作为展览入口，引导观众浏览作品列表。','为主视觉作品设置一个明确的入口，让观众直达作品集。','查看作品'],
    ['切换画幅宽度，看看同一组作品如何在单列和三列间重新排列。','无论屏幕多宽，作品图片和标题始终相邻。','根据可用宽度调整列数和阅读顺序。','切换宽度'],
    ['选择卡片，比较各件作品的印制工艺和创作笔记。','将图片、标题和说明组成一张可选的作品卡片。','点击卡片任意位置，即可选中作品并更新说明。','选择下一件作品'],
    ['切换主推作品，看看大小不一的图块如何重新排列。','在展览索引中同时呈现主推作品和相关作品。','主推作品占用大图块，旁边保留相关作品。','切换主推作品'],
    ['从左侧选择类别，筛选右侧的作品。','浏览档案时，分类目录始终可见。','更新作品列表时，分类菜单保持原位。','下一个类别'],
    ['在列表内滚动，展览标题会固定在顶部。','浏览较长的作品列表时，仍能看到展览标题。','滚动列表时，将展览标题固定在顶部。','下一件作品'],
    ['调整分栏比例，比较图片和作品档案各自占用的空间。','查看作品时，可在一旁阅读其资料。','将照片与档案并排显示，并提供放大照片的选项。','调整分栏比例'],
    ['选择“作品”“工艺”或“养护”。也可以用方向键切换标签页。','查阅同一件作品的不同资料。','把作品介绍、工艺和养护说明放入支持键盘操作的标签页。','下一个标签页'],
    ['展开一个问题，了解如何养护版画。','运送、存放等问题可以逐项展开查看。','点击问题，在原处展开或收起答案。','展开第一个答案'],
    ['点击“查看校样”。关闭对话框或按 Esc 键，即可回到原来的位置。','查看校样后，可回到刚才的工作。','在居中的对话框中展示校样。关闭后，将焦点交还给打开它的按钮。','查看校样'],
    ['点击“查看档案”，即可在列表旁打开作品详情。','阅读完整档案时，保留在列表中的浏览位置。','从侧边滑入所选作品的档案。用关闭按钮、遮罩或 Esc 键关闭后，将键盘焦点还给打开档案的那一行。','打开档案'],
    ['选择一种纸张，比较其颜色和说明。','从几种颜色或材质中选择一项。','选用其他纸张时，立即更新色样和按钮状态。','选择纸张'],
    ['点击“专色”旁的帮助图标，或用键盘将焦点移至图标，即可查看释义。','在专业术语出现的位置解释它的含义。','支持鼠标、触摸和键盘打开说明，按 Esc 键关闭。','了解专色'],
    ['将作品加入观展清单，再点击提示中的“撤销”。','确认作品已保存，并允许立即撤销。','保存后显示提示，点击“撤销”即可恢复先前状态。','加入观展清单'],
    ['左右滑动作品或点击下方标题，即可切换。','在同一个区域中以相同尺寸展示多件作品。','使用手动轮播，并在导航中标明当前作品。','下一张'],
    ['点击“重新加载”，看看封面和说明如何取代占位内容。','在图片和档案加载期间保持布局稳定。','先为封面和文字预留空间，加载后在原位显示内容。','重新加载'],
    ['鼠标悬停或用键盘聚焦卡片，即可抬起封面并查看作品详情。','提示观众这件作品还有更多信息可看。','鼠标悬停和键盘聚焦时使用相同反馈，并支持触摸操作。','掀起封面'],
    ['向下滚动档案，观察下一张图片和标题如何出现。','在下一件作品或下一段文字进入视野时展示它。','每件作品只在首次进入视野时播放入场动画。开启减弱动态效果后立即显示。','查看下一件作品'],
    ['点击播放，依次查看三张校样。','让一组内容按照预设顺序逐个出现。','三张校样短暂错开出现，最后整齐排列。','展示校样'],
    ['切换色板，观察印刷色样的颜色、尺寸和形状如何变化。','用连续的变化衔接选项的两种状态。','在两种色样状态间平滑过渡颜色和形状。','切换色样'],
    ['切换标签材质，比较哪些背景纹理透了出来。','让作品标签悬浮在图片上，同时保持文字清晰。','在照片上叠加半透明标签，调整对比度和背景模糊效果。','切换材质'],
    ['在面板内滚动，观察文字和图片以不同速度移动。','为作品解说增加层次感。','让图片和文字以不同速度移动。开启减弱动态效果后采用静态布局。','下一段'],
    ['逐屏滚动，观察每件作品如何停靠在画面边缘。','像逛展一样纵向浏览照片或海报，每次欣赏一件。','纵向滚动时，将每件作品吸附到视口边缘。','下一面展墙'],
    ['点一下爱心收藏作品，再点一下取消收藏。','用户做出选择后，立即给予反馈。','用简短的爱心动画回应操作，同时更新收藏状态和数量。','切换收藏状态']
  ];
  const guide=Object.fromEntries(guides.map(([instruction,use,request,action],i)=>[i+1,{instruction,use,request,action}]));
  guide[11].spec='将三件作品纵向排列，在每行右侧放置“查看档案”按钮。选中后，图片和说明在 330 毫秒内从右侧滑入。面板宽度为列表的 75%，最大 370 像素。打开时调暗列表并暂停列表交互，将焦点移至“关闭”。点击关闭按钮、点按遮罩或按 Esc 键后，将焦点还给选中的行。启用减弱动态效果时直接打开。';
  const media = key => window.MotionFoundationMedia?.[key] || key;
  const img=(i,cls='')=>'<img class="ff-image '+cls+'" src="'+media(works[i].image)+'" alt="'+works[i].alt+'" draggable="false">';
  const name=i=>'<strong>'+works[i].title+'</strong><i lang="en">'+works[i].en+'</i>';
  const byline=i=>'<span class="ff-kind">'+works[i].process+'</span>';
  const command=(act,label,extra='')=>'<button type="button" class="ff-cmd" data-fn="'+act+'" '+extra+'>'+label+'</button>';
  const stamp=text=>'<span class="ff-stamp">'+text+'</span>';
  const heading=(title,sub='')=>'<div class="ff-heading"><h3>'+title+'</h3>'+(sub?'<i lang="en">'+sub+'</i>':'')+'</div>';
  const card=(i,act='',attr='')=>act?'<button class="ff-work" type="button" data-fn="'+act+'" data-i="'+i+'" '+attr+'>'+img(i)+name(i)+'</button>':'<div class="ff-work">'+img(i)+name(i)+'</div>';
  const register=()=>works.map((w,i)=>'<article>'+img(i)+'<div>'+name(i)+byline(i)+'</div></article>').join('');
  const nav=(name,labels,attr='')=>'<div class="ff-nav" '+attr+'>'+labels.map((text,i)=>command(name,text,'data-i="'+i+'" aria-pressed="'+(i===0)+'"')).join('')+'</div>';
  const labelRow=(i)=>'<h4>'+works[i].title+'</h4><p>'+works[i].note+'</p>';
  const selections=['作品','工艺','养护'];
  const papers=[
    ['本白','温润的未涂布纸，保留油墨的质感。','#efe4ca'],
    ['亮白','纸面平滑，白色清透。','#f7f6f0'],
    ['牛皮纸','棕色再生纸，适合粗犷有力的线条。','#bf9a67']
  ];
  const answer=[
    ['拿版画时应注意什么？','先洗净并擦干双手，拿住纸边，避免接触油墨。'],
    ['应该存放在哪里？','平放保存，避开阳光直射、潮气和强光。'],
    ['可以叠放版画吗？','可以，请在印面之间垫上干净的薄衬纸。']
  ];
  const strips=()=>works.map((w,i)=>'<figure>'+img(i)+'<figcaption>'+name(i)+'</figcaption></figure>').join('');
  const pages = {
    1:()=>'<div class="ff-hero">'+img(0)+'<div>'+stamp('纸的形态')+'<h3>纸上肌理</h3>'+command('landing','查看作品 ↗')+'</div></div><div class="ff-index" hidden>'+heading('参展作品','Exhibition index')+'<div class="ff-trio">'+works.map((_,i)=>card(i)).join('')+'</div>'+command('landing','← 返回展览封面')+'</div>',
    2:()=>'<div class="ff-flexhead">'+heading('参展作品','Exhibition catalogue')+command('width','单列')+'</div><div class="ff-viewport"><div class="ff-trio">'+works.map((_,i)=>card(i)).join('')+'</div></div>',
    3:()=>heading('作品档案','Selected work')+'<div class="ff-trio ff-pickgrid">'+works.map((_,i)=>card(i,'record','aria-pressed="'+(i===0)+'"')).join('')+'</div><div class="ff-record" aria-live="polite">'+labelRow(0)+'</div>',
    4:()=>heading('本次展览的三件作品','On view')+'<div class="ff-bento">'+works.map((_,i)=>card(i,'lead','aria-pressed="'+(i===0)+'"')).join('')+'</div>',
    5:()=>'<div class="ff-side"><nav aria-label="类别">'+heading('版画档案')+nav('section',['全部','版画','雕塑'])+'</nav><div class="ff-side-results"><h4>全部 · 3 件作品</h4><div class="ff-register">'+register()+'</div></div></div>',
    6:()=>'<div class="ff-scroll ff-sticky-scroll" tabindex="0" aria-label="滚动展览列表"><div class="ff-sticky">'+heading('纸上肌理')+stamp('作品')+'</div><div class="ff-register">'+register()+'</div></div>',
    7:()=>'<div class="ff-split">'+img(0)+'<div>'+stamp('作品档案')+heading('纸环','Paper Loop')+'<p>'+works[0].note+'</p>'+command('split','放大照片')+'</div></div>',
    8:()=>'<div class="ff-detail">'+img(1)+'<div>'+heading('潮汐线','Tidal Lines')+'<div class="ff-nav" role="tablist" aria-label="作品档案">'+selections.map((s,i)=>command('tab',s,'role="tab" id="ff-tab-'+i+'" data-i="'+i+'" aria-controls="ff-panel" aria-selected="'+(i===0)+'" tabindex="'+(i===0?'0':'-1')+'"')).join('')+'</div><div id="ff-panel" role="tabpanel" aria-labelledby="ff-tab-0"><p>'+works[1].note+'</p></div></div></div>',
    9:()=>heading('版画养护指南','Paper care')+'<div class="ff-faq">'+answer.map(([q,a],i)=>'<details><summary><small>0'+(i+1)+'</small>'+q+'</summary><p>'+a+'</p></details>').join('')+'</div>',
    10:()=>'<div class="ff-proof ff-underlay">'+img(2)+'<div>'+stamp('印刷校样')+heading('错版漫步','Offset Walk')+'<p>检查各色印版的套准情况和边缘。</p>'+command('modal','查看校样')+'</div></div><div class="ff-over" hidden><div class="ff-modal" role="dialog" aria-label="放大校样" aria-modal="true">'+img(2)+'<div>'+heading('定稿校样')+'<p>靛蓝、朱红和棕色三块印版准确套印。</p>'+command('close','关闭并返回')+'</div></div></div>',
    11:()=>'<div class="ff-underlay">'+heading('作品','Works register')+'<div class="ff-register">'+works.map((w,i)=>'<article>'+img(i)+'<div>'+name(i)+byline(i)+'</div>'+command('drawer','查看档案','data-i="'+i+'" aria-label="'+w.title+' 查看档案"')+'</article>').join('')+'</div></div><div class="ff-over ff-drawer-layer" hidden><div class="ff-drawer" role="dialog" aria-label="作品详情" aria-modal="true">'+command('close','关闭 ×')+'<div class="ff-drawer-copy"></div></div></div>',
    12:()=>'<div class="ff-paper"><div class="ff-sample-stock"><span>专色校样</span><b>Ink</b></div><div>'+heading('选择纸张','Paper stock')+'<div class="ff-drop">'+command('dropdown',papers[0][0]+' ▾','aria-expanded="false" aria-controls="ff-papers"')+'<div id="ff-papers" hidden>'+papers.map((p,i)=>command('paper',p[0],'data-i="'+i+'"')).join('')+'</div></div><p class="ff-paper-note">'+papers[0][1]+'</p></div></div>',
    13:()=>'<div class="ff-proof">'+img(1)+'<div>'+stamp('印刷参数')+heading('潮汐线','Tidal Lines')+'<div class="ff-help"><strong>两种专色</strong>'+command('tip','?','aria-label="关于专色" aria-describedby="ff-tip"')+'<div role="tooltip" id="ff-tip" hidden>专色使用预先调配的油墨。这件作品使用了两种专色。</div></div></div></div>',
    14:()=>'<div class="ff-proof">'+img(2)+'<div>'+stamp('我的观展清单')+heading('错版漫步','Offset Walk')+command('save','加入观展清单','aria-pressed="false"')+'</div></div><div class="ff-toast" hidden><span role="status">已加入观展清单。</span>'+command('undo','撤销')+'</div>',
    15:()=>'<div class="ff-film" aria-label="作品轮播" tabindex="0"><div class="ff-filmtrack">'+works.map((w,i)=>'<figure>'+img(i)+'<figcaption>'+name(i)+'</figcaption></figure>').join('')+'</div></div>'+nav('slide',works.map(w=>w.title)),
    16:()=>heading('新作版画','New acquisition')+'<div class="ff-load" aria-live="polite"></div>',
    17:()=>'<button class="ff-hoverwork" data-fn="hover" type="button" aria-expanded="false">'+img(2)+'<span>'+name(2)+'<small>'+works[2].note+'</small></span></button>',
    18:()=>'<div class="ff-scroll ff-reveal" tabindex="0" aria-label="滚动作品档案">'+heading('从线条到图像','Line studies')+strips()+'</div>',
    19:()=>heading('印刷顺序','Proof sequence')+'<div class="ff-contact">'+works.map((_,i)=>'<figure>'+img(i)+'<figcaption><small>0'+(i+1)+'</small>'+works[i].title+'</figcaption></figure>').join('')+'</div>',
    20:()=>'<div class="ff-ink-proof"><div class="ff-ink-swatch"><b>Ink</b><em>01</em></div><div>'+heading('油墨色样','Ink study')+'<p class="ff-ink-name">红色 · 方形色样</p>'+command('ink','切换色样')+'</div></div>',
    21:()=>'<div class="ff-glass">'+img(0)+'<div class="ff-plaque">'+stamp('纸的形态')+heading('纸环','Paper Loop')+'<p>网点印刷 · 纸雕</p>'+command('glass','使用不透明标签')+'</div></div>',
    22:()=>'<div class="ff-scroll ff-parallax" tabindex="0" aria-label="《潮汐线》作品笔记"><div class="ff-depth">'+img(1)+'<div>'+heading('潮汐线','Tidal Lines')+'</div></div><div class="ff-depth-note">'+stamp('作品笔记')+'<h4>线条化作波浪</h4><p>'+works[1].note+'</p></div></div>',
    23:()=>'<div class="ff-scroll ff-snap" tabindex="0" aria-label="纵向作品轮播">'+strips()+'</div>',
    24:()=>'<div class="ff-proof">'+img(0)+'<div>'+stamp('已收藏的作品')+heading('纸环','Paper Loop')+'<button type="button" class="ff-cmd ff-heart" data-fn="like" aria-pressed="false"><b aria-hidden="true">♡</b><span>收藏作品</span><em>0</em></button></div></div>'
  };
  function html(id){
    if(!pages[id])return '';
    return '<div class="demo-scene foundation-scene" data-demo="'+id+'"><div class="ff-page" data-cover>'+pages[id]()+'</div></div>';
  }

  function mount(id, root, options={}) {
    const scene=root.querySelector('.foundation-scene');
    const touchProfile=()=>['ios','android'].includes(scene.ownerDocument.documentElement.dataset.motionPlatform);
    const reduced=!!options.reduced || (!!window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);
    const report=options.status || (()=>{});
    const q=s=>scene.querySelector(s), all=s=>Array.from(scene.querySelectorAll(s));
    const commandFor=act=>q('[data-fn="'+act+'"]');
    const lifetime=new AbortController();
    const on=(element,event,handler,opts={})=>element.addEventListener(event,handler,{...opts,signal:lifetime.signal});
    const timers=new Map();
    const later=(key,fn,ms)=>{clearTimeout(timers.get(key));timers.set(key,setTimeout(fn,ms));};
    const stopTimer=key=>{clearTimeout(timers.get(key)); timers.delete(key);};
    scene.classList.toggle('ff-reduced',reduced);
    let index=0, busy=false, innerOpener=null;
    function listPressed(selector,i){
      all(selector).forEach((entry,n)=>entry.setAttribute('aria-pressed',String(i===n)));
    }
    function scrollOne(){
      const sc=q('.ff-scroll');
      if(!sc)return;
      const end=sc.scrollHeight-sc.clientHeight;
      const target=sc.scrollTop>=end-3?0:Math.min(end,sc.scrollTop+Math.max(75,sc.clientHeight*(id===23?1:.62)));
      sc.scrollTo({top:target,behavior:reduced?'instant':'smooth'});
    }
    function section(i){
      index=i;listPressed('[data-fn="section"]',i);
      const type=['全部','版画','雕塑'][i];
      let count=0;
      all('.ff-register article').forEach((a,j)=>{a.hidden=i!==0&&works[j].kind!==type;if(!a.hidden)count++;});
      q('.ff-side-results h4').textContent=type+' · '+count+' 件作品';
    }
    function tab(i,focus=false){
      index=i;
      all('[role="tab"]').forEach((b,n)=>{b.setAttribute('aria-selected',String(n===i));b.tabIndex=n===i?0:-1;});
      if(focus) all('[role="tab"]')[i].focus();
      q('[role="tabpanel"]').setAttribute('aria-labelledby','ff-tab-'+i);
      q('[role="tabpanel"] p').textContent=[works[1].note,'青绿色和朱红色的油墨分开印制，线条之间露出纸面的底色。','平放在无酸纸之间，避免触碰印面。'][i];
    }
    function openLayer(button,i){
      innerOpener=button;
      const over=q('.ff-over');
      if(id===11)q('.ff-drawer-copy').innerHTML=img(i)+name(i)+byline(i)+'<p>'+works[i].note+'</p>';
      q('.ff-underlay').inert=true;
      over.hidden=false;commandFor('close').focus({preventScroll:true});
    }
    function closeLayer(){
      q('.ff-over').hidden=true;q('.ff-underlay').inert=false;
      innerOpener?.focus({preventScroll:true});
    }
    function drop(open,focus=false){
      const toggle=commandFor('dropdown');q('#ff-papers').hidden=!open;
      toggle.setAttribute('aria-expanded',String(open));
      if(open&&focus)all('[data-fn="paper"]')[index].focus();
    }
    function slide(i){
      index=(i+works.length)%works.length;
      q('.ff-filmtrack').style.transform='translateX(-'+index*100+'%)';
      listPressed('[data-fn="slide"]',index);
      all('.ff-filmtrack figure').forEach((f,n)=>f.setAttribute('aria-hidden',String(n!==index)));
      report(works[index].title);
    }
    function load(){
      const host=q('.ff-load');
      host.setAttribute('aria-busy','true');
      host.innerHTML='<div class="ff-skeleton"><span></span><span></span><span></span></div>';
      later('load',()=>{
        host.innerHTML=img(1)+'<div>'+byline(1)+name(1)+'<p>'+works[1].note+'</p></div>';
        host.setAttribute('aria-busy','false');report('作品档案已加载。');
      },reduced?30:950);
    }
    function pokeHover(show){
      const b=commandFor('hover');b.classList.toggle('ff-raised',show);b.setAttribute('aria-expanded',String(show));
    }
    function reveal(){
      const scroll=q('.ff-scroll'),r=scroll.getBoundingClientRect();
      all('.ff-reveal figure').forEach(el=>{if(el.getBoundingClientRect().top<r.bottom-15 || reduced)el.classList.add('ff-shown');});
    }
    function save(on){
      const b=commandFor('save');b.setAttribute('aria-pressed',String(on)); b.textContent=on?'✓ 已加入观展清单':'加入观展清单';
      q('.ff-toast').hidden=!on;stopTimer('toast');
      if(on)later('toast',()=>{q('.ff-toast').hidden=true;},3800);
      else report('已从观展清单移除。');
    }
    function act(button,kind=button?.dataset.fn) {
      if(!button)return;
      const i=Number(button.dataset.i || 0);
      switch(kind){
        case 'landing':{
          const cover=q('.ff-hero'),list=q('.ff-index');
          const open=list.hidden;list.hidden=!open;cover.hidden=open;
          (open?list:cover).querySelector('button').focus({preventScroll:true});
          report(open?'正在展出三件作品。':'展览封面。');break;
        }
        case 'width':{const small=q('.ff-viewport').classList.toggle('ff-narrow');button.textContent=small?'三列':'单列';button.setAttribute('aria-pressed',String(small));break;}
        case 'record':index=i; listPressed('[data-fn="record"]',i);q('.ff-record').innerHTML=labelRow(i);break;
        case 'lead':{
          index=i; const set=all('[data-fn="lead"]');
          listPressed('[data-fn="lead"]',i);
          set.forEach((b,n)=>b.style.order=String((n-i+3)%3));break;
        }
        case 'section':section(i);break;
        case 'split':{const wide=q('.ff-split').classList.toggle('ff-wide');button.textContent=wide?'放大档案':'放大照片';button.setAttribute('aria-pressed',String(wide));break;}
        case 'tab':tab(i);break;
        case 'modal':case 'drawer':openLayer(button,i);break;
        case 'close':closeLayer();break;
        case 'dropdown':drop(q('#ff-papers').hidden);break;
        case 'paper':{
          index=i; const [title,note,color]=papers[i];
          commandFor('dropdown').textContent=title+' ▾';q('.ff-paper-note').textContent=note;
          q('.ff-sample-stock').style.backgroundColor=color;drop(false);commandFor('dropdown').focus();break;
        }
        case 'tip':q('#ff-tip').hidden=touchProfile()?!q('#ff-tip').hidden:false;break;
        case 'save':save(button.getAttribute('aria-pressed')!=='true');break;
        case 'undo':save(false);commandFor('save').focus();break;
        case 'slide':slide(i);break;
        case 'hover':pokeHover(!button.classList.contains('ff-raised'));break;
        case 'ink':{const alt=q('.ff-ink-swatch').classList.toggle('ff-alt');q('.ff-ink-name').textContent=alt?'蓝色 · 圆角色样':'红色 · 方形色样';q('.ff-ink-swatch em').textContent=alt?'02':'01';button.setAttribute('aria-pressed',String(alt));break;}
        case 'glass':{const opaque=q('.ff-plaque').classList.toggle('ff-solid');button.textContent=opaque?'使用玻璃质感标签':'使用不透明标签';button.setAttribute('aria-pressed',String(opaque));break;}
        case 'like':{const yes=button.getAttribute('aria-pressed')!=='true';button.setAttribute('aria-pressed',String(yes));button.querySelector('b').textContent=yes?'♥':'♡';button.querySelector('span').textContent=yes?'已收藏的作品':'收藏作品';button.querySelector('em').textContent=yes?'1':'0';if(!reduced)button.querySelector('b').animate([{transform:'scale(.86)'},{transform:'scale(1.22)'},{transform:'scale(1)'}],{duration:310});break;}
      }
    }
    function play(){
      if(id===1)return act(q((q('.ff-hero').hidden?'.ff-index':'.ff-hero')+' [data-fn]'));
      if(id===3||id===4||id===5||id===8||id===15){
        const action={3:'record',4:'lead',5:'section',8:'tab',15:'slide'}[id];
        return act(all('[data-fn="'+action+'"]')[(index+1)%3]);
      }
      if([6,18,22,23].includes(id))return scrollOne();
      if(id===9){const details=q('details');details.open=!details.open;return;}
      if(id===16)return load();
      if(id===17){pokeHover(true);later('hover',()=>pokeHover(false),1600);return;}
      if(id===19){
        all('.ff-contact figure').forEach((el,n)=>{
          el.getAnimations().forEach(a=>a.cancel());
          if(!reduced)el.animate([{opacity:0,transform:'translateY(24px) rotate(2deg)'},{opacity:1,transform:'none'}],{duration:430,delay:n*150,easing:'cubic-bezier(.2,.75,.25,1)',fill:'backwards'});
        });
        report('三张校样已全部展示。');return;
      }
      const primary={2:'width',7:'split',10:'modal',11:'drawer',12:'dropdown',13:'tip',14:'save',20:'ink',21:'glass',24:'like'}[id];
      if(primary){if((id===10||id===11)&&!q('.ff-over').hidden)return closeLayer();return act(commandFor(primary));}
    }
    on(scene,'click',e=>{const b=e.target.closest('button[data-fn]');if(b)act(b);else if(e.target.classList.contains('ff-over'))closeLayer();});
    on(scene,'keydown',e=>{
      const target=e.target, key=e.key;
      if((id===10||id===11)&&!q('.ff-over').hidden){
        if(key==='Escape'){e.preventDefault();e.stopPropagation();closeLayer();}
        else if(key==='Tab'){e.preventDefault();commandFor('close').focus();}
      }else if(id===8&&target.matches('[role="tab"]')&&['ArrowLeft','ArrowRight','Home','End'].includes(key)){
        e.preventDefault();tab(key==='Home'?0:key==='End'?2:(index+(key==='ArrowLeft'?2:1))%3,true);
      }else if(id===12){
        if(key==='Escape'&&!q('#ff-papers').hidden){e.preventDefault();e.stopPropagation();drop(false);commandFor('dropdown').focus();}
        if(['ArrowDown','ArrowUp','Home','End'].includes(key)){e.preventDefault();if(q('#ff-papers').hidden)drop(true,true);else{const items=all('[data-fn="paper"]');const pos=items.indexOf(target);items[key==='Home'?0:key==='End'?2:(pos+(key==='ArrowDown'?1:2))%3].focus();}}
      }else if(id===13&&key==='Escape'&&!q('#ff-tip').hidden){e.preventDefault();e.stopPropagation();q('#ff-tip').hidden=true;}
      else if(id===15&&['ArrowLeft','ArrowRight'].includes(key)){e.preventDefault();slide(index+(key==='ArrowRight'?1:-1));}
    });
    if(id===12) on(scene,'focusout',e=>{if(!q('.ff-drop').contains(e.relatedTarget))drop(false);});
    if(id===13){
      const trigger=commandFor('tip');
      on(trigger,'pointerenter',()=>{if(!touchProfile())q('#ff-tip').hidden=false;});
      on(trigger,'focus',()=>{if(!touchProfile()||trigger.matches(':focus-visible'))q('#ff-tip').hidden=false;});
      on(trigger,'pointerleave',()=>{if(!touchProfile())q('#ff-tip').hidden=true;});
      on(trigger,'blur',()=>{q('#ff-tip').hidden=true;});
      on(scene.ownerDocument,'pointerdown',e=>{if(touchProfile()&&!q('.ff-help').contains(e.target))q('#ff-tip').hidden=true;});
    }
    if(id===15){
      let start=0;
      const surface=q('.ff-film');
      on(surface,'pointerdown',e=>{start=e.clientX;busy=true;surface.setPointerCapture(e.pointerId);});
      on(surface,'pointerup',e=>{if(busy && Math.abs(e.clientX-start)>30)slide(index+(e.clientX<start?1:-1));busy=false;});
      on(surface,'pointercancel',()=>busy=false);
      slide(0);
    }
    if(id===16)load();
    if(id===17){
      const b=commandFor('hover');
      on(b,'pointerenter',e=>{if(!touchProfile()&&e.pointerType==='mouse')pokeHover(true);});
      on(b,'pointerleave',e=>{if(!touchProfile()&&e.pointerType==='mouse')pokeHover(false);});
      on(b,'focus',()=>{if(b.matches(':focus-visible'))pokeHover(true);});on(b,'blur',()=>pokeHover(false));
    }
    if(id===18) {scene.classList.add('ff-live');on(q('.ff-scroll'),'scroll',reveal,{passive:true});reveal();}
    if(id===22&&!reduced){const sc=q('.ff-scroll');on(sc,'scroll',()=>{q('.ff-depth img').style.transform='translateY('+sc.scrollTop*.34+'px)';},{passive:true});}
    function dispose(){lifetime.abort();timers.forEach(clearTimeout);scene.getAnimations({subtree:true}).forEach(a=>a.cancel());}
    return {play,dispose};
  }
  const assetsFor=id=>{
    const ids={7:[0],8:[1],9:[],10:[2],12:[],13:[1],14:[2],16:[1],17:[2],20:[],21:[0],22:[1],24:[0]}[id] || [0,1,2];
    return ids.map(i=>works[i].image);
  };
  window.MotionFoundation={html,mount,guide,assetsFor,assets:works.map(work=>work.image)};
})();
</script><script>const id=12, stage=document.querySelector("#stage"), play=document.querySelector("#playDemo"), status=document.querySelector("#sampleStatus"),m=matchMedia("(prefers-reduced-motion: reduce)");let view;function mount(){view?.dispose();status.textContent="";play.textContent="选择纸张";const options={reduced:m.matches,status:text=>{status.textContent=text},playButton:play};stage.innerHTML=MotionFoundation.html(id);view=MotionFoundation.mount(id,stage,options);}mount();play.addEventListener("click",()=>view.play());document.querySelector("#reset").addEventListener("click",mount);m.addEventListener("change",mount);</script></body></html>
```
