/* The star that turns into a cloud: the opening of a made-up studio on a bright sky. One box in the middle holds the
   drawing (the star, the cloud it becomes and the sun in front); the line of text runs on a rounded frame drawn by the
   script around the whole page, so it follows any screen. */
:root {
  --cielo: #2d5bff;        /* the sky */
  --stella: #ffd23f;       /* the falling star */
  --nuvola: #ffffff;       /* the cloud it becomes */
  --sole: #ffc23d;         /* the sun with the studio's name */
  --inchiostro: #0d1b4c;   /* the name on the sun */
  --anello: #ffffff;       /* the text running around */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--cielo);
  color: var(--anello);
  font-family: 'Fredoka Variable', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.palco {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the text around the page */
.anello {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  opacity: 0;
}

.anello__testo {
  fill: var(--anello);
  font-size: clamp(13px, 1.45vw + 4px, 26px);
  font-weight: 560;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- the drawing */
.scena {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(78vw, 92vh * 1000 / 760);
  aspect-ratio: 1000 / 760;
  translate: -50% -50%;
}

.caduta,
.scintille {
  position: absolute;
  inset: 0;
}

.disegno,
.scintille {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.nascosta {
  display: none;
}

.forma {
  fill: var(--stella);
}

.sole {
  fill: var(--sole);
}

.sole__parola {
  fill: var(--inchiostro);
  font-family: 'Bagel Fat One', 'Arial Black', sans-serif;
  font-size: 50px;
  letter-spacing: 0.01em;
}

.scintille {
  opacity: 0;
  pointer-events: none;
}

.scintille path {
  fill: var(--stella);
}

/* ---------------------------------------------------------------- the button to see it again */
.ancora {
  position: absolute;
  left: 50%;
  bottom: max(64px, 12vh);
  translate: -50% 0;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--inchiostro);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ancora[hidden] {
  display: none;
}

.ancora > * {
  grid-area: 1 / 1;
}

/* the pill grows with a bounce under the pointer, and the word widens with it */
.ancora__fondo {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: var(--sole);
  transition: transform 0.55s cubic-bezier(0.34, 1.8, 0.5, 1);
}

.ancora__testo {
  position: relative;
  padding: 13px 24px;
  font-stretch: 100%;
  font-variation-settings: 'wdth' 100;
  letter-spacing: 0;
  transition: letter-spacing 0.45s cubic-bezier(0.34, 1.6, 0.5, 1);
}

.ancora:focus-visible {
  outline: 2px solid var(--nuvola);
  outline-offset: 4px;
  border-radius: 999px;
}

@media (hover: hover) {
  .ancora:hover .ancora__fondo {
    transform: scale(1.08, 1.14);
  }

  .ancora:hover .ancora__testo {
    letter-spacing: 0.06em;
  }
}

.ancora:active .ancora__fondo {
  transform: scale(0.94);
  transition-duration: 0.15s;
}

/* less motion: the cloud and the sun are already in place and only fade in; the text stands still */
@media (max-width: 600px) {
  .scena {
    width: min(94vw, 92vh * 1000 / 760);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ancora__fondo,
  .ancora__testo {
    transition: none;
  }
}
