/* ClimbSync home page: the question on the wall, the pain, the app in three steps (sticky
   phone), the rest in four phones at once, the sign-off, the close. The phone itself is
   /styles/phone.css; behaviour lives in /scripts/home.js. */

.home {
  --h-gutter: clamp(20px, 5vw, 64px);
}
.home .h-accent {
  color: var(--accent);
}

/* ---------- Hero ---------- */
.h-hero {
  --phone-w: clamp(240px, 22vw, 320px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(110px, 16vh, 170px) 0 clamp(60px, 9vh, 110px);
}
.h-hero .h-hero-copy {
  position: relative;
  z-index: 2;
  max-width: 1040px;
  padding: 0 var(--h-gutter);
  text-align: center;
}
.h-hero h1.display {
  font-size: clamp(44px, 6.4vw, 92px);
  line-height: 1;
}
.h-hero .lead {
  margin: 22px auto 0;
  max-width: 520px;
}
.h-hero .cta-store {
  margin-top: 30px;
}
.h-hero .cta-store .badges {
  justify-content: center;
}
/* the whole phone, under the copy: the loop needs all of its screen */
.h-hero .h-hero-stage {
  position: relative;
  z-index: 1;
  margin-top: 54px;
  width: var(--phone-w);
}
.h-hero .h-hero-stage .loop-phone {
  width: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  .h-hero .h-hero-copy > * {
    animation: h-fadeup 0.8s cubic-bezier(0.2, 0.9, 0.25, 1) both;
  }
  .h-hero .h-hero-copy > :nth-child(2) {
    animation-delay: 0.15s;
  }
  .h-hero .h-hero-copy > :nth-child(3) {
    animation-delay: 0.3s;
  }
  .h-hero .h-hero-stage {
    animation: h-rise 1.1s cubic-bezier(0.2, 0.9, 0.25, 1) 0.9s both;
  }
}
@keyframes h-fadeup {
  from {
    transform: translateY(18px);
    opacity: 0;
  }
}
@keyframes h-rise {
  from {
    transform: translateY(80px);
    opacity: 0;
  }
}

/* ---------- Reveal on scroll (home.js adds .in; visible without JS) ---------- */
.js .h-reveal {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.8s ease,
    transform 0.8s cubic-bezier(0.2, 0.9, 0.25, 1);
}
.js .h-reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- Tiles: the pain and the story are big rounded panels ---------- */
.h-tile {
  position: relative;
  overflow: hidden;
  border-radius: 34px;
  background: linear-gradient(
    160deg,
    var(--surface),
    color-mix(in oklab, var(--surface) 70%, var(--bg))
  );
  border: 1px solid var(--border);
}
.h-tile-accent {
  background: linear-gradient(160deg, var(--accent), var(--accent-deep));
  border-color: transparent;
}
.h-tile-accent h2.display,
.h-tile-accent h2.display .h-accent {
  color: var(--ink);
  text-shadow: none;
}
.h-tile-accent .lead {
  color: rgba(22, 22, 26, 0.8);
}

/* ---------- The pain: the headline and the group chat that keeps arguing ---------- */
/* straight on the panel, no tile; and no seam under it: the story's panel continues it */
.h-problem {
  /* the bottom leaves room for the chat's shadow, about 100px below it: the story's panel would
     paint over the rest */
  padding: clamp(80px, 12vh, 140px) var(--h-gutter) 110px;
  border-bottom: none;
}
.h-problem-tile {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  align-items: center;
  gap: clamp(30px, 4vw, 70px);
}
.h-problem h2.display {
  font-size: clamp(44px, 5.2vw, 84px);
  line-height: 1;
}
.h-problem .h-line {
  display: block;
}
.h-problem .lead {
  margin-top: 28px;
  max-width: 500px;
}
.h-problem-tile .gc {
  justify-self: end;
}

/* ---------- The story: a reel of tiles to drag, swipe or step through (home.js) ---------- */
.h-story {
  --tile-w: min(1000px, 78vw);
}
.h-reel-pin {
  position: relative;
  padding: clamp(40px, 6vh, 70px) 0;
}
/* the current tile snaps to the middle, its neighbours peeking in at the sides */
.h-reel-track {
  display: flex;
  gap: 28px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 0 max(var(--h-gutter), calc((100% - var(--tile-w)) / 2));
}
.h-reel-track::-webkit-scrollbar {
  display: none;
}
.h-reel-track.is-draggable {
  cursor: grab;
}
.h-reel-track.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  user-select: none;
}
.h-reel-track img {
  -webkit-user-drag: none;
}
/* on very wide screens a centred first tile leaves a wide empty band on its left: the reel starts
   at the gutter instead and its later tiles still settle in the middle */
@media (min-width: 1600px) {
  .h-reel-track {
    padding-left: var(--h-gutter);
  }
  .h-reel-tile:first-child {
    scroll-snap-align: start;
    scroll-margin-left: var(--h-gutter);
  }
}
.h-reel-tile {
  flex: none;
  width: var(--tile-w);
  height: min(760px, calc(100svh - 190px));
  min-height: 560px;
  scroll-snap-align: center;
  padding: clamp(40px, 5vw, 70px);
}
.h-reel-copy {
  position: relative;
  z-index: 1;
  max-width: 48%;
}
.h-reel-tile h2.display {
  font-size: clamp(48px, 6.4vw, 104px);
  line-height: 0.98;
}
.h-reel-tile .lead {
  margin-top: 26px;
  max-width: 420px;
}
/* the phone stands in the tile's right half and runs off its bottom edge */
.h-reel-tile .h-reel-phone {
  position: absolute;
  right: clamp(30px, 6%, 80px);
  top: clamp(50px, 12%, 110px);
  width: clamp(260px, 36%, 380px);
}
.h-reel-progress {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 26px var(--h-gutter) 0;
}
.h-reel-progress > span {
  display: flex;
  align-items: center;
  gap: 4px;
}
/* a step either way, either side of the dots */
.h-reel-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 0.2s,
    opacity 0.2s;
}
.h-reel-arrow:hover {
  border-color: var(--text-subtle);
}
.h-reel-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}
.h-reel-arrow svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* a dot per tile, the current one stretched into an orange pill; each jumps to its tile, and
   its hit area is larger than the dot it draws */
.h-reel-progress i {
  display: block;
  padding: 8px 5px;
  cursor: pointer;
}
.h-reel-progress i::after {
  content: "";
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--border-strong);
  transition:
    width 0.3s cubic-bezier(0.2, 0.9, 0.25, 1),
    background-color 0.3s;
}
.h-reel-progress i.on::after {
  width: 24px;
  background-color: var(--accent);
}

/* ---------- Beyond the gym: four phones at once ---------- */
.h-beyond {
  padding: clamp(60px, 10vh, 120px) var(--h-gutter) clamp(60px, 10vh, 120px);
}
.h-beyond-head,
.h-feats {
  max-width: 1320px;
  margin: 0 auto;
}
.h-beyond h2.display {
  font-size: clamp(40px, 6vw, 88px);
  line-height: 1;
}
.h-beyond-head .lead {
  margin-top: 18px;
  max-width: 560px;
}
.h-feats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(16px, 2.4vw, 36px);
  align-items: start;
  margin-top: clamp(40px, 7vh, 80px);
}
.h-feat {
  margin: 0;
}
.h-feat-lo {
  margin-top: clamp(40px, 7vw, 110px);
}
.js .h-feat {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.7s ease,
    transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.js .h-feats.in .h-feat {
  opacity: 1;
  transform: none;
}
.js .h-feats.in .h-feat:nth-child(2) {
  transition-delay: 0.12s;
}
.js .h-feats.in .h-feat:nth-child(3) {
  transition-delay: 0.24s;
}
.js .h-feats.in .h-feat:nth-child(4) {
  transition-delay: 0.36s;
}
.h-feat .loop-phone {
  width: 100%;
}
.h-feat figcaption {
  margin-top: 22px;
}
.h-feat h3.display {
  font-size: clamp(20px, 1.7vw, 26px);
  line-height: 1.15;
  margin: 0 0 8px;
}
.h-feat p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
}

/* ---------- The close: the sign-off on the wall ---------- */
/* the dark clip's ground is black, kept out by lighten; the light clip's is white, by darken:
   either way the wall runs on behind the mark and the words */
.h-signoff-frame {
  width: min(620px, 100%);
  /* it overlaps the badges' row below (the negative margin), and its blend gives it a layer of
     its own above them: it must not take their hover and clicks */
  pointer-events: none;
  /* the frame keeps room under the line for the mark's full-size landing; once it has
     settled that is empty, so the badges tuck up into it */
  margin: 0 auto -6%;
}
.h-signoff-clip {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1320 / 1000;
  mix-blend-mode: lighten;
}
.h-signoff-clip.only-light {
  mix-blend-mode: darken;
}
/* ---------- The close ---------- */
.h-cta {
  overflow: hidden;
  padding: clamp(70px, 10vh, 120px) var(--h-gutter);
  text-align: center;
}
/* no stacking context of its own (no z-index): the sign-off's lighten blend must reach the wall */
.h-cta .h-cta-copy {
  max-width: 760px;
  margin: 0 auto;
}
.h-cta .cta-store {
  margin-top: 8px;
}
/* the price note sits right under the badges it qualifies */
.h-cta .h-cta-note {
  margin-top: 14px;
  font-size: 14px;
  color: var(--text-subtle);
}
.h-cta .cta-store .badges {
  justify-content: center;
}

/* ---------- Phones ---------- */
@media (max-width: 820px) {
  .h-hero {
    --phone-w: min(72vw, 300px);
  }
  .h-problem-tile {
    grid-template-columns: minmax(0, 1fr);
  }
  .h-problem-tile .gc {
    justify-self: center;
  }
  /* the reel's tiles nearly fill the width; the dots alone steer it */
  .h-story {
    --tile-w: 84vw;
  }
  .h-reel-track {
    gap: 14px;
  }
  .h-reel-arrow {
    display: none;
  }
  /* a mouse drags the feature row too (home.js) */
  .h-feats.is-draggable {
    cursor: grab;
  }
  .h-feats.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    user-select: none;
  }
  .h-feats img {
    -webkit-user-drag: none;
  }
  .h-reel-tile {
    height: auto;
    min-height: 0;
    padding: 30px 26px 0;
    border-radius: 26px;
    scroll-snap-align: center;
  }
  .h-reel-copy {
    max-width: none;
  }
  .h-reel-tile h2.display {
    font-size: 40px;
  }
  .h-reel-tile .h-reel-phone {
    position: relative;
    right: auto;
    top: auto;
    width: 76%;
    margin: 28px auto -40%;
  }
  .h-feats {
    grid-template-columns: repeat(4, 64vw);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin-left: calc(-1 * var(--h-gutter));
    margin-right: calc(-1 * var(--h-gutter));
    padding: 0 var(--h-gutter) 10px;
    scrollbar-width: none;
  }
  .h-feats::-webkit-scrollbar {
    display: none;
  }
  .h-feat {
    scroll-snap-align: center;
  }
  .h-feat-lo {
    margin-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .js .h-reveal,
  .js .h-feat {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
