/* SALES (v16): "How I sell." I am the driver, my client is my passenger. One road on a 2D canvas (sales.js draws it,
   car.js draws the car), type over it, the scroll as its playhead. Film layout is the default. Reduced motion
   (.is-reduced) turns the same markup into a plain, complete section with one still of the car and its two people. */
#sales { position: relative; background: #01030a; }

/* labels inside the picture: plain bold words, placed by the script each frame */
#sales .sl-tags { position: absolute; inset: 0; pointer-events: none; }
#sales .sl-tag { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; color: var(--ink); opacity: 0; will-change: transform, opacity; }
#sales .sl-tag-leak { font-size: 20px; letter-spacing: -0.015em; }

/* the chapter title and its line, top left */
#sales .sl-head { position: absolute; left: 0; top: clamp(10px, 4vh, 44px); width: min(100%, 760px); }
#sales .sl-sub { margin-top: clamp(12px, 2vh, 20px); max-width: 30ch; color: var(--soft); text-wrap: pretty; will-change: opacity, transform; }

/* the five beats share one place, bottom left; one is on at a time */
#sales .sl-beats { list-style: none; position: absolute; left: 0; bottom: 0; width: min(100%, 660px); display: grid; align-items: end; }
#sales .sl-beat { grid-area: 1 / 1; }
#sales .sl-beat .mg-mask > b { transform: translateY(122%); text-wrap: balance; }
#sales .sl-d { margin-top: clamp(10px, 1.6vh, 16px); opacity: 0; will-change: opacity, transform; }
#sales .sl-d .mg-lead { max-width: 37ch; color: var(--ink); text-wrap: pretty; }
/* the two questions: each on its own line, lit when it is asked */
#sales .sl-qs { margin-top: clamp(8px, 1.2vh, 12px); max-width: none; }
#sales .sl-q { display: block; font-weight: 700; letter-spacing: -0.02em; will-change: opacity; }

/* the math: title on top, the four bars in the middle, the words at the foot */
#sales .sl-math {
  position: absolute; inset: 0; pointer-events: none;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr auto; column-gap: clamp(32px, 6vw, 110px);
  grid-template-areas: "title title" "bars bars" "para close";
}
#sales .sl-mtitle { grid-area: title; margin-top: clamp(10px, 4vh, 44px); }
#sales .sl-mtitle .mg-mask > b { transform: translateY(122%); }
#sales .sl-bars { grid-area: bars; align-self: center; list-style: none; display: grid; row-gap: clamp(20px, 6.2vh, 62px); }
#sales .sl-bars b { display: block; font-size: 20px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; color: var(--ink); opacity: 0; will-change: opacity; }
#sales .sl-bars i { display: block; height: 0; margin-top: 13px; }
#sales .sl-para { grid-area: para; align-self: start; max-width: 40ch; color: var(--soft); text-wrap: pretty; opacity: 0; will-change: opacity, transform; }
#sales .sl-close { grid-area: close; align-self: start; max-width: 34ch; font-size: clamp(21px, 1.85vw, 30px); font-weight: 600; letter-spacing: -0.025em; line-height: 1.24; color: var(--ink); text-wrap: balance; opacity: 0; will-change: opacity, transform; }

/* the still picture is only for the plain version */
#sales .sl-still { display: none; }
#sales .sl-who { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; color: var(--ink); }

@media (max-width: 899px) {
  #sales .sl-tag { font-size: 18px; }
  #sales .sl-tag-leak { font-size: 16px; }
  #sales .sl-head { top: 12px; width: 100%; }
  #sales .sl-sub { margin-top: 12px; max-width: 32ch; }
  #sales .sl-beats { width: 100%; }
  #sales .sl-d { margin-top: 10px; }
  #sales .sl-d .mg-lead { max-width: none; }
  #sales .sl-qs { margin-top: 6px; }
  /* one column: the paragraph and the closing line take turns in the same place */
  #sales .sl-math { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "bars" "words"; }
  #sales .sl-mtitle { margin-top: 12px; }
  #sales .sl-bars { row-gap: clamp(12px, 4.8vh, 36px); }
  #sales .sl-bars b { font-size: 15px; }
  #sales .sl-bars i { margin-top: 13px; }   /* room for the car to stand on the bar under its label */
  #sales .sl-para, #sales .sl-close { grid-area: words; align-self: end; max-width: none; }
  #sales .sl-close { font-size: 21px; }
}
/* a short phone: the beat's sentence steps down one size so the road keeps its room */
@media (max-width: 899px) and (max-height: 600px) {
  #sales .sl-beat .mg-beat { font-size: 32px; }
  #sales .sl-d .mg-lead { font-size: 17px; }
}
/* a phone on its side, or a very short window: the type steps down so the picture keeps its room */
@media (max-height: 520px) {
  #sales .sl-sub { display: none; }
  #sales .sl-beat .mg-beat { font-size: 26px; }
  #sales .sl-d .mg-lead, #sales .sl-para { font-size: 15px; max-width: 60ch; }
  #sales .sl-mtitle { font-size: 30px; margin-top: 0; }
  #sales .sl-bars { row-gap: 8px; }
  #sales .sl-bars b { font-size: 14px; }
  #sales .sl-bars i { margin-top: 5px; }
  #sales .sl-close { font-size: 17px; }
}

/* ---- reduced motion: nothing is pinned, nothing moves. The same words set as a page, and one still of the car. ---- */
.is-reduced #sales .mg-art, .is-reduced #sales .sl-tags { display: none; }
.is-reduced #sales .mg-safe { max-width: 1100px; }
.is-reduced #sales .sl-head, .is-reduced #sales .sl-beats, .is-reduced #sales .sl-math { position: relative; left: auto; top: auto; bottom: auto; inset: auto; width: auto; }
.is-reduced #sales .sl-still { display: block; position: relative; margin-top: clamp(26px, 5vh, 48px); max-width: 860px; }
.is-reduced #sales .sl-still canvas { display: block; width: 100%; height: clamp(150px, 26vw, 250px); }
@media (max-width: 899px) { #sales .sl-who { font-size: 17px; } }
.is-reduced #sales .sl-beats { display: grid; row-gap: clamp(26px, 4vh, 40px); margin-top: clamp(34px, 6vh, 60px); max-width: 760px; }
.is-reduced #sales .sl-beat { grid-area: auto; }
.is-reduced #sales .sl-beat .mg-beat { font-size: clamp(26px, 3vw, 40px); }
.is-reduced #sales .sl-beat .mg-mask > b, .is-reduced #sales .sl-mtitle .mg-mask > b { transform: none; }
.is-reduced #sales .sl-d, .is-reduced #sales .sl-para, .is-reduced #sales .sl-close, .is-reduced #sales .sl-bars b { opacity: 1; }
.is-reduced #sales .sl-math { display: block; margin-top: clamp(64px, 12vh, 120px); }
.is-reduced #sales .sl-mtitle { margin-top: 0; }
.is-reduced #sales .sl-para { margin-top: clamp(12px, 2vh, 20px); max-width: 44ch; }
.is-reduced #sales .sl-bars { margin-top: clamp(30px, 5vh, 50px); row-gap: 22px; max-width: 760px; }
.is-reduced #sales .sl-bars i { height: 4px; border-radius: 2px; background: var(--ink); width: calc(var(--w) * 100%); }
.is-reduced #sales .sl-close { margin-top: clamp(34px, 6vh, 56px); max-width: 34ch; }
