/* Keep this grid unpositioned and unclipped: how-it-works.js uses document-relative
   offsetTop, and Safari needs an unobstructed sticky ancestor chain. */
.story-sections {
  /* THE IDEA bottom and HOW IT WORKS top share this seam spacing. */
  --story-section-seam-space: var(--space-128);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.story-sections__background {
  grid-area: 1 / 1 / 4 / 2;
  position: relative;
  z-index: 0;
  overflow: clip;
  background: var(--color-how-it-works-canvas);
  pointer-events: none;
}

/* Section composition. visual-product.css owns the standalone calendar tile face. */
.the-idea {
  --the-idea-scene-width: calc(var(--the-idea-event-width, 125.92px) + var(--space-4) + 592.25px);
  position: relative;
  isolation: isolate;
  overflow-x: clip;
  /* Matches the bottom seam (128px by default), so top and bottom padding are equal below 1200px. */
  padding-top: calc(var(--space-128) + var(--space-48));
  padding-bottom: var(--story-section-seam-space, var(--space-128));
  grid-area: 2 / 1;
  z-index: 1;
  color: var(--color-lp-headline);
}

.the-idea__viewport {
  grid-area: visual;
  position: relative;
  z-index: 1;
  /* Let the popover shadow escape; THE IDEA still clips horizontal overflow at the page edge. */
  width: 100%;
  height: calc(var(--space-32) + 460px);
}

/* the-idea.js caches section height here so the soft glows paint beyond THE IDEA. */
.the-idea__mesh {
  position: absolute;
  inset: var(--hero-height, 0px) 0 auto;
  height: var(--the-idea-height, 100%);
  opacity: 0.22;
  pointer-events: none;
}

.the-idea__glow {
  position: absolute;
  border-radius: 50%;
}

.the-idea__glow--blue {
  top: -18%;
  left: -12%;
  width: min(760px, 58vw);
  aspect-ratio: 1;
  background: radial-gradient(ellipse, var(--color-bright-azure), transparent 70%);
  opacity: 0.42;
}

.the-idea__glow--ember {
  right: -8%;
  bottom: -20%;
  width: min(680px, 50vw);
  aspect-ratio: 1;
  background: radial-gradient(ellipse, var(--color-lp-ember-glow), transparent 70%);
  opacity: 0.34;
}

.the-idea__glow--sky {
  top: 8%;
  left: 38%;
  width: min(520px, 40vw);
  aspect-ratio: 1;
  background: radial-gradient(ellipse, var(--color-lp-glow), transparent 70%);
  opacity: 0.3;
}

.the-idea__layout {
  display: grid;
  /* Below 1200px the copy leads and the event scene follows; the side-by-side layout at 1200px+ keeps the scene on the left. */
  grid-template-areas: "copy" "visual";
  align-items: center;
  /* Below 1200px the scene sits closer to the copy: half the previous 88px. */
  gap: calc(var(--space-88) / 2);
  width: min(calc(100% - 2 * var(--page-gutter)), var(--section-track));
  margin-inline: auto;
  padding-top: 0;
}

.the-idea__copy {
  grid-area: copy;
  position: relative;
  z-index: 3;
  width: 100%;
  min-width: 0;
  text-align: left;
}

.the-idea__kicker {
  margin: 0;
  color: var(--color-lp-accent);
}

.the-idea__title {
  margin: var(--space-16) 0 0;
  color: inherit;
}

.the-idea__body {
  margin: var(--space-24) 0 0;
  color: var(--color-lp-subhead);
  font: var(--type-body-1-font);
  max-width: 780px;
  margin-inline: 0;
}

.the-idea__body p {
  margin: 0;
}

.the-idea__body p + p {
  margin-top: var(--space-16);
}

.the-idea__founders {
  width: auto;
  max-width: 100%;
  margin: var(--space-32) 0 0;
  padding-left: var(--space-24);
  border-left: var(--space-2) solid var(--color-lp-accent);
  text-align: left;
}

.the-idea__quote {
  margin: 0;
  color: var(--color-lp-headline);
  font: var(--type-h5-font);
  white-space: normal;
}

.the-idea__credit {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-16);
  margin-top: var(--space-16);
  color: var(--color-lp-subhead);
  font: var(--type-body-2-font);
  font-weight: 600;
}

.the-idea__avatars {
  display: flex;
  flex: none;
  align-items: center;
  padding-right: var(--space-16);
}

.the-idea__avatars img {
  width: var(--space-48);
  height: var(--space-48);
  border: 3px solid var(--color-how-it-works-canvas);
  border-radius: 50%;
  object-fit: cover;
}

.the-idea__avatars img + img {
  margin-left: calc(-1 * var(--space-16));
}

.the-idea__scene {
  position: relative;
  left: 50%;
  width: var(--the-idea-scene-width);
  height: 100%;
  margin-left: calc(var(--the-idea-scene-width) / -2);
  pointer-events: none;
}

/* Native Work tile geometry comes from calendar-data.js; the shared .vp-tile rules own its palette and face. */
.the-idea__event {
  top: calc(var(--space-32) + var(--space-8));
  left: 0;
  width: var(--the-idea-event-width, 125.92px);
  height: var(--the-idea-event-height, 75px);
  font-family: "Inter", system-ui, sans-serif;
  transform-origin: top center;
}

.the-idea__event-copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  opacity: 0;
}

.the-idea__cursor {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  opacity: 0;
}

.the-idea__cursor img {
  display: block;
  transform: translate(-12px, -5px);
  transform-origin: 12px 5px;
}

/* Native popover frame; the shared scene owns animated scale for the event and popover together. */
.the-idea__creation {
  position: absolute;
  z-index: 2;
  top: var(--space-32);
  left: calc(var(--the-idea-event-width, 125.92px) + var(--space-4));
  width: 592.25px;
  clip-path: inset(0 0 100% 0);
  pointer-events: none;
}

@media (min-width: 1200px) {
  .the-idea {
    padding-top: var(--space-128);
  }

  .the-idea__layout {
    padding-top: 0;
    /* Match the centered track and 72px two-column rhythm of GOOD QUESTIONS. */
    grid-template-columns: minmax(var(--the-idea-scene-width), 1fr) minmax(0, 1fr);
    grid-template-areas: "visual copy";
    gap: var(--space-72);
  }
}

@media (max-width: 1199px) {
  .the-idea__copy {
    max-width: 780px;
    margin-inline: auto;
  }

  /* Pull the event scene up so the visible distance from the copy to the event is 24px. */
  .the-idea__viewport {
    margin-top: calc(-1 * (var(--space-32) + var(--space-4)));
  }
}

/* Only the compact-layout popover fits the available width; the event and its cursor stay native size. */
@media (max-width: 819px) {
  /* Space above the event tile; the phone breakpoint below halves it together with the section padding. */
  .the-idea {
    --the-idea-compact-lead: var(--space-32);
  }

  .the-idea__viewport {
    height: calc(var(--the-idea-compact-lead) + var(--the-idea-event-height, 75px) + var(--space-4) + 460px * var(--the-idea-popover-fit, 1));
  }

  .the-idea__scene {
    left: 0;
    width: 100%;
    margin-left: 0;
  }

  .the-idea__event {
    top: var(--the-idea-compact-lead);
    left: calc(50% - var(--the-idea-event-width, 125.92px) / 2);
  }

  .the-idea__creation {
    top: calc(var(--the-idea-compact-lead) + var(--the-idea-event-height, 75px) + var(--space-4));
    left: 50%;
    margin-left: -296.125px;
    /* the-idea.js sets this static fit on resize; the reveal clock never animates scale. */
    transform: scale(var(--the-idea-popover-fit, 1));
    transform-origin: top center;
  }
}

@media (max-width: 743px) {
  .story-sections {
    --story-section-seam-space: var(--space-88);
  }

  .the-idea {
    /* Phone: the gap from section top to the graphic is half of the compact-layout value. */
    --the-idea-compact-lead: var(--space-16);
    /* Equal top and bottom padding; the shared seam variable stays at 88px for HOW IT WORKS' lead. */
    padding-top: calc(var(--space-64) + var(--space-48));
    padding-bottom: var(--space-64);
  }
}
