/* public/styles/sky-strip.css */

/*
 * The page body and the strip of the banner's sky at the top of every page without the banner, the same in every
 * look: the stylesheet of the look sets how tall the strip is, how its picture ends and the title's colour. The
 * colours are the night tokens of `src/tailwind.css`. The strip's stars light up once, inside the no-preference
 * query; with reduced motion they stand in their final state.
 */

/*
 * The page under the menu. It isolates its layers, so the strip's backdrop and the veil at `z-index: -1` paint
 * over the page's background and under the text, and clips them at the window's sides, so nothing in them makes
 * the page scroll sideways.
 */
.page-body {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
}
/* The veil is the night look's; without it the element takes no room and draws nothing. */
.page-body-veil {
  display: none;
}

/*
 * The strip in the flow: at least as tall as the look sets, with the title resting on its foot. A title on two
 * lines makes the strip taller rather than climbing under the menu button: the top padding keeps it a pair
 * step below the button.
 */
.sky-strip {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  flex-shrink: 0;
  width: 100%;
  min-height: var(--sky-strip-height, 140px);
  padding-top: calc(var(--spacing-menu-toggle-top) + var(--spacing-menu-toggle-size) + var(--spacing-pair));
  padding-bottom: var(--sky-strip-title-gap, 20px);
}
/* A strip without a title is a backdrop alone and leaves the page's own top spacing as it is. */
.sky-strip-bare {
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}
.sky-strip-backdrop {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: -1;
  height: var(--sky-strip-backdrop-height, 100%);
  overflow: hidden;
  pointer-events: none;
}
/*
 * The banner picture keeps one scale and is anchored as the text column is, centred on a wide window and to the
 * left edge on a phone, so the title always lands on the same calm patch of sky, clear of the bright stars.
 */
.sky-strip-picture {
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--sky-strip-picture-height, 100%);
  background: var(--color-night-navy) url('/public/media/banner/background.webp') center 0 / max(2200px, 100%) auto
    no-repeat;
}
@media (max-width: 42.49rem) {
  .sky-strip-picture {
    background-size: max(585px, 100% + 78px) auto;
    background-position: -78px 0;
  }
}

/*
 * A star of the strip, placed and timed by its inline custom properties. The plain rule is the final drawing;
 * with motion it grows from nothing, flares a little past its size and settles, all done by about 3 s.
 */
.sky-strip-spark {
  position: absolute;
  width: var(--spark-size);
  height: var(--spark-size);
  opacity: var(--spark-opacity, 0.85);
  background:
    radial-gradient(
      circle,
      var(--color-night-white) 0 14%,
      rgb(from var(--color-night-glow) r g b / 0.55) 26%,
      rgb(from var(--color-night-glow) r g b / 0) 52%
    ),
    linear-gradient(90deg, transparent 44%, rgb(from var(--color-night-gold) r g b / 0.9) 50%, transparent 56%),
    linear-gradient(0deg, transparent 44%, rgb(from var(--color-night-gold) r g b / 0.9) 50%, transparent 56%);
}
@media (prefers-reduced-motion: no-preference) {
  .sky-strip-spark {
    animation: sky-strip-spark-in 0.9s ease-out var(--spark-delay, 0s) 1 backwards;
  }
}
@keyframes sky-strip-spark-in {
  0% {
    opacity: 0;
    transform: scale(0.2);
  }
  55% {
    opacity: 1;
    transform: scale(1.35);
  }
  100% {
    opacity: var(--spark-opacity, 0.85);
    transform: scale(1);
  }
}

/*
 * The page title on the strip: the banner title's script face with its stroke and no glow, in the colour the
 * look gives it. As wide as its words, so the soft dark patch behind it, with no visible edge, sits on the
 * letters and dims the stars and clouds right behind them. Dancing Script has nothing heavier than 700.
 */
.sky-strip-title {
  position: relative;
  isolation: isolate;
  width: fit-content;
  margin: 0;
  color: var(--sky-strip-title-color, var(--color-night-white));
  font-family: 'Dancing Script', cursive;
  font-weight: 700;
  font-size: 2.75rem;
  line-height: 1.1;
  letter-spacing: 0.005em;
  -webkit-text-stroke: 0.03em currentColor;
  paint-order: stroke fill;
}
.sky-strip-title::before {
  content: '';
  position: absolute;
  inset: -20px -32px;
  z-index: -1;
  pointer-events: none;
  border-radius: 999px;
  background: rgb(from var(--color-night-shade) r g b / 0.82);
  filter: blur(16px);
}
