/* Keep the films in one column before the desktop sidebar crowds the video. */
@media (max-width: 1000px) {
  html { -webkit-text-size-adjust: 100%; }
  html body .lede { width: 100% !important; }
  html .film .rgrid .main,
  html .film.playing .rgrid .main {
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 20px !important;
  }
  html body .film .rgrid .main > .bdesc {
    grid-column: 1;
    grid-row: auto;
    padding-top: 0;
    order: 4;
  }
  html body .film:not(.started) .rgrid .main > .bdesc { display: none !important; }
  html body .film:not(.started) .scene-head.scene-head > span.label,
  html body .film .scene-head.scene-head > span.label,
  html body .film:not(.started) .scene-head.scene-head > h3,
  html body .film .scene-head.scene-head > h3,
  html body .film:not(.started) .rgrid .main > .stage.rv,
  html body .film .rgrid .main > .stage.rv,
  html body .film:not(.started) .rgrid .main > .sqw.rv,
  html body .film .rgrid .main > .sqw.rv,
  html body .film:not(.started) .rgrid .main > .tx-trace,
  html body .film .rgrid .main > .tx-trace { transform: none !important; }
  html body .film .rgrid .main > .tx-trace { order: 3; }
  html .film .main > .rbar {
    display: flex !important;
    margin: 0;
    opacity: 1;
    order: 1;
  }
  html .film .rbar .play { width: 44px; height: 44px; }
  html .film .rbar .time { display: none; }
  html[data-variant] .film .rbar .trk { display: block; min-width: 0; height: 44px; touch-action: none; }
  html body .film .rgrid .main > .sqw {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    height: auto !important;
    margin: 0 !important;
    order: 2;
    cursor: auto;
  }
  html .film .sqw > svg,
  html .film .sqw .sq-head,
  html .film .sqw .sqst,
  html .film .sqw .sqd,
  html .film .sqw .sqb::before { display: none !important; }
  html .film .sqw .sqb { position: static; width: auto; height: auto; min-width: 0; }
  html body .film .main > .sqw .sqb .sql {
    position: static;
    min-height: 44px;
    height: 100%;
    padding: 10px;
    gap: 8px;
    border-radius: 6px;
    font: 400 14px/1.3 var(--body);
    white-space: normal;
    transform: none;
    translate: none !important;
    scale: 1;
    opacity: 1;
  }
  html .film .sqw .sqb .sql em { flex: none; font-size: 11px; }
}

@media (max-width: 640px) {
  :root { --pw: calc(100vw - 32px) !important; }
  html .hq-pin { padding-top: 80px; }
  html body .xp-intro { margin-top: 80px !important; padding-inline: 0; }
  html body .xp-intro h2,
  html body .xp-cycle h2 { font-size: 32px !important; }
  html body .film .scene-head.scene-head { margin-bottom: 24px !important; }
  html body .mck .mck-l { width: 100%; padding: 16px; gap: 12px; }
  html body .mck .mck-cap { font-size: clamp(18px, 5vw, 28px) !important; }
  html body .mck .mck-mark,
  html body .mck .bgd { display: none; }
  html body .mck .bgl { right: 0; }
  html body .mck .mck-go { min-height: 44px; }
  html body .xp-cycle { width: 100%; margin-block: 80px !important; }
  html body .film .scene-head.scene-head > span.label { font-size: 28px !important; }
}

/* The line and spacer the phone bookmark strip adds stay out of every other layout. */
.sqw > .mtrk, .sqw > .msp, .film .main > .mcap { display: none; }

/* Phone bookmarks: thin chips hanging from hashmarks on a line (Matthew's option B, "Centred").
   Two or three show at once, the next one is cut off at the screen edge, and the line fills as the film plays. */
@media (max-width: 640px) {
  html body .lede { padding-inline: 16px; }
  /* the subtitle keeps the same side margins as the paragraphs under it */
  html body .hsub { padding-inline: 16px; box-sizing: border-box; }
  html body .lede p,
  html body .lede p:first-child,
  html body .lede > p.kick,
  html body .lede .tx-caps li { font-size: 16px !important; line-height: 1.6 !important; }
  html body .film .rgrid .main > .sqw {
    position: relative;
    display: flex !important;
    gap: 8px;
    margin-inline: -16px !important;
    padding: 7px 16px 0;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 16px;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    touch-action: auto;
  }
  html body .film .main > .sqw::-webkit-scrollbar { display: none; }
  html body .film .main > .sqw > .mtrk { display: block; position: absolute; left: 0; top: 6px; height: 1px; background: #DAD9D5; pointer-events: none; }
  html body .film .main > .sqw > .mtrk > i { position: absolute; left: 0; top: -.5px; height: 2px; width: 0; border-radius: 1px; background: #1B1D1F; }
  /* a short upright line closes the track after the last bookmark, so it reads as the end; it darkens once the last bookmark is reached */
  html body .film .main > .sqw > .mtrk::after { content: ""; position: absolute; right: -1px; top: -6px; width: 2px; height: 13px; border-radius: 1px; background: #C9C8C3; transition: background-color .35s ease; }
  html body .film .main > .sqw:has(> .sqb.now:last-of-type) > .mtrk::after { background: #1B1D1F; }
  html body .film .main > .sqw > .msp { display: block; flex: none; }
  /* the button keeps a 43px tap height around the 23px chip */
  html body .film .main > .sqw .sqb { display: flex; flex: none; padding: 10px 0; scroll-snap-align: start; background: none; }
  html body .film .main > .sqw .sqb .sqc { display: none !important; }
  html body .film .main > .sqw .sqb .sql,
  html body .film.started .main > .sqw .sqb .sql {
    position: relative;
    inset: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 23px;
    min-height: 0;
    padding: 0 10px 0 9px;
    border-radius: 999px;
    background: #F1F1EF !important;
    color: #3B3E40 !important;
    box-shadow: none !important;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    transition: background-color .35s ease, color .35s ease;
  }
  html body .film .main > .sqw .sqb .sql em,
  html body .film.started .main > .sqw .sqb .sql em { font-size: 10.5px; color: #A7A5A6 !important; letter-spacing: .02em; transition: color .35s ease; }
  html body .film .main > .sqw .sqb.now .sql,
  html body .film.started .main > .sqw .sqb.now .sql { background: #FFDB4D !important; color: #1B1D1F !important; }
  html body .film .main > .sqw .sqb.now .sql em,
  html body .film.started .main > .sqw .sqb.now .sql em { color: #1B1D1F !important; }
  /* the hashmark meets the middle of its bookmark; it turns dark once the film reaches it */
  html body .film .main > .sqw .sqb .sql::before { content: ""; position: absolute; left: 50%; bottom: 100%; width: 1px; height: 10px; background: #DAD9D5; transition: background-color .35s ease; }
  html body .film .main > .sqw .sqb.mpast .sql::before,
  html body .film .main > .sqw .sqb.now .sql::before { background: #1B1D1F; }
}
/* Phone controls follow the same concept: a small play button with the time, no seek bar (the bookmark line is the progress bar),
   the strip right under it, and the chapter's one-liner under the strip in place of the description card. */
@media (max-width: 640px) {
  html body .film.film .rgrid .main { gap: 0 !important; }
  html body .film .main > .rbar { margin-top: 12px !important; gap: 10px; }
  html[data-variant] body .film .rbar .trk { display: none !important; }
  html[data-variant] body .film .rbar .play { width: 28px; height: 28px; }
  html[data-variant] body .film .rbar .play svg { width: 10px; height: 10px; }
  html[data-variant] body .film .rbar .time { display: block; font: 400 13px/1 var(--body); color: #A7A5A6; font-variant-numeric: tabular-nums; }
  html body .film .rgrid .main > .sqw { margin-top: 14px !important; }
  html body .film .rgrid .main > .mcap { display: block; order: 3; margin: 4px 0 0; min-height: 2.9em; font: 400 13.5px/1.45 var(--body); color: #3B3E40; }
  html body .film .rgrid .main > .bdesc { display: none !important; }
}
@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  html body .film .main > .sqw .sqb .sql,
  html body .film .main > .sqw .sqb .sql::before,
  html body .film .main > .sqw .sqb .sql em { transition: none; }
}
