/* paper to sky */
.paper {
  position:relative;
  z-index:1;
  -webkit-mask-image:linear-gradient(to bottom,#000 calc(100% - 90svh),transparent 100%);
  mask-image:linear-gradient(to bottom,#000 calc(100% - 90svh),transparent 100%);
}
.darkness {
  position:relative;
  z-index:0;
  height:190svh;
  margin-top:-90svh;
  overflow:visible;
  pointer-events:auto;
  background:#080d16;
}
/* stars */
.night-sky {
  position:sticky;
  top:0;
  height:100svh;
  min-height:620px;
  overflow:hidden;
  isolation:isolate;
  background:#080d16;
  color:#e1e7ee;
}
.night-sky__stars,
.night-sky__constellations,
.night-sky__threads {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  pointer-events:none;
}
.night-sky__stars { z-index:0; }
.night-sky__threads { z-index:1; overflow:visible; }
.night-sky__constellations { z-index:2; }
.sky-particle {
  position:absolute;
  left:var(--x);
  top:var(--y);
  width:var(--size);
  height:var(--size);
  border-radius:50%;
  background:#e8eff8;
  opacity:var(--brightness);
  box-shadow:0 0 3px rgba(193,216,244,.22);
}
.sky-particle.is-breathing { animation:sky-breathe var(--breath) ease-in-out var(--delay) infinite alternate; }
@keyframes sky-breathe { from { opacity:calc(var(--brightness) * .6); } to { opacity:var(--brightness); } }
/* constellation shapes */
.sky-shape {
  position:absolute;
  width:clamp(100px,25vw,158px);
  aspect-ratio:1;
  opacity:.4;
  transition:opacity .8s ease;
}
.sky-shape:nth-child(1) { left:13%; top:8%; }
.sky-shape:nth-child(2) { right:15%; top:11%; }
.sky-shape:nth-child(3) { left:14%; top:56%; }
.sky-shape:nth-child(4) { right:16%; top:54%; }
.sky-shape:nth-child(5) { left:50%; top:76%; transform:translateX(-50%); }
.sky-shape.is-active { opacity:.92; }
.sky-shape.is-solved { opacity:1; }
.sky-shape svg { display:block; width:100%; height:100%; overflow:visible; }
.sky-shape circle { fill:#edf4fc; filter:drop-shadow(0 0 3px rgba(198,221,250,.55)); transition:opacity .7s ease,filter .7s ease; }
.sky-shape .sky-star--early { opacity:.62; }
.sky-shape .sky-star--late { opacity:0; }
.sky-shape.is-active .sky-star--early { opacity:.92; }
.sky-shape.is-solved .sky-star--early,
.sky-shape.is-solved .sky-star--late { opacity:.94; }
/* draw the lines */
.sky-shape path {
  fill:none;
  stroke:#cbdcf0;
  stroke-width:.85;
  stroke-linecap:round;
  stroke-linejoin:round;
  vector-effect:non-scaling-stroke;
  opacity:0;
  stroke-dasharray:1;
  stroke-dashoffset:1;
  transition:stroke-dashoffset 1.35s cubic-bezier(.28,.68,.3,1),opacity .7s ease;
}
.sky-shape.is-solved path { opacity:.52; stroke-dashoffset:0; }
.sky-shape.is-solved circle.is-central { filter:drop-shadow(0 0 5px rgba(214,231,255,.85)); }
/* final connections */
.night-sky__threads path {
  fill:none;
  stroke:#bfcedf;
  stroke-width:.65;
  vector-effect:non-scaling-stroke;
  stroke-linecap:round;
  opacity:0;
  stroke-dasharray:1;
  stroke-dashoffset:1;
  transition:stroke-dashoffset 2.3s cubic-bezier(.3,.7,.3,1),opacity 1.6s ease;
}
.night-sky.is-connected .night-sky__threads path { stroke-dashoffset:0; opacity:.23; }
/* quiz stuff */
.night-sky__question {
  position:absolute;
  z-index:4;
  top:30%;
  left:50%;
  width:min(86vw,370px);
  text-align:center;
  transform:translateX(-50%);
  opacity:0;
  transition:opacity .65s ease;
}
.night-sky.is-arrived .night-sky__question { opacity:1; }
.night-sky__question.is-switching,
.night-sky.is-finished .night-sky__question { opacity:0; pointer-events:none; }
.night-sky__prompt { margin:0 0 18px; font:normal 400 clamp(20px,4.6vw,26px)/1.4 var(--font-literary); letter-spacing:-.012em; }
.night-sky__answers { display:grid; grid-template-columns:repeat(2,minmax(112px,max-content)); justify-content:center; gap:4px 16px; }
/* answer words */
.night-sky__answers button {
  min-height:44px;
  padding:8px 4px;
  border:0;
  background:none;
  color:#c8d0da;
  font:normal 400 clamp(16px,3.9vw,18px)/1.4 var(--font-literary);
  cursor:pointer;
  text-decoration:underline;
  text-decoration-color:transparent;
  text-underline-offset:6px;
  transition:color .25s ease,text-decoration-color .25s ease;
}
.night-sky__answers button:hover,
.night-sky__answers button:focus-visible { color:#f3f7fc; text-decoration-color:rgba(222,231,244,.65); }
.night-sky__answers button:focus-visible { outline:1px solid rgba(222,231,244,.72); outline-offset:2px; }
.night-sky__reaction,
.night-sky__completion { min-height:22px; margin:14px 0 0; font-size:15px; line-height:1.5; }
.night-sky__reaction { color:#aebdce; opacity:0; transition:opacity .28s ease; }
.night-sky__reaction.is-visible { opacity:1; }
.night-sky__completion { color:#d5e1ef; opacity:0; transition:opacity .65s ease; }
.night-sky__completion.is-visible { opacity:1; }
.night-sky__memory {
  position:absolute;
  z-index:5;
  top:27%;
  left:50%;
  width:min(42vw,178px);
  max-height:32svh;
  margin:0;
  transform:translateX(-50%);
  opacity:0;
  transition:opacity 1.1s ease;
}
.night-sky__memory.is-visible { opacity:1; }
.night-sky__memory img { width:100%; max-height:32svh; object-fit:contain; }
/* ending text */
.night-sky__final {
  position:absolute;
  z-index:4;
  top:34%;
  left:50%;
  width:min(86vw,440px);
  text-align:center;
  transform:translateX(-50%);
  pointer-events:none;
}
.night-sky__final p { margin:0; opacity:0; transition:opacity 1.35s ease; }
.night-sky__final p:first-child { font-size:clamp(19px,4.7vw,25px); line-height:1.5; }
.night-sky__final p:nth-child(2) { margin-top:33px; font-size:clamp(15px,3.8vw,18px); }
.night-sky__final p:nth-child(3) { margin-top:24px; font-size:clamp(15px,3.8vw,18px); }
.night-sky__final p:last-child { margin-top:27px; font-size:clamp(13px,3.2vw,16px); color:rgba(213,225,239,.78); }
.night-sky__final.is-first p:first-child,
.night-sky__final.is-last p:nth-child(2),
.night-sky__final.is-signoff p:nth-child(3),
.night-sky__final.is-afterword p:last-child { opacity:1; }
/* music in the dark */
.music.is-in-sky {
  --color-ink:#e3e8ee;
  --color-ink-soft:#aebdcc;
  --color-date:#d5dfeb;
  --color-groove:#9baabc;
  transition:opacity .6s ease,color .55s ease;
}
.music.is-in-sky .vinyl { box-shadow:0 0 5px rgba(198,216,238,.15); }
.music.is-in-sky .music__icon { transition:fill .55s ease,stroke .55s ease; }
.music.is-in-sky .playlist {
  --color-ink:#302a24;
  --color-ink-soft:#695946;
  color:#302a24;
}
/* phone stars */
@media (max-width:600px) {
  .sky-shape { width:clamp(91px,27vw,116px); }
  .sky-shape:nth-child(1) { left:4%; top:7%; }
  .sky-shape:nth-child(2) { right:4%; top:10%; }
  .sky-shape:nth-child(3) { left:2%; top:59%; }
  .sky-shape:nth-child(4) { right:2%; top:58%; }
  .sky-shape:nth-child(5) { left:50%; top:79%; }
  .night-sky__question { top:29%; }
  .night-sky__prompt { margin-bottom:12px; }
  .night-sky__answers { gap:0 12px; }
  .night-sky__reaction,.night-sky__completion { margin-top:8px; }
}
@media (max-height:700px) and (max-width:600px) {
  .night-sky__question { top:28%; }
  .sky-shape:nth-child(3),.sky-shape:nth-child(4) { top:62%; }
  .sky-shape:nth-child(5) { top:81%; }
}
/* less motion */
@media (prefers-reduced-motion:reduce) {
  .sky-particle.is-breathing { animation:none; }
  .sky-shape,.sky-shape circle,.sky-shape path,.night-sky__threads path,
  .night-sky__question,.night-sky__reaction,.night-sky__completion,
  .night-sky__memory,.night-sky__final p { transition:none; }
}
