/* INTERSECT: the hacker-mystic world. Black ground, phosphor-bone text, one
   red; a monospace for the hacker layer (labels, tables, the ASCII solid)
   and IM Fell, the only place it lives, for the title, the headings and the
   text. Loaded after nts.css. One token set; before the bleed-in (arrived
   from home) the page reads the NTS tokens from nts.css and the grain is
   off. The nav keeps the site's text face: only its colour is this world's.
   Contrast: phosphor on black 15.4:1, dim 6.6:1, fire-hi 5.6:1. */
[data-world="intersect"], :root:where(:has(> body[data-world="intersect"])) {
  --w-bg: #0a0a0a;
  /* The grained ground's average (#0a0a0a under the 7% screen grain,
     measured): the colour iPhone Safari samples from the body for its status
     strip, and the side bands WebKit paints from the sticky bar's colour (so
     the scrolled bar is this colour too, not the ground's #0a0a0a). The
     theme-color meta in intersect/index.html holds the same value, kept in
     step by hand; the L11 test in tests/layout/intersect-ground.spec.mjs
     compares them. */
  --w-bg-mean: #131313;
  --w-bg-2: #141412;
  --w-fg: #e9e2cf;
  --w-muted: #9c9684;
  --w-accent: #e51d47;
  --w-accent-text: #ff3b63;
  --w-link: #e9e2cf;
  --w-line: rgba(233, 226, 207, 0.16);
  --w-line-strong: rgba(233, 226, 207, 0.38);
  --w-selection: #e51d47;
  --w-selection-fg: #0a0a0a;
  --w-bar-bg: color-mix(in srgb, var(--w-bg-mean) 80%, transparent);
  --w-bar-fg: #e9e2cf;
  --w-sigil: "intersect";
  --w-rim: rgba(233, 226, 207, 0.34);
  --w-cast: rgba(0, 0, 0, 0.7);
  --w-deep: #000;
  --grain: .07;
  --grain-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.9 0 0 0 0 0.88 0 0 0 0 0.8 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: dark;
}
html[data-bleed-state="before"] [data-world="intersect"] { --grain: 0; }
/* The ground is a body::before layer, so body's own background can be the
   grained ground's mean: iPhone Safari samples the body's background for its
   status strip, and the mean is what the strip blends with. html (the
   overscroll canvas) takes it too, except while the bleed-in runs (`before`,
   `in`): the root's NTS ground is what the arrival's crossfade lies on, so
   no frame darkens. */
:root:where(:has(> body[data-world="intersect"])):not([data-bleed-state="before"], [data-bleed-state="in"]) { background: var(--w-bg-mean); }
body[data-world="intersect"] { background: var(--w-bg-mean); }
body[data-world="intersect"]::before { content: ""; position: absolute; inset: 0; z-index: 0; background: var(--w-bg); pointer-events: none; }
[data-world="intersect"] { font-family: var(--font-intersect); font-size: 1.1875rem; }
[data-world="intersect"] :is(h1, h2, h3, .display, .incant, .whisper, .mark, .ledger .what, details.reveal p) { font-family: var(--font-intersect); font-weight: 400; font-variation-settings: normal; letter-spacing: 0; }
[data-world="intersect"] .label, [data-world="intersect"] .go, [data-world="intersect"] .ledger .when { font-family: var(--font-mono); font-weight: 500; }
[data-world="intersect"] .nts-footer .label { font-family: var(--font-mono); }
[data-world="intersect"] strong { font-weight: 400; color: var(--w-accent-text); }

/* film grain, after the risograph pins: absolute, not fixed, so scrolling
   never repaints the whole screen. It is part of the world's ground, so it
   is on from the bleed-in's start, and while the disc opens it lies over the
   hero's night copy (z-index 3, above .nts-night): one layer for the disc and
   the page below it, the same tile at the same raster scale. A copy of it in
   the scaled copy would be resampled and read as a different texture. The
   bar has no grain layer of its own: at the top it is clear, so the page's
   grain shows through, and once scrolled its colour is the ground's mean
   (--w-bg-mean), which is what the eye sees of grained ground and also what
   WebKit paints into the side bands from the bar's colour. */
.intersect-grain { position: absolute; inset: 0; pointer-events: none; opacity: var(--grain); mix-blend-mode: screen; background-image: var(--grain-tile); transition: opacity .4s ease; }
.intersect-grain { z-index: 0; }
html[data-bleed-state="in"] .intersect-grain { z-index: 3; }
html[data-bleed-state="world"] [data-world="intersect"] .nts-header:not(.is-scrolled) { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
[data-world="intersect"] { position: relative; }
/* above the grain; the header keeps its own sticky position and z-index.
   :where() keeps the specificity of the old `> *`, so page rules still win. */
[data-world="intersect"] > :where(:not(.nts-header, .intersect-grain, .nts-night)) { position: relative; z-index: 1; }

/* the ASCII solid */
/* the solid fills the orbit ring; the margins (percentages of the entity's
   width, on every side) pad it out to the same square box as the other figures */
/* the entity is the size the ring is measured from (orrery.css) */
.intersect-hero .entity { container-type: inline-size; }
pre[data-nts-ascii] {
  display: block; margin: calc((100% - var(--ring)) / 2) auto;
  width: var(--ring); aspect-ratio: 1; overflow: hidden;
  /* the baked still's glyphs at the live glyphs' size: data-cols (52)
     cells of the mono's 0.6em advance span the ring. --ring's 100% means
     a font size here, so its formula is repeated on the entity's width
     (100cqi); the L3 still test in tests/layout/ascii.spec.mjs checks it */
  font-family: var(--font-mono); font-weight: 700; line-height: 1; font-size: calc((min(100cqi, 92svh) - var(--ring-inset)) / 31.2);
  color: var(--w-fg); white-space: pre; user-select: none; -webkit-user-select: none;
  touch-action: pan-y;
}
pre[data-nts-ascii].is-grab { cursor: grab; }
pre[data-nts-ascii].is-grabbing { cursor: grabbing; }

/* live, ascii.js draws the glyphs on a canvas over the pre's box, in the
   pre's computed colour, without a glow; the
   baked still text stays in the pre for scripts off, hidden once live */
:is(pre[data-nts-ascii], [data-nts-fragment="intersect"] pre) { position: relative; }
:is(pre[data-nts-ascii], [data-nts-fragment="intersect"] pre) > canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
:is(pre[data-nts-ascii], [data-nts-fragment="intersect"] pre).is-live > .ascii-still { visibility: hidden; }
/* the page's solid overshoots its ring at its widest poses, as the other
   worlds' figures do: its canvas reaches past the pre, which ascii.js
   reads. It is what the fit uses and no more (its area is drawn every
   frame): the solid's furthest reach plus a cell and a half on each side,
   68 columns across and 42 rows down at 52 columns of a 0.6em face (a
   cell snapped to device pixels changes the count, not the figure's size) */
pre[data-nts-ascii].is-live { overflow: visible; }
pre[data-nts-ascii] > canvas { inset: -17.6% -16.2%; width: 132.4%; max-width: none; height: 135.2%; }
/* the canvas's empty margin may pass the screen's edge on a phone (the
   glyphs stay inside it): the page clips what would scroll sideways, at
   the screen's edge rather than the hero's, which is inside the gutters */
body[data-world="intersect"] > main { overflow-x: clip; }

/* the hacker table: a correspondence of worlds */
.corr { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: .85rem; }
.corr th, .corr td { text-align: left; padding: .7rem .6rem .7rem 0; border-bottom: 1px solid var(--w-line); vertical-align: top; }
.corr th { font-weight: 500; color: var(--w-muted); font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; }
.corr td.g { color: var(--w-accent-text); width: 2.5rem; font-family: var(--font-intersect); font-size: 1.3rem; line-height: 1; }
.corr a { color: inherit; text-decoration-color: var(--w-accent); }

/* the fragment */
[data-nts-fragment="intersect"] { container-type: inline-size; position: relative; aspect-ratio: 1; width: 100%; background: var(--frag-bg, #0a0a0a); color: #e9e2cf; overflow: hidden; border-radius: inherit; display: grid; place-items: center; padding: 4%; }
[data-nts-fragment="intersect"] .still { width: 100%; height: 100%; display: grid; place-items: center; }
[data-nts-fragment="intersect"] pre { margin: 0; width: 100%; aspect-ratio: 1; font-family: var(--font-mono); font-weight: 700; line-height: 1; white-space: pre; overflow: hidden; font-size: calc(100cqi / 31.2); }
/* as the page's: 52 cells (ascii.js's fragment default) of 0.6em span the box */
