/* The original: Journey to the West and this retelling. The comparison reads across a gap:
   the classic on the left in woodcut black, the novel on the right in Wei's inks, and between
   them the two-inch seam every painting on this site is first seen through. */

.original-head .lede { max-width: 44rem; text-wrap: pretty; }
.wrap.narrow { max-width: 50rem; }
.original-classic .prose p + p, .original-invented .prose p + p { margin-top: 1em; }
.original-invented .btn-row { margin-top: 1.6rem; }
/* Headings break into even lines rather than leaving one word on the last; paragraphs avoid a
   lone last word where the browser can. */
.section-title { text-wrap: balance; }
.prose p, p.prose, .lede, .keeps-what, .changes td { text-wrap: pretty; }
.original-stops .section-title { margin-bottom: clamp(1rem, 2.5vh, 1.5rem); }

/* ---------------------------------------------------------------- what it keeps
   Each event of the classic as the classic has always been pictured: a hand-coloured woodblock
   print, shown whole and at once. The novel's own images open from the gap; the classic's never
   needed one. Under the print: the numeral, the event, and where the novel tells it, which sits
   at the foot of the card so the links of one row line up. */
.keeps-list {
  --gap-x: clamp(1.2rem, 2.5vw, 2rem);
  /* The wide card's columns: one card's width for the print (and the gutter after it, as its
     margin), then the numeral and the words, lined up with the cards above. */
  --wide: calc((100% - (var(--cols) - 1) * var(--gap-x)) / var(--cols) + var(--gap-x) - .6rem) 2.2rem minmax(0, 1fr);
  list-style: none; margin: clamp(1.5rem, 4vh, 2.5rem) 0 0; padding: 0;
  counter-reset: keep;
  display: grid; gap: clamp(1.8rem, 3.5vw, 2.6rem) var(--gap-x);
  grid-template-columns: minmax(0, 1fr);
}
/* Two cards to a row, then three (each at least 20rem wide). A card left alone on the last row
   ends the list across the whole row: its print where a card's would be, its words beside it
   (the same rules twice, for two columns and for three). */
@media (min-width: 44rem) {
  .keeps-list { --cols: 2; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
}
@media (min-width: 68rem) {
  .keeps-list { --cols: 3; }
}
@media (min-width: 44rem) and (max-width: 67.99rem) {
  .keeps-list > li:last-child:nth-child(2n+1) { grid-column: 1 / -1; grid-template-columns: var(--wide); grid-template-rows: auto auto 1fr; }
  .keeps-list > li:last-child:nth-child(2n+1) > .keeps-print { grid-row: 1 / -1; grid-column: 1; margin: 0 calc(var(--gap-x) - .6rem) 0 0; }
  .keeps-list > li:last-child:nth-child(2n+1)::before { grid-row: 1; grid-column: 2; }
  .keeps-list > li:last-child:nth-child(2n+1) > .keeps-what { grid-row: 1; grid-column: 3; }
  .keeps-list > li:last-child:nth-child(2n+1) > a.label { grid-row: 2; grid-column: 3; }
}
@media (min-width: 68rem) {
  .keeps-list > li:last-child:nth-child(3n+1) { grid-column: 1 / -1; grid-template-columns: var(--wide); grid-template-rows: auto auto 1fr; }
  .keeps-list > li:last-child:nth-child(3n+1) > .keeps-print { grid-row: 1 / -1; grid-column: 1; margin: 0 calc(var(--gap-x) - .6rem) 0 0; }
  .keeps-list > li:last-child:nth-child(3n+1)::before { grid-row: 1; grid-column: 2; }
  .keeps-list > li:last-child:nth-child(3n+1) > .keeps-what { grid-row: 1; grid-column: 3; max-width: var(--measure); }
  .keeps-list > li:last-child:nth-child(3n+1) > a.label { grid-row: 2; grid-column: 3; }
}
.keeps-list li {
  counter-increment: keep;
  display: grid; grid-template-columns: 2.2rem minmax(0, 1fr); grid-template-rows: auto 1fr auto;
  column-gap: .6rem; align-items: start;
}
/* Top-aligned, not by baseline: the brush numeral would otherwise push the first line down. */
.keeps-list li::before {
  grid-row: 2; grid-column: 1; margin-top: .22rem;
  content: counter(keep, cjk-ideographic); font-family: var(--f-brush); font-size: 1.25rem; color: var(--accent-2); line-height: 1;
}
.keeps-print {
  grid-row: 1; grid-column: 1 / -1; margin: 0 0 .9rem;
  aspect-ratio: 16 / 9; overflow: hidden; background: #e9dcc0;
  box-shadow: 0 0 0 1px rgba(26, 24, 16, .12), 0 14px 30px -18px rgba(26, 24, 16, .45);
}
.keeps-print picture, .keeps-print img { display: block; width: 100%; height: 100%; }
.keeps-print img { object-fit: cover; }
.keeps-what { grid-row: 2; grid-column: 2; line-height: 1.5; }
/* Where the novel tells it: a link, so it looks like one, and a whole 44 px to tap. */
.keeps-list a.label {
  grid-row: 3; grid-column: 2; justify-self: start;
  display: inline-flex; align-items: center; min-height: 2.75rem; margin-top: .2rem;
  color: var(--muted); white-space: nowrap;
  text-decoration: underline 1px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: .35em;
  transition: color .2s, text-decoration-color .2s;
}
.keeps-list a.label:hover, .keeps-list a.label:focus-visible { color: var(--accent-2); text-decoration-color: currentColor; }

/* ---------------------------------------------------------------- what it changes */
.changes-lede { margin: 1rem 0 clamp(1.5rem, 4vh, 2.5rem); }
/* The lede says how to read the table: across on a wide screen, down on a narrow one. */
.changes-lede-down { display: none; }
.changes {
  width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed;
  --seam: clamp(1.4rem, 3vw, 2.6rem);
}
.changes thead th {
  text-align: left; font-weight: 400; padding: 0 0 .9rem;
  font-family: var(--f-mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.changes thead th cite { font-style: normal; }
/* The seam's breadth on each side of it: the two columns only, never the topic rows. */
.changes thead th:first-child, .changes td:first-child { padding-right: var(--seam); }
.changes thead th:last-child, .changes td:last-child { padding-left: var(--seam); }
.changes-topic {
  text-align: left; font-weight: 400; padding: 1.4rem 0 .6rem;
  font-size: var(--step-1); letter-spacing: -.005em; border-top: 1px solid var(--rule);
}
.changes td { vertical-align: top; line-height: 1.55; padding: 0 0 1.3rem; position: relative; }   /* not the browser's 1px */
/* The classic's column: black woodcut ink on a warmer paper. */
.changes td:first-child { color: var(--ink-2); font-family: var(--f-body); }
/* The seam: a line of light between the two columns, the length of the row's words. */
.changes td:last-child::before {
  content: ""; position: absolute; left: 0; top: .25rem; bottom: 1rem; width: 1px;
  background: linear-gradient(180deg, rgba(212, 160, 32, .9), rgba(200, 32, 0, .35));
  box-shadow: 0 0 10px rgba(232, 184, 56, .35);
}
.changes .brush { font-size: 1.35em; vertical-align: -.1em; color: var(--red-4); }
/* A print in the classic's column only: the novel's side has no picture of him to show. */
.changes-print {
  margin: .3rem 0 .9rem; aspect-ratio: 16 / 9; overflow: hidden; background: #e9dcc0;
  box-shadow: 0 0 0 1px rgba(26, 24, 16, .12);
}
.changes-print picture, .changes-print img { display: block; width: 100%; height: 100%; }
.changes-print img { object-fit: cover; }

/* ---------------------------------------------------------------- the film */
.original-film .section-title { max-width: 26ch; margin: .8rem 0 clamp(1.5rem, 4vh, 2.5rem); }

/* ---------------------------------------------------------------- narrow screens: stacked
   Each change reads down: the topic, the classic under its name, then this novel under its
   name, set off by the seam running down its left edge. */
@media (max-width: 44rem) {
  .changes-lede-across { display: none; }
  .changes-lede-down { display: inline; }
  .changes, .changes tbody, .changes tr, .changes td, .changes th { display: block; width: auto; }
  .changes thead { display: none; }
  .changes-topic { padding: 1.3rem 0 .35rem; }
  .changes td:first-child, .changes td:last-child { padding: .45rem 0 .6rem; }
  .changes td:last-child {
    margin: .3rem 0 1.1rem; padding: .1rem 0 .2rem 1rem;
    border-left: 1px solid rgba(212, 160, 32, .8);
    border-image: linear-gradient(180deg, rgba(212, 160, 32, .9), rgba(200, 32, 0, .45)) 1;
  }
  .changes td:first-child::before, .changes td:last-child::before {
    position: static; display: block; width: auto; height: auto; background: none; box-shadow: none;
    font-family: var(--f-mono); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase;
    line-height: 1.35; color: var(--muted); margin: 0 0 .35rem;
  }
  .changes td:first-child::before { content: "Journey to the West"; }
  .changes td:last-child::before { content: "This novel"; }
  .changes-print { margin-top: .1rem; }
  .keeps-list li { grid-template-columns: 1.8rem minmax(0, 1fr); }
}
