/* Next Tuesday Society: the shared layer.
   Tokens, the skeleton (header, footer), type, the section grammar, the
   ledger, and the CSS side of the behaviours (lift, draw-in, night-fall).
   World kits (worlds/*.css) only redefine the --w-* tokens and add their own
   entity; they never redefine what is below the tokens block.

   Contrast, body text: ink on beige 16.4:1; muted on beige 6.1:1; voice on
   beige 6.9:1; bone on ink 13.7:1; bone-muted and ochre on ink 6.9 and 8.2:1. */

/* ---------- 1. tokens ---------- */
:root {
  /* The colour code: the NTS chrome on every page draws only from these
     (the worlds keep their kits). Neutrals by role:
       beige      the page's ground
       plywood    the words band
       ink        the black of the sun's dial, the keylines, the ledger's
                  plate; type, sigils, links and
                  focus rings on the light grounds
       bone       the light of the bone dial and of text on the black
       bone-muted small text on the black
       muted      small text on the beige and the plywood
       voice      the italic voice, the secret and the hints on a light ground
       shade      the pyramid's lower face, a shadow of the Philo grey
       etch       the faint geometry: the sunburst and the star on stop
     The code: each initiative has its colour, wherever it appears (orbit
     dots, pyramid faces, marks):
       embers     red, EMBERS (the rave): fire
       philo      grey, NOT NOT PHILO (the salons)
       intersect  phosphor, INTERSECT
       events     ochre, the events and what is yet to come; also the eye,
                  the north, and the hints and upcoming dates on the black
       sky        the sun's inner band, no initiative
       reserve    green, for what is none of the above (experiments) */
  --pal-beige: #f4ecdc;
  --pal-plywood: #e6d8c0;
  --pal-ink: #141312;
  --pal-bone: #e8dcc6;
  --pal-bone-muted: #a59d8f;
  --pal-muted: #5e5a52;
  --pal-voice: #9e1430;
  --pal-shade: #55544f;
  --pal-etch: #77726a;
  --code-embers: #e51d47;
  --code-philo: #858481;
  --code-intersect: #e9e2cf;
  --code-events: #d9a414;
  --pal-sky: #3a8fc6;
  --pal-reserve: #2f9a5a;

  /* the worlds, for use outside their pages (ledger marks, fragments) */
  --embers-night: #0b0709;
  --embers-plum: #2a0a22;
  --embers-fire: #e51d47;
  --embers-ember: #f2591b;
  --embers-cream: #ffe9d0;
  --philo-ground: #e6e6e8;
  --philo-ink: #2b2d3e;
  --philo-red: #e5174a;
  --philo-red-text: #c0103a;
  /* the key word's red: the posters' red nudged (dE 1) so it holds 3:1 on its
     own charcoal plate and on the grey (3.05, 3.57); --philo-red stays put
     because white on the bar needs it that dark */
  --philo-red-key: #e81e4c;
  --intersect-black: #0a0a0a;
  --intersect-phosphor: #e9e2cf;
  --intersect-fire: #ff3b63;
  --intersect-fire-text: #c8103a;
  /* the title's ">": the fire nudged (dE 1) so it holds 3:1 on the NTS paper
     and on the black (3.05, 5.4); one value in both states of the hero */
  --intersect-fire-key: #fa3b63;

  /* the world the page is in: NTS by default (its colours are the set
     after this block). World kits set these on [data-world] and on the root
     when body is the world (so the canvas behind body, the scrollbar and
     color-scheme follow); the skeleton reads only these. */
  --w-sigil: "nts";
  /* depth: whatever stands off the ground (a bead, an orb, a lift) is lit
     from above. --w-rim lights the upper lip of what lifts as a card (a
     bead's edge is flat: one ring all round), --w-cast is the shadow it
     throws. A light ground can only show the shadow and a near-black one
     only the light, so each world sets the pair so the two edges carry the
     same contrast against its ground: the dark worlds' lip is as strong as
     the light worlds' shadow (tests/behaviour/orbs.spec.mjs measures it).
     --w-deep is the inside of the world, deeper than its ground: the colour
     an orb's well falls away to. */
  --w-deep: var(--pal-ink);

  /* type. Fraunces is the display face and Instrument Sans the text face,
     everywhere by default. IM Fell lives only inside INTERSECT. Archivo is
     the voice two worlds brought with them (EMBERS' extended flyer caps,
     NOT NOT PHILO's poster bold). The mono sets dates, the hacker layer and
     the ASCII solid. A page loads only the families it uses, in one Google
     Fonts link. */
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-text: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --font-intersect: "IM Fell DW Pica", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-flyer: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Red Hat Mono", ui-monospace, Menlo, Consolas, monospace;
  /* Fraunces' axes by role: display is cut sharp (opsz 144, SOFT 40), the
     italic voice soft (SOFT 100), small display in between; WONK 1 keeps the
     wonky alternates on in every role */
  --fraunces-display: "opsz" 144, "SOFT" 40, "WONK" 1;
  --fraunces-voice: "opsz" 48, "SOFT" 100, "WONK" 1;
  --fraunces-small: "opsz" 24, "SOFT" 50, "WONK" 1;
  --font-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --text: 1.0625rem;
  --measure: 38rem;

  /* space */
  /* clear of the side safe areas (a notch, a phone held sideways); 0 elsewhere */
  --gutter: max(clamp(16px, 5vw, 48px), env(safe-area-inset-left), env(safe-area-inset-right));
  --wrap: 72rem;
  --section: clamp(3.5rem, 9vw, 7rem);
  --bar-h: 3.25rem;

  /* lines: the width of every line of the home emblem and of the beads.
     A line scales with its figure, so it is a number in the figure's own unit:
     eu, the emblem's (1/202 of its box, 100cqi / 202: 1.60px at 390, 2.80px at
     1440); sigil/64, a sigil's; glyph/14, the star bead's glyph's. CSS cannot
     divide a length by a length, and a non-scaling stroke would put the dashes
     in px and stop the beam's growth, so none of them is a px length. Lines
     that do not scale are px. Each comment starts with the token's unit. */
  /* The emblem's lines come in three weights (eu), and every line token below
     is one of them; the two exceptions keep their own value for their reason
     (--line-seam, --line-ring). A weight is not a line: the token names the
     line, the weight names the value. */
  --weight-fine: .3;                        /* eu: the faintest lines: the dial's minor marks, the sunburst, the chalk's second and third passes */
  --weight-mid: .483;                       /* eu: the default line. Set so the chalk star draws a bead sigil's line at 1440: 2.4 (sigil/64) * 58% of a 62.22px bead face / 64 ≈ 1.353px, over 2.8006px per eu */
  --weight-bold: .9;                        /* eu: the emphasized lines: keylines, the major marks, the pyramid's edge, the beam, the dotted orbit */
  --line-keyline: var(--weight-bold);       /* eu: the band keylines and the north; the generator spaces the bands by it */
  --line-tick: var(--weight-fine);          /* eu: the dial's and the bezel's minor marks, filled quads the generator draws this wide */
  --line-tick-5: var(--weight-mid);         /* eu: the dial's marks every 5 */
  --line-tick-15: var(--weight-bold);       /* eu: the dial's marks every 15 */
  --line-bezel-5: var(--weight-bold);       /* eu: the bezel's marks every 5 */
  --line-outline: var(--weight-mid);        /* eu: drawn objects, the pyramid, the eye, the star dots (the live tetrahedron's 2 on 108) */
  --line-outline-edge: var(--weight-bold);  /* eu: the pyramid's edge in the other ink under the faces, the outline and about .2 each side */
  --line-seam: .25;                         /* eu: a face stroked in its own ink, which closes the seams between faces; its width is the gap it covers, not a weight */
  --line-ring: 1.5;                         /* eu: the dotted ring, its dots' size, not a weight */
  --line-rays: var(--weight-fine);          /* eu: the sunburst */
  --line-beam: var(--weight-bold);          /* eu: the eye's beam at its full size (orrery.css converts it to the beam's box) */
  --line-orbit: var(--weight-mid);          /* eu: the inner orbit and the red outer one */
  --line-orbit-dash: var(--weight-mid);     /* eu: the dashed orbit (78.4) */
  --line-orbit-dot: var(--weight-bold);     /* eu: the dotted orbit (84) */
  --line-halo: var(--weight-mid);           /* eu: a star dot's hover halo */
  --line-pulse: var(--weight-mid);          /* eu: the pulsing star dot's ring, a border (snaps to whole px) */
  --line-chalk: var(--weight-mid);          /* eu: the star drawn on stop, its chalk's main pass */
  --line-chalk-mid: var(--weight-fine);     /* eu: the chalk's second pass */
  --line-chalk-fine: var(--weight-fine);    /* eu: the chalk's third pass */
  --line-sigil: 2.4;                        /* sigil/64: every sigil, everywhere; in a bead, 58% of it */
  --line-star-bead: .4614;                  /* glyph/14: the star bead's keyline (its glyph is 66% of the bead), the sigil's line there */
  --line-bead-ring: .75px;                  /* px: the face's edge ring, inside the face, with .5px ramps */
  --line-bead-seal: 2.25px;                 /* px: the seal on hover and focus, with .25px ramps */
  --line-bead-hint: 1px;                    /* px: the ring that grows off a bead now and then */

  /* motion. --ease-lift/--dur-lift/--lift-y: the card lift (ease, 250ms, -4px). */
  --ease-lift: ease;
  --dur-lift: 250ms;
  --lift-y: -4px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-turn: cubic-bezier(.65, 0, .15, 1);
  --dur-draw: 1.6s;
  /* the world bleed-in (section 11): how long a part outside the hero
     (the header) takes to cross to the world's colours as the disc passes */
  --dur-bleed-fade: 200ms;

  /* the ✴︎ mark as a mask, for pseudo-elements (the sprite covers markup) */
  --star-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M32 6L35.25 28.75L58 32L35.25 35.25L32 58L28.75 35.25L6 32L28.75 28.75Z'/%3E%3C/svg%3E");
}

/* The NTS colours, in the colour code: the default world (the home,
   /events/) and the NTS state a world page opens in when reached from the
   home (section 11) read this one set, so the hand-over from the home to a
   world is seamless. World kits set theirs on [data-world] (and on the
   root at no more than :root's weight); the arrival selectors outrank them.
   The root keeps the NTS set until the world settles ("before" and "in"):
   its ground is what the arrival's view transition crossfades over, so a
   world's ground there would darken the whole page for the crossfade.
   Accent and accent text are ink: the voice and the ochre mark hints by
   name. */
:root, html[data-bleed-state="before"], html[data-bleed-state="in"], html[data-bleed-state="before"] [data-world], html[data-bleed-state="in"] .nts-bleed-old {
  --w-bg: var(--pal-beige);
  --w-bg-2: var(--pal-plywood);
  --w-fg: var(--pal-ink);
  --w-muted: var(--pal-muted);
  --w-accent: var(--pal-ink);
  --w-accent-text: var(--pal-ink);
  --w-link: var(--pal-ink);
  --w-line: color-mix(in srgb, var(--pal-ink) 18%, transparent);
  --w-line-strong: color-mix(in srgb, var(--pal-ink) 42%, transparent);
  --w-selection: var(--pal-ink);
  --w-selection-fg: var(--pal-bone);
  --w-bar-bg: color-mix(in srgb, var(--pal-beige) 86%, transparent);
  --w-bar-fg: var(--pal-ink);
  --w-rim: rgb(255 255 255 / .5);
  --w-cast: color-mix(in srgb, var(--pal-ink) 30%, transparent);
}
/* the ledger's black plate (the home's "Yet to come", /events/): bone text,
   ochre for what is yet to come; the rest of it is in apertures.css */
.ledger-ap {
  --w-bg: var(--pal-ink);
  --w-fg: var(--pal-bone);
  --w-muted: var(--pal-bone-muted);
  --w-accent: var(--pal-bone);
  --w-accent-text: var(--code-events);
  --w-link: var(--pal-bone);
  --w-line: color-mix(in srgb, var(--pal-bone) 18%, transparent);
  --w-selection: var(--pal-bone);
  --w-selection-fg: var(--pal-ink);
}

/* ---------- 2. ground ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--w-bg);
  color: var(--w-fg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--w-line-strong) var(--w-bg);
  scrollbar-width: thin;
  scroll-padding-top: calc(var(--bar-h) + 1rem);
  accent-color: var(--w-accent);
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--w-bg);
  color: var(--w-fg);
  font-family: var(--font-text);
  font-size: var(--text);
  line-height: 1.55;
  font-kerning: normal;
  overflow-x: clip;
}
::selection { background: var(--w-selection); color: var(--w-selection-fg); }
:focus-visible { outline: 2px solid var(--w-accent-text); outline-offset: 4px; border-radius: 2px; }
::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-thumb { background: var(--w-line-strong); border-radius: 9px; }
::-webkit-scrollbar-track { background: var(--w-bg); }
a { color: var(--w-link); text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: .18em; text-decoration-thickness: 1px; transition: color 160ms, text-decoration-color 160ms; }
a:hover { text-decoration-color: currentColor; }
img, svg, canvas { display: block; max-width: 100%; }
p { margin: 0 0 1em; text-wrap: pretty; }
em { font-style: italic; }
strong { font-weight: 600; }
.emoji { font-family: var(--font-emoji); font-style: normal; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.prose { max-width: var(--measure); }
.prose > :last-child { margin-bottom: 0; }

/* ---------- 3. type ---------- */
/* Roles: display (h1-h3, .display), the italic voice (.incant, .whisper, the
   reveals), text (body, .lede), labels (.label, .caps), mono. Fraunces gets
   its axes from the role tokens above; a world that brings its own display
   face overrides the family and resets font-variation-settings. */
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 600; font-variation-settings: var(--fraunces-display); line-height: 1.02; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 10vw, 5.5rem); font-weight: 700; letter-spacing: -.015em; line-height: .95; }
h2 { font-size: clamp(1.9rem, 5.5vw, 3rem); }
h3 { font-size: clamp(1.3rem, 3.4vw, 1.65rem); font-variation-settings: "opsz" 48, "SOFT" 40, "WONK" 1; }
.caps { text-transform: uppercase; letter-spacing: .06em; }
h1.caps { letter-spacing: -.005em; }
.incant { font-family: var(--font-display); font-style: italic; font-weight: 400; font-variation-settings: var(--fraunces-voice); font-size: clamp(1.25rem, 3.4vw, 1.75rem); line-height: 1.3; letter-spacing: 0; }
.lede { font-size: clamp(1.15rem, 2.6vw, 1.35rem); line-height: 1.45; }
.label { font-family: var(--font-text); font-weight: 600; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; }
.whisper { font-family: var(--font-display); font-style: italic; font-variation-settings: var(--fraunces-voice); color: var(--w-muted); font-size: 1.05rem; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.mark { color: var(--w-accent); font-family: var(--font-display); font-variation-settings: var(--fraunces-display); }

/* ---------- 4. sigils ---------- */
.nts-sigil { width: 1.5em; height: 1.5em; flex: none; color: var(--w-accent); overflow: visible; stroke-width: var(--line-sigil); }
.nts-sigil use { stroke-linecap: round; }
.nts-sigil.lg { width: 3.5rem; height: 3.5rem; }
.nts-sigil.xl { width: clamp(4.5rem, 14vw, 7rem); height: clamp(4.5rem, 14vw, 7rem); }
/* nts:sigils */
.sigil-embers { color: var(--embers-fire); }
.sigil-philo { color: var(--philo-red); }
.sigil-intersect { color: var(--intersect-fire-text); }
/* /nts:sigils */
.sigil-nts { color: var(--w-accent); }

/* ---------- 5. the skeleton: header ---------- */
.nts-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--w-bar-bg);
  color: var(--w-bar-fg);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color 400ms;
}
.nts-header.is-scrolled { border-bottom-color: var(--w-line); }
.nts-header .bar {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem 1rem;
  min-height: var(--bar-h);
}
.nts-header a { color: inherit; text-decoration: none; }
.nts-home { display: inline-flex; align-items: center; gap: .6rem; padding: .5rem 0; min-height: 44px; }
.nts-home .nts-sigil { width: 1.75rem; height: 1.75rem; color: var(--w-accent); transition: transform 2.2s var(--ease-turn); }
.nts-home:hover .nts-sigil, .nts-home:focus-visible .nts-sigil { transform: rotate(51.43deg); }
.nts-home .wordmark { font-family: var(--font-display); font-weight: 600; font-variation-settings: var(--fraunces-small); font-size: 1.15rem; letter-spacing: -.005em; line-height: 1; white-space: nowrap; padding-top: .1em; }
.nts-nav { display: flex; gap: 0 clamp(.6rem, 2.5vw, 1.6rem); margin: 0; padding: 0; list-style: none; }
.nts-nav a {
  position: relative; display: inline-flex; align-items: center; gap: .4rem;
  min-height: 44px; padding: .2rem 0;
  font-family: var(--font-text); font-weight: 600; font-size: .72rem; line-height: 1.2; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
  transition: color 200ms;
}
/* the current page's marker: a 2px bar right under the label, on the
   text's own line (4px below the baseline), in the site's red. It belongs
   to the word, not to the bar's bottom edge. Hover and focus grow the same
   bar faintly in the text colour, from the label's centre. The current bar
   is an element (.nts-mark, from sync) so the page transition can move it;
   the label's ::after is only the hover bar, and the current link has none. */
.nts-nav a span { position: relative; }
.nts-nav a span::after, .nts-mark { position: absolute; left: 0; right: 0; top: calc(100% + .05em); height: 2px; border-radius: 1px; }
.nts-nav a span::after { content: ""; background: currentColor; opacity: 0; transform: scaleX(0); transform-origin: center; transition: opacity 200ms, transform 300ms var(--ease-out); }
.nts-nav a:hover span::after, .nts-nav a:focus-visible span::after { opacity: .5; transform: none; }
.nts-nav a[aria-current="page"] span::after { content: none; }
/* the site's red on every page, whatever the world's accent: the same bar
   from page to page, so it keeps its colour as it travels */
.nts-mark { background: var(--embers-fire); }
@media (max-width: 639px) {
  .nts-home .wordmark { display: none; }
  /* the destinations spread from the sigil to the gutter, as far from the
     sigil as from each other */
  .nts-header nav { flex: 1; }
  .nts-nav { justify-content: space-between; }
  .nts-nav a { font-size: .7rem; letter-spacing: .05em; }
}
@media (max-width: 359px) { .nts-nav a { font-size: .6875rem; letter-spacing: .01em; } .nts-nav { gap: 0 .4rem; } }

/* ---------- 6. the skeleton: footer ---------- */
.nts-footer {
  margin-top: var(--section);
  border-top: 1px solid var(--w-line);
  padding: clamp(2.5rem, 6vw, 4rem) 0 calc(1.5rem + env(safe-area-inset-bottom)); /* the page ends at the footer; clear of the home indicator */
  color: var(--w-fg);
}
.nts-footer .cols { display: grid; gap: 2rem 3rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .nts-footer .cols { grid-template-columns: 1.3fr 1fr 1fr; } }
.nts-footer h2 { font-size: 1.35rem; margin-bottom: .6rem; }
.nts-footer p { margin: 0 0 .35rem; }
.nts-footer .label { color: var(--w-muted); margin-bottom: .7rem; }
.nts-footer a { color: inherit; }
.nts-footer ul { list-style: none; margin: 0; padding: 0; }
.nts-footer li { margin: 0 0 .5rem; }
.nts-footer .worlds li a { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; min-height: 32px; }
.nts-footer .worlds li a:hover span { text-decoration: underline; text-underline-offset: .18em; }
.nts-footer .worlds .nts-sigil { width: 1.35rem; height: 1.35rem; }
.nts-footer .sign { margin-top: clamp(2rem, 5vw, 3rem); padding-top: 1.25rem; border-top: 1px solid var(--w-line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; align-items: baseline; }
.nts-footer .sign .small { font-size: .85rem; color: var(--w-muted); }
.nts-footer .signoff { font-family: var(--font-display); font-style: italic; font-variation-settings: var(--fraunces-voice); font-size: 1.25rem; margin: 0; }
.nts-footer .signoff .emoji { margin-right: .35em; }

/* ---------- 7. section grammar ---------- */
.sect { padding: var(--section) 0; }
.sect + .sect { padding-top: 0; }
.sect-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.25rem; }
.sect-head .mark { font-size: 1.6rem; line-height: 1; }
.sect-head h2 { margin: 0; }
.sect-head .nts-sigil { width: 2.25rem; height: 2.25rem; }
.rule { border: 0; height: 1px; background: var(--w-line); margin: 0; }
.rule.draw { transform-origin: left; }
.band { background: var(--band-bg, var(--w-bg-2)); color: var(--band-fg, var(--w-fg)); }
.band a { color: inherit; }
.band ::selection { background: var(--pal-ink); color: var(--pal-bone); }
.band :focus-visible { outline-color: var(--pal-ink); }

/* a link that leads somewhere, with the ✴︎ mark */
.go { display: inline-flex; align-items: center; gap: .55rem; font-weight: 600; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; color: var(--w-accent-text); min-height: 44px; }
.go .nts-sigil { width: .9rem; height: .9rem; color: currentColor; transition: transform 500ms var(--ease-out); }
.go:hover .nts-sigil, .go:focus-visible .nts-sigil { transform: rotate(90deg) scale(1.15); }
.go::after { content: "→"; font-family: var(--font-text); transition: transform 300ms var(--ease-out); }
.go:hover::after, .go:focus-visible::after { transform: translateX(4px); }
.band .go { color: inherit; }

/* a reveal on tap: the whisper */
details.reveal { margin-top: .5rem; }
details.reveal summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; color: var(--w-accent-text); font-weight: 600; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; }
details.reveal summary::-webkit-details-marker { display: none; }
details.reveal summary::before { content: ""; width: .9em; height: .9em; background: currentColor; -webkit-mask: var(--star-mask) center / contain no-repeat; mask: var(--star-mask) center / contain no-repeat; transition: transform 500ms var(--ease-out); }
details.reveal[open] summary::before { transform: rotate(180deg); }
details.reveal p { margin: .35rem 0 0; font-family: var(--font-display); font-style: italic; font-variation-settings: var(--fraunces-voice); font-size: 1.2rem; }

/* ---------- 8. the lift ---------- */
.lift {
  display: block; position: relative; text-decoration: none; color: inherit;
  border: 1px solid var(--w-line); border-radius: 14px;
  background: var(--card-bg, color-mix(in srgb, var(--w-bg) 70%, var(--w-bg-2)));
  transition: transform var(--dur-lift) var(--ease-lift), border-color var(--dur-lift), background-color var(--dur-lift);
}
/* lifted, it is lit from above (the depth tokens): the light on its lip and
   its shadow sit on a layer that fades in, so the hover is a transform and
   an opacity, never a repainted shadow */
.lift::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 1px 0 var(--w-rim), 0 12px 24px -12px var(--w-cast);
  opacity: 0; visibility: hidden; transition: opacity var(--dur-lift) var(--ease-lift), visibility 0s var(--dur-lift);
}
.lift:hover, .lift:focus-visible { transform: translateY(var(--lift-y)); border-color: var(--w-accent); }
/* hidden at rest, so the layer is not painted until it is wanted */
.lift:hover::after, .lift:focus-visible::after { opacity: 1; visibility: visible; transition-delay: 0s; }
.lift:active { transform: scale(.99); }
.lift:active::after { opacity: 0; }
.lift:focus-visible { outline-offset: 3px; }

/* ---------- 9. the ledger ---------- */
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger-group { margin: 0 0 clamp(2rem, 5vw, 3rem); }
.ledger-group > h2, .ledger-group > h3 { display: flex; align-items: center; gap: .8rem; margin: 0 0 1rem; font-size: clamp(1.5rem, 4vw, 2rem); }
.ledger-group > h2::after, .ledger-group > h3::after { content: ""; flex: 1; height: 1px; background: var(--w-line); }
.ledger li { position: relative; display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: .25rem 1rem; padding: 1.1rem 0; border-top: 1px solid var(--w-line); }
.ledger li:last-child { border-bottom: 1px solid var(--w-line); }
.ledger .nts-sigil { width: 1.9rem; height: 1.9rem; margin-top: .15rem; grid-row: span 4; }
.ledger .when, .ledger .what, .ledger .where, .ledger .line { grid-column: 2; }
.ledger .when { font-family: var(--font-mono); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; color: var(--w-muted); }
.ledger .what { font-family: var(--font-display); font-weight: 500; font-variation-settings: var(--fraunces-small); font-size: 1.35rem; line-height: 1.15; margin: 0; }
.ledger .what a { color: inherit; text-decoration: none; }
.ledger .what a:hover { text-decoration: underline; text-underline-offset: .15em; text-decoration-color: var(--w-accent); }
.ledger .where { font-size: .9rem; color: var(--w-muted); margin: 0; }
.ledger .line { margin: .3rem 0 0; font-size: .98rem; max-width: 44rem; }
.ledger .kind { display: inline-block; font-size: .7rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; padding: .15em .5em .1em; border-radius: 3px; margin-left: .5rem; vertical-align: .15em; color: var(--kind-fg, var(--w-fg)); background: var(--kind-bg, var(--w-line)); }
/* nts:kinds */
.ledger li[data-of="embers"] { --kind-bg: var(--embers-fire); --kind-fg: #fff; }
.ledger li[data-of="philo"] { --kind-bg: var(--philo-red); --kind-fg: #fff; }
.ledger li[data-of="intersect"] { --kind-bg: var(--intersect-black); --kind-fg: var(--intersect-phosphor); }
/* /nts:kinds */
.ledger li[data-of="nts"] { --kind-bg: var(--pal-ink); --kind-fg: var(--pal-bone); }
.ledger li.upcoming .when { color: var(--w-accent-text); }
@media (min-width: 720px) {
  .ledger li { grid-template-columns: 2.5rem 11rem minmax(0, 1fr); align-items: start; }
  .ledger .nts-sigil { grid-row: span 2; }
  .ledger .when { padding-top: .35rem; grid-row: span 2; }
  .ledger .what, .ledger .where, .ledger .line { grid-column: 3; }
}

/* ---------- 10. draw-in (Threshold's build-up, on entering view) ---------- */
/* Only when JS is there to add .is-in; otherwise everything is simply drawn. */
.js [data-nts-draw] svg, .js svg[data-nts-draw] { --draw-delay: 0ms; }
.js [data-nts-draw]:not(.is-in) .nts-sigil use, .js .nts-sigil[data-nts-draw]:not(.is-in) use,
.js [data-nts-draw]:not(.is-in) .drawn, .js [data-nts-draw]:not(.is-in) .drawn * { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js [data-nts-draw].is-in .nts-sigil use, .js .nts-sigil[data-nts-draw].is-in use,
.js [data-nts-draw].is-in .drawn, .js [data-nts-draw].is-in .drawn * { stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke-dashoffset var(--dur-draw) var(--ease-out) var(--draw-delay); }
.js [data-nts-draw="fade"]:not(.is-in) { opacity: 0; transform: translateY(8px); }
.js [data-nts-draw="fade"].is-in { opacity: 1; transform: none; transition: opacity 700ms ease var(--draw-delay), transform 900ms var(--ease-out) var(--draw-delay); }
.js .rule.draw:not(.is-in) { transform: scaleX(0); }
.js .rule.draw.is-in { transform: scaleX(1); transition: transform 1.2s var(--ease-out) var(--draw-delay); }
.js [data-nts-draw] .nts-sigil .dot, .js .nts-sigil[data-nts-draw] .dot { transition: opacity 400ms ease calc(var(--draw-delay) + var(--dur-draw)); }

/* ---------- 11. the world bleed-in ---------- */
/* A world page loaded with <script src="nts-head.js" data-bleed="scroll">
   and reached from the home starts in the NTS colours
   (html[data-bleed-state="before"]): every [data-world] on the page reads
   the NTS set of section 1, as the home does, and each kit undoes what else its world brings
   (EMBERS' glow, INTERSECT's grain). nts.js then makes the crossing (the
   "bleed" block there): from then on (data-bleed-state="in") the page is
   the world's except what carries .nts-bleed-old (the hero, and the header
   until the disc reaches it), which reads the same NTS tokens, and a copy
   of the hero in the world's colours (.nts-night) opens over it as a disc,
   on its own over a few seconds once the page is first scrolled, and not
   with the scroll. */
html:is([data-bleed-state="before"], [data-bleed-state="in"]), html[data-bleed-state="before"] [data-world], html[data-bleed-state="in"] .nts-bleed-old { color-scheme: light; }
/* text inherits the body's colour as a value, not its token */
html[data-bleed-state="in"] .nts-bleed-old { color: var(--w-fg); }
/* the hero's own ground until the world settles, full-bleed from the top
   of the page and ending at the hero's foot, where the world's begins */
html:is([data-bleed-state="before"], [data-bleed-state="in"]) main .hero { background: var(--w-bg); box-shadow: 0 0 0 100vmax var(--w-bg); clip-path: inset(-100vmax -100vmax 0 -100vmax); }
/* the night: the copy of the hero on the world's ground, over the hero and
   under the header, in document px (nts.js sizes it). The disc is scaled,
   the copy in it scaled back: both transforms, on layers of their own, so
   the animation runs without a paint */
body > .nts-night { position: absolute; left: 0; top: 0; z-index: 2; overflow: clip; pointer-events: none; user-select: none; -webkit-user-select: none; }
.nts-night-disc { position: absolute; border-radius: 50%; overflow: hidden; transform: scale(0); will-change: transform; }
.nts-night-in { position: absolute; background: var(--w-bg); color: var(--w-fg); will-change: transform; }
.nts-night * { view-transition-name: none !important; }
/* the parts outside the hero crossfade once the disc covers them. Only the
   part itself fades: what is inside it inherits the fading colour frame for
   frame. A transition on each level would restart whenever its parent's
   value moved, so the ink would trail its ground by one fade per level
   (labels dark on the new dark ground). Marks with a colour of their own
   (the accent) change at once */
html[data-bleed-state="in"] body > :not(main, footer, .nts-night) { transition: color var(--dur-bleed-fade) ease, background-color var(--dur-bleed-fade) ease, border-color var(--dur-bleed-fade) ease, box-shadow var(--dur-bleed-fade) ease, text-shadow var(--dur-bleed-fade) ease, fill var(--dur-bleed-fade) ease, stroke var(--dur-bleed-fade) ease; }
html[data-bleed-state="in"] body > :not(main, footer, .nts-night) * { transition: none; }

/* ---------- 12. shared keyframes ---------- */
@keyframes turn { to { transform: rotate(360deg); } }

/* ---------- 13. reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .js [data-nts-draw]:not(.is-in) .nts-sigil use, .js .nts-sigil[data-nts-draw]:not(.is-in) use, .js [data-nts-draw]:not(.is-in) .drawn, .js [data-nts-draw]:not(.is-in) .drawn * { stroke-dasharray: none; stroke-dashoffset: 0; }
  .js [data-nts-draw="fade"]:not(.is-in) { opacity: 1; transform: none; }
  .js .rule.draw:not(.is-in) { transform: none; }
  .lift:hover, .lift:focus-visible { transform: none; }
}
