/* Full-bleed intro with localized motion supplied by intro-motion.js. */
.voyage-art { display: none; }
#experience[data-chapter="intro"] { background: #071c69; color: white; --scene-ink: white; }
#experience[data-chapter="intro"] #scenes { isolation: isolate; overflow: hidden; }
#experience[data-chapter="intro"] .voyage-art {
  display: block; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  /* Only the base colour lives here: the poster and the two edge scrims are declared further down
     (the art swap and `.voyage-art::after`), which is why no image layer is repeated here. */
  background-color: #071c69;
}
/* Entry and release motion is scoped to the intro. */
#intro.entering .title-lockup::before { animation: hat-fly 1.25s cubic-bezier(.5,.05,.55,.95) .2s both; }
#experience:not(.is-unwrapping) #intro.entering .year-object { animation: year-pop .85s cubic-bezier(.18,1.1,.3,1) .5s backwards; }
@keyframes hat-fly {
  0% { opacity: 1; transform: rotate(8deg) translate3d(0,0,0); }
  15% { opacity: 1; transform: rotate(3deg) translate3d(-5px,-10px,0); }
  100% { opacity: 0; transform: rotate(-44deg) translate3d(-34px,-140%,0); }
}
@keyframes year-pop {
  from { opacity: 0; transform: translateY(24px) scale(.72); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
#experience[data-chapter="intro"] .celebration-marks svg { animation: none; }
/* Poster-tuned marks: the intro art is cream along the upper left and dark below, so the
   shared decoration colours sink into it. Navy over the sail, white out over the sea. */
#experience[data-chapter="intro"] .celebration-marks svg:nth-child(1),
#experience[data-chapter="intro"] .celebration-marks svg:nth-child(2) { color: #202758; }
#experience[data-chapter="intro"] .celebration-marks svg:nth-child(3) { color: #fff; }
/* Front page only: the left edge runs along the sail, so it gets its own sparkle set. */
.intro-marks {
  position: absolute; inset: 90px 0 110px; z-index: -1; pointer-events: none;
  overflow: hidden; opacity: 0; transition: opacity .35s;
}
#experience[data-chapter="intro"] .intro-marks { opacity: 1; }
.intro-marks svg {
  position: absolute; width: 22px; height: 22px; stroke-width: 1.6; color: #202758;
  filter: drop-shadow(0 0 1.5px #fff) drop-shadow(0 0 3px #14153a80);
  animation: margin-float 4s ease-in-out infinite alternate;
}
.intro-marks svg:nth-child(1) { left: calc(var(--gutter)*1.14); top: 15%; width: 22px; height: 22px; color: #fff; }
.intro-marks svg:nth-child(2) { left: calc(var(--gutter)*.36); top: 32%; width: 26px; height: 26px; animation-delay: -1.1s; }
.intro-marks svg:nth-child(3) { left: calc(var(--gutter)*.76); top: 59%; width: 30px; height: 30px; animation-delay: -2.2s; }
.intro-marks svg:nth-child(4) { left: calc(var(--gutter)*1.02); top: 78%; width: 18px; height: 18px; color: #ffd166; animation-delay: -3.1s; }
.intro-marks svg:nth-child(5) { left: calc(var(--gutter)*1.78); top: 90%; width: 15px; height: 15px; color: #fff; animation-delay: -.6s; }
@media(prefers-reduced-motion:reduce) {
  /* Same specificity as the entry beats above, so this opt-out still wins the cascade over them. */
  #experience[data-chapter="intro"] #intro.entering .title-lockup::before,
  #experience[data-chapter="intro"] #intro.entering .year-object { animation: none; }
}

/* The chrome is transparent: the poster's own scrims carry legibility. */
#experience[data-chapter="intro"] :is(.topbar,.player) { background: none; color: #fff; }
#experience[data-chapter="intro"] .brand-logo { filter: brightness(0) invert(1); }
#experience[data-chapter="intro"] .brand-divider { background: white; }
#intro { color: #fff; padding: 0; }
#intro .intro-title {
  position: absolute; left: 10%; top: 3%; width: 52%; height: 65%; display: flex;
  justify-content: center; align-items: center; flex-direction: column; gap: 0;
  padding-top: min(6vh,48px); transform: rotate(-4deg) skewX(-5deg); text-align: center;
}
#intro .title-lockup { position: relative; display: block; }
#intro .title-mark { display: none; }
/* bottom is a share of the lockup height, so the lift scales with the clamped type. */
#intro .title-lockup::before {
  content: ""; position: absolute; width: 28%; aspect-ratio: 3/1; left: 48%; bottom: 99%; z-index: 1;
  background: url("../assets/images/intro-hat.webp") center / contain no-repeat;
  transform-origin: 50% 62%; transform: rotate(8deg);
}
#intro-title { color: #fff; text-shadow: 0 .045em #0c134a; text-transform: uppercase; font-weight: 800; }
#intro-title span:first-child { font-size: clamp(24px,min(4.6vw,8.5dvh),84px); white-space: nowrap; line-height: .99; }
#intro-title span:last-child { font-size: clamp(45px,min(8.5vw,15.3dvh),152px); line-height: .9; }
#intro .year-object {
  position: relative; inset: auto; margin: 0; display: flex; font-size: clamp(42px,min(7.9vw,12dvh),124px);
  font-weight: 800; line-height: .94; color: #ff77c3; text-shadow: 0 .045em #400b69, 0 0 2px #400b69;
  will-change: auto;
  transform: translateY(calc(var(--tension)*-4px)) scale(calc(1 + var(--tension)*.035));
}
#intro .intro-streams { display: none; }
#intro .intro-bottom {
  position: absolute; inset: auto auto 9% 11%; width: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: clamp(5px,1.2dvh,15px); text-align: center;
}
#intro .intro-bottom > p {
  margin: 0; padding: .35em 1.55em; color: #191c4d; background: #ffdc90; font-family: var(--display);
  font-weight: 780; font-size: clamp(14px,min(1.6vw,2.6dvh),22px); line-height: 1.12;
  transform: rotate(-2deg); clip-path: polygon(0 5%,100% 0,98% 47%,100% 96%,0 100%,2% 53%);
}
#intro .intro-bottom em { padding: 0; rotate: none; color: inherit; background: transparent; }
#intro .pull-control { color: #202758; width: min(100%,320px); }
#intro .start-button { color: white; background: #10235e; padding: 3px 10px; border-radius: 4px; }
/* readability.css already sizes this footer at clamp(22px,1.65vw,26px); the 10-14px this rule used to
   carry was unreadable over the poster, on desktop and phone alike. */
#intro .scene-footer { inset: auto 0 0; padding: 3px var(--gutter); background: none; color: white; text-shadow: 0 1px 2px #030b1cd9; font-size: clamp(14px,1.5vw,22px); }
@media (max-width:680px) and (min-height:541px) {
  #intro .intro-title { left: 3%; top: 2%; width: 94%; height: 38%; padding-top: 5%; }
  #intro-title span:first-child { font-size: 8.7vw; }
  #intro-title span:last-child { font-size: 16vw; }
  #intro .year-object { font-size: 14.5vw; }
  #intro .intro-bottom { left: 4%; width: 92%; bottom: 6%; }
  #intro .scene-footer { justify-content: center; }
}
@media(max-height:540px) {
  #intro .intro-title { left: 3%; width: 49%; height: 78%; top: 7%; padding-top: 0; }
  #intro .intro-bottom { left: 49%; width: 33%; bottom: 12%; }
  #intro .intro-bottom > p { font-size: 12px; }
  #intro .pull-control { max-width: 230px; }
}
/* Localized cloth and cloud motion sits below the existing header/footer scrims. */
.voyage-canvas { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
#experience[data-chapter="intro"] .voyage-art { background-image:url("../assets/images/intro-sunny.webp"); background-size:cover; background-position:center; }
@media(max-width:680px) {
  #experience[data-chapter="intro"] .voyage-art { background-image:url("../assets/images/intro-sunny-mobile.webp"); }
}
.voyage-art::after { content:""; position:absolute; inset:0; pointer-events:none; background:linear-gradient(#030b1cd9,transparent 17%,transparent 67%,#030b1cc7); }
#intro.entering .title-lockup::before { animation:hat-arrive 850ms cubic-bezier(.16,1,.3,1) 150ms both; }
#intro.entering #intro-title span { animation:title-arrive 700ms cubic-bezier(.16,1,.3,1) both; }
#intro.entering #intro-title span:last-child { animation-delay:100ms; }
#intro .intro-title { translate:calc(var(--tension)*-18px) calc(var(--tension)*-8px); scale:calc(1 + var(--tension)*.035); }
/* The pull lift is a fixed 38px while the top row shrinks under max-height:760px (styles.css:30,
   70px) and on short phones (styles.css:43, 62px). The crown then climbed past the scene's clip line
   and sat there sliced flat for as long as the pull was held. --hat-lift caps the lift per viewport
   class (--hat-arc does the same for the entry arc, which lives inside the same clip). */
#experience { --hat-lift: 38px; --hat-arc: -44px; }
@media(max-height:760px) and (min-width:681px) { #experience { --hat-lift: 14px; } }
/* Short phones have ~5px of headroom above the resting hat, and the .intro-title scale already lifts
   it ~10px, so the lift goes negative: the hat settles instead of rising, still rotating sideways. */
@media(max-width:680px) and (max-height:760px) { #experience { --hat-lift: -12px; --hat-arc: -2px; } }
#intro .title-lockup::before { translate:calc(var(--tension)*26px) calc(var(--tension)*var(--hat-lift)*-1); rotate:calc(var(--tension)*18deg); }
#intro .pull-track { background:#f0e4ff; border-color:#ffffffa0; box-shadow:0 5px 22px #00174040; }
#intro .pull-track::before { background:linear-gradient(90deg,#ffce73,#ff9cd3); transform:scaleX(var(--pull-progress)); transform-origin:left; }
/* No dashed track line on the intro: the label sits on top of it, so the dashes only read as a
   broken line poking out from under the copy. */
#intro .pull-track::after { content: none; }
#intro #pull { box-shadow:0 0 0 calc(var(--pull-progress)*7px) #ffdc9040; }
#intro #pull svg { rotate:calc(var(--pull-progress)*-25deg); scale:calc(1 + var(--pull-progress)*.15); }
#intro .is-dragging .pull-label { top:16px; left:65px; right:12px; font-size:12px; line-height:1.4; opacity:calc(1 - var(--pull-progress)*.7); }
#experience.is-unwrapping #intro .title-lockup { animation:title-depart 700ms cubic-bezier(.6,0,.8,.4) both; }
#experience.is-unwrapping #intro .title-lockup::before { animation:hat-depart 650ms cubic-bezier(.4,0,.8,.4) both; }
#experience.is-unwrapping #intro .year-object { animation:year-depart 700ms cubic-bezier(.6,0,.8,.4) both; }
#experience.is-unwrapping #intro .intro-bottom > p { animation:banner-depart 600ms cubic-bezier(.6,0,.8,.4) both; }
#experience.is-unwrapping #intro .pull-control { animation:pull-release 700ms cubic-bezier(.2,.8,.2,1) both; }
#experience.is-unwrapping .voyage-canvas { animation:set-sail 700ms ease-in both; }
@keyframes title-arrive { from {opacity:0;transform:translate3d(-55px,15px,0) skewX(8deg);} to {opacity:1;transform:none;} }
/* The scene clips its own box (.scene{overflow:hidden}) and the resting hat sits ~93px (desktop) and
   ~69px (phone) below that top edge, so the entry arc has to stay inside it. At -95px the rotated
   crown crossed the clip line and the hat arrived visibly sliced; --hat-arc (-44px by default) keeps
   clearance at every size and drops to -2px on short phones, where the headroom is a few pixels. */
@keyframes hat-arrive { from {opacity:0;transform:translate3d(80px,var(--hat-arc),0) rotate(48deg) scale(.7);} 70% {opacity:1;transform:translate3d(-3px,4px,0) rotate(4deg);} to {opacity:1;transform:rotate(8deg);} }
@keyframes title-depart { 20% {opacity:1;transform:translateX(10px) scale(.98);} to {opacity:0;transform:translate3d(-120px,-24px,0) scale(1.12);} }
/* While the pull is held the crown sits only ~14px (phone) under the scene's clip line, because the
   same pseudo also carries the --hat-lift tension lift; unwrapping holds the pull at full tension. An
   upward exit therefore gets sliced flat the moment it climbs: the old -160px arc crossed the line
   at ~50% opacity and the hat arrived on screen with its top cut off. Flying right and slightly
   down passes out through the scene's right edge and never crosses the top clip. */
@keyframes hat-depart { 15% {opacity:1;transform:rotate(8deg);} to {opacity:0;transform:translate3d(260px,26px,0) rotate(40deg) scale(.6);} }
@keyframes year-depart { 20% {opacity:1;transform:scale(.95);} to {opacity:0;transform:translate3d(90px,35px,0) scale(1.3) rotate(-10deg);} }
@keyframes banner-depart { to {opacity:0;transform:translateX(-80px) rotate(-8deg);} }
@keyframes pull-release { 25% {opacity:1;transform:scaleX(1.06) scaleY(.92);} to {opacity:0;transform:translateX(65px) scaleX(.85);} }
@keyframes set-sail { to {transform:scale(1.045) translateX(-.7%);} }
@media(prefers-reduced-motion:reduce) {
  #experience #intro.entering #intro-title span,#experience #intro.entering .title-lockup::before { animation:none; }
  #intro .intro-title,#intro .title-lockup::before {translate:none;scale:none;rotate:none;}
}
@media (max-width:680px) and (min-height:541px) {
  #experience[data-chapter="intro"] .voyage-art { background-position:85% center; }
  .voyage-canvas { top:auto; bottom:0; height:62%; mask-image:linear-gradient(transparent,black 23%); }
}

/* The supplied title artwork gets one clean, cinematic entrance over the original voyage scene. */
#intro .intro-title { display:none; }
#intro .intro-poster {
  position:absolute; z-index:2; left:4%; top:45%; width:min(61vw,920px); height:min(55dvh,560px);
  isolation:isolate; transform:translateY(-50%) rotate(-1.5deg);
  translate:calc(var(--tension)*12px) calc(var(--tension)*-5px); scale:calc(1 + var(--tension)*.012);
  pointer-events:none; transform-origin:50% 58%;
}
#intro .poster-art {
  display:block; width:100%; height:100%; object-fit:contain; opacity:1;
  transform-origin:50% 56%;
}
#intro .intro-poster::before { content:""; position:absolute; inset:-12%; pointer-events:none; opacity:0; }
#intro .intro-poster::before {
  z-index:-1; background:radial-gradient(ellipse at 50% 55%,#fff2a866 0,#ffb63d4d 23%,transparent 68%);
  transform:scale(.76);
}
#intro.entering .poster-art { animation:poster-pop-in 900ms cubic-bezier(.2,.8,.25,1) both; }
#intro.entering .intro-poster::before { animation:poster-soft-glow 760ms ease-out 70ms both; }
#intro .intro-bottom,.intro-scene .scene-footer { z-index:4; }
@keyframes poster-pop-in {
  0% {opacity:0;transform:translate3d(0,24px,0) scale(.86) rotate(-2.5deg);}
  62% {opacity:1;transform:translate3d(0,-3px,0) scale(1.045) rotate(.65deg);}
  82% {transform:translate3d(0,1px,0) scale(.985) rotate(-.2deg);}
  100% {opacity:1;transform:translate3d(0,0,0) scale(1) rotate(0);}
}
@keyframes poster-soft-glow { 0% {opacity:0;transform:scale(.76);} 42% {opacity:.65;} 100% {opacity:0;transform:scale(1.16);} }
#experience.is-unwrapping #intro .intro-poster { animation:poster-exit 650ms cubic-bezier(.6,0,.8,.4) both; }
@keyframes poster-exit { to {opacity:0;transform:translate3d(0,14px,0) scale(.95) rotate(-2deg);} }
#experience[data-chapter="villains"] #ribbon-canvas { display:none; }

@media (max-width:680px) and (min-height:541px) {
  #intro .intro-poster { left:3%; top:39%; width:94%; height:min(40dvh,390px); transform:translateY(-50%) rotate(-1deg); }
}
@media (max-height:540px) {
  #intro .intro-poster { left:0; top:39%; width:54%; height:60%; }
}
@media (prefers-reduced-motion:reduce) {
  #intro.entering .poster-art,#intro.entering .intro-poster::before { animation:none; }
  #intro .poster-art { opacity:1; transform:none; }
}
#experience.motion-paused #intro .poster-art,#experience.motion-paused #intro .intro-poster::before { animation:none; opacity:1; transform:none; }
