/* Mind Moon v2 motion.css. Owner: motion designer. Scope (direction-v2.md section 8):
   1. Pre-animation states for the above-the-fold hero layers, only under html.motion-ok.
      The head script removes motion-ok after 2.5s if motion.js never finishes, so nothing stays hidden.
      The H1 and the buy button are never hidden.
   2. The levels STAGE layout (html.motion-ok at min-width 900px).
   3. The lightbox open animation.
   4. Lenis helper rules (only active while Lenis is running: it adds html.lenis). */

/* 1. Hero pre-states (match the first frame of M1 in motion.js) */
html.motion-ok #hero .hill--back { transform: translateY(36px); }
html.motion-ok #hero .hill--mid { transform: translateY(48px); }
html.motion-ok #hero .hill--front { transform: translateY(60px); }
html.motion-ok #hero-moon { opacity: 0; }
html.motion-ok #hero-sheets .sheet-lift { transform: translateY(70%); }
html.motion-ok #hero .star { opacity: 0; }
html.motion-ok #hero .hero-copy .eyebrow,
html.motion-ok #hero .hero-sub { opacity: 0; }
html.motion-ok #hero .scribble { transform: scaleX(0); transform-origin: 0% 50%; }
@media (min-width: 900px) {
  html.motion-ok #hero .hill--back { transform: translateY(60px); }
  html.motion-ok #hero .hill--mid { transform: translateY(80px); }
  html.motion-ok #hero .hill--front { transform: translateY(100px); }
}

/* 2. Levels STAGE layout (M5). Static layout lives in site.css and applies otherwise. */
@media (min-width: 900px) {
  html.motion-ok #levels .window {
    min-height: calc(100vh - 24px);
    padding-top: clamp(40px, 7vh, 96px);
    padding-bottom: clamp(124px, 17vh, 170px);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  html.motion-ok #levels .levels-stage {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto auto auto auto;
    column-gap: 32px;
    align-items: start;
    align-content: center;
  }
  html.motion-ok #levels .levels-stage > h2 {
    grid-column: 7 / -1;
    grid-row: 1;
    margin-bottom: 28px;
  }
  html.motion-ok #levels #levels-moon {
    display: block;
    grid-column: 1 / 7;
    grid-row: 1 / span 4;
    align-self: center;
    justify-self: center;
    width: min(380px, 50vh);
    max-width: 100%;
    height: auto;
    aspect-ratio: 1;
  }
  html.motion-ok #levels .levels-list {
    grid-column: 7 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    margin: 0;
  }
  html.motion-ok #levels .levels-list > .level {
    grid-area: 1 / 1;
    display: block;
  }
  html.motion-ok #levels .level .moon-mini { display: none; }
  html.motion-ok #levels .phase-markers {
    grid-column: 7 / -1;
    grid-row: 3;
    display: flex;
    gap: 14px;
    margin-top: 28px;
  }
  html.motion-ok #levels .levels-note {
    grid-column: 7 / -1;
    grid-row: 4;
    margin-top: 24px;
  }
}

/* 3. Lightbox open: the page settles in from .94 with opacity. */
@keyframes mm-lightbox-in {
  from { opacity: 0; transform: scale(.94); }
  to { opacity: 1; transform: none; }
}
html.motion-ok .lightbox[open] .lb-sheet {
  animation: mm-lightbox-in 300ms cubic-bezier(.22, 1, .36, 1) both;
}

/* 4. Lenis (desktop pointer only) */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: clip; }

@media (prefers-reduced-motion: reduce) {
  html.motion-ok .lightbox[open] .lb-sheet { animation: none; }
}
