/* Page transition — four panels close completely over the viewport (their
   edges meet and overlap at the centre, no square or line is drawn), then part
   toward the edges on arrival to reveal the new page. Animation lives in
   js/page-transition.js (WAAPI). CSS only declares the resting ("covered") state.

   Four anchor dots and a 1px frame guide the movement: they start at the
   screen corners and converge to a single point at the centre (and back).

   Knobs:
     --pt-panel   panel colour   (default: page background)
     --pt-ink     dots + line    (default: page text colour)
     --pt-inset   distance of the corner anchors from the screen edge (28px;
                  keep in sync with INSET in js/page-transition.js)           */

.pt {
  --pt-inset: 28px;
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
}
.pt.is-active { visibility: visible; pointer-events: auto; }

.pt__panel {
  position: absolute;
  background: var(--pt-panel, var(--color-bg, #0f0f0f));
  will-change: transform;
}
.pt__panel--top, .pt__panel--bottom { left: 0; width: 100%; height: calc(50% + 1px); }
.pt__panel--top { top: 0; }
.pt__panel--bottom { bottom: 0; }
.pt__panel--left, .pt__panel--right {
  top: 0; height: 100%;
  width: calc(50% + 1px);
}
.pt__panel--left { left: 0; }
.pt__panel--right { right: 0; }

.pt__line {
  position: absolute;
  inset: var(--pt-inset);
  box-sizing: border-box;
  border: 1px solid var(--pt-ink, var(--color-text, #f0f0ee));
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}

.pt__point {
  position: absolute;
  width: 7px; height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: var(--pt-ink, var(--color-text, #f0f0ee));
  will-change: transform, opacity;
}
.pt__point--tl, .pt__point--bl { left: var(--pt-inset); }
.pt__point--tr, .pt__point--br { left: calc(100% - var(--pt-inset)); }
.pt__point--tl, .pt__point--tr { top: var(--pt-inset); }
.pt__point--bl, .pt__point--br { top: calc(100% - var(--pt-inset)); }

/* Arriving via a transition: cover the first paint until JS takes over.
   Failsafe — if the script never runs, the curtain fades itself away. */
@keyframes pt-bail { to { opacity: 0; visibility: hidden; } }
html.pt-arriving::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--pt-panel, var(--color-bg, #0f0f0f));
  animation: pt-bail 0.4s ease-out 4s forwards;
}
html.pt-ready::before { display: none; }

/* The page scales slightly while it is covered/revealed. */
.main { transform-origin: 50% 50vh; }

@media (prefers-reduced-motion: reduce) {
  .pt, html.pt-arriving::before { display: none; }
}
