/* Shared styles for the sky background, star buttons and page transitions. Use with /js/sky.js. */

html { background: #04060c; }
/* Ted Sky: the title font (TeX Gyre Adventor with an A that has no crossbar; see /fonts/README-TedSky.txt) */
@font-face { font-family: "Ted Sky"; src: url("/fonts/tedsky.woff?v=2") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
html.no-sky {
  background:
    radial-gradient(60% 50% at 70% 30%, rgba(60, 70, 150, 0.22), transparent 70%),
    radial-gradient(40% 35% at 25% 70%, rgba(120, 40, 90, 0.14), transparent 70%),
    #04060c;
}
#sky { position: fixed; inset: 0; width: 100%; height: 100%; height: 100lvh; display: block; z-index: -2; }   /* lvh: as tall as a phone screen with its browser bars hidden */
html.no-sky #sky { display: none; }

/* Page content sits above the sky (which is at z-index -2) and flies past during transitions. main has
   no z-index of its own, so the star pictures inside it can add their light onto the sky (see .star-sprite). */
main { position: relative; transition: opacity 0.9s ease, transform 1.1s cubic-bezier(0.2, 0.7, 0.2, 1); }
html.sky-arriving main { opacity: 0; transform: scale(1.08); transition: none; animation: sky-reveal 0s 2.5s forwards; }
html.sky-leaving main {
  opacity: 0; transform: scale(1.9); pointer-events: none;
  transition: opacity 0.45s ease-in, transform 0.95s cubic-bezier(0.55, 0, 1, 0.45);
}
@keyframes sky-reveal { to { opacity: 1; transform: none; } }   /* safety net if sky.js never runs */
/* Transitions scale the page up; never let that (or anything else) widen the page, since phones
   would widen the whole viewport to fit it. (Clipping <html> too keeps body's clip on the body.) */
html, body { overflow-x: clip; }

/* Star buttons: the sky draws the star on .star-button__target. Only the star is the link;
   the label underneath is plain text. */
.star-button-wrap { display: grid; justify-items: center; gap: 14px; }
.star-button { display: block; border-radius: 50%; -webkit-tap-highlight-color: transparent; }
.star-button__target { position: relative; display: block; width: 180px; height: 180px; border-radius: 50%; }
/* On touch screens, sky.js puts a picture of each star here so it scrolls exactly with the page (the
   sky can lag a phone's scrolling). It's 500/150 of the target across, centered, behind the page's boxes. */
.star-sprite {
  position: absolute; left: -116.667%; top: -116.667%; width: 333.333%; height: 333.333%;
  z-index: -1; pointer-events: none; visibility: hidden; mix-blend-mode: plus-lighter;   /* adds its light, like the sky does */
}
.star-sprite > span { position: absolute; inset: 0; background: #000 center / 100% 100% no-repeat; }
.star-sprite > span + span { opacity: 0; mix-blend-mode: plus-lighter; }
html.no-sky .star-sprite { display: none; }
.star-button:focus-visible { outline: none; }
.star-button:focus-visible .star-button__target { outline: 1px solid rgba(169, 192, 255, 0.55); outline-offset: 6px; }
html.no-sky .star-button__target {
  background: radial-gradient(circle, #fff 0 3px, rgba(255, 236, 205, 0.6) 6px, rgba(255, 236, 205, 0.12) 22px, transparent 48%);
}
.star-button__label {
  margin: 0; color: #a3adc2; cursor: default; user-select: none; -webkit-user-select: none;
  font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase;
}
.star-button-wrap:has(.star-button:hover, .star-button:focus-visible, .star-button.is-snapped) .star-button__label { color: #e9edf5; }

/* While the mouse is snapped onto a star button, the star itself is the cursor */
html.sky-snapped, html.sky-snapped * { cursor: none !important; }
.when-touch { display: none; }
@media (hover: none) { .when-touch { display: inline; } .when-hover { display: none; } }

@media (prefers-reduced-motion: reduce) {
  html.sky-arriving main, html.sky-leaving main { opacity: 1; transform: none; animation: none; transition: none; }
}
