/* TVI scroll edition: the review's own stills fill the screen behind the text and change as the
   reader moves through the piece. Standard for reviews from 2026-11-26 (Jordan). Applied by
   tools/apply-scroll-reviews.py, which marks the page with body[data-scroll-edition] and adds the
   stage with the cover; /assets/scroll-review.js adds the other stills and drives them.
   Screen only: print keeps the standard page (the kids print kit depends on it). */

@media screen {
  body[data-scroll-edition] { background: #141414 !important; }

  .tvi-stage { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: #141414; transition: opacity 1.2s ease; }
  .tvi-stage.dim { opacity: .16; }
  /* A still that is neither showing nor fading out is hidden, so the browser can drop its layer; only the
     showing and the held still are promoted (2026-11-27, Sita glitch: a GPU layer per still blanked phones). */
  .tvi-layer { position: absolute; inset: -8%; background-size: cover; background-position: center; opacity: 0; visibility: hidden; }
  .tvi-layer.on { opacity: 1; visibility: visible; will-change: opacity, transform; }
  .tvi-layer.held { opacity: 1; visibility: visible; transition: none; }
  .tvi-tint, .tvi-shade, .tvi-vignette { z-index: 1000000; }
  /* Bright stills (manuscripts, daylight, snow) are taken down so the text keeps its contrast. */
  /* Only the arriving still fades (in, over the held one); a released still leaves at once, so a fast reader
     never has a stack of stills fading out together. */
  .tvi-layer { transition: none; }
  .tvi-layer.on { transition: opacity 1.3s ease, filter 1.2s ease; }
  .tvi-stage.bright .tvi-layer.on { filter: brightness(.62) saturate(.9); }
  .tvi-tint { position: absolute; inset: 0; background: var(--scene, #C17F3E); mix-blend-mode: soft-light; opacity: .16; transition: background-color 1.2s ease; }
  .tvi-shade { position: absolute; inset: 0; transition: opacity .9s ease;
    background: linear-gradient(90deg, rgba(14,14,14,.28) 0%, rgba(14,14,14,.72) calc(50% - 540px), rgba(14,14,14,.72) calc(50% + 540px), rgba(14,14,14,.28) 100%); }
  .tvi-stage.open .tvi-shade { opacity: .62; }
  /* A bright still (daylight, snow) keeps more shade on the title screen so the dek stays readable. */
  .tvi-stage.open.bright .tvi-shade { opacity: .9; }
  .tvi-vignette { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(14,14,14,.55), transparent 22%), linear-gradient(180deg, rgba(14,14,14,.42), transparent 16%); }

  body[data-scroll-edition] > :is(.wrap, .layout-wrap, footer) { position: relative; z-index: 1; }
  body[data-scroll-edition] .review-backdrop { display: none; }
  body[data-scroll-edition] > footer { background: #141414; }

  /* Opening: the cover is the background, so the title sits low on the first screen. */
  body[data-scroll-edition] .wrap { display: flex; flex-direction: column; }
  body[data-scroll-edition] .wrap > * { min-width: 0; }
  body[data-scroll-edition] .wrap > :is(.breadcrumb, .eyebrow, .article-title, .article-subtitle, .article-meta) { order: -1; }
  body[data-scroll-edition] .wrap > .breadcrumb { margin-top: 44svh; }
  body[data-scroll-edition] .wrap > :is(.review-cover, .cover-cap) { display: none; }
  body[data-scroll-edition] .article-title { font-size: clamp(42px, 6.4vw, 74px); line-height: 1.02; text-shadow: 0 2px 30px rgba(0,0,0,.7); }
  body[data-scroll-edition] :is(.article-subtitle, .article-meta, .breadcrumb, .eyebrow) { text-shadow: 0 1px 16px rgba(0,0,0,.8); }
  body[data-scroll-edition] .article-meta { margin-bottom: 14vh; }
  /* Flagship layout (contents rail beside the essay): the whole grid starts low. */
  body[data-scroll-edition] .layout-wrap { padding-top: 44svh; }
  body[data-scroll-edition] .layout-wrap .review-cover { display: none; }
  @media (max-width: 1000px) { body[data-scroll-edition] .layout-wrap > .toc-rail { order: 1; } }
  body[data-scroll-edition] .toc-rail { background: rgba(20,20,20,.72); padding: 14px 16px; border-radius: 12px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

  /* Boxes keep their own styling and gain a dark ground so they read over the art. */
  body[data-scroll-edition] :is(.watching-resources, .reader-tools, .score-card, .answer-first, .score-table-wrap, aside[data-editorial-decision], .capture, .keep-reading, .dq-box, .editor-note, .score-callout, .author-card, .newsletter, .nl-box, .format-decision, .format-path, .score-note) {
    background-color: rgba(20,20,20,.8); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-radius: 14px; }
  body[data-scroll-edition] .reader-tools { padding: 14px 18px; }

  body[data-scroll-edition] :is(.lead-body, .article-body, .wrap) > :is(p, ul, ol) { text-shadow: 0 1px 3px rgba(0,0,0,.9), 0 1px 16px rgba(0,0,0,.8); }

  /* With the script running, the stills move off the page and into the stage. */
  body.tvi-live .tvi-plate { display: none; }
  body.tvi-live h2.tvi-breath { font-size: clamp(32px, 4.4vw, 50px); line-height: 1.08; margin: 26vh 0 5vh; text-shadow: 0 2px 34px rgba(0,0,0,.9), 0 0 2px rgba(0,0,0,.6); }
  body.tvi-live h2.tvi-breath::before { content: ""; display: block; width: 54px; height: 3px; background: var(--scene, #C17F3E); margin-bottom: 20px; transition: background-color 1.2s ease; }
  body.tvi-live :is(blockquote, .pullquote).tvi-breath { font-size: clamp(30px, 4vw, 46px); line-height: 1.16; font-style: italic; margin: 26vh 0; border-left-color: var(--scene, #C17F3E); text-shadow: 0 2px 34px rgba(0,0,0,.95), 0 0 2px rgba(0,0,0,.7); }
  body.tvi-live .tvi-essay > .lkvideo { margin: 8vh 0; }

  /* Tracks (2026-11-26, first used on Sita Sings the Blues): when a film tells its story in several
     visual styles, each paragraph carries data-track and its type shifts with the film's look, so the
     prose changes register where the animation does. Light touches only: the piece stays one read. */
  body.tvi-live .tvi-essay p[data-track] { padding-left: 20px; position: relative; transition: color .6s; }
  body.tvi-live .tvi-essay p[data-track]::before { content: ""; position: absolute; left: 0; top: .35em; bottom: .35em; width: 3px; border-radius: 3px; opacity: .85; }
  body.tvi-live .tvi-essay p[data-track="nina"] { font-size: 1.02em; letter-spacing: .005em; }
  body.tvi-live .tvi-essay p[data-track="nina"]::before { width: 8px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='40' viewBox='0 0 8 40'%3E%3Cpath d='M4 0c3 5-3 8 0 13s-2 9 1 14-3 8 0 13' fill='none' stroke='%23F5F0E8' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") repeat-y; }
  body.tvi-live .tvi-essay p[data-track="narrators"] { color: #E9D9B6; }
  body.tvi-live .tvi-essay p[data-track="narrators"]::before { width: 0; border-left: 3px dotted #C9A66B; border-radius: 0; }
  body.tvi-live .tvi-essay p[data-track="epic"] { font-family: 'Instrument Serif', Georgia, serif; font-size: 1.2em; line-height: 1.55; letter-spacing: .005em; }
  body.tvi-live .tvi-essay p[data-track="epic"]::before { width: 0; border-left: 4px double #C17F3E; border-radius: 0; }
  body.tvi-live .tvi-essay p[data-track="song"] { font-family: 'Instrument Serif', Georgia, serif; font-style: italic; font-size: 1.2em; line-height: 1.55; }
  body.tvi-live .tvi-essay p[data-track="song"]::before { background: var(--scene, #C17F3E); }
  body.tvi-live .tvi-essay p[data-track="intermission"] { text-align: center; padding: 0 6%; font-style: italic; }
  body.tvi-live .tvi-essay p[data-track="intermission"]::before { display: none; }
  body.tvi-live .tvi-essay p[data-track="frame"], body.tvi-live .tvi-essay p[data-track="outside"] { padding-left: 0; }
  body.tvi-live .tvi-essay p[data-track="frame"]::before, body.tvi-live .tvi-essay p[data-track="outside"]::before { display: none; }
  .tvi-track { position: fixed; left: 16px; bottom: 12px; z-index: 2; font: 700 11px/1 'DM Sans', sans-serif; letter-spacing: .14em; text-transform: uppercase;
    color: #F5F0E8; background: rgba(20,20,20,.72); border: 1px solid rgba(245,240,232,.16); border-radius: 99px; padding: 8px 12px; pointer-events: none;
    opacity: 0; transition: opacity .5s; }
  .tvi-track.on { opacity: 1; }
  .tvi-track::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--scene, #C17F3E); margin-right: 8px; vertical-align: 1px; }
  .tvi-stage.dim ~ .tvi-track { opacity: 0; }
  .tvi-credit { position: fixed; right: 16px; bottom: 12px; z-index: 2; max-width: 44vw; text-align: right; font: 400 11px/1.4 'DM Sans', sans-serif; color: rgba(245,240,232,.55); pointer-events: none; transition: opacity .6s; }
  .tvi-stage.dim ~ .tvi-credit { opacity: 0; }
  .tvi-credit.hold { opacity: 0 !important; }
  .tvi-bar { position: fixed; left: 0; top: 0; height: 3px; width: 0; z-index: 101; background: var(--scene, #C17F3E); transition: background-color 1.2s ease; }

  @media (max-width: 760px) {
    /* Phone contrast (2026-11-27): at .64 the brightest parts of eight Sita stills fell under 4.5:1 behind the
       text; .84 keeps every one above 5.5:1 before the text shadow. Headings still let more art through. */
    .tvi-shade { background: rgba(14,14,14,.84); }
    .tvi-stage.open .tvi-shade { opacity: .82; }
    /* Phones skip the two most expensive effects over moving art: the colour blend and the blurred boxes. */
    .tvi-tint { display: none; }
    body[data-scroll-edition] :is(.watching-resources, .reader-tools, .score-card, .answer-first, .score-table-wrap, aside[data-editorial-decision], .capture, .keep-reading, .dq-box, .editor-note, .score-callout, .author-card, .newsletter, .nl-box, .format-decision, .format-path, .score-note, .toc-rail) {
      -webkit-backdrop-filter: none; backdrop-filter: none; background-color: rgba(20,20,20,.92); }
    body[data-scroll-edition] .layout-wrap { padding-top: 30svh; }
    body[data-scroll-edition] .wrap > .breadcrumb { margin-top: 30svh; }
    /* On a phone the credit would sit on the text: show it only while the art is open. */
    .tvi-credit { max-width: 70vw; font-size: 10px; opacity: 0; }
    .tvi-stage.open:not(.dim) ~ .tvi-credit { opacity: 1; }
  }
  @media (prefers-reduced-motion: reduce) {
    .tvi-layer { transition: opacity .2s; transform: none !important; }
  }
}
@media print {
  .tvi-stage, .tvi-credit, .tvi-bar { display: none !important; }
}
