/* jasa-paper.css · 2026-11-22 b "纸页精修" (plan A)
   A layer on top of the existing bundles for the main site (.studio / .personal). It does three things:
   1. Paper tokens and editorial type: numbered section heads with an ink rule, tighter cards, calmer kickers.
   2. Scroll choreography: rule draws, heads rise, lists and grids stagger in (classes set by jasa-paper.js).
   3. Pointer feedback: spotlight and lift on cards, underline sweeps, arrow nudges, magnetic primary buttons.
   The top bar stays where it is (reading bars and tables of contents on other pages sit under it).
   Rules:
   - Nothing is hidden unless jasa-paper.js has put .jp-on on <html>; without JS the page reads as before.
   - All motion sits behind prefers-reduced-motion and html[data-motion=off].
   - Star Map (html[data-ui=orbit]) keeps its own look: the type and token parts skip it.
   - Only opacity / transform / clip-path animate. */

/* ---------- 1. tokens ---------- */
:root:not([data-theme=dark]):not([data-ui=orbit]){
  --bg:#f4f3ee;--paper:#fbfbf8;--ink:#17191a;--muted:#5a5e5f;--line:#d5d8d4;
}
:root{
  --jp-ease:cubic-bezier(.16,1,.3,1);
  --jp-spring:cubic-bezier(.22,1.18,.36,1);
  --jp-rule:color-mix(in srgb,var(--ink) 88%,transparent);
  --jp-r:12px;
}
html:not([data-ui=orbit]) :is(.studio,.personal){--p-r-card:var(--jp-r)}
:is(.studio,.personal) ::selection{background:color-mix(in srgb,var(--accent) 22%,transparent)}
:is(.studio,.personal) :focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:4px}

/* ---------- 2. editorial section heads ---------- */
html:not([data-ui=orbit]) :is(.studio,.personal) main{counter-reset:jp-sec}
html:not([data-ui=orbit]) :is(.studio,.personal) main>.section>.section-head{
  counter-increment:jp-sec;position:relative;padding-top:22px;
}
html:not([data-ui=orbit]) :is(.studio,.personal) main>.section>.section-head::before{
  content:"";position:absolute;left:0;right:0;top:0;height:1px;background:var(--jp-rule);
  transform-origin:left center;
}
html:not([data-ui=orbit]) :is(.studio,.personal) main>.section>.section-head .kicker{
  display:flex;align-items:baseline;gap:.9em;
  font-size:12px;letter-spacing:.14em;text-transform:uppercase;font-weight:600;color:var(--ink);
}
html:not([data-ui=orbit]) :is(.studio,.personal) main>.section>.section-head .kicker::before{
  content:counter(jp-sec,decimal-leading-zero);
  font-variant-numeric:tabular-nums;font-weight:500;letter-spacing:.04em;color:var(--muted);
}
html[lang^=zh]:not([data-ui=orbit]) :is(.studio,.personal) main>.section>.section-head .kicker{letter-spacing:.1em}
html:not([data-ui=orbit]) :is(.studio,.personal) .section-head h2{font-weight:600;text-wrap:balance}
html:not([data-ui=orbit]) :is(.studio,.personal) .hero-intro,
html:not([data-ui=orbit]) :is(.studio,.personal) .section-head .sub{text-wrap:pretty}

/* cards: one radius, hairline that darkens on hover */
html:not([data-ui=orbit]) :is(.studio,.personal) :is(.hx-item,.hx-feature,.jf-node,.w-teaser),
html:not([data-ui=orbit]) .studio #products .hx-item{border-radius:var(--jp-r)}

/* articles (2026-11-22 b): a short ink tick over each chapter heading, and links you can tell apart without colour */
html:not([data-ui=orbit]) .studio .n-article>h2::before{
  content:"";display:block;width:36px;height:1px;margin-bottom:22px;background:var(--jp-rule);transform-origin:left center;
}
html:not([data-ui=orbit]) .studio .n-article :is(p,li) a:not(.n-back):not(.btn){
  text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:.24em;
  text-decoration-color:color-mix(in srgb,var(--accent) 40%,transparent);transition:text-decoration-color .25s;
}
html:not([data-ui=orbit]) .studio .n-article :is(p,li) a:not(.n-back):not(.btn):hover{text-decoration-color:currentColor}

/* Safari still wants the prefix for these two (the unprefixed rules live in the bundles) */
.jf-band,.w-keys{-webkit-user-select:none;user-select:none}

/* ---------- 3. scroll choreography ---------- */
@media (prefers-reduced-motion:no-preference){
  html.jp-on:not([data-motion=off]) .jp-r{
    opacity:0;translate:0 26px;
    transition:opacity .9s var(--jp-ease),translate 1.1s var(--jp-ease);
    transition-delay:calc(var(--jp-i,0)*70ms);
    will-change:opacity,translate;
  }
  html.jp-on:not([data-motion=off]) .jp-r.jp-fade{translate:none}
  html.jp-on:not([data-motion=off]) .jp-r.jp-in{opacity:1;translate:0 0}
  html.jp-on:not([data-motion=off]) .jp-r.jp-done{will-change:auto;transition-delay:0s}

  /* section head: rule draws, kicker and title rise behind a mask */
  html.jp-on:not([data-motion=off]) .jp-head::before{transform:scaleX(0);transition:transform 1.25s var(--jp-ease)}
  html.jp-on:not([data-motion=off]) .jp-head.jp-in::before{transform:scaleX(1)}
  html.jp-on:not([data-motion=off]) .jp-head :is(.kicker,h2,.sub,.hx-all,.jf-chips){
    opacity:0;translate:0 22px;
    transition:opacity .8s var(--jp-ease),translate 1s var(--jp-ease);
  }
  html.jp-on:not([data-motion=off]) .jp-head h2{clip-path:inset(0 0 100% 0);transition:opacity .8s var(--jp-ease),translate 1.1s var(--jp-ease),clip-path 1.1s var(--jp-ease);transition-delay:.08s}
  html.jp-on:not([data-motion=off]) .jp-head .sub{transition-delay:.18s}
  html.jp-on:not([data-motion=off]) .jp-head :is(.hx-all,.jf-chips){transition-delay:.26s}
  html.jp-on:not([data-motion=off]) .jp-head.jp-in :is(.kicker,h2,.sub,.hx-all,.jf-chips){opacity:1;translate:0 0}
  html.jp-on:not([data-motion=off]) .jp-head.jp-in h2{clip-path:inset(-12% -4% -16% -4%)}

  /* article chapter tick draws with its heading */
  html.jp-on:not([data-motion=off]) .n-article>h2.jp-r::before{transform:scaleX(0);transition:transform .9s var(--jp-ease) .15s}
  html.jp-on:not([data-motion=off]) .n-article>h2.jp-r.jp-in::before{transform:scaleX(1)}

  /* pictures open like a shutter and settle */
  html.jp-on:not([data-motion=off]) .jp-pic{clip-path:inset(0 0 100% 0 round var(--jp-r));transition:clip-path 1.2s var(--jp-ease)}
  html.jp-on:not([data-motion=off]) .jp-pic img{scale:1.08;transition:scale 1.6s var(--jp-ease)}
  html.jp-on:not([data-motion=off]) .jp-pic.jp-in{clip-path:inset(0 0 0 0 round var(--jp-r))}
  html.jp-on:not([data-motion=off]) .jp-pic.jp-in img{scale:1}

  /* filter change on the product list: the visible ones re-deal */
  @keyframes jp-deal{from{opacity:0;translate:0 14px;scale:.985}to{opacity:1;translate:0 0;scale:1}}
  html:not([data-motion=off]) .jp-deal{animation:jp-deal .55s var(--jp-ease) both;animation-delay:calc(var(--jp-i,0)*45ms)}

  /* scroll-linked depth, on the compositor where the browser can */
  @supports (animation-timeline:view()){
    @keyframes jp-drift-up{from{translate:0 34px}to{translate:0 -34px}}
    @keyframes jp-drift-side{from{translate:22px 0}to{translate:-22px 0}}
    @keyframes jp-hero-out{to{opacity:.25;translate:0 -46px}}
    @keyframes jp-hero-obj{to{translate:0 60px;scale:.94}}
    html:not([data-motion=off]) :is(.studio,.personal) .hx-item .hx-ghost{animation:jp-drift-up linear both;animation-timeline:view();animation-range:entry 0% exit 100%}
    html:not([data-motion=off]) .studio .w-teaser .w-name{animation:jp-drift-side linear both;animation-timeline:view();animation-range:entry 0% exit 100%}
    html:not([data-motion=off]) .studio .atlas-hero .hero-copy>:is(h1,.hero-intro,.eyebrow){animation:jp-hero-out linear both;animation-timeline:scroll(root);animation-range:120px 760px}
    html:not([data-motion=off]) .studio .atlas-hero .hero-object>svg{animation:jp-hero-obj linear both;animation-timeline:scroll(root);animation-range:0px 900px}
  }
}

/* ---------- 4. pointer feedback ---------- */
@media (hover:hover) and (prefers-reduced-motion:no-preference){
  /* cards: lift, hairline to ink, a soft light that follows the pointer */
  html:not([data-motion=off]):not([data-ui=orbit]) :is(.studio,.personal) :is(.hx-item,.hx-feature,.w-teaser){
    transition:translate .5s var(--jp-ease),box-shadow .5s var(--jp-ease),border-color .35s;
  }
  html:not([data-motion=off]):not([data-ui=orbit]) :is(.studio,.personal) :is(.hx-item,.hx-feature,.w-teaser):hover{
    translate:0 -5px;border-color:color-mix(in srgb,var(--ink) 55%,var(--line));
    box-shadow:0 22px 44px -26px color-mix(in srgb,var(--ink) 38%,transparent);
  }
  html:not([data-motion=off]) .jp-spot{position:relative}
  html:not([data-motion=off]) .jp-spot>.jp-light{
    position:absolute;inset:0;border-radius:inherit;pointer-events:none;z-index:0;opacity:0;
    background:radial-gradient(340px circle at var(--jp-x,50%) var(--jp-y,50%),color-mix(in srgb,var(--accent) 13%,transparent),transparent 62%);
    transition:opacity .45s;
  }
  html:not([data-motion=off]) .jp-spot:hover>.jp-light{opacity:1}

  /* space rows: paper wipes in from the left, icon turns a little */
  html:not([data-motion=off]) .studio .tool-card{position:relative;isolation:isolate}
  html:not([data-motion=off]) .studio .tool-card::before{
    content:"";position:absolute;inset:0;z-index:-1;background:var(--paper);
    transform:scaleX(0);transform-origin:left center;transition:transform .7s var(--jp-ease);
  }
  html:not([data-motion=off]) .studio .tool-card:hover::before{transform:scaleX(1)}
  html:not([data-motion=off]) .studio .tool-card .tool-icon{transition:rotate .7s var(--jp-spring),scale .7s var(--jp-spring)}
  html:not([data-motion=off]) .studio .tool-card:hover .tool-icon{rotate:-8deg;scale:1.12}
  html:not([data-motion=off]) .studio .tool-card :is(h3,p){transition:translate .6s var(--jp-ease)}
  html:not([data-motion=off]) .studio .tool-card:hover :is(h3,p){translate:10px 0}
  html:not([data-motion=off]) .studio .tool-card .tool-arrow{transition:transform .5s var(--jp-spring)}

  /* quiet links: the underline is redrawn in ink from the left */
  html:not([data-motion=off]) :is(.studio,.personal) .quiet-link{
    background:linear-gradient(var(--ink),var(--ink)) left bottom/0 1px no-repeat;
    transition:background-size .6s var(--jp-ease),color .3s;
  }
  html:not([data-motion=off]) :is(.studio,.personal) .quiet-link:hover{background-size:100% 1px}
  html:not([data-motion=off]) :is(.studio,.personal) :is(.quiet-link,.btn,.hx-all,.hx-go) :is(svg,[aria-hidden=true]){transition:transform .5s var(--jp-spring),translate .5s var(--jp-spring)}
  html:not([data-motion=off]) :is(.studio,.personal) :is(.hx-all,.hx-go):hover [aria-hidden=true]{translate:5px 0}

  /* footer and inline text links */
  html:not([data-motion=off]) :is(.studio,.personal) .footer-links a{
    background:linear-gradient(currentColor,currentColor) left 100%/0 1px no-repeat;transition:background-size .5s var(--jp-ease);
  }
  html:not([data-motion=off]) :is(.studio,.personal) .footer-links a:hover{background-size:100% 1px}

  /* filter pills and chips press like keys */
  html:not([data-motion=off]) :is(.studio,.personal) .filter{transition:translate .35s var(--jp-spring),background-color .3s,color .3s,border-color .3s}
  html:not([data-motion=off]) :is(.studio,.personal) .filter:hover{translate:0 -2px}
  html:not([data-motion=off]) :is(.studio,.personal) .filter:active{translate:0 1px;transition-duration:.08s}

  /* primary buttons follow the pointer a few pixels (offset set by jasa-paper.js) */
  html:not([data-motion=off]) .jp-mag{translate:var(--jp-mx,0) var(--jp-my,0);transition:translate .5s var(--jp-spring),transform .3s}
  html:not([data-motion=off]) .jp-mag.jp-mag-live{transition:translate .12s linear,transform .3s}

  /* banknotes and article rows */
  html:not([data-motion=off]) .studio .jwb-row>*{transition:translate .6s var(--jp-ease),rotate .6s var(--jp-ease)}
  html:not([data-motion=off]) .studio .jwb-row>*:hover{translate:0 -8px;rotate:-1.2deg}
  html:not([data-motion=off]) :is(.studio,.personal) .hx-updates a b{transition:translate .5s var(--jp-ease),color .3s}
  html:not([data-motion=off]) :is(.studio,.personal) .hx-updates a:hover b{translate:8px 0}
}

/* touch screens have no hover: cards and rows give a little under the finger instead (2026-11-22 b) */
@media (hover:none) and (prefers-reduced-motion:no-preference){
  html:not([data-motion=off]) :is(.studio,.personal) :is(.hx-item,.hx-feature,.pj-tile,.jf-node,.n-row a,.hx-updates a){
    transition:scale .2s var(--jp-ease),opacity .9s var(--jp-ease),translate 1.1s var(--jp-ease);
    -webkit-tap-highlight-color:transparent;
  }
  html:not([data-motion=off]) :is(.studio,.personal) :is(.hx-item,.hx-feature,.pj-tile,.jf-node,.n-row a,.hx-updates a):active{scale:.985}
}

/* the top bar gains a soft shadow once the page has moved */
html.jp-scrolled:not([data-ui=orbit]) :is(.studio,.personal)>.topbar{box-shadow:0 12px 30px -24px color-mix(in srgb,var(--ink) 45%,transparent)}
:is(.studio,.personal)>.topbar{transition:box-shadow .4s}

@media print{.jp-r,.jp-head *,.jp-pic{opacity:1!important;translate:none!important;clip-path:none!important}}
