/* AI: one becomes many. The picture is one canvas (ai.js draws it, words and all, and the scroll plays it); this
   file sets the type that sits on it. Title top left, one beat at a time bottom left. */
#ai .ai-title { position: absolute; left: 0; top: clamp(10px, 4vh, 44px); color: var(--ink); }
/* the title's full stop is the film's dot: the canvas picks it up from exactly here */
#ai .ai-stop { display: inline-block; width: .19em; height: .19em; margin-left: .045em; border-radius: 50%; background: var(--ink); }

#ai .ai-beats { list-style: none; position: absolute; left: 0; right: 0; bottom: clamp(0px, 2.2vh, 22px); height: 0; }
#ai .ai-beat { position: absolute; left: 0; bottom: 0; width: min(100%, 34rem); visibility: hidden; }
#ai .ai-last { width: min(100%, 46rem); }                          /* its first line is the longest heading in the chapter */
#ai .ai-beat h3 { color: var(--ink); will-change: transform; }
#ai .ai-beat h3 .mg-mask { display: block; }                       /* one mask per line, so a two line heading rises a line at a time */
#ai .ai-beat h3 b { white-space: nowrap; will-change: transform; }
#ai .ai-beat p { margin-top: clamp(12px, 1.8vh, 20px); max-width: 38ch; color: var(--soft); text-wrap: pretty; will-change: transform, opacity; }
/* the eighteen jobs are words on the canvas while the film plays; the list keeps them for a reader who cannot see it */
#ai .ai-ops { list-style: none; position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#ai .ai-ops ul { list-style: none; }

@media (max-width: 899px) {
  #ai .ai-title { top: 12px; }
  #ai .ai-beats { bottom: 0; }
  #ai .ai-beat { width: 100%; }
  #ai .ai-beat p { max-width: none; margin-top: 10px; }
  #ai .ai-last h3 { font-size: min(var(--t-beat), calc((100vw - var(--pad-l) - var(--pad-r)) / 9.75)); }   /* its first line fits the narrowest phone */
}
/* a short phone: the sentence steps down one size so the picture keeps its room (the same step the car chapter takes) */
@media (max-width: 899px) and (max-height: 600px) {
  #ai .ai-beat p { margin-top: 8px; font-size: 17px; line-height: 1.32; }
}
/* a phone on its side, or any window this short: the words keep a left column and the picture sits beside them */
@media (max-height: 499px) and (min-aspect-ratio: 5/4) {
  #ai .ai-title { top: 4px; font-size: clamp(30px, 11vh, 46px); }
  #ai .ai-beats { bottom: 0; }
  #ai .ai-beat { width: 43%; }
  #ai .ai-beat h3 { font-size: clamp(24px, 8.4vh, 34px); }
  #ai .ai-beat p { margin-top: 8px; max-width: none; font-size: 15px; }
}

/* reduced motion: a set page. Title, the five beats in order with every word and all eighteen jobs, then the last picture. */
.is-reduced #ai .mg { display: flex; flex-direction: column; }
.is-reduced #ai .mg-safe { order: 1; }
.is-reduced #ai .mg-art { order: 2; position: relative; inset: auto; flex: none; height: clamp(230px, 42vh, 400px); margin-bottom: clamp(40px, 8vh, 96px); }
.is-reduced #ai .ai-title, .is-reduced #ai .ai-beats, .is-reduced #ai .ai-beat { position: static; height: auto; width: auto; visibility: visible; }
.is-reduced #ai .ai-beats { margin-top: clamp(36px, 7vh, 72px); display: grid; row-gap: clamp(44px, 8vh, 84px); }
.is-reduced #ai .ai-beat { display: grid; grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); column-gap: clamp(32px, 6vw, 96px); align-items: start; }
.is-reduced #ai .ai-beat h3 { grid-column: 1; grid-row: 1 / span 2; font-size: clamp(32px, 3.4vw, 54px); }
.is-reduced #ai .ai-beat h3 b { white-space: normal; }               /* a set page: a long heading wraps in its column */
.is-reduced #ai .ai-beat p { grid-column: 2; margin-top: .3em; max-width: 46ch; }
.is-reduced #ai .ai-ops { grid-column: 2; position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; margin-top: clamp(24px, 4vh, 40px); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px clamp(16px, 2.4vw, 40px); }
.is-reduced #ai .ai-op strong { display: block; margin-bottom: 10px; font-size: var(--t-lead); font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; color: var(--ink); }
.is-reduced #ai .ai-op li li { font-size: var(--t-body); font-weight: 600; letter-spacing: -0.012em; line-height: 1.6; color: var(--soft); }
@media (max-width: 1099px) { .is-reduced #ai .ai-ops { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 899px) {
  .is-reduced #ai .ai-beat { grid-template-columns: minmax(0, 1fr); }
  .is-reduced #ai .ai-beat h3 { grid-row: auto; font-size: var(--t-beat); }
  .is-reduced #ai .ai-beat p, .is-reduced #ai .ai-ops { grid-column: 1; }
  .is-reduced #ai .ai-beat p { margin-top: 12px; max-width: none; }
}
