/* ── Page transition — refined curtain with brand + 0-100 loader
 *
 *  Architecture
 *    1. ARRIVAL  — html.is-arriving::before paints the curtain bg from
 *                  first frame (no flash).  transition.js attaches the
 *                  brand stack (logo + wordmark + 100% bar) on top.
 *    2. EXIT     — transition.js builds .page-transition dynamically on
 *                  click. Panel slides in from bottom; counter rapidly
 *                  ticks 0→100 with easeOutCubic; navigate at 540ms.
 *
 *    Curve  cubic-bezier(.83, 0, .17, 1)  for the panel slide.
 *  ──────────────────────────────────────────────────────────────────── */

:root { --pt-curve: cubic-bezier(.83, 0, .17, 1); }

/* ───────── Arrival — pseudo curtain bg (instant cover) ───────── */

html.is-arriving::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 95% 70% at 50% 45%,
      oklch(99% 0.008 70) 0%,
      oklch(96.5% 0.022 220) 65%,
      oklch(94% 0.030 220) 100%);
  z-index: 99999;
  transform: translateY(0);
  will-change: transform;
}

html.is-arriving.is-revealing::before {
  transform: translateY(-101%);
  transition: transform .68s var(--pt-curve);
}

/* Lock hero entrance animations during arrival so they don't visibly
 * replay through the curtain. */
html.is-arriving .hero__badge,
html.is-arriving .hero__title,
html.is-arriving .hero__sub,
html.is-arriving .hero__actions,
html.is-arriving .hero__trust,
html.is-arriving .hero__title em::after,
html.is-arriving .scroll-hint,
html.is-arriving .hero__lake-hint {
  animation: none !important;
}

/* ───────── Exit — JS-built panel (slides in from bottom) ───────── */

.page-transition {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  visibility: hidden;
}
.page-transition.is-active {
  visibility: visible;
  pointer-events: auto;
}

.page-transition__panel {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 95% 70% at 50% 45%,
      oklch(99% 0.008 70) 0%,
      oklch(96.5% 0.022 220) 65%,
      oklch(94% 0.030 220) 100%);
  transform: translateY(101%);
  will-change: transform;
}

.page-transition.is-leaving .page-transition__panel {
  transform: translateY(0);
  transition: transform .55s var(--pt-curve);
}

/* ───────── Brand stack (used by both arrival + exit) ───────── */

.pt-brand {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  width: min(280px, 70vw);
}

.pt-brand__logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 6px 18px oklch(50% 0.19 228 / .14));
  margin-bottom: 1.25rem;
  animation: pt-brand-logo 2.4s ease-in-out infinite;
}

@keyframes pt-brand-logo {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-4px) rotate(1deg); }
}

.pt-brand__name {
  font-family: 'Noto Serif TC', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: oklch(20% 0.04 230);
  letter-spacing: .12em;
  line-height: 1;
  margin-bottom: .375rem;
}

.pt-brand__name-en {
  font-family: ui-monospace, 'JetBrains Mono', Menlo, monospace;
  font-size: .6875rem;
  font-weight: 500;
  color: oklch(50% 0.015 232);
  letter-spacing: .22em;
  text-transform: uppercase;
  margin-bottom: 2.5rem;
}

.pt-brand__bar {
  width: 100%;
  height: 2px;
  background: oklch(50% 0.19 228 / .12);
  border-radius: 100px;
  overflow: hidden;
  position: relative;
}

.pt-brand__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, oklch(62% 0.14 196), oklch(50% 0.19 228));
  border-radius: 100px;
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
}

.pt-brand__pct {
  margin-top: .875rem;
  font-family: ui-monospace, 'JetBrains Mono', Menlo, monospace;
  font-size: .75rem;
  font-weight: 600;
  color: oklch(50% 0.19 228);
  letter-spacing: .14em;
  font-variant-numeric: tabular-nums;
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.pt-brand__pct::after {
  content: '';
  width: 18px;
  height: 1px;
  background: oklch(50% 0.19 228 / .35);
  display: inline-block;
}

/* Entry fade-in for the brand stack (after curtain covers) */
.pt-brand {
  opacity: 0;
  transform: translate(-50%, -46%);
  transition: opacity .26s ease, transform .42s var(--pt-curve);
}
.pt-brand.is-shown {
  opacity: 1;
  transform: translate(-50%, -50%);
}

/* During arrival reveal, brand stack fades upward with curtain */
html.is-arriving.is-revealing .pt-brand {
  opacity: 0;
  transform: translate(-50%, -54%) scale(.98);
  transition: opacity .32s ease, transform .55s var(--pt-curve);
}

/* ───────── Reduced motion fallback ───────── */
@media (prefers-reduced-motion: reduce) {
  html.is-arriving::before,
  .page-transition,
  .pt-brand { display: none !important; }
  html.is-arriving .hero__badge,
  html.is-arriving .hero__title,
  html.is-arriving .hero__sub,
  html.is-arriving .hero__actions,
  html.is-arriving .hero__trust,
  html.is-arriving .hero__title em::after,
  html.is-arriving .scroll-hint,
  html.is-arriving .hero__lake-hint {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
