/* Karya finesse layer (fx.js): the motion that sits on top of the site without changing its layout.
   Everything here is expo-out, plays once, and is switched off whole by ?fx=0 or reduced motion.
   html.fx is set by fx.js; without it nothing below applies (except the intro cover, set in the head). */

/* ── page to page: the next page rises like a sheet of paper over the one you are leaving ── */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: fx-leave .75s cubic-bezier(.32, .72, 0, 1) both; }
  ::view-transition-new(root) { animation: fx-arrive .75s cubic-bezier(.32, .72, 0, 1) both; }
}
@keyframes fx-leave { to { transform: translateY(-7vh); opacity: .4; } }
@keyframes fx-arrive { from { transform: translateY(100vh); } }

html.fx { scroll-behavior: auto !important; }

/* ── headings: each line rises out of its own mask ── */
.fx-split .fx-w { display: inline-block; clip-path: inset(-.12em -.12em -.24em -.12em); }
.fx-split .fx-word { display: inline-block; white-space: nowrap; }
.fx-split .fx-i { display: inline-block; transform: translateY(135%); transition: transform 1.05s var(--ease-out-expo); transition-delay: calc(var(--l, 0) * 95ms + var(--k, 0) * 16ms); will-change: transform; }
.fx-split.fx-chars .fx-i { transition-duration: 1.15s; transition-delay: calc(var(--k, 0) * 34ms); }
.fx-split.fx-in .fx-i { transform: none; }

/* what stands beside a heading: its label, its paragraph, its buttons */
.fx .fx-rise { opacity: 0; transform: translateY(16px); transition: opacity .9s var(--ease-out-quart), transform 1s var(--ease-out-expo); transition-delay: var(--d, 0ms); }
.fx .fx-rise.fx-in { opacity: 1; transform: none; }

/* the rule under a section's heading draws from the left */
.fx .fx-line { position: relative; }
.fx .shead.fx-line, .fx .chead.fx-line { border-bottom-color: transparent; }
.fx .rhead.fx-line { border-top-color: transparent; }
.fx .fx-line::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: var(--fx-c, var(--ink)); transform: scaleX(0); transform-origin: left;
  transition: transform 1.4s var(--ease-out-expo) .12s; pointer-events: none; }
.fx .shead.fx-line::after, .fx .chead.fx-line::after { bottom: -1px; } .fx .rhead.fx-line::after { top: -1px; }
.fx .fx-line.fx-in::after { transform: none; }

/* ── pictures: the frame opens from the top while the picture settles back into it ── */
.fx .fx-clip { clip-path: inset(0 0 100% 0 round var(--r-card, 10px)); transition: clip-path 1.25s var(--ease-out-expo); transition-delay: var(--d, 0ms); }
.fx .fx-clip .bk-pic { transform: scale(1.09); transition: transform 1.9s var(--ease-out-expo); transition-delay: var(--d, 0ms); }
.fx .fx-clip.fx-in { clip-path: inset(0 round var(--r-card, 10px)); }
.fx .fx-clip.fx-in .bk-pic { transform: none; }

/* ── controls ── */
@media (hover: hover) and (pointer: fine) {
  /* a button's label rolls up into itself */
  .fx-roll { display: inline-block; overflow: hidden; vertical-align: top; line-height: 1.5; }
  .fx-roll > span { display: block; position: relative; transition: transform .55s var(--ease-out-expo); }
  .fx-roll > span::after { content: attr(data-t); position: absolute; left: 0; top: 100%; white-space: nowrap; }
  .btn:hover .fx-roll > span { transform: translateY(-100%); }
  /* a bar link's rule draws in from the left and leaves to the right */
  .fx .nav .links a:not([aria-current]) { background: linear-gradient(currentColor, currentColor) no-repeat 100% 100% / 0 1px; padding-block: 7px; margin-block: -7px;
    transition: background-size .5s var(--ease-out-expo), color .18s var(--ease-out-quart); }
  .fx .nav .links a:not([aria-current]):hover { background-size: 100% 1px; background-position: 0 100%; }
}

/* how far down the page you are: a bronze hairline along the bar's lower edge */
.fx-prog { position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--bronze); transform: scaleX(0); transform-origin: left; pointer-events: none; }
@supports (animation-timeline: scroll()) { .fx-prog { animation: fx-prog linear both; animation-timeline: scroll(root block); } }
@keyframes fx-prog { to { transform: scaleX(1); } }

/* ── the first arrival (homepage, once a session): the paper, the mark, a line; then the sheet lifts ── */
html.fx-intro body::before { content: ""; position: fixed; inset: 0; z-index: 9000; background: var(--paper); transition: transform .95s cubic-bezier(.32, .72, 0, 1);
  animation: fx-bail 0s 6s forwards; }   /* never left covering the page if the script fails */
html.fx-intro.fx-lift body::before { transform: translateY(-101%); }
@keyframes fx-bail { to { visibility: hidden; } }
.fx-mark { position: fixed; inset: 0; z-index: 9001; display: grid; place-content: center; justify-items: center; gap: 22px; pointer-events: none; transition: transform .95s cubic-bezier(.32, .72, 0, 1), opacity .4s var(--ease-out-quart); }
.fx-mark i { width: 54px; height: 54px; background: var(--ink); -webkit-mask: url(img/panther.png) center / contain no-repeat; mask: url(img/panther.png) center / contain no-repeat;
  opacity: 0; transform: translateY(10px); transition: opacity .7s var(--ease-out-quart), transform .9s var(--ease-out-expo); }
.fx-mark b { width: 132px; height: 1px; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform 1.05s cubic-bezier(.45, 0, .2, 1) .12s; }
.fx-mark.on i { opacity: 1; transform: none; } .fx-mark.on b { transform: none; }
html.fx-lift .fx-mark { transform: translateY(-42vh); opacity: 0; }
/* the headline waits behind the sheet, then inks in as it clears */
html.fx-intro:not(.fx-go) .hero h1 .w { opacity: 0 !important; transform: translateY(12px) !important; filter: blur(6px) !important; }

@media (prefers-reduced-motion: reduce) {
  html.fx-intro body::before, .fx-mark { display: none; }
  html.fx-intro:not(.fx-go) .hero h1 .w { opacity: 1 !important; transform: none !important; filter: none !important; }
}

/* ── the membrane (membrane.js): the homepage's pinned chapter ──
   As it stands in the page (no script, reduced motion, ?fx=0): three statements side by side under a rule. */
.mb { padding: 120px 0 0; }
.mb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.mb-cv { display: none; }
.mb-beats { list-style: none; margin: 0; padding: 32px 0 0; border-top: 1px solid var(--ink); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px; }
.mb-beat .mb-n { display: block; margin-bottom: 20px; font: 500 .75rem/1 var(--sans); letter-spacing: .1em; font-variant-numeric: tabular-nums; color: var(--ink-70); }
.mb-beat h3 { margin: 0 0 16px; font: 400 clamp(1.9rem, 3vw, 2.6rem)/1.05 var(--serif); letter-spacing: -.015em; }
.mb-beat h3 em { font-style: italic; color: var(--ink-70); }
.mb-beat p { margin: 0; max-width: 40ch; color: var(--ink-70); text-wrap: pretty; }
.mb-meter { display: none; }
@media (max-width: 760px) { .mb { padding-top: 72px; } .mb-beats { grid-template-columns: minmax(0, 1fr); gap: 36px; } }

/* live: one screen that plays by itself (membrane.js); it scrolls past like any other section, nothing is pinned */
.mb.live { padding: 0; }
.mb.live .mb-stage { position: relative; height: 100vh; height: 100svh; min-height: 600px; max-height: 1000px; overflow: clip; }
.mb.live .mb-cv { display: block; position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1.2s var(--ease-out-quart); pointer-events: none; }
.mb.live .mb-cv.on { opacity: 1; }
.mb.live .mb-wrap { height: 100%; } .mb.live .mb-in { position: relative; height: 100%; }
.mb.live .mb-beats { display: block; padding: 0; border: 0; position: absolute; left: 0; top: 50%; width: min(44%, 560px); }
.mb.live .mb-beat { position: absolute; left: 0; top: 0; width: 100%; translate: 0 -50%; pointer-events: none; }
.mb.live .mb-beat.on { pointer-events: auto; }
.mb.live .mb-beat h3 { margin-bottom: 24px; font-size: clamp(2.8rem, 5.4vw, 5.25rem); line-height: .98; letter-spacing: -.025em; }
.mb.live .mb-beat p { max-width: 36ch; font-size: 1.0625rem; }
.mb.live .mb-w { display: inline-block; clip-path: inset(-.1em -.12em -.24em -.12em); }
.mb.live .mb-i { display: inline-block; transform: translateY(128%); transition: transform .6s var(--ease-out-quart); transition-delay: calc(var(--k) * 25ms); will-change: transform; }
.mb.live .mb-beat.on .mb-i { transform: none; transition: transform 1.1s var(--ease-out-expo); transition-delay: calc(.22s + var(--k) * 80ms); }
.mb.live .mb-beat.past .mb-i { transform: translateY(-128%); }
.mb.live .mb-beat .mb-n, .mb.live .mb-beat p { opacity: 0; transform: translateY(16px); transition: opacity .4s var(--ease-out-quart), transform .6s var(--ease-out-quart); }
.mb.live .mb-beat.past .mb-n, .mb.live .mb-beat.past p { transform: translateY(-12px); }
.mb.live .mb-beat.on .mb-n { opacity: 1; transform: none; transition: opacity .8s var(--ease-out-quart) .2s, transform 1s var(--ease-out-expo) .2s; }
.mb.live .mb-beat.on p { opacity: 1; transform: none; transition: opacity .9s var(--ease-out-quart) .5s, transform 1s var(--ease-out-expo) .5s; }
/* which of the three you are on, and how far through it */
.mb.live .mb-meter { display: flex; align-items: center; position: absolute; left: -4px; bottom: 30px; font: 500 .75rem/1 var(--sans); letter-spacing: .1em; font-variant-numeric: tabular-nums; color: var(--ink-70); }
.mb.live .mb-meter { gap: 0; }
.mb.live .mb-meter button { appearance: none; border: 0; background: none; margin: 0; padding: 18px 4px; cursor: pointer; color: inherit; }
.mb.live .mb-meter button:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.mb.live .mb-meter button:hover i { background: var(--ink-70); }
.mb.live .mb-meter i { display: block; position: relative; width: 44px; height: 1px; background: var(--line-2); transition: background .3s var(--ease-out-quart); }
.mb.live .mb-meter i::after { content: ""; position: absolute; inset: 0; background: var(--ink); transform: scaleX(var(--a, 0)); transform-origin: left; }
.mb.live .mb-meter span { margin-left: 10px; }
@media (max-width: 760px) {
  .mb.live .mb-beats { top: auto; bottom: 96px; width: 100%; }
  .mb.live .mb-beat { top: auto; bottom: 0; translate: none; }
  .mb.live .mb-beat h3 { font-size: clamp(2.3rem, 10.5vw, 3.1rem); margin-bottom: 16px; }
  .mb.live .mb-beat p { font-size: 1rem; }
  .mb.live .mb-meter { bottom: 20px; }
}
