/* ─────────────────────────────────────────────────────────────────────────────
   PAGE TRANSITIONS — Appia  (2026-11-23)

   Pages are separate documents; this file animates the hand-off between them
   with the browser's native cross-document view transitions. Browsers without
   the feature ignore everything here and load pages exactly as before.

   Each page has its own way in, laid over the page before it:
     · Home                     rises from BELOW   (bottom to top)
     · Art Advisory             drops from ABOVE   (top to bottom)
     · Cultural Consultancy     enters from the LEFT   (left to right)
     · Curatorial · Editorial   rises from BELOW   (bottom to top)
       — its project and publication pages enter the same way
     · About                    enters from the RIGHT  (right to left)

   The browser's Back button undoes the last move: the page being left
   withdraws by the side it came in from, uncovering the page beneath.
   The header holds still throughout.

   Which of these applies is decided per navigation by page-transitions.js,
   which sets html[data-vt] before first paint:
       arrive-below | arrive-above | arrive-left | arrive-right |
       withdraw-below | withdraw-above | withdraw-left | withdraw-right | none
   ───────────────────────────────────────────────────────────────────────────── */

@view-transition { navigation: auto; }

:root {
    --vt-dur:    0.7s;
    --vt-ease:   cubic-bezier(0.4, 0, 0.2, 1);   /* the curve the mobile pager already uses */
    --vt-ground: #12110f;                        /* what a receding page dims into */
}

/* ── HEADER ── lifted out of the page so it stays put and cross-fades in place.
   Matches the header variants (main, project, publication): each is the one
   <nav> that holds the logo. Only the transparent header over a hero is
   lifted; once it has become the solid cream bar (.scrolled) it belongs to its
   page and travels with it — otherwise the bar lingers as a band across the
   page that is arriving. */
nav:has(> .nav-logo):not(.scrolled) { view-transition-name: site-nav; }

::view-transition-group(site-nav),
::view-transition-old(site-nav),
::view-transition-new(site-nav) {
    animation-duration: var(--vt-dur);
    animation-timing-function: var(--vt-ease);
}

/* ── PAGE ── no default cross-fade: the two pages are opaque sheets. */
::view-transition { background: var(--vt-ground); }

::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

/* Arrive: the new page comes in over the old one, which drifts the same way and dims */
html[data-vt="arrive-below"]::view-transition-new(root) { animation: vt-in-below   var(--vt-dur) var(--vt-ease) both; }
html[data-vt="arrive-below"]::view-transition-old(root) { animation: vt-recede-up  var(--vt-dur) var(--vt-ease) both; }

html[data-vt="arrive-above"]::view-transition-new(root) { animation: vt-in-above   var(--vt-dur) var(--vt-ease) both; }
html[data-vt="arrive-above"]::view-transition-old(root) { animation: vt-recede-dn  var(--vt-dur) var(--vt-ease) both; }

html[data-vt="arrive-left"]::view-transition-new(root)  { animation: vt-in-left    var(--vt-dur) var(--vt-ease) both; }
html[data-vt="arrive-left"]::view-transition-old(root)  { animation: vt-recede-rt  var(--vt-dur) var(--vt-ease) both; }

html[data-vt="arrive-right"]::view-transition-new(root) { animation: vt-in-right   var(--vt-dur) var(--vt-ease) both; }
html[data-vt="arrive-right"]::view-transition-old(root) { animation: vt-recede-lt  var(--vt-dur) var(--vt-ease) both; }

/* Withdraw (Back): the outgoing page sits on top and leaves the way it came;
   the page beneath comes back up to full strength */
html[data-vt^="withdraw"]::view-transition-old(root)      { z-index: 1; }

html[data-vt="withdraw-below"]::view-transition-old(root) { animation: vt-out-below  var(--vt-dur) var(--vt-ease) both; }
html[data-vt="withdraw-below"]::view-transition-new(root) { animation: vt-return-up  var(--vt-dur) var(--vt-ease) both; }

html[data-vt="withdraw-above"]::view-transition-old(root) { animation: vt-out-above  var(--vt-dur) var(--vt-ease) both; }
html[data-vt="withdraw-above"]::view-transition-new(root) { animation: vt-return-dn  var(--vt-dur) var(--vt-ease) both; }

html[data-vt="withdraw-left"]::view-transition-old(root)  { animation: vt-out-left   var(--vt-dur) var(--vt-ease) both; }
html[data-vt="withdraw-left"]::view-transition-new(root)  { animation: vt-return-rt  var(--vt-dur) var(--vt-ease) both; }

html[data-vt="withdraw-right"]::view-transition-old(root) { animation: vt-out-right  var(--vt-dur) var(--vt-ease) both; }
html[data-vt="withdraw-right"]::view-transition-new(root) { animation: vt-return-lt  var(--vt-dur) var(--vt-ease) both; }

@keyframes vt-in-below  { from { transform: translateY(100%); }  to { transform: translateY(0); } }
@keyframes vt-in-above  { from { transform: translateY(-100%); } to { transform: translateY(0); } }
@keyframes vt-in-left   { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes vt-in-right  { from { transform: translateX(100%); }  to { transform: translateX(0); } }

@keyframes vt-out-below { from { transform: translateY(0); } to { transform: translateY(100%); } }
@keyframes vt-out-above { from { transform: translateY(0); } to { transform: translateY(-100%); } }
@keyframes vt-out-left  { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@keyframes vt-out-right { from { transform: translateX(0); } to { transform: translateX(100%); } }

@keyframes vt-recede-up { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-6%); opacity: 0.5; } }
@keyframes vt-recede-dn { from { transform: translateY(0); opacity: 1; } to { transform: translateY(6%);  opacity: 0.5; } }
@keyframes vt-recede-lt { from { transform: translateX(0); opacity: 1; } to { transform: translateX(-6%); opacity: 0.5; } }
@keyframes vt-recede-rt { from { transform: translateX(0); opacity: 1; } to { transform: translateX(6%);  opacity: 0.5; } }

@keyframes vt-return-up { from { transform: translateY(-6%); opacity: 0.5; } to { transform: translateY(0); opacity: 1; } }
@keyframes vt-return-dn { from { transform: translateY(6%);  opacity: 0.5; } to { transform: translateY(0); opacity: 1; } }
@keyframes vt-return-lt { from { transform: translateX(-6%); opacity: 0.5; } to { transform: translateX(0); opacity: 1; } }
@keyframes vt-return-rt { from { transform: translateX(6%);  opacity: 0.5; } to { transform: translateX(0); opacity: 1; } }

/* ── HOME SPLASH ── plays when Home is the way into the site (or is reloaded),
   not when Home arrives from another page of the site. */
html.no-splash .splash { display: none; }

/* ── REDUCED MOTION ── no page transitions at all. */
@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
}
