/* ==========================================================================
   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.
   ========================================================================== */
.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); }

/* the bands sit close to the sections either side of them, so no section runs long around a join */
.tx + .sec { padding-top: calc(var(--sec-pad) * 0.55); }
.sec:has(+ .tx) { padding-bottom: calc(var(--sec-pad) * 0.55); }

/* ==========================================================================
   SUBTLE PRINT TEXTURES on elements, cut from the same baked images as the bands:
   worn photocopy specks in the orange buttons, paper grain on the paper sections,
   and a faded patch of halftone in a corner of some dark sections.
   ========================================================================== */
.btn-primary::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: var(--black); opacity: 0.22;
  -webkit-mask: url("/assets/texture/tx-grain.webp") 0 0 / 12rem, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: url("/assets/texture/tx-grain.webp") 0 0 / 12rem, linear-gradient(#000 0 0); mask-composite: exclude;
}
[data-theme="light"]:is(.sec, .process), .found, .work { position: relative; isolation: isolate; }
[data-theme="light"]:is(.sec, .process)::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: var(--black); opacity: 0.045;
  -webkit-mask: url("/assets/texture/tx-grain.webp") 0 0 / 26.25rem, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: url("/assets/texture/tx-grain.webp") 0 0 / 26.25rem, linear-gradient(#000 0 0); mask-composite: exclude;
}
.found::before, .work::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none; width: min(68rem, 80%); aspect-ratio: 2400 / 420;
  -webkit-mask: url("/assets/texture/tx-halftone-e.webp") center / cover no-repeat; mask: url("/assets/texture/tx-halftone-e.webp") center / cover no-repeat;
}
.found::before { top: 0; right: 0; background: var(--bone); opacity: 0.06; transform: scaleY(-1); }
.work::before { bottom: 0; left: 0; background: var(--accent); opacity: 0.09; }
