/* =============================================================
   WvH Hospitality — motion layer, 11.6.26. Five movements,
   Wes Anderson blocking, Apple pacing: I. The Curtain · II. Page cross-fade
   III. The Log Stamp · IV. The Departure Board · V. Symmetry Choreography
   ============================================================= */

/* ---------- I. THE CURTAIN — drawn velvet, swag valance, spotlight ---------- */
/* the house is dark until the cloth is hung (set by the inline head script on the cover) */
html.curtain-pending::before {
  content: ""; position: fixed; inset: 0; z-index: 11999; background: #1a0204;
}
.curtain-overlay {
  position: fixed; inset: 0; z-index: 12000;
  pointer-events: all; overflow: hidden;
}
/* house lights: the room is dim behind the curtain and comes up as it parts */
.curtain-backdrop {
  position: absolute; inset: 0; background: rgba(8, 3, 1, 0.55);
  transition: opacity 0.8s ease 0.15s;
}
.curtain-overlay.open .curtain-backdrop { opacity: 0; }

.curtain-panel {
  position: absolute; top: 0; bottom: 0; width: calc(50% + 1px); z-index: 2;
  will-change: transform;
  filter: drop-shadow(0 0 24px rgba(0,0,0,0.6));
}
.curtain-panel svg { display: block; width: 100%; height: 100%; }
/* velvet nap — fine vertical streaks, drawn once, travels with the cloth */
.curtain-panel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9 0.035' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.9 -0.28'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
  opacity: 0.5;
}
.curtain-left  { left: 0;  transform-origin: left center; }
.curtain-right { right: 0; transform-origin: right center; }

/* the gather: cloth compresses toward the wings, then is drawn off */
@keyframes gather-left {
  0%   { transform: translateX(0) scaleX(1);       animation-timing-function: cubic-bezier(0.62, 0, 0.3, 1); }
  84%  { transform: translateX(0) scaleX(0.06);    animation-timing-function: ease-in; }
  100% { transform: translateX(-7%) scaleX(0.06); }
}
@keyframes gather-right {
  0%   { transform: translateX(0) scaleX(1);       animation-timing-function: cubic-bezier(0.62, 0, 0.3, 1); }
  84%  { transform: translateX(0) scaleX(0.06);    animation-timing-function: ease-in; }
  100% { transform: translateX(7%) scaleX(0.06); }
}
.curtain-overlay.open .curtain-left  { animation: gather-left 1.35s forwards; }
.curtain-overlay.open .curtain-right { animation: gather-right 1.35s forwards; }

/* spotlight pooled on the closed curtain */
.curtain-spot {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: radial-gradient(ellipse 38% 46% at 50% 52%,
    rgba(255, 232, 190, 0.85) 0%, rgba(255, 216, 160, 0.42) 44%, transparent 72%);
  mix-blend-mode: soft-light;
  transition: opacity 0.35s ease;
}
/* stage-light falloff — the wings sit in shadow while the house waits */
.curtain-falloff {
  position: absolute; inset: 0; z-index: 6; pointer-events: none;
  background: radial-gradient(ellipse 72% 88% at 50% 50%,
    transparent 46%, rgba(10, 1, 2, 0.34) 78%, rgba(6, 0, 1, 0.62) 100%);
  transition: opacity 0.45s ease;
}

.curtain-valance {
  position: absolute; top: 12px; left: 0; width: 100%; height: 112px; z-index: 5;
  filter: drop-shadow(0 9px 10px rgba(0,0,0,0.55));
  transition: transform 0.7s cubic-bezier(0.6, 0, 0.4, 1) 0.42s, opacity 0.7s ease 0.42s;
}
.curtain-valance svg { display: block; width: 100%; height: 100%; }
.curtain-rod {
  position: absolute; top: 0; left: 0; right: 0; height: 14px; z-index: 6;
  background: linear-gradient(180deg, #f1e0a8 0%, #c9a24c 30%, #6e5520 82%, #3c2a0e 100%);
  box-shadow: 0 2px 10px rgba(0,0,0,0.65);
  transition: transform 0.65s ease 0.46s, opacity 0.65s ease 0.46s;
}
.curtain-overlay.open .curtain-rod,
.curtain-overlay.open .curtain-valance { transform: translateY(-135%); opacity: 0; }

.curtain-card {
  position: absolute; inset: 0; z-index: 7;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center;
  opacity: 0; animation: card-in 0.7s ease 0.3s forwards;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
@keyframes card-in { to { opacity: 1; } }
/* the card (and its light) leave FIRST, before any cloth moves */
.curtain-overlay.card-out .curtain-card { opacity: 0 !important; transform: scale(0.96); animation: none; }
.curtain-overlay.card-out .curtain-spot,
.curtain-overlay.card-out .curtain-falloff,
.curtain-overlay.card-out .curtain-hint { opacity: 0; }
.curtain-rule { width: 96px; height: 1.5px; background: linear-gradient(90deg, transparent, #f1e0a8, transparent); }
.curtain-kicker {
  font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; font-weight: 500;
  letter-spacing: 0.45em; text-transform: uppercase; color: #fff3d6;
  text-shadow: 0 1px 3px rgba(0,0,0,0.85), 0 0 12px rgba(40,4,8,0.6);
}
.curtain-presents {
  font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic;
  font-size: 25px; color: #fff3d6;
  text-shadow: 0 1px 3px rgba(0,0,0,0.85), 0 0 12px rgba(40,4,8,0.6);
}
.curtain-title {
  font-family: 'Big Shoulders Display', 'Arial Black', sans-serif;
  font-weight: 900; font-size: clamp(36px, 11vw, 70px);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: #f6ebd0;
  text-shadow: 0 2px 0 #3a060b, 0 4px 18px rgba(0,0,0,0.55);
}
.curtain-hint {
  position: absolute; bottom: 58px; left: 0; right: 0; text-align: center; z-index: 7;
  font-family: 'IBM Plex Mono', monospace; font-size: 9px;
  letter-spacing: 0.32em; text-transform: uppercase; color: rgba(246,235,208,0.6);
  transition: opacity 0.3s ease;
}

@media (max-width: 560px) {
  .curtain-kicker { font-size: 9.5px; letter-spacing: 0.3em; }
  .curtain-presents { font-size: 21px; }
  .curtain-valance { height: 86px; top: 9px; }
  .curtain-rod { height: 11px; }
}

/* ---------- II. PAGE CROSS-FADE — one room dissolves into the next ---------- */
/* Cross-document view transitions (Chrome 126+, Safari 18.2+); browsers without them simply cut. */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.55s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- III. THE LOG STAMP — settles into place ---------- */
.stamp-pending { opacity: 0; }
.stamp-settle { animation: stamp-settle 1.1s cubic-bezier(0.22, 0.61, 0.36, 1) forwards; }
@keyframes stamp-settle {
  0%   { opacity: 0; transform: translateY(10px) scale(1.025); }
  100% { opacity: 1; transform: none; }
}

/* ---------- IV. THE DEPARTURE BOARD — the ticker flaps ---------- */
.flap {
  display: inline-block; transform-origin: 50% 55%;
  animation: flap-turn 0.14s ease-in-out;
}
@keyframes flap-turn {
  0% { transform: rotateX(85deg); filter: brightness(0.6); }
  100% { transform: rotateX(0deg); filter: brightness(1); }
}

/* ---------- V. SYMMETRY CHOREOGRAPHY — paired entrances ---------- */
.symL { opacity: 0; transform: translate3d(-12px, 8px, 0); }
.symR { opacity: 0; transform: translate3d(12px, 8px, 0); }
.symU { opacity: 0; transform: translate3d(0, 12px, 0); }
.sym-in {
  opacity: 1; transform: none;
  transition: opacity 1.1s cubic-bezier(0.22, 0.61, 0.36, 1), transform 1.1s cubic-bezier(0.22, 0.61, 0.36, 1);
}
/* rules draw from the center outward */
.rule-undrawn::before { transform: scaleX(0); transform-origin: 100% 50%; }
.rule-undrawn::after  { transform: scaleX(0); transform-origin: 0% 50%; }
.rule-draw::before, .rule-draw::after {
  transform: scaleX(1);
  transition: transform 1.2s cubic-bezier(0.22, 0.61, 0.36, 1) 0.1s;
}

@media (prefers-reduced-motion: reduce) {
  html.curtain-pending::before, .curtain-overlay { display: none !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.2s; }
}
