/* Dolf Agency — cross-page column-stair curtain (fx/page-curtain.js).
   Leave: five columns stair in (alternating top / bottom), the DOLF wordmark
   rises through a mask, a hairline draws under it with the destination label.
   Enter: the same frame is painted by html.pt-enter::after before first paint,
   then the module swaps in the real curtain and the columns stair out. */

/* Wordmark face for the curtain + cover. Same file the Google Fonts stylesheet
   serves for Syne (latin subset, variable wght, as requested by the pages'
   css2?family=Syne:wght@500;600;700;800 link) so it comes from cache, but with
   font-display:block: while it loads, DOLF is invisible instead of flashing
   in a fallback face for a few frames on every navigation. If the URL ever
   changes upstream it still resolves (versioned), and the stack falls back
   to --font-display. */
@font-face {
  font-family: "fx-page-syne";
  font-style: normal;
  font-weight: 400 800;
  font-display: block;
  src: url(https://fonts.gstatic.com/s/syne/v24/8vIH7w4qzmVxm2BL9A.woff2) format("woff2");
  unicode-range: U+0044, U+0046, U+004C, U+004F; /* D F L O */
}

/* ---------- No-flash cover on the incoming page ----------
   Mirrors the curtain's final leave frame: column hairlines, centred DOLF and
   the 64px rule under it, so the hand-off between documents is seamless.
   Fails safe: if the module never runs, the cover fades away on its own. */
html.pt-enter::after {
  content: "DOLF";
  content: "DOLF" / "";
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-family: "fx-page-syne", var(--font-display);
  font-weight: 800;
  font-size: clamp(2.5rem, 8vw, 6.5rem);
  letter-spacing: -0.04em;
  line-height: 0.9;
  text-transform: uppercase;
  color: var(--fg);
  background:
    linear-gradient(var(--fg-dim), var(--fg-dim)) center calc(50% + 0.55em + 18.5px) / 64px 1px no-repeat,
    repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), var(--line) calc(25% - 1px) 25%) left top / 80% 100% no-repeat,
    var(--bg-elevated);
  animation: fx-page-cover-failsafe 0.4s ease 3s forwards;
}

@keyframes fx-page-cover-failsafe {
  to { opacity: 0; visibility: hidden; }
}

/* ---------- Curtain ----------
   Resting transforms (columns / word / rule / label off-stage) are set by GSAP,
   not here: GSAP would read a CSS translateY(%) back as fixed px. The layer is
   visibility:hidden until a transition runs, so nothing shows before JS. */
.page-curtain {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
  contain: layout paint;
}
.page-curtain.is-active { visibility: visible; }
/* Leave: the whole layer swallows clicks / taps / touch-scroll gestures */
.page-curtain.is-blocking { pointer-events: auto; touch-action: none; }
/* Enter: only the columns block, so already-uncovered areas respond */
.page-curtain.is-entering .page-curtain__col { pointer-events: auto; }

/* Lenis.stop() sets overflow:hidden on <html>; keep the classic-scrollbar
   gutter so the page does not jump sideways while the columns come in. The
   fixed curtain stops at that gutter, which shows the canvas: paint it like
   the columns (body keeps its own --bg, so only the gutter changes). */
html.pt-leaving {
  scrollbar-gutter: stable;
  background: var(--bg-elevated);
}

.page-curtain__col {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  background: var(--bg-elevated);
  backface-visibility: hidden;
}
/* Column edges fall on fractional pixels; as separate anti-aliased layers two
   abutting edges leave a seam the page shows through (white hero text as
   broken ticks in the closed frame). Each column after the first overlaps
   its neighbour by 1px and carries the hairline on that overlap, so every
   pixel is fully covered. Hairlines land at k·20% − 1px, exactly where the
   html.pt-enter::after cover draws them. */
.page-curtain__col + .page-curtain__col {
  margin-left: -1px;
  border-left: 1px solid var(--line);
}
/* Layers only while a transition runs, not on every idle page */
.page-curtain.is-active:not(.page-curtain--fade) .page-curtain__col,
.page-curtain.is-active:not(.page-curtain--fade) .page-curtain__word { will-change: transform; }

.page-curtain__logo {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.page-curtain__mark {
  position: relative;
  font-size: clamp(2.5rem, 8vw, 6.5rem);
}

.page-curtain__mask {
  display: block;
  overflow: hidden;
  padding: 0.1em 0.05em;
}

.page-curtain__word {
  display: block;
  font-family: "fx-page-syne", var(--font-display);
  font-weight: 800;
  font-size: 1em;
  letter-spacing: -0.04em;
  line-height: 0.9;
  text-transform: uppercase;
  color: var(--fg);
}

/* Rule + caption hang below the word so the word itself sits dead centre
   (matches the html.pt-enter::after cover exactly). */
.page-curtain__meta {
  position: absolute;
  top: 100%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 18px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.page-curtain__line {
  display: block;
  width: 64px;
  height: 1px;
  background: var(--fg-dim);
  transform-origin: left center;
}

.page-curtain__caption {
  display: block;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.24em;
  padding-left: 0.24em; /* optical centring: cancels trailing tracking */
  text-transform: uppercase;
  color: var(--fg-muted);
}
.page-curtain__label { display: block; }
.page-curtain__caption:empty,
.page-curtain__label:empty { display: none; }

/* ---------- Reduced motion: one flat layer, opacity only ---------- */
.page-curtain--fade {
  background: var(--bg);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.page-curtain--fade.is-shown { opacity: 1; }
.page-curtain--fade .page-curtain__col { display: none; }
.page-curtain--fade .page-curtain__word,
.page-curtain--fade .page-curtain__line,
.page-curtain--fade .page-curtain__label {
  transform: none;
  will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
  html.pt-enter::after {
    background:
      linear-gradient(var(--fg-dim), var(--fg-dim)) center calc(50% + 0.55em + 18.5px) / 64px 1px no-repeat,
      var(--bg);
    animation-delay: 1.5s;
  }
  .page-curtain__col { display: none; }
}
