/* Motion and the site-wide player. Loaded on every page after site.css or song.css.
   Everything here is additive: with JavaScript off, or with "reduce motion" on, the pages
   look exactly as they did before. */

/* ---------- page-to-page fade (browsers that support cross-document view transitions) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root){animation:ps-fade-out .16s ease both}
::view-transition-new(root){animation:ps-fade-in .22s ease both}
@keyframes ps-fade-out{to{opacity:0}}
@keyframes ps-fade-in{from{opacity:0}}

@media (prefers-reduced-motion:no-preference){

  /* ---------- scroll reveals (classes are added by site.js only) ---------- */
  .rv{opacity:0;transform:translateY(16px);transition:opacity .75s cubic-bezier(.2,.7,.2,1),transform .75s cubic-bezier(.2,.7,.2,1)}
  .rv.in{opacity:1;transform:none}
  .rv-1{transition-delay:.07s}.rv-2{transition-delay:.14s}.rv-3{transition-delay:.21s}.rv-4{transition-delay:.28s}.rv-5{transition-delay:.35s}.rv-6{transition-delay:.42s}

  /* the pull quotes: the red bar grows down as the quote arrives */
  .quote.rv{position:relative;border-left-color:transparent}
  .quote.rv::before{content:"";position:absolute;left:-5px;top:0;width:5px;height:0;background:var(--red);transition:height .9s cubic-bezier(.2,.7,.2,1) .15s}
  .quote.in::before{height:100%}

  /* the drawing develops like a print */
  .drawing.rv img{filter:blur(6px) contrast(.6) brightness(1.15);transition:filter 1.6s ease .2s}
  .drawing.in img{filter:none}

  /* ---------- hero: slow drift, film grain, a glow that follows the beat ---------- */
  .hero{animation:ps-drift 36s ease-in-out infinite alternate}
  @keyframes ps-drift{from{background-position:100% 0}to{background-position:92% 8%}}
  @media (min-width:900px){
    @keyframes ps-drift{from{background-position:82% 60%}to{background-position:76% 52%}}
  }
  .hero .pulse{position:absolute;inset:0;pointer-events:none;background:radial-gradient(60% 70% at 72% 45%,rgba(255,255,255,.55),rgba(255,255,255,0) 70%);opacity:calc(var(--beat,0) * .14);transition:opacity .08s linear;mix-blend-mode:screen}
  .hero .inner > *{opacity:0;transform:translateY(14px);animation:ps-rise .8s cubic-bezier(.2,.7,.2,1) forwards}
  .hero .inner > :nth-child(1){animation-delay:.05s}
  .hero .inner > :nth-child(2){animation-delay:.18s}
  .hero .inner > :nth-child(3){animation-delay:.3s}
  .hero .inner > :nth-child(4){animation-delay:.42s}
  .hero .inner > :nth-child(5){animation-delay:.54s}
  .hero .inner > :nth-child(6){animation-delay:.66s}
  @keyframes ps-rise{to{opacity:1;transform:none}}

  .grain{position:absolute;inset:0;pointer-events:none;opacity:.07;mix-blend-mode:overlay;
    background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    animation:ps-grain .9s steps(6) infinite}
  @keyframes ps-grain{0%{transform:translate(0,0)}20%{transform:translate(-14px,9px)}40%{transform:translate(9px,-12px)}60%{transform:translate(-7px,-5px)}80%{transform:translate(12px,10px)}100%{transform:translate(0,0)}}
  .band.navy,.quote-band{position:relative;overflow:hidden}
  .band.navy > .grain{opacity:.05}

  /* ---------- small things that answer the hand ---------- */
  .btn{transition:transform .18s ease,background-color .18s ease,border-color .18s ease,box-shadow .18s ease}
  .btn:hover{transform:translateY(-1px);box-shadow:0 10px 22px -14px rgba(26,32,39,.6)}
  .btn:active{transform:translateY(0)}
  .cards a,.lines li,.code,.platforms a{transition:transform .22s ease,border-color .22s ease,box-shadow .22s ease}
  .cards a:hover,.platforms a:hover{transform:translateY(-2px);box-shadow:0 14px 26px -18px rgba(26,32,39,.55)}
  .cover{transition:transform .5s cubic-bezier(.2,.7,.2,1),box-shadow .5s ease}
  .cover:hover{transform:translateY(-3px) scale(1.01);box-shadow:0 26px 48px -20px rgba(26,32,39,.55)}
  .nav a{position:relative}
  .nav a::after{content:"";position:absolute;left:0;right:100%;bottom:-4px;height:2px;background:var(--red);transition:right .22s ease}
  .nav a:hover::after,.nav a.on::after{right:0}
  .steps .n,.brief .n{display:inline-block;transition:transform .4s cubic-bezier(.2,.7,.2,1)}
  .steps li.in .n,.brief li.in .n{animation:ps-pop .55s cubic-bezier(.2,.7,.2,1)}
  @keyframes ps-pop{0%{transform:scale(.6)}60%{transform:scale(1.12)}100%{transform:scale(1)}}
}

/* ---------- the player bar ---------- */
.radio{position:fixed;left:50%;bottom:14px;transform:translate(-50%,0);z-index:60;width:min(680px,calc(100% - 20px));
  display:grid;grid-template-columns:46px minmax(0,1fr) auto auto auto auto;gap:12px;align-items:center;
  background:rgba(15,30,45,.94);color:#fff;border:1px solid rgba(255,255,255,.14);border-radius:14px;padding:10px 12px 10px 10px;
  box-shadow:0 18px 44px -18px rgba(0,0,0,.7);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);font-family:var(--sans)}
.radio[hidden]{display:none}
.radio-art{width:46px;height:46px;border-radius:8px;object-fit:cover;display:block}
.radio-meta{min-width:0;display:flex;flex-direction:column;gap:2px}
.radio-k{font-size:11.5px;letter-spacing:.1em;text-transform:uppercase;color:#AEBBC8;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.radio-t{font-size:16px;font-weight:600;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.radio-t a{color:#fff;text-decoration:none}
.radio-t a:hover{text-decoration:underline}
.radio.ready .radio-k{color:#E0394A}
.eq{display:flex;align-items:flex-end;gap:3px;height:22px;width:34px}
.eq i{display:block;flex:1;background:#E0394A;border-radius:2px 2px 0 0;height:15%;transform-origin:bottom;transition:height .09s linear}
.radio.playing.css-eq .eq i{animation:ps-eq .9s ease-in-out infinite alternate}
.radio.playing.css-eq .eq i:nth-child(2){animation-duration:.7s;animation-delay:.1s}
.radio.playing.css-eq .eq i:nth-child(3){animation-duration:1.1s;animation-delay:.2s}
.radio.playing.css-eq .eq i:nth-child(4){animation-duration:.8s;animation-delay:.05s}
.radio.playing.css-eq .eq i:nth-child(5){animation-duration:1s;animation-delay:.15s}
@keyframes ps-eq{from{height:15%}to{height:100%}}
.radio-btn{appearance:none;border:1.5px solid rgba(255,255,255,.22);background:transparent;color:#fff;width:40px;height:40px;border-radius:50%;display:grid;place-items:center;cursor:pointer;padding:0}
.radio-btn:hover{border-color:#fff;background:rgba(255,255,255,.08)}
.radio-btn svg{width:18px;height:18px;fill:currentColor}
.radio-btn.play{background:var(--red);border-color:var(--red)}
.radio-btn.play:hover{background:var(--red-hover)}
.radio.ready .radio-btn.play{animation:ps-ring 1.6s ease-out infinite}
@keyframes ps-ring{0%{box-shadow:0 0 0 0 rgba(224,57,74,.7)}100%{box-shadow:0 0 0 14px rgba(224,57,74,0)}}
.radio-btn.muted{color:#AEBBC8}
.radio-x{appearance:none;border:0;background:transparent;color:#AEBBC8;width:30px;height:30px;border-radius:50%;cursor:pointer;font-size:20px;line-height:1;padding:0}
.radio-x:hover{color:#fff;background:rgba(255,255,255,.08)}
.radio-bar{grid-column:1 / -1;height:3px;background:rgba(255,255,255,.14);border-radius:2px;overflow:hidden;cursor:pointer;margin-top:2px}
.radio-fill{height:100%;width:0;background:#E0394A;border-radius:2px}
.radio-hint{grid-column:1 / -1;font-size:13px;color:#AEBBC8;margin:0;line-height:1.3}
.radio-hint:empty{display:none}
body.has-radio{padding-bottom:96px}
.radio-pill{display:none}
.radio.collapsed{display:block;width:48px;height:48px;padding:0;border-radius:50%;left:auto;right:14px;transform:none;overflow:hidden;background:var(--navy);box-sizing:border-box}
.radio.collapsed > *{display:none}
.radio.collapsed .radio-pill{display:block;position:absolute;inset:0;border:0;background:transparent;padding:0;cursor:pointer}
.radio-pill img{width:100%;height:100%;object-fit:cover;display:block;opacity:.85}
.radio-pill .pill-glyph{position:absolute;inset:0;display:grid;place-items:center;color:#fff}
.radio-pill .pill-glyph svg{width:20px;height:20px;fill:#fff;filter:drop-shadow(0 1px 3px rgba(0,0,0,.7))}
@media (hover:hover){.radio.collapsed:hover{box-shadow:0 0 0 3px rgba(224,57,74,.5)}}
/* the player and the progress line stay put while the rest of the page crossfades */
.radio{view-transition-name:ps-radio}
.progress{view-transition-name:ps-progress}

/* phones: a thin strip pinned to the top, so it never sits on what you're reading */
@media (max-width:700px){
  .radio{top:0;bottom:auto;left:0;right:0;width:100%;height:44px;box-sizing:border-box;transform:none;border-radius:0;border-width:0 0 1px 0;padding:0 8px 0 10px;
    grid-template-columns:26px minmax(0,1fr) auto auto auto;gap:8px;background:rgba(15,30,45,.97);box-shadow:0 6px 18px -10px rgba(0,0,0,.6)}
  .radio-art{width:26px;height:26px;border-radius:5px}
  .radio-k{font-size:9.5px;letter-spacing:.08em}
  .radio-t{font-size:12.5px}
  .eq{display:none}
  .radio-btn{width:30px;height:30px;border-width:1px}
  .radio-btn svg{width:14px;height:14px}
  .radio-x{width:26px;height:26px;font-size:18px}
  .radio-bar{position:absolute;left:0;right:0;bottom:-1px;height:2px;margin:0;border-radius:0}
  .radio-hint{display:none}
  .radio.ready .radio-btn.play{animation:none;box-shadow:0 0 0 3px rgba(224,57,74,.45)}
  body.has-radio{padding-bottom:0;padding-top:44px}
  .radio.collapsed{top:6px;right:8px;left:auto;width:40px;height:40px;padding:0;border-radius:50%;border-width:1px}
  body.has-radio .skip:focus{top:52px}
  body.has-radio .progress{display:none}
}
@media print{.radio{display:none!important}}

/* ---------- the Glass cover: the cracks draw themselves once, then settle into the art ---------- */
.cover-wrap{position:relative;max-width:360px;margin:0 auto}
@media (min-width:900px){ main.song .cover-wrap{max-width:none;margin:0} }
.cover-wrap .cover{max-width:none;margin:0}
.crack{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;border-radius:var(--radius);display:none}
@media (prefers-reduced-motion:no-preference){
  .crack{display:block;animation:ps-crack-fade 1.4s ease 2.6s forwards}
  .crack polyline,.crack path{fill:none;stroke:#fff;stroke-width:.45;stroke-linecap:round;stroke-linejoin:round;opacity:.9;
    stroke-dasharray:1;stroke-dashoffset:1;animation:ps-crack-draw .9s cubic-bezier(.3,.8,.3,1) forwards;filter:drop-shadow(0 0 1px rgba(255,255,255,.8))}
  .crack .flash{fill:#fff;opacity:0;transform-origin:69px 64px;animation:ps-flash .7s ease-out .25s}
  @keyframes ps-crack-draw{to{stroke-dashoffset:0}}
  @keyframes ps-crack-fade{to{opacity:0}}
  @keyframes ps-flash{0%{opacity:0;transform:scale(.2)}20%{opacity:.95;transform:scale(1)}100%{opacity:0;transform:scale(6)}}
}

/* ---------- more motion ---------- */
@media (prefers-reduced-motion:no-preference){
  /* the page arrives with a small lift as well as a fade */
  ::view-transition-new(root){animation:ps-fade-in .22s ease both,ps-lift .34s cubic-bezier(.2,.7,.2,1) both}
  @keyframes ps-lift{from{transform:translateY(10px)}to{transform:none}}

  /* a light passes over the hero now and then */
  .hero .sweep{position:absolute;top:-20%;bottom:-20%;left:-60%;width:60%;pointer-events:none;mix-blend-mode:screen;
    background:linear-gradient(100deg,transparent 35%,rgba(255,255,255,.09) 50%,transparent 65%);animation:ps-sweep 13s ease-in-out infinite}
  @keyframes ps-sweep{0%,55%{transform:translateX(0)}100%{transform:translateX(300%)}}
  .hero .dust{position:absolute;inset:0;pointer-events:none;mix-blend-mode:screen}

  /* section headings underline themselves as they arrive */
  .band .wrap > h2.rv::after,.band .wide > h2.rv::after,.story > h2.rv::after,.page-head h1.rv::after{content:"";display:block;width:0;height:4px;background:var(--red);margin-top:10px;border-radius:2px;transition:width .8s cubic-bezier(.2,.7,.2,1) .25s}
  .band .wrap > h2.rv.in::after,.band .wide > h2.rv.in::after,.story > h2.rv.in::after,.page-head h1.rv.in::after{width:58px}
  .band.navy h2.rv::after,.quote-band h2.rv::after{background:#E0394A}

  /* the lyric side of each row on the Glass page lands a beat after the page side */
  .map > div.rv dd{opacity:0;transform:translateX(12px);transition:opacity .6s ease .35s,transform .6s cubic-bezier(.2,.7,.2,1) .35s}
  .map > div.rv.in dd{opacity:1;transform:none}

  /* the thin flag stripe catches the light */
  .ribbon{position:relative;overflow:hidden}
  .ribbon::after{content:"";position:absolute;top:0;bottom:0;left:-30%;width:30%;background:linear-gradient(90deg,transparent,rgba(255,255,255,.55),transparent);animation:ps-sheen 9s linear infinite}
  @keyframes ps-sheen{0%{left:-30%}60%{left:130%}100%{left:130%}}

  /* the star blinks awake, then keeps time with the music */
  .brand .star{transform-origin:center;animation:ps-twinkle 2.2s ease-in-out .4s 1;transition:transform .08s linear}
  @keyframes ps-twinkle{0%{transform:scale(1) rotate(0)}30%{transform:scale(1.35) rotate(-8deg)}55%{transform:scale(.95) rotate(4deg)}100%{transform:scale(1) rotate(0)}}
  body.beat .brand .star{transform:scale(calc(1 + var(--beat,0) * .45))}
  body.beat .radio-art{transform:scale(calc(1 + var(--beat,0) * .08))}
  body.beat .radio{border-color:rgba(224,57,74,calc(.14 + var(--beat,0) * .6))}
  body.beat main.song .cover,body.beat .feature .cover,body.beat .release .cover{box-shadow:0 18px 40px -18px rgba(26,32,39,.45),0 0 calc(var(--beat,0) * 46px) rgba(224,57,74,calc(var(--beat,0) * .32))}

  /* cards and covers tilt toward the hand (desktop) */
  .tilt{transform-style:preserve-3d;will-change:transform}
  .cards a.tilt,.cover.tilt,.cover-wrap.tilt{transition:transform .22s ease,border-color .22s ease,box-shadow .12s linear}
}

/* ---------- more motion, part two ---------- */
.progress{position:fixed;top:0;left:0;width:100%;height:3px;background:var(--red);transform-origin:0 50%;transform:scaleX(0);z-index:59;pointer-events:none}
@media print{.progress{display:none!important}}
@media (prefers-reduced-motion:no-preference){
  /* the title arrives with its phantom, which fades back into it */
  .hero .inner > h1{animation:ps-rise .8s cubic-bezier(.2,.7,.2,1) .05s forwards,ps-phantom 2.8s ease-out .7s 1}
  @keyframes ps-phantom{0%{text-shadow:none}25%{text-shadow:10px 0 0 rgba(255,255,255,.16),-10px 0 0 rgba(224,57,74,.22)}100%{text-shadow:none}}
  /* the wordmark settles into place */
  .brand{animation:ps-settle 1.1s cubic-bezier(.2,.7,.2,1) both}
  @keyframes ps-settle{from{letter-spacing:.34em;opacity:0}to{letter-spacing:.14em;opacity:1}}
  /* the main button breathes */
  .hero .cta .btn{animation:ps-breathe 3.4s ease-in-out 1.2s infinite}
  @keyframes ps-breathe{0%,100%{box-shadow:0 0 0 0 rgba(224,57,74,0)}50%{box-shadow:0 0 0 7px rgba(224,57,74,.22),0 10px 30px -8px rgba(224,57,74,.55)}}
  /* navy bands glow red on the beat, like the hero */
  .band.navy > .pulse{position:absolute;inset:0;pointer-events:none;background:radial-gradient(55% 65% at 28% 45%,rgba(224,57,74,.5),rgba(224,57,74,0) 70%);opacity:calc(var(--beat,0) * .12);transition:opacity .08s linear;mix-blend-mode:screen}
  /* thumbnails drift closer under the hand */
  .cards .thumb img{transition:transform 1.4s cubic-bezier(.2,.7,.2,1)}
  .cards a:hover .thumb img{transform:scale(1.1)}
  /* a glare that follows the pointer across a tilted card or cover */
  .cards a.tilt{position:relative}
  .cards a.tilt::after,.cover-wrap.tilt::after{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;opacity:0;transition:opacity .3s ease;
    background:radial-gradient(circle at var(--mx,50%) var(--my,50%),rgba(255,255,255,.16),rgba(255,255,255,0) 58%)}
  .cards a.tilt:hover::after,.cover-wrap.tilt:hover::after{opacity:1}
  .cover-wrap.tilt::after{border-radius:var(--radius)}
  .hub .intro > h1.rv::after{content:"";display:block;width:0;height:4px;background:var(--red);margin-top:10px;border-radius:2px;transition:width .8s cubic-bezier(.2,.7,.2,1) .25s}
  .hub .intro > h1.rv.in::after{width:58px}
  /* VSO results step in one after another */
  #vsoNear li,#vsoList li{animation:ps-up .55s cubic-bezier(.2,.7,.2,1) both}
  #vsoNear li:nth-child(2),#vsoList li:nth-child(2){animation-delay:.08s}
  #vsoNear li:nth-child(3),#vsoList li:nth-child(3){animation-delay:.16s}
  #vsoNear li:nth-child(4),#vsoList li:nth-child(4){animation-delay:.24s}
  #vsoNear li:nth-child(n+5),#vsoList li:nth-child(n+5){animation-delay:.3s}
  @keyframes ps-up{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
}
