/* ==========================================================================
   TEXTURE BANDS: the strips that join a black section to a paper one.
   Two kinds, used in turn down each page: a halftone fade (a collage of our pages and
   photographs breaking into dots, a different collage each time) and a run of ratios as
   worn, photocopied numerals (a different run each time).
   Both images are baked in advance (assets/texture/tx-*), so nothing filters live.
   data-dir="dl" goes dark to light, "ld" light to dark. In the light skin every section
   is white, so the bands print black (and blue) on white.
   ========================================================================== */
.tx { --tx-dark: var(--black); --tx-light: var(--paper); position: relative; z-index: 2; overflow: hidden; display: block; }

/* halftone fade */
.tx-halftone { height: clamp(9.375rem, 17.5vw, 20rem); background: var(--tx-dark); }
.tx-halftone::before { content: ""; position: absolute; inset: -1px 0; background: var(--tx-light); -webkit-mask: url("/assets/texture/tx-halftone.webp") center / cover no-repeat; mask: url("/assets/texture/tx-halftone.webp") center / cover no-repeat; }
/* every band down the site is cut from a different set of our pages */
.tx-halftone.tx-b::before { -webkit-mask-image: url("/assets/texture/tx-halftone-b.webp"); mask-image: url("/assets/texture/tx-halftone-b.webp"); }
.tx-halftone.tx-d::before { -webkit-mask-image: url("/assets/texture/tx-halftone-d.webp"); mask-image: url("/assets/texture/tx-halftone-d.webp"); }
.tx-halftone.tx-e::before { -webkit-mask-image: url("/assets/texture/tx-halftone-e.webp"); mask-image: url("/assets/texture/tx-halftone-e.webp"); }
.tx-halftone[data-dir="ld"]::before { transform: scaleY(-1); }

/* photocopied ratios: counter-changed across the join */
.tx-copy { font-size: clamp(6.5rem, 15.6vw, 18.75rem); height: 0.84em; background: linear-gradient(var(--tx-light) 50%, var(--tx-dark) 50%); }
.tx-copy[data-dir="dl"] { background: linear-gradient(var(--tx-dark) 50%, var(--tx-light) 50%); }
.tx-copy p {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; white-space: pre; /* pre: keeps the spaces either side of the <em> */
  font-family: var(--f-sans); font-weight: 900; font-stretch: 125%; font-size: 1em; line-height: 1; letter-spacing: -0.04em; word-spacing: 0.12em;
  background: linear-gradient(var(--tx-dark) 50%, var(--tx-light) 50%); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-mask: url("/assets/texture/tx-grain.webp") 0 0 / 26.25rem; mask: url("/assets/texture/tx-grain.webp") 0 0 / 26.25rem;
}
.tx-copy[data-dir="dl"] p { background-image: linear-gradient(var(--tx-light) 50%, var(--tx-dark) 50%); }
.tx-copy p em { font-style: normal; -webkit-text-fill-color: var(--accent); }

@media (prefers-color-scheme: light) {
  .tx { --tx-light: #ffffff; }
  .tx-copy, .tx-copy[data-dir="dl"] { background: #ffffff; }
  .tx-copy p, .tx-copy[data-dir="dl"] p { background-image: linear-gradient(var(--black) 50%, var(--accent-deep) 50%); }
  .tx-copy p em { -webkit-text-fill-color: var(--accent); }
}
