/* De Nachtkracht: one page in the colours of the logo. Night falls, the stars come out and
   twinkle, the moon of the logo rises and the rest of the logo follows. */

:root {
  --night: #001e46;
  --orange: #eb6608;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Avenir Next", "Nunito", "Segoe UI", system-ui, sans-serif;
  color: #fff;
  background: var(--night);
}

/* Night falls when the page opens: the sky darkens while the moon of the logo rises. */
body { animation: nightfall 3.5s ease-out backwards; }

@keyframes nightfall {
  from { background-color: #24487e; }
}

/* The stars: three layers of small dots (white, a few in the orange of the logo) that come
   out after dusk and then each twinkle at their own pace. Every dot is one shadow of a
   layer; places are in parts of the screen. */
.sky,
.sky::before,
.sky::after {
  content: "";
  position: fixed;
  left: 0;
  top: 0;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  pointer-events: none;
  animation: stars-out 2.5s 1.2s ease-out backwards, twinkle 2.6s ease-in-out infinite alternate;
}

.sky {
  box-shadow:
    45.4vw 55.6vh 0 1px var(--orange),
    50.8vw 58.2vh 0 0px var(--orange),
    62.5vw 77.5vh 0 0px var(--orange),
    31.1vw 11.5vh 0 0px var(--orange),
    94.6vw 64.5vh 0 0px #fff,
    81.8vw 8.9vh 0 0px #fff,
    86.4vw 59.4vh 0 1px #fff,
    44.3vw 82.2vh 0 0px #fff,
    50.0vw 65.3vh 0 1px #fff,
    41.1vw 54.8vh 0 0px #fff,
    32.3vw 24.6vh 0 0.5px #fff,
    8.7vw 75.0vh 0 1px #fff,
    83.3vw 39.3vh 0 0px #fff,
    22.5vw 90.1vh 0 0px var(--orange),
    38.0vw 69.6vh 0 1px #fff,
    56.4vw 21.7vh 0 0.5px #fff;
}

.sky::before {
  animation-duration: 2.5s, 3.7s;
  animation-delay: 1.6s, -1.3s;
  box-shadow:
    10.4vw 34.3vh 0 1px #fff,
    14.9vw 69.5vh 0 0px #fff,
    46.6vw 48.8vh 0 0px var(--orange),
    50.9vw 95.6vh 0 0px var(--orange),
    63.8vw 14.0vh 0 1px #fff,
    2.0vw 84.2vh 0 0.5px #fff,
    22.2vw 40.1vh 0 0px #fff,
    97.0vw 23.0vh 0 0.5px #fff,
    76.2vw 33.9vh 0 0.5px var(--orange),
    9.0vw 11.5vh 0 0px #fff,
    59.7vw 37.9vh 0 1px #fff,
    94.1vw 48.5vh 0 0px var(--orange),
    19.6vw 17.5vh 0 0px #fff,
    71.6vw 17.9vh 0 0px var(--orange),
    86.7vw 59.7vh 0 1px #fff,
    12.0vw 6.6vh 0 0.5px #fff;
}

.sky::after {
  animation-duration: 2.5s, 1.9s;
  animation-delay: 2s, -0.7s;
  box-shadow:
    73.0vw 39.8vh 0 1px #cfe0ff,
    30.2vw 19.5vh 0 0px #fff,
    23.9vw 55.6vh 0 0px #cfe0ff,
    22.4vw 89.0vh 0 0px #fff,
    27.8vw 44.9vh 0 0px #fff,
    18.9vw 37.7vh 0 0px #fff,
    36.8vw 86.7vh 0 0.5px #fff,
    58.6vw 89.8vh 0 1px #cfe0ff,
    69.3vw 93.5vh 0 0px #fff,
    48.3vw 71.7vh 0 0.5px #fff,
    97.9vw 10.1vh 0 0.5px #fff,
    88.4vw 72.3vh 0 0px #cfe0ff,
    35.8vw 67.4vh 0 0px #cfe0ff,
    92.6vw 5.8vh 0 1px #fff;
}

@keyframes stars-out {
  from { opacity: 0; }
}

@keyframes twinkle {
  from { opacity: 0.2; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .sky,
  .sky::before,
  .sky::after { animation: none; }
}

.stage {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3.5svh, 36px);
  text-align: center;
}

h1 { margin: 0; line-height: 0; }

.logo {
  width: min(78vw, 58svh * 0.793);  /* the logo is 130 wide on 164 high */
  height: auto;
  overflow: visible;
}

.logo .white  { fill: #fff; }
.logo .orange { fill: var(--orange); }

/* Every part moves around its own middle. */
.logo path,
.logo g {
  transform-box: fill-box;
  transform-origin: center;
}

/* ---------- The logo coming in ----------
   First the moon rises. Then letters and camera pop in one by one (--delay per part, set in
   index.html), "mediamakers" and the stripe under it are written in from the left, and the
   spatters land somewhere in between. --start = when the letters begin, --letters = how long
   they take. */

.logo { --start: 1.3s; }

.logo .pop { animation: pop 0.5s calc(var(--start) + var(--delay)) cubic-bezier(0.3, 1.5, 0.5, 1) backwards; }

@keyframes pop {
  from { opacity: 0; transform: scale(0.3) rotate(-12deg); }
}

.logo .wipe   { animation: wipe 0.7s calc(var(--start) + var(--letters) + 0.1s) ease-out backwards; }
.logo .swoosh { animation-delay: calc(var(--start) + var(--letters) + 0.6s); animation-duration: 0.5s; }

@keyframes wipe {
  from { clip-path: inset(-10% 100% -10% -5%); }
  to   { clip-path: inset(-10% -5% -10% -5%); }
}

/* ---------- The logo staying alive ---------- */

.logo .spatter {
  animation:
    pop 0.4s calc(var(--start) + var(--delay)) backwards,
    twinkle-spatter 3.2s var(--twinkle) ease-in-out infinite alternate;
}

@keyframes twinkle-spatter {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0.25; transform: scale(0.6); }
}

/* The moon comes up from below in a slight arc, then keeps rocking gently. */
.logo .moon {
  animation:
    moonrise 2.4s cubic-bezier(0.2, 0.7, 0.2, 1) backwards,
    rock 6s 2.4s ease-in-out infinite alternate;
}

@keyframes moonrise {
  from { opacity: 0; transform: translate(-60%, 330%) rotate(-50deg); }
  35%  { opacity: 1; }
  to   { transform: rotate(-5deg); }
}

@keyframes rock {
  from { transform: rotate(-5deg); }
  to   { transform: rotate(6deg); }
}

.logo .sparkle {
  animation:
    pop 0.5s calc(var(--start) + var(--delay)) cubic-bezier(0.3, 1.5, 0.5, 1) backwards,
    sparkle 2.4s 2.4s ease-in-out infinite alternate;
}

@keyframes sparkle {
  from { transform: scale(0.7) rotate(0deg); }
  to   { transform: scale(1.25) rotate(45deg); }
}

/* The lamp of the camera: it glows, with now and then a short flicker. */
.logo .lamp {
  animation:
    pop 0.5s calc(var(--start) + var(--delay)) cubic-bezier(0.3, 1.5, 0.5, 1) backwards,
    glow 7s 3.5s linear infinite;
}

@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 1px rgba(235, 102, 8, 0.5)); }
  45%      { filter: drop-shadow(0 0 6px rgba(255, 150, 60, 0.95)) brightness(1.15); }
  50%      { filter: drop-shadow(0 0 1px rgba(235, 102, 8, 0.4)) brightness(0.8); }
  53%      { filter: drop-shadow(0 0 7px rgba(255, 150, 60, 1)) brightness(1.2); }
  80%      { filter: drop-shadow(0 0 4px rgba(255, 150, 60, 0.8)); }
}

@media (prefers-reduced-motion: reduce) {
  .logo * { animation: none !important; }
}

.words {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(18px, 3.5svh, 36px);
}

.intro {
  margin: 0;
  max-width: 24em;
  font-size: clamp(16px, 2.4svh, 20px);
  line-height: 1.4;
  text-wrap: balance;
}

.join {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 26px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  background: var(--orange);
  border-radius: 999px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.join:hover,
.join:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(235, 102, 8, 0.45);
  outline: none;
}

.join:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* Low screens (phone on its side): logo and text next to each other. */
@media (orientation: landscape) and (max-height: 520px) {
  .stage { flex-direction: row; gap: 5vw; }
  .logo { width: calc(80svh * 0.793); }
  .words { align-items: flex-start; }
  .intro { max-width: 16em; text-align: left; }
}
