/* global.css */
:root {
  --c-cloud: rgb(27, 25, 31);
  --c-gold: rgb(228, 201, 152);
}
.parallax {
  /* overflow: hidden; */
  position: relative;
  z-index: 0;
  min-height: 75vh;
  display: grid;
  grid-template-areas: "stack";
}

.stack {
  display: grid;
  grid-template-areas: "stack";
}

.parallax > * {
  grid-area: stack;
  animation: parallax linear;
  animation-timeline: view();
}

.parallax > img {
  width: 100%;
}

.primary-header,
.hero {
  --parallax-speed: 1;
  z-index: 10;
}

.parallax__bg {
  --parallax-speed: 3;

  z-index: 1;
  min-height: 100%;
  width: 100%;
  object-fit: cover;
}

.parallax__dust {
  --parallax-speed: -2;
  z-index: 10;
}

.parallax__foreground-front,
.parallax__foreground-back {
  z-index: 999;
  align-self: end;
}

.parallax__foreground-back {
  transform: scaleY(1.2);
  transform-origin: bottom;
  mix-blend-mode: hard-light;
}

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-repeat: repeat;
  will-change: transform;
}

.starfield-far {
  background-image:
    radial-gradient(2px 2px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 120px 80px, #fff, transparent),
    radial-gradient(2px 2px at 180px 220px, #fff, transparent),
    radial-gradient(1px 1px at 280px 130px, #fff, transparent),
    radial-gradient(2px 2px at 350px 260px, #fff, transparent);
  background-size: 400px 400px;
  opacity: 0.7;
  animation: parallax-bg linear;
  animation-timeline: scroll(root);
}

.starfield-near {
  background-image:
    radial-gradient(3px 3px at 50px 50px, #fff, transparent),
    radial-gradient(2px 2px at 250px 150px, #fff, transparent),
    radial-gradient(3px 3px at 400px 250px, #fff, transparent);
  background-size: 600px 600px;
  opacity: 0.9;
  animation: parallax-bg linear;
  animation-timeline: scroll(root);
}

.far-scroll {
  --parallax-distance: 1000px;
}

.near-scroll {
  --parallax-distance: -240px;
}

@keyframes parallax-bg {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 0 var(--parallax-distance);
  }
}

@media (prefers-reduced-motion: reduce) {
  .starfield-far,
  .starfield-near {
    animation: none;
    animation-timeline: scroll(root);
  }
}

.nebula {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, var(--c-cloud), transparent 35%),
    radial-gradient(circle at 80% 20%, var(--c-cloud), transparent 40%),
    radial-gradient(circle at 50% 80%, var(--c-cloud), transparent 40%);
  filter: blur(40px);
  pointer-events: none;
}

/* general styling */

html {
  color-scheme: dark;
}

body {
  margin: 0;
  font-size: 1.25rem;
  background: #0a070e;
  background-image: url("/imgs/t_paul-white-dwarf-4319223.jpg");
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  backdrop-filter: saturate(0%) contrast(1) brightness(10%) grayscale(50%);
  min-height: 100vh;
  min-height: 100dvh;
}

nav.social {
  > a {
    color: white;
  }
  svg {
    width: 3rem;
    height: 3rem;
  }
}

img {
  display: block;
  max-width: 100%;
}

.wrapper {
  width: min(65rem, 100% - 4rem);
  margin-inline: auto;
}

.flex-group {
  display: flex;
  gap: 1rem;
}

.button {
  font: inherit;
  text-transform: uppercase;
  background: hsl(279, 75%, 59%);
  padding: 1em 2em;
  border: 0;
  border-radius: 0.125em;
}

.primary-header {
  padding-block: 2rem;
}

.primary-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.primary-nav ul {
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 2rem;
  justify-content: space-between;

  & a {
    border-bottom-style: double;
    border-bottom-width: 3px;
    border-bottom-color: white;
  }
  & a:hover {
    border-bottom-style: solid;
  }
}

.primary-nav a {
  color: white;
  font-weight: 700;
  text-decoration: none;
}

.logo {
  max-width: 100px;
  position: relative;

  &::after {
    content: "";
    position: absolute;
    inset: -3rem;
    z-index: -1;
    background: radial-gradient(hsl(0 0% 100% / 0.2), transparent 70%);
  }
}

.bg-image {
  position: absolute;
  inset: 0;
}

.hero {
  position: relative;
  padding-block-start: max(5vh, 4rem);
  /* background-image: url("imgs/leoleobobeo-solar-eclipse-2017-2670350_1920-nocrust.png"); */
  background-size: cover;
  background-position: center center;
  min-height: 50vh;
  min-height: 50dvh;
  align-items: center;
  display: flex;
  max-width: 1200px;
  margin-inline: auto;

  & > .bg-image {
    width: clamp(2.5rem, 70vw, 500rem);
    inset: 0 0 1px 19%;
  }
}

.hero__title {
  font-size: 3rem;
  max-width: 17ch;
  line-height: 1;
  font-weight: 900;
  position: relative;
  text-align: center;

  > span {
    font-style: normal;
    font-size: 0.5em;
    display: block;
  }

  > h1 {
    margin: 0;
    font-weight: 800;
    font-size: clamp(4rem, 10vw, 9.5rem);
    line-height: 1.05;
    letter-spacing: 0.05em;
  }
}

body > main {
  position: relative;
  padding: 6rem 1rem;
  max-width: 800px;
  margin-inline: auto;
}
main > div[data-layout="content"] {
  position: relative;
  padding: 6rem 1rem;
  max-width: 800px;
  margin-inline: auto;
}

body > footer {
  background-color: rgb(52, 47, 36);
  min-height: 10rem;
  z-index: 10;
  position: sticky;
  padding: clamp(0.1rem, 1vw, 1rem);

  > .wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
  }
}

.media-text {
  display: grid;
  grid-template-columns: 1fr 2fr;

  & > div {
    display: grid;
    align-items: center;
  }
}

.gold {
  color: var(--c-gold, gold);
}

.grid {
  display: grid;
}

.gap-s {
  gap: 0.2rem;
}
.gap-m {
  gap: 1rem;
}
.gap-l {
  gap: 2rem;
}

.muted {
  opacity: 0.7;
}

.osc-waves {
  --wave-color: #e4e4e4; /* oscilloscope green, swap freely */
  --wave-glow: rgba(216, 216, 216, 0.65);
  --bg: #0a0a0c;

  position: relative;
  display: inline-block;
  padding: 0 clamp(1.25rem, 6vw, 3em);
  color: var(--wave-color);
  text-shadow: 0 0 12px var(--wave-glow);
  pointer-events: none;
}

.osc-waves::before,
.osc-waves::after {
  content: "";
  position: absolute;
  top: 50%;
  width: clamp(1.1rem, 5vw, 2.6em);
  height: 0.9em;
  transform: translateY(-50%);

  /* a repeating sine-wave line, drawn once and tiled */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M0 12 C 3 2 9 2 12 12 S 21 22 24 12' stroke='%237CFFCB' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 24px 100%;

  filter: drop-shadow(0 0 4px var(--wave-glow));

  animation:
    wave-scroll 2s linear infinite,
    wave-amplitude 4s steps(6, end) infinite;
}

.osc-waves::before {
  left: 0;
  /* fade out as it moves away from the letters */
  mask-image: linear-gradient(to left, black 40%, transparent 100%);
  -webkit-mask-image: linear-gradient(to left, black 40%, transparent 100%);
}

.osc-waves::after {
  right: 0;
  mask-image: linear-gradient(to right, black 40%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black 40%, transparent 100%);
  /* offset the loop timing so both sides don't pulse in perfect sync */
  animation-delay:
    -0.3s,
    -0.35s;
}

@keyframes wave-scroll {
  from {
    background-position-x: 0;
  }
  to {
    background-position-x: -24px;
  }
}

/* fake "audio reactive" amplitude jumps */
@keyframes wave-amplitude {
  0% {
    transform: translateY(-50%) scaleY(0.9);
  }
  15% {
    transform: translateY(-50%) scaleY(1.1);
  }
  30% {
    transform: translateY(-50%) scaleY(0.8);
  }
  45% {
    transform: translateY(-50%) scaleY(1.1);
  }
  60% {
    transform: translateY(-50%) scaleY(0.8);
  }
  75% {
    transform: translateY(-50%) scaleY(1.1);
  }
  90% {
    transform: translateY(-50%) scaleY(0.8);
  }
  100% {
    transform: translateY(-50%) scaleY(0.9);
  }
}

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

@media screen and (width < 600px) {
  .media-text {
    grid-template-columns: 1fr;
  }
  .wrapper {
    margin-inline: 1rem;
  }
}

@media screen and (width > 600px) {
  .reverse {
    & > div:first-child {
      order: 2;
    }
  }
}
