/* Copyright Ayers Electronics Inc. All rights reserved. */

/* --night-bed and --night-wake are the bird's going to bed and waking, set on <html> from the
   manifest's timings (js/night-state.js): Night Mode fades in and out over them, html.night-on
   marking it on. */

/* One shade over the whole screen, above every layer: the picture, every panel and the marquee
   (css/components/marquee.css stands just under it). It takes no input or accessibility focus. */
#nightShade {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 210;
  pointer-events: none;
}
/* The dimming layer, then the warm layer over it, each a token at its own opacity. */
#nightShade::before,
#nightShade::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}
#nightShade::before {
  background: var(--night-dark);
  opacity: var(--night-dim, 0);
}
#nightShade::after {
  background: var(--night-warm);
  opacity: var(--night-warmth, 0);
}
#nightShade::before,
#nightShade::after {
  transition: opacity var(--night-wake) ease-out;
}
html.night-on #nightShade::before,
html.night-on #nightShade::after {
  transition: opacity var(--night-bed) ease-in-out;
}

/* A single night face covers the ordinary words without changing the channel or its playback. */
#nightCard {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  pointer-events: none;
  opacity: 1;
  transition:
    opacity 120ms ease-out 100ms,
    background-color var(--night-wake) ease-out;
}
html.night-on #nightCard {
  transition:
    opacity 120ms ease-out 100ms,
    background-color var(--night-bed) ease-in-out;
}
#nightCard[hidden],
#nightCardContent[hidden],
#nightCardPicture[hidden] {
  display: none;
}
#nightCardPicture {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
#nightCardContent {
  text-align: center;
  animation: night-settle var(--night-bed) ease-out both;
}
/* The off-air card's Night Mode offer (js/off-air-night.js), above the sleeping bird. */
#offAirNightMode {
  position: absolute;
  bottom: clamp(32px, 7.4vh, 80px);
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
}
#offAirNightMode[hidden] {
  display: none;
}
.night-bird {
  position: relative;
  width: min(30vh, 240px);
  height: min(30vh, 240px);
  margin: 0 auto 24px;
}
.night-bird img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.night-zs {
  position: absolute;
  top: -34%;
  right: -34%;
  width: 64%;
  height: 78%;
  color: var(--night-sleep-mark);
  font-weight: 700;
}
.night-zs span {
  position: absolute;
  bottom: 0;
  left: 0;
  opacity: 0;
  animation: night-z-rise 14s linear infinite;
}
.night-zs span::before {
  content: "Z";
}
.night-zs span:nth-child(1) {
  font-size: 1.5rem;
}
.night-zs span:nth-child(2) {
  font-size: 2.375rem;
  animation-delay: 4.5s;
  animation-duration: 16s;
}
.night-zs span:nth-child(3) {
  font-size: 3.375rem;
  animation-delay: 9s;
  animation-duration: 18s;
}
#nightCardTitle {
  margin: 0;
  color: var(--text);
  font-size: calc(clamp(var(--type-heading), 3.65vw, var(--type-card-headline)) * 0.8);
}
#offAirCard.night-card-up > .offair-body {
  visibility: hidden;
}
#nightCard.night-waking {
  opacity: 0;
}
#nightCard.night-scheduled-wake #nightCardContent {
  animation: none;
  opacity: 1;
}
#nightCard.night-scheduled-wake .night-zs {
  display: none;
}
@keyframes night-settle {
  0%,
  52% {
    opacity: 1;
  }
  100% {
    opacity: 0.58;
  }
}
@keyframes night-z-rise {
  0%,
  12% {
    opacity: 0;
    transform: translate(0, 18px) scale(0.9);
  }
  26% {
    opacity: 0.58;
  }
  78% {
    opacity: 0.34;
  }
  100% {
    opacity: 0;
    transform: translate(66px, -124px) scale(1.08);
  }
}
html[data-reduce-motion] #nightCard {
  transition: none;
}
html[data-reduce-motion] #nightCardContent {
  animation: none;
  opacity: 0.58;
}
html[data-reduce-motion] .night-zs span {
  animation: none;
  opacity: 0.42;
}
html[data-reduce-motion] .night-zs span:nth-child(1) {
  transform: translate(0, -4px);
}
html[data-reduce-motion] .night-zs span:nth-child(2) {
  transform: translate(38px, -58px);
}
html[data-reduce-motion] .night-zs span:nth-child(3) {
  transform: translate(76px, -116px);
}
html[data-reduce-motion] #nightCard.night-scheduled-wake .night-bird {
  background:
    url("../../assets/launch/eye.svg") center / contain no-repeat,
    url("../../assets/launch/wing.svg") center / contain no-repeat,
    url("../../assets/launch/base.svg") center / contain no-repeat;
}
html[data-reduce-motion] #nightCard.night-scheduled-wake #nightBirdPose {
  visibility: hidden;
}
@media (prefers-reduced-motion: reduce) {
  #nightCard,
  html.night-on #nightCard {
    transition: none;
  }
  #nightCardContent {
    animation: none;
    opacity: 0.58;
  }
  .night-zs span {
    animation: none;
    opacity: 0.42;
  }
  .night-zs span:nth-child(1) {
    transform: translate(0, -4px);
  }
  .night-zs span:nth-child(2) {
    transform: translate(38px, -58px);
  }
  .night-zs span:nth-child(3) {
    transform: translate(76px, -116px);
  }
  #nightCard.night-scheduled-wake .night-bird {
    background:
      url("../../assets/launch/eye.svg") center / contain no-repeat,
      url("../../assets/launch/wing.svg") center / contain no-repeat,
      url("../../assets/launch/base.svg") center / contain no-repeat;
  }
  #nightCard.night-scheduled-wake #nightBirdPose {
    visibility: hidden;
  }
}
