/* The Portal: the finale, and the reason the ten grammars had to be different.
   The corridor's far wall opens and one continuous walk quotes every camera
   the site owns for a few seconds each: you sink, you dolly, the boughs part,
   the window slides by, the map inks a road, the sky lifts you, a tent
   swallows you, a porch light clicks through a year, a stamp slams down, and
   a lens dives through a keyhole, into an empty room holding one blank wall
   and one brush. Reduced motion and phones get the same walk as a column. */

.portal { --void: #06060a; --ink: #ece7db; --dim: #9a9482; --gold: #d4a84c;
  background: var(--void); color: var(--ink); }
body[data-portal] { background: #06060a; }

/* ================= the far wall opens ================= */
.pt-dark { position: fixed; inset: 0; z-index: 70; background: #040407;
  transition: opacity 1s ease .3s, visibility 1s .3s; }
.pt-dark.through { opacity: 0; visibility: hidden; }
.pt-wall { position: absolute; inset: 0; overflow: hidden; }
.pw-seam { position: absolute; left: 50%; top: 50%; width: 2px; height: 0;
  transform: translate(-50%, -50%); background: linear-gradient(180deg,
    transparent, rgba(212, 168, 76, .95) 18%, rgba(255, 236, 190, 1) 50%,
    rgba(212, 168, 76, .95) 82%, transparent);
  box-shadow: 0 0 30px 8px rgba(212, 168, 76, .5);
  transition: height 1.5s cubic-bezier(.5, 0, .2, 1), width 1.4s ease 1.3s; }
.pt-dark.cracking .pw-seam { height: 76vh; }
.pt-dark.opening .pw-seam { width: 78vw; height: 84vh;
  box-shadow: 0 0 90px 30px rgba(212, 168, 76, .35); }
.pw-spill { position: absolute; left: 50%; top: 50%; width: 120vw; height: 120vh;
  transform: translate(-50%, -50%); opacity: 0; pointer-events: none;
  background: radial-gradient(40% 46% at 50% 50%, rgba(255, 226, 168, .5), transparent 70%);
  transition: opacity 1.6s ease; }
.pt-dark.opening .pw-spill { opacity: 1; }
.pt-open { position: absolute; left: 50%; bottom: 15%; transform: translateX(-50%);
  width: min(90vw, 44ch); text-align: center; font-family: var(--font-body);
  font-style: italic; font-size: clamp(15px, 1.4vw, 22px); color: #8a8272;
  opacity: 0; animation: pt-say-in 3.4s ease-out .5s; }
@keyframes pt-say-in { 0% { opacity: 0; } 22% { opacity: 1; } 76% { opacity: 1; } 100% { opacity: 0; } }
.pt-skip { position: absolute; right: 22px; bottom: 20px; z-index: 3;
  font-family: var(--font-ui); font-size: 10px; letter-spacing: .3em;
  text-transform: uppercase; color: #6a6458; background: none; border: none; cursor: pointer; }
.pt-skip:hover { color: var(--gold); }

/* ================= the walk ================= */
.pt-track { position: relative; height: var(--track-h, 1200vh); }
.pt-stage { position: sticky; top: 0; height: 100vh; overflow: hidden; background: var(--void); }
.beat { position: absolute; inset: 0; opacity: 0; visibility: hidden;
  will-change: opacity; }
.beat.live { visibility: visible; }
.beat > div, .beat > img { will-change: transform; }

/* 1. the deep: you sink */
.bd-col { position: absolute; left: 0; right: 0; top: 0; height: 400%;
  transform: translateY(var(--sink, 0%)); }
.bd-band { height: 25%; background-size: cover; background-position: center; }
.bd-plain:nth-child(1) { background: linear-gradient(180deg, #2a6a7a, #14425a); }
.bd-plain:nth-child(2) { background: linear-gradient(180deg, #14425a, #0d2c3c); }
.bd-plain:nth-child(3) { background: linear-gradient(180deg, #0d2c3c, #06141c); }
.bd-plain:nth-child(4) { background: linear-gradient(180deg, #06141c, #03080c); }
.bd-bubbles { position: absolute; inset: 0; pointer-events: none; }
.pbb { position: absolute; border-radius: 50%; border: 1px solid rgba(190, 240, 235, .5);
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .5), transparent 60%);
  animation: pbb-rise linear infinite; }
@keyframes pbb-rise { to { transform: translateY(-120vh) translateX(var(--bx, 0px)); } }

/* 2. night city: the street dolly */
.bc-far { position: absolute; inset: 0; background-size: cover; background-position: center;
  transform: scale(var(--cityz, 1)); filter: brightness(.8); }
.bc-road { position: absolute; left: 50%; bottom: -10%; width: min(62vw, 900px); height: 150%;
  transform: translateX(-50%); background-size: 100% auto; background-repeat: repeat-y;
  background-position-y: var(--roady, 0px); opacity: .95;
  mask-image: linear-gradient(180deg, transparent, #000 22%, #000 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 22%, #000 100%); }
.bc-rain { position: absolute; inset: 0; pointer-events: none; }
.pcr { position: absolute; top: -14vh; width: 1.5px; border-radius: 1px;
  background: linear-gradient(180deg, transparent, rgba(216, 226, 240, .5) 30%, rgba(150, 180, 220, .2));
  animation: pcr-fall linear infinite; }
@keyframes pcr-fall { to { transform: translateY(126vh); } }

/* 3. the wild: the boughs part */
.bw-deep { position: absolute; inset: 0; background-size: cover; background-position: center;
  transform: scale(var(--wildz, 1.06)); }
.bw-bough { position: absolute; width: 62%; height: auto; pointer-events: none;
  transition: none; }
.bo-1 { left: -6%; top: -8%; transform: translateX(calc(var(--part, 0) * -26%)) rotate(calc(var(--part, 0) * -7deg)); transform-origin: 0 0; }
.bo-2 { right: -6%; top: -10%; transform: translateX(calc(var(--part, 0) * 26%)) rotate(calc(var(--part, 0) * 7deg)); transform-origin: 100% 0; }
.bo-3 { left: -10%; bottom: -12%; transform: translateX(calc(var(--part, 0) * -22%)) rotate(calc(var(--part, 0) * 5deg)); transform-origin: 0 100%; }
.bo-4 { right: -10%; bottom: -14%; transform: translateX(calc(var(--part, 0) * 22%)) rotate(calc(var(--part, 0) * -5deg)); transform-origin: 100% 100%; }

/* 4. far out: the window slides by */
.bf-void { position: absolute; inset: -6%; background-size: cover; background-position: center;
  transform: translateX(calc(var(--drift, 0) * -6%)); }
.bf-deck { position: absolute; inset: 0; background-size: cover; background-position: center;
  transform: translateX(calc(var(--slide, 0) * -108%)); }

/* 5. the realm: the map inks a road */
.br-map { position: absolute; inset: 0; background-size: cover; background-position: center;
  transform: scale(var(--mapz, 1.04)); }
.br-ink { position: absolute; inset: 0; width: 100%; height: 100%; }
#br-road { stroke-dasharray: var(--len, 200); stroke-dashoffset: var(--dash, 200);
  filter: drop-shadow(0 0 2px rgba(42, 26, 14, .6)); }

/* 6. dreamscape: the sky lifts you */
.bm-room { position: absolute; inset: 0; background-size: cover; background-position: center;
  transform: translateY(calc(var(--lift, 0) * 34%)); }
.bm-moon { position: absolute; left: 58%; top: 8%; width: 26%;
  transform: translateY(calc(var(--lift, 0) * -22%)) scale(calc(1 + var(--lift, 0) * .2)); }
.bm-cloud { position: absolute; left: 6%; top: 26%; width: 42%; opacity: .85;
  transform: translateY(calc(var(--lift, 0) * -40%)) translateX(calc(var(--lift, 0) * 8%)); }

/* 7. carnival: a tent swallows you */
.bn-mid { position: absolute; inset: 0; background-size: cover; background-position: center;
  transform: scale(calc(1 + var(--swallow, 0) * .5)); filter: brightness(calc(1 - var(--swallow, 0) * .5)); }
.bn-tent { position: absolute; inset: 0; background-size: cover; background-position: center;
  opacity: var(--swallow, 0); transform: scale(calc(.6 + var(--swallow, 0) * .5)); }
.bn-confetti { position: absolute; inset: 0; pointer-events: none; }
.pcf { position: absolute; top: -4vh; width: 7px; height: 10px; border-radius: 1px;
  animation: pcf-fall linear infinite; }
@keyframes pcf-fall {
  100% { transform: translateY(112vh) translateX(var(--cx, 0px)) rotateZ(420deg); } }

/* 8. hometown: a porch light clicks through a year */
.bh-year { position: absolute; inset: 0; background-size: cover; background-position: center;
  opacity: 0; }

/* 9. the workshop: a stamp slams down */
.bs-shop { position: absolute; inset: 0; background-size: cover; background-position: center;
  filter: brightness(.85); }
.bs-piece { position: absolute; left: 50%; top: 52%; width: min(56vw, 860px); aspect-ratio: 2 / 1;
  transform: translate(-50%, -50%); background-size: cover; background-position: center;
  border: 8px solid #e8e3d6; box-shadow: 0 30px 60px -18px rgba(0, 0, 0, .8); }
.bs-blank { position: absolute; inset: 0; opacity: calc(1 - var(--slam, 0));
  background: repeating-linear-gradient(0deg, transparent 0 30px, rgba(58, 106, 160, .12) 30px 31px),
    linear-gradient(165deg, #eef3f8, #d8e2ec); }
.bs-head { position: absolute; left: 50%; top: -46%; width: min(26vw, 340px);
  transform: translateX(-50%) translateY(calc(var(--drop, 0) * 74%)); }
.bs-steam { position: absolute; left: 50%; top: 40%; }
.bs-steam i { position: absolute; width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 240, 248, .45), transparent 70%);
  filter: blur(4px); opacity: 0; }
.bs-steam.go i { animation: psteam 1s ease-out forwards; }
.bs-steam i:nth-child(1) { --px: -90px; }
.bs-steam i:nth-child(2) { --px: 60px; animation-delay: .07s; }
.bs-steam i:nth-child(3) { --px: -10px; animation-delay: .13s; }
@keyframes psteam { 0% { opacity: 0; transform: translate(var(--px, 0), 0) scale(.5); }
  20% { opacity: .8; } 100% { opacity: 0; transform: translate(calc(var(--px, 0) * 1.7), -16vh) scale(2.6); } }

/* 10. tiny worlds: a lens dives through a keyhole */
.bt-cab { position: absolute; inset: 0; background-size: cover; background-position: center;
  transform: scale(var(--dive, 1)); filter: blur(calc(var(--dblur, 0) * 1px)); }
.bt-inside { position: absolute; inset: 0; background-size: cover; background-position: center;
  opacity: var(--dopa, 0); transform: scale(var(--dins, .08)); }
.bt-hole { position: absolute; left: 50%; top: 50%; width: 3vw; aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(var(--hole, 1)); border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 226, 168, .9), rgba(240, 201, 106, .3) 60%, transparent 72%);
  opacity: calc(1 - var(--dopa, 0)); }

/* ---- the last wall ---- */
.bl-room { position: absolute; inset: 0; background-size: cover; background-position: center; }
.bl-plain { background:
  radial-gradient(70% 60% at 50% 40%, #241f1a, #0b0908 78%); }
.bl-wall { position: absolute; left: 50%; top: 46%; width: min(52vw, 760px); aspect-ratio: 2 / 1;
  transform: translate(-50%, -50%) scale(var(--wallz, .96));
  background: linear-gradient(168deg, #efe9dc, #d8d1c2);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .9), inset 0 0 60px rgba(160, 140, 110, .18);
  border: 10px solid #b9ad96; }
/* the brush leans against the wall, clear of the words underneath it */
.bl-brush { position: absolute; left: 23%; bottom: 12.5%; width: min(11vw, 168px); height: auto;
  transform: rotate(-7deg) translateY(calc((1 - var(--brush, 0)) * 40%));
  transform-origin: 50% 100%; opacity: var(--brush, 0);
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, .8)); }
.bl-brushplain { display: block; width: min(2.4vw, 32px); aspect-ratio: 1 / 6;
  background: linear-gradient(180deg, #2a2018 0 30%, #8a6a3a 30% 42%, #d8c9a8 42% 100%);
  border-radius: 40% 40% 3px 3px; }

/* ---- the placard, the title, the ending ---- */
.pt-say { position: absolute; left: 50%; bottom: 11%; transform: translateX(-50%);
  z-index: 8; width: min(90vw, 52ch); text-align: center; pointer-events: none; }
.pt-say span { font-family: var(--font-body); font-style: italic;
  font-size: clamp(16px, 1.6vw, 26px); color: rgba(236, 231, 219, .92);
  text-shadow: 0 2px 18px rgba(0, 0, 0, .95); opacity: var(--sayo, 0);
  transition: opacity .45s ease; display: inline-block; }
.pt-title { position: absolute; left: 50%; top: 22vh; transform: translateX(-50%);
  z-index: 9; text-align: center; width: min(92vw, 900px);
  transition: opacity .9s ease, transform .9s ease; }
.pt-title.gone { opacity: 0; transform: translateX(-50%) translateY(-18px); pointer-events: none; }
.pt-plate { font-family: var(--font-ui); font-size: 11px; letter-spacing: .34em;
  text-transform: uppercase; color: var(--gold); }
.pt-name { font-family: var(--font-display); font-weight: 500; font-style: italic;
  font-size: clamp(52px, 8vw, 132px); line-height: 1; color: var(--ink); margin: 12px 0 10px;
  text-shadow: 0 4px 40px rgba(0, 0, 0, .8); }
.pt-tag { font-family: var(--font-body); font-style: italic; font-size: clamp(15px, 1.3vw, 21px);
  color: #b9b3a4; text-shadow: 0 2px 14px rgba(0, 0, 0, .9); }
.pt-end { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%);
  z-index: 10; text-align: center; width: min(92vw, 760px);
  opacity: var(--endo, 0); pointer-events: none; transition: opacity .8s ease; }
.pt-end.on { pointer-events: auto; }
.pe-line { font-family: var(--font-display); font-weight: 500; font-style: italic;
  font-size: clamp(30px, 4.2vw, 68px); color: var(--ink); text-shadow: 0 3px 30px rgba(0, 0, 0, .9); }
.po-ctas { display: flex; gap: 18px; align-items: center; justify-content: center;
  flex-wrap: wrap; margin-top: 26px; }
.po-cta { font-family: var(--font-ui); font-size: 12px; letter-spacing: .24em;
  text-transform: uppercase; color: #1a1508; background: var(--gold); border: none;
  padding: 15px 28px; cursor: pointer; text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease; }
.po-cta:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -12px rgba(212, 168, 76, .6); }
.pe-hall { font-family: var(--font-body); font-style: italic; font-size: 16px; color: var(--dim);
  text-decoration: none; border-bottom: 1px dashed rgba(154, 148, 130, .5); }
.pe-hall:hover { color: var(--ink); }
.pt-cue { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 9;
  font-family: var(--font-body); font-style: italic; font-size: 13px;
  color: rgba(236, 231, 219, .7); text-shadow: 0 1px 8px rgba(0, 0, 0, .9);
  animation: pt-bob 3.4s ease-in-out infinite; transition: opacity .8s ease; }
.pt-cue.gone { opacity: 0; }
@keyframes pt-bob { 0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(7px); } }

/* ================= the flat walk: phones and reduced motion ================= */
.portal.flat .pt-dark { display: none; }
.portal.flat .pt-track { height: auto; }
.portal.flat .pt-stage { position: static; height: auto; overflow: visible;
  display: flex; flex-direction: column; }
.portal.flat .beat { position: relative; inset: auto; opacity: 1; visibility: visible;
  height: 56vh; overflow: hidden; }
.portal.flat .bd-col { position: absolute; height: 100%; transform: none; }
.portal.flat .bd-band { height: 25%; }
.portal.flat .bw-bough, .portal.flat .bm-moon, .portal.flat .bm-cloud,
.portal.flat .bs-head, .portal.flat .bt-hole { display: none; }
.portal.flat .bn-tent, .portal.flat .bt-inside { opacity: 1; transform: none; }
.portal.flat .bs-blank { opacity: 0; }
.portal.flat .bc-road { background-position-y: 0; }
.portal.flat .pt-title { position: relative; order: -1; top: auto; left: auto;
  transform: none; padding: 40px clamp(18px, 5vw, 44px) 10px; }
.portal.flat .pt-say { position: relative; left: auto; bottom: auto; transform: none;
  padding: 14px 18px; }
.portal.flat .pt-say span { opacity: 1; }
.portal.flat .pt-end { position: relative; left: auto; bottom: auto; transform: none;
  opacity: 1; pointer-events: auto; padding: 40px 18px 70px; }
.portal.flat .pt-cue { display: none; }
.portal.flat .bl-wall { position: relative; left: auto; top: auto; transform: none;
  margin: 0 auto; }
.portal.flat .bl-brush { opacity: 1; transform: translateX(-50%); }
@media (prefers-reduced-motion: reduce) {
  .pt-cue, .pt-open { animation: none; }
  .pbb, .pcr, .pcf { display: none; }
}
