/* KarZ interaction details. Each has a static fallback in the base theme. */
@media(prefers-reduced-motion:no-preference){
  /* 01 — Stagger the expanded menu labels, not their hit targets. */
  html:not(.reduced-motion) .menu-panel[open] .menu-inner nav a{
    animation:karz-ux-menu-enter .42s cubic-bezier(.16,.78,.25,1) both;
  }
  html:not(.reduced-motion) .menu-panel[open] .menu-inner nav a:nth-child(2){animation-delay:.025s}
  html:not(.reduced-motion) .menu-panel[open] .menu-inner nav a:nth-child(3){animation-delay:.05s}
  html:not(.reduced-motion) .menu-panel[open] .menu-inner nav a:nth-child(4){animation-delay:.075s}
  html:not(.reduced-motion) .menu-panel[open] .menu-inner nav a:nth-child(5){animation-delay:.1s}
  @keyframes karz-ux-menu-enter{from{opacity:.63;translate:0 8px}to{opacity:1;translate:0 0}}

  /* 02 — Fine underline draws outward under the actual menu link. */
  html:not(.reduced-motion) .menu-panel .menu-inner nav a{
    background-image:linear-gradient(currentColor,currentColor);
    background-repeat:no-repeat;background-position:center calc(100% - .13em);
    background-size:0 1px;transition:background-size .29s cubic-bezier(.2,.75,.25,1);
  }
  html:not(.reduced-motion) .menu-panel .menu-inner nav a:is(:hover,:focus-visible){background-size:92% 1px}

  /* 03 — Search focus opens the magnifying mark and illuminates its baseline. */
  html:not(.reduced-motion) .search-label input{transition:border-color .22s ease}
  html:not(.reduced-motion) .search-label>span:last-child{transition:color .22s ease,rotate .26s cubic-bezier(.2,.7,.25,1),scale .26s cubic-bezier(.2,.7,.25,1)}
  html:not(.reduced-motion) .search-label:focus-within input{border-bottom-color:#ff9eb5}
  html:not(.reduced-motion) .search-label:focus-within>span:last-child{color:#ffc0d0;rotate:-12deg;scale:1.1}

  /* 04 — Archive filters get a clean, left-to-right selection mark. */
  html:not(.reduced-motion) .archive-controls .filter-buttons [data-filter]::after{
    content:'';position:absolute;left:0;right:0;bottom:1px;height:2px;
    background:linear-gradient(90deg,#ef597a,#ff97b1);pointer-events:none;
    transform:scaleX(0);transform-origin:left center;
    transition:transform .25s cubic-bezier(.25,.75,.3,1);
  }
  html:not(.reduced-motion) .archive-controls .filter-buttons [data-filter][aria-pressed=true]::after{transform:scaleX(1)}

  /* 05 — The gallery explorer's arrow lifts without moving the label. */
  html:not(.reduced-motion) .archive-explore span{display:inline-block;transition:translate .25s cubic-bezier(.16,.75,.28,1)}
  html:not(.reduced-motion) .archive-explore:is(:hover,:focus-visible) span{translate:2px -3px}

  /* 06 — The gallery project picker lights up only while focused. */
  html:not(.reduced-motion) .gallery-footer select{transition:box-shadow .23s ease}
  html:not(.reduced-motion) .gallery-footer select:focus-visible{box-shadow:0 0 0 3px #ff97b140}

  /* 07 — The current gallery view shows a thin light on the inset edge. */
  html:not(.reduced-motion) .gallery-modes button{transition:box-shadow .24s ease}
  html:not(.reduced-motion) .gallery-modes button[aria-pressed=true]{box-shadow:inset 0 -2px #ffabbc9a}

  /* 08 — News topic underline follows the selected or focused topic. */
  html:not(.reduced-motion) .trend .trend-tools [data-topic]{
    background-image:linear-gradient(#f597b1,#f597b1);background-repeat:no-repeat;
    background-position:left calc(100% - 3px);background-size:0 1px;
    transition:background-size .25s cubic-bezier(.16,.75,.28,1),color .18s ease;
  }
  html:not(.reduced-motion) .trend .trend-tools [data-topic]:is([aria-pressed=true],:focus-visible){background-size:100% 1px}

  /* 09 — A small finite loading sweep when news refresh is underway. */
  html:not(.reduced-motion) [data-trend-refresh]:disabled{
    animation:karz-ux-news-wait .64s ease-out 2;
  }
  @keyframes karz-ux-news-wait{0%{box-shadow:inset 0 -2px #ffbad0}100%{box-shadow:inset 0 0 #ffbad000}}

  /* 10 — A soft inset gleam showing the chosen material in the Playground. */
  html:not(.reduced-motion) .playground-options button{transition:box-shadow .24s ease}
  html:not(.reduced-motion) .playground-options button[aria-pressed=true]{box-shadow:inset 0 1px #ffe1d88c,inset 0 5px 14px -6px #ffb4b68a}

  /* 11 — One pass of a light stripe across the arcade launch button. */
  html:not(.reduced-motion) .arcade-start{
    position:relative;isolation:isolate;
  }
  html:not(.reduced-motion) .arcade-start::before{
    content:'';position:absolute;inset:1px;pointer-events:none;z-index:-1;
    background:linear-gradient(108deg,transparent 34%,#ffe5d138 54%,transparent 74%) -100% 0 / 210% 100% no-repeat;
    opacity:0;border-radius:inherit;
  }
  html:not(.reduced-motion) .arcade-start:is(:hover,:focus-visible)::before{animation:karz-ux-arcade-sweep .55s ease-out}
  @keyframes karz-ux-arcade-sweep{0%{opacity:0;background-position:110% 0}24%{opacity:1}100%{opacity:0;background-position:-85% 0}}

  /* 12 — The close glyph gives a short, readable twist. */
  html:not(.reduced-motion) .arcade-player-head [data-arc-close] span{
    display:inline-block;transition:rotate .25s cubic-bezier(.18,.72,.23,1);
  }
  html:not(.reduced-motion) .arcade-player-head [data-arc-close]:is(:hover,:focus-visible) span{rotate:90deg}

  /* 13 — A warmer focus halo on the library subject picker. */
  html:not(.reduced-motion) .history-toolbar select{transition:box-shadow .22s ease}
  html:not(.reduced-motion) .history-toolbar select:focus-visible{box-shadow:0 0 0 3px #edba806b}

  /* 14 — Book source links use a small editorial underline emphasis. */
  html:not(.reduced-motion) .history-recto [data-books-source]{
    transition:text-underline-offset .2s ease,color .2s ease;
  }
  html:not(.reduced-motion) .history-recto [data-books-source]:is(:hover,:focus-visible){text-underline-offset:5px;color:#4b211b}

  /* 15 — A perforation highlight on the contact ticket, separate from magnetism. */
  html:not(.reduced-motion) .contact-ticket .ticket-perforation{transition:opacity .25s ease,filter .3s ease}
  html:not(.reduced-motion) .contact-ticket:is(:hover,:focus-visible) .ticket-perforation{opacity:1;filter:brightness(1.65)}

  /* 16 — Project detail next-link symbol lifts alone. */
  html:not(.reduced-motion) .detail-next>a span{display:inline-block;transition:translate .23s ease}
  html:not(.reduced-motion) .detail-next>a:is(:hover,:focus-visible) span{translate:3px -3px}
}
