/* ==========================================================================
   Home page: hero (layered scene, wavy title, CTA),
   manifesto (physics drop over the teaser ship), and the zigzag showcase.
   Scenes come from js/art.js; behavior from js/home.js. Mobile first.
   ========================================================================== */

/* Ground color for the hero skyline silhouette and the fade below it */
:root {
  --ground: #04040f;
}

:root[data-theme="day"] {
  --ground: #d9ccf6;
}

#hero-beam-grad,
#teaser-beam-grad {
  color: var(--art-beam);
}

#hero-trail-grad {
  color: var(--fire);
}

/* ---- 1. Hero ---- */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: max(660px, 100svh);
  /* Slides under the transparent header so the sky runs to the top edge */
  margin-top: calc(-1 * var(--header-h));
  overflow: hidden;
}

/* Mobile: the scene sits under the text; desktop: it fills the hero */
.hero__art {
  position: absolute;
  inset: auto 0 0;
  height: 58%;
  z-index: -1;
  pointer-events: none;
}

.hero__layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  will-change: transform;
}

.hero__layer--far {
  opacity: 0.8;
}

.hero__layer--near {
  inset: auto 0 0;
  height: clamp(90px, 13vw, 180px);
}

.hero__content {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: var(--space-5);
  padding-block: calc(var(--header-h) + var(--space-7)) var(--space-9);
}

@media (min-width: 860px) {
  .hero__art {
    inset: 0;
    height: auto;
  }

  .hero__content {
    align-content: center;
    padding-block: calc(var(--header-h) + var(--space-6)) var(--space-10);
  }
}

/* Wavy title */
.hero__title {
  max-width: 10ch;
  font-size: clamp(3.4rem, 1.6rem + 8vw, 9.5rem);
  letter-spacing: -0.015em;
}

.wavy__word {
  display: inline-block;
  white-space: nowrap;
}

.wavy__char {
  display: inline-block;
  animation: wave 2.8s ease-in-out infinite;
  /* Negative start so the wave is already moving; later letters lag behind */
  animation-delay: calc(var(--i) * 0.11s - 3s);
}

.hero__title.is-paused .wavy__char {
  animation-play-state: paused;
}

@keyframes wave {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-0.08em);
  }
}

.hero__cta {
  margin-top: var(--space-2);
}

/* The badges' clear space sits outside the text column, so the visible badges line up */
.hero__cta .store-badges,
.showcase__body .store-badges {
  margin-inline-start: calc(var(--badge-h) / -4);
}

/* Scene details */
.hero-mothership > path:first-child,
.teaser-hull > path:first-child {
  fill: var(--sky-mid);
}

.hero-ground {
  fill: var(--ground);
  stroke: var(--art-line);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.hero-lit {
  fill: none;
  stroke: var(--fire-hot);
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: 0.75;
}

.hero-smoke {
  fill: none;
  stroke: var(--art-smoke);
  stroke-width: 22;
  stroke-linecap: round;
  opacity: 0.12;
}

.hero-smoke--inner {
  stroke-width: 8;
  opacity: 0.22;
}

.hero-trail {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
}

/* Liftoff: the trail draws up from the tower, the rocket climbs in */
.hero-smoke,
.hero-trail {
  stroke-dasharray: 1;
  animation: trail-draw 2.4s var(--ease-out) both;
}

@keyframes trail-draw {
  from {
    stroke-dashoffset: 1;
  }

  to {
    stroke-dashoffset: 0;
  }
}

.hero__layer--mid .hero-rocket {
  animation:
    rocket-in 2.4s var(--ease-out) both,
    rocket-bob 3.2s ease-in-out 2.4s infinite;
}

@keyframes rocket-in {
  from {
    transform: translateY(240px);
    opacity: 0;
  }
}

@keyframes rocket-bob {
  50% {
    transform: translateY(-6px);
  }
}

/* ---- 2-4. Manifesto, tagline, secondary CTA ---- */
.manifesto {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(11rem, 6rem + 16vw, 19rem) var(--space-9);
  background: linear-gradient(180deg, var(--ground), transparent 260px);
}

/* Wider than the section so the ship can drift sideways without showing its edge */
.manifesto__art {
  position: absolute;
  top: 0;
  left: -6%;
  width: 112%;
  z-index: -1;
  pointer-events: none;
}

.teaser {
  width: 100%;
  height: clamp(320px, 46vw, 640px);
  will-change: transform;
}

.teaser-beam {
  animation: beam-pulse 6s ease-in-out infinite;
}

.manifesto__inner {
  display: grid;
  gap: var(--space-7);
}

.manifesto__title {
  max-width: 15ch;
  font-size: clamp(2.6rem, 1.4rem + 5.4vw, 6.6rem);
}

.drop__word {
  display: inline-block;
}

.drop__word--accent {
  color: var(--fire-text);
}

/* Armed = waiting off-screen; dropped = falls with gravity, then two small bounces */
.manifesto__title.is-armed .drop__word {
  opacity: 0;
}

.manifesto__title.is-dropped .drop__word {
  animation: drop 1.1s both;
  animation-delay: calc(var(--i) * 0.09s);
}

.manifesto__title.is-landed .drop__word {
  animation: none;
  opacity: 1;
}

@keyframes drop {
  0% {
    opacity: 0;
    transform: translateY(-2.2em) rotate(var(--r));
    animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45);
  }

  12% {
    opacity: 1;
  }

  58% {
    transform: translateY(0) rotate(0deg);
    animation-timing-function: cubic-bezier(0, 0.55, 0.45, 1);
  }

  76% {
    transform: translateY(-0.2em) rotate(calc(var(--r) * -0.3));
    animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45);
  }

  89% {
    transform: translateY(0) rotate(0deg);
    animation-timing-function: cubic-bezier(0, 0.55, 0.45, 1);
  }

  95% {
    transform: translateY(-0.05em);
    animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.manifesto__aside {
  display: grid;
  justify-items: start;
  gap: var(--space-5);
  padding-left: var(--space-5);
  border-left: var(--border-w) solid var(--fire);
}

.btn__arrow {
  flex: none;
  transition: transform var(--dur-fast) var(--ease-out);
}

.btn:hover .btn__arrow {
  transform: translateX(4px);
}

@media (min-width: 860px) {
  .manifesto__inner {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--space-5);
  }

  .manifesto__title {
    grid-column: 1 / span 10;
  }

  .manifesto__aside {
    grid-column: 7 / -1;
  }
}

/* ---- 5. Showcase: zigzag game cards ---- */
.showcase {
  padding-block: var(--space-8) var(--space-6);
}

.showcase__title {
  margin-bottom: var(--space-7);
}

/* Featured banner: the wide cover (1915x821, it shows the title) + description */
.showcase__feature {
  display: grid;
  gap: var(--space-5);
}

.showcase__cover {
  width: 100%;
  height: auto;
  border: var(--hairline) solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--sky-top), var(--sky-horizon));
}

.showcase__lead {
  max-width: 60ch;
  font-size: var(--step-1);
  color: var(--ink-muted);
}

.showcase__feature + .showcase__item {
  margin-top: var(--space-8);
}

.showcase__item {
  display: grid;
  gap: var(--space-5);
  padding: var(--space-4);
}

.showcase__item + .showcase__item {
  margin-top: var(--space-8);
}

.showcase__body {
  display: grid;
  justify-items: start;
  gap: var(--space-4);
  padding: var(--space-2);
}

.showcase__kind {
  font-size: var(--step-4);
}

.showcase__text {
  color: var(--ink-muted);
}

@media (min-width: 860px) {
  .showcase__item {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: center;
    gap: var(--space-7);
    width: 92%;
    padding: var(--space-5);
  }

  .showcase__item--flip {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    margin-left: auto;
  }

  .showcase__item--flip .showcase__media {
    order: 2;
  }

  .showcase__item + .showcase__item {
    margin-top: var(--space-9);
  }
}

/* Video: 16:9 poster button, replaced by the youtube-nocookie player on click */
.video {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--sky-top), var(--sky-horizon));
}

.video__poster {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.video__poster:focus-visible {
  outline-offset: -4px;
}

.video__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video__play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 0 8px rgb(255 138 51 / 0.22);
  transform: translate(-50%, -50%);
  transition: transform var(--dur-fast) var(--ease-out);
}

.video__play svg {
  width: 30px;
  height: 30px;
  margin-left: 4px;
  fill: currentColor;
}

.video__poster:hover .video__play {
  transform: translate(-50%, -50%) scale(1.1);
}

/* ---- Reduced motion: everything rests in its final position ---- */
@media (prefers-reduced-motion: reduce) {
  .wavy__char,
  .hero-smoke,
  .hero-trail,
  .hero__layer--mid .hero-rocket,
  .teaser-beam,
  .drop__word {
    animation: none !important;
  }

  .hero-smoke,
  .hero-trail {
    stroke-dasharray: none;
  }

  .manifesto__title .drop__word {
    opacity: 1;
  }
}
