/* Toppie: small "task cleared" moments + the "Same Monday" film pair.
   Mounts and attributes are documented at the top of assets/js/toppie.js.
   Bible rules kept here: clay art untouched (no outline, no glow, no drop shadow, no filter), scaled evenly,
   full body never below 120 px tall, one red square of clear space, peeks sit on a real edge.
   Final states: JS off, prefers-reduced-motion and body.paused all show a finished still (or nothing for a
   "pass" peek with JS off). Hidden pre-entrance states are gated on html.tpy-ready, which toppie.js sets. */

.tpy{display:block;pointer-events:none;line-height:0;--tp-h:120px}
.tpy img{display:block;height:var(--tp-h);width:auto;max-width:none;user-select:none}

/* ---------- settle: rises in once (16 px, fade), one small act, then stays ---------- */
.tpy--settle{width:max-content}
html.tpy-ready .tpy--settle{opacity:0;transform:translateY(16px);transition:opacity var(--d3) var(--ease),transform var(--d3) var(--ease)}
html.tpy-ready .tpy--settle.is-in{opacity:1;transform:none}
.tpy--settle.is-act[data-act="hop"] img{animation:tpy-hop 700ms var(--ease) 1 both;transform-origin:50% 100%}
.tpy--settle.is-act[data-act="hello"] img{animation:tpy-hello 1600ms var(--ease-io) 1 both;transform-origin:50% 100%}
@keyframes tpy-hop{0%{transform:none}30%{transform:translateY(-9px)}60%{transform:none}78%{transform:translateY(-3px)}100%{transform:none}}
@keyframes tpy-hello{0%,100%{transform:none}20%{transform:rotate(-5deg)}45%{transform:rotate(4deg)}70%{transform:rotate(-3deg)}88%{transform:rotate(1deg)}}

/* placement: stands on the bottom edge of the nearest positioned section, right side */
.tpy[data-place="edge-br"]{position:absolute;right:max(var(--pad),calc((100% - var(--max)) / 2 + var(--pad)));bottom:0;z-index:1}
/* placement: stands on the bottom rule of an inner-page hero (.ih), left of the art on wide screens */
.tpy[data-place="hero"]{position:absolute;bottom:7px;left:calc(50% + 8px);z-index:1}

/* ---------- pass: slides out from behind an anchor's left edge, holds, slides back. Gone. ---------- */
.tpy--pass{position:absolute;z-index:-1;left:var(--tp-x,0);top:var(--tp-y,0)}
.tpy-host{position:relative;isolation:isolate}
html:not(.tpy-ready) .tpy--pass{display:none}                     /* JS off: nothing (it is a passing moment) */
.tpy--pass img{transform:translateX(var(--tp-hide,64px)) rotate(4deg);transition:transform 520ms cubic-bezier(.4,0,1,1)}
.tpy--pass.is-in img{transform:none;transition:transform 640ms var(--ease)}

/* ---------- no motion: show the finished still ---------- */
@media (prefers-reduced-motion:reduce){
  html.tpy-ready .tpy--settle,.tpy--pass img{transition:none!important}
  html.tpy-ready .tpy--settle{opacity:1;transform:none}
  .tpy--settle img{animation:none!important}
  .tpy--pass img{transform:none}
}
body.paused .tpy--settle,body.paused .tpy--pass img{transition:none!important}
html.tpy-ready body.paused .tpy--settle{opacity:1;transform:none}
body.paused .tpy--settle img{animation:none!important}
body.paused .tpy--pass img{transform:none}

/* ---------- phones ---------- */
@media (max-width:599px){
  .tpy--pass{display:none!important}                              /* no room beside a full-width phone */
  .tpy[data-place="edge-br"]{display:none}                        /* would sit on the statement's last line */
}
/* the inner hero is one column below 1000 px, where he would stand on the art's people: leave him out */
@media (max-width:999px){ .tpy[data-place="hero"]{display:none} }

/* =====================================================================
   Same Monday: two stills from the film, before and with Utopia.
   Wide: two-up. Phone: a two-card swipe rail (the second card peeks in). No JS needed.
   ===================================================================== */
.tpy-sm{margin:clamp(28px,4vw,48px) auto 0;max-width:1080px}
.tpy-sm__row{display:grid;grid-template-columns:1fr 1fr;gap:clamp(14px,2vw,24px);margin:0;padding:0;list-style:none}
.tpy-sm__card{margin:0;display:grid;gap:12px;align-content:start;padding:10px 10px 16px;border-radius:var(--r-card);background-color:var(--surface);background-image:var(--sheen);box-shadow:var(--shadow)}
.tpy-sm__pic{position:relative;overflow:hidden;border-radius:calc(var(--r-card) - 6px);aspect-ratio:16/9;background:var(--bone)}
.tpy-sm__pic img{display:block;width:100%;height:100%;object-fit:cover}
.tpy-sm__tag{position:absolute;left:10px;top:10px;padding:6px 11px;border-radius:999px;font:600 14px/1 var(--f-body);color:var(--ink);background-color:color-mix(in srgb,var(--white) 88%,transparent);background-image:var(--sheen);backdrop-filter:blur(6px)}
.tpy-sm__tag--after{color:var(--white);background-color:var(--blue)}
.tpy-sm__line{margin:0 6px;font:500 16px/1.45 var(--f-body);color:var(--ink-2);text-align:left}
.tpy-sm__cap{margin:14px 0 0;font:400 14px/1.4 var(--f-body);color:var(--mute);text-align:center}
@media (max-width:759px){
  .tpy-sm{margin-left:calc(-1 * var(--pad));margin-right:calc(-1 * var(--pad))}
  .tpy-sm__row{display:flex;gap:12px;overflow-x:auto;scroll-snap-type:x mandatory;padding:4px var(--pad) 14px;scroll-padding:0 var(--pad);scrollbar-width:none;overscroll-behavior-x:contain}
  .tpy-sm__row::-webkit-scrollbar{display:none}
  .tpy-sm__card{flex:0 0 86%;scroll-snap-align:start}
  .tpy-sm__cap{padding:0 var(--pad)}
}
