/* The two voices — spec §15.2, and the reader rebuild's roles (2026-09-25).
 *
 * The show has exactly two: a novel and a game-show AI. The novel is Newsreader — titles,
 * prose, names, the desk, section labels, buttons. The AI is IBM Plex Mono, and it is the
 * *only* monospace on the page: the System's cards, the ticker, clocks and countdowns, and
 * the numbers the world counts (turn, alive, HP, damage, tallies). Nothing sits between
 * them — a mid-size sans would make the page a dashboard.
 *
 * The roles (`.t-*`) are what a template or a builder reaches for; `.mono`, the one older
 * helper still worn (the gallery's code line), stays until nothing wears it.
 * Then the base pass: links, focus, headings, and the classes the renderer hands out —
 * a crawler's name, their face, and how hurt they are.
 */

/* --- the faces --------------------------------------------------------------------------- */

/* Ours, served from `static/fonts` (Latin subset, the OFL beside them), so the first screen waits
 * on no third party and the CSP names none (backlog #23). `optional` (the owner, 2026-10-15, over
 * the global `swap` rule, #23's font race: "fonts don't render well in the first frame"): a face
 * the browser has — every page after the first, cached — paints in the first frame; one it does not
 * have leaves that page in the fallback, which wears the face's own metrics below, so nothing ever
 * swaps in front of the reader. The `url()`s are relative to this file's place (`styles/`), which the page's one
 * bundle keeps (`broadcast/static_build.py`). Only the weights and styles the sheets ask for. */
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url("../fonts/newsreader-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 600;
  font-display: optional;
  src: url("../fonts/newsreader-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 400;
  font-display: optional;
  src: url("../fonts/newsreader-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: optional;
  src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: optional;
  src: url("../fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* The fallbacks, each Georgia (or Courier New) scaled and re-spaced to its face's measure:
 * `size-adjust` the average Latin advance, the three overrides the face's own ascent, descent
 * and line gap over that scale. Measured off the files (hhea metrics, English letter
 * frequencies), so a line wraps where it will wrap in the real face and the box is as tall. */
@font-face {
  font-family: "Newsreader Fallback";
  font-style: normal;
  font-weight: 400;
  src: local("Georgia");
  size-adjust: 96.07%;
  ascent-override: 76.51%;
  descent-override: 27.58%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Newsreader Fallback";
  font-style: normal;
  font-weight: 600;
  src: local("Georgia Bold"), local("Georgia-Bold");
  size-adjust: 86.47%;
  ascent-override: 85%;
  descent-override: 30.64%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Newsreader Fallback";
  font-style: italic;
  font-weight: 400;
  src: local("Georgia Italic"), local("Georgia-Italic");
  size-adjust: 87.45%;
  ascent-override: 84.05%;
  descent-override: 30.3%;
  line-gap-override: 0%;
}

/* Plex Mono is 0.6 em a character and so is Courier New: the scale is the identity. */
@font-face {
  font-family: "IBM Plex Mono Fallback";
  font-style: normal;
  font-weight: 400 600;
  src: local("Courier New"), local("CourierNewPSMT");
  size-adjust: 100%;
  ascent-override: 102.5%;
  descent-override: 27.5%;
  line-gap-override: 0%;
}

/* --- the roles ------------------------------------------------------------------------- */

/* The System's voice: a card's body, a vote's label, the crawl. */
.t-system {
  font-family: var(--font-system);
  font-variant-ligatures: none;
}

/* A number the world counted. Tabular, so a column of them lines up and a clock that ticks
 * does not shuffle the words beside it. */
.t-readout {
  font-family: var(--font-system);
  font-variant-ligatures: none;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* A sentence with numbers in it — "Over after 5 rounds", "8 got out · 21 caught on floor 10" — is
 * the page talking, so it is the serif (2026-10-08, TYPE, R18, the design review's finding #2):
 * words in monospace read as a terminal and dilute the System, the only monospace the show owns.
 * Tabular and lining figures keep a ticking count from shuffling the words beside it. `.t-readout`
 * is for a number with its unit (`lv 7`, `turn 295`, `collapses in 6h 12m`) and nothing longer. */
.t-figures {
  font-family: var(--font-prose);
  font-variant-numeric: tabular-nums lining-nums;
}

/* The show's section labels — serif caps, tracked, at the floor or one step above it, and
 * the faintest colour allowed to carry a word. Never mono: a label is the page talking. */
.t-label {
  font-family: var(--font-prose);
  font-size: var(--text-12);
  font-weight: 400;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--parchment-faint);
}

.t-label--14 {
  font-size: var(--text-14);
}

.t-h1 {
  font-family: var(--font-prose);
  font-size: var(--text-h1);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: var(--track-tight);
}

.t-h2 {
  font-family: var(--font-prose);
  font-size: var(--text-h2);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: var(--track-tight);
}

.t-lead {
  font-family: var(--font-prose);
  font-size: var(--text-lead);
  line-height: 1.35;
}

.t-prose {
  font-family: var(--font-prose);
  font-size: var(--text-prose);
  line-height: var(--leading-prose);
}

/* A line about a line: when, where, who else. Serif, one step down, and dim. */
.t-meta {
  font-family: var(--font-prose);
  font-size: var(--text-14);
  line-height: var(--leading-chrome);
  color: var(--parchment-dim);
}

/* --- the older helper ------------------------------------------------------------------- */

.mono {
  font-family: var(--font-system);
  font-size: var(--text-12);
  line-height: var(--leading-chrome);
  font-variant-ligatures: none;
}

/* --- the base pass ---------------------------------------------------------------------- */

h1,
h2,
h3 {
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration-color: var(--link-rest);
  text-underline-offset: 0.18em;
  transition: color var(--duration-fast) var(--ease-out);
}

/* A link pointed at comes up to the story's own ink, its rule drawn whole. Never acid: that is
 * the System speaking, and the pointer is the reader's (the reader rebuild's polish). */
a:hover {
  color: var(--parchment);
  text-decoration-color: currentColor;
}

/* One focus ring for the whole reader: the story's brightest ink, drawn clear of the element
 * so it frames rather than touches, and outside it so it never reflows what it is marking
 * (§15.4). Buttons and links share it deliberately — "where am I" should not depend on what
 * kind of control the answer is — and it is the reader's, so it is never the System's acid. */
:focus-visible {
  outline: 2px solid var(--parchment);
  outline-offset: 3px;
  border-radius: 1px;
}

/* A crawler's name, wherever it appears: the one link the page makes out of the world. The rule
 * is `--link-rule`, so the underline and the hover share one colour. It is the text's own underline
 * at every width, never a border under the link's box (TURNHEAD, backlog #13, R17): a border sits
 * under the box, so a name padded for a thumb dropped its rule 4 px below it, and on a roll of
 * names a row's rules sat on the next row's text (the fallen roll, 2026-10-15). `page_underline_close`
 * holds it within 0.35em of the baseline. */
.crawler-link {
  --link-rule: var(--link-rest);
  color: var(--parchment);
  text-decoration: underline 1px var(--link-rule);
  text-underline-offset: 0.3em;
}

/* A name in prose keeps its ring off its neighbours' glyphs (SR2-VISUAL, M33): "in|The Salt-Blind Reef|:" had
 * the 3 px ring pressing on the word and the colon, so a name wears 2 px of padding aside, paid back in
 * margin — the ring (1 px off, below) then stands in the space either side. */
.crawler-link:where(:not(.crawler-link--sigil)) {
  padding-inline: 2px;
  margin-inline: -2px;
}

/* A name is 15 px tall on a phone, under WCAG 2.5.8's 24 px (R17, TAPLIVE): 5 px above and below
 * is hit area only, since an inline box's padding adds no line height, and 2 px aside is paid
 * back in margin (the same 2 px as above). The underline is the text's own, which padding never moves. Not a background
 * line: that made a padded inline-block name a painted chip, read by its box (`page_overlap`,
 * 8 px on the intermission's wrapped fallen chips, B13-seeds s7). The face-and-name pair keeps its
 * own rule (below). One class of specificity (`:where`), so a component that sizes its own target
 * — those chips, 4 px paid back in margin (`intermission.css`) — keeps it. */
@media (max-width: 47.99em) {
  .crawler-link:where(:not(.crawler-link--sigil)) {
    padding: 5px 2px;
    margin-inline: -2px;
  }
}

.crawler-link:hover,
.crawler-link:focus-visible {
  --link-rule: var(--parchment);
  color: var(--parchment);
}

/* The ring of a link in a line of text stands 1 px off it, not 3: a name or a room beside a comma has no
 * room for more (M33). A room link has the same padding, so the same space. */
.crawler-link:focus-visible,
a[data-hover="room"]:focus-visible {
  outline-offset: 1px;
}

a[data-hover="room"]:where(:not(.minimap-room-link)) {
  padding-inline: 2px;
  margin-inline: -2px;
}

/* Every mention of the crawler under the pointer or the keyboard (`name_tint.js`, #31, R16): a marker
 * wash and a solid rule. The fade is the token's, so it is none under `prefers-reduced-motion`. A
 * link's rule is `--link-rule`; a prose host (a span) and a fight box's face have none of their own. */
.crawler-link,
.hover-host,
.fighter-face {
  transition:
    background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.name-tinted {
  --link-rule: var(--parchment);
  color: var(--parchment); /* whatever ink the name wore, the wash is judged against this one */
  background-color: var(--name-tint);
  border-radius: 1px;
}

.name-tinted:not(.crawler-link--sigil, .crawler-link--named, .fighter-face) {
  text-decoration: underline 1px var(--parchment);
  text-underline-offset: 0.3em;
}

/* A face and a name (a board row, a roster) tint the name alone: the link stretches the row's width, and
 * its wash read as a bar (the designer, L11; R16). The board's link draws its face beside it (`named`, AS1)
 * and stretches the row all the same. */
.name-tinted.crawler-link--sigil,
.name-tinted.crawler-link--named {
  background-color: transparent;
}

.name-tinted.crawler-link--sigil .crawler-link-name,
.name-tinted.crawler-link--named .crawler-link-name {
  background-color: var(--name-tint);
  border-radius: 1px;
}

.fighter-face.name-tinted {
  outline: 1px solid var(--name-tint-edge);
  outline-offset: 1px;
}

/* The name with its face (`parts.crawlerLink(…, {sigil: true})`), a link or the page's own
 * crawler. Aligned on the name's baseline, so the pair sits in a sentence like the name alone
 * would and names beside faces of different sizes line up; the face centres itself on the
 * line instead. The rule moves under the name, because a hairline under a picture is a line
 * under nothing. */
.crawler-link--sigil,
.crawler-self--sigil {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4em;
  max-width: 100%;
}

.crawler-link--sigil {
  text-decoration: none;
}

.crawler-link--sigil .crawler-link-name {
  min-width: 0;
  text-decoration: underline 1px var(--link-rule);
  text-underline-offset: 0.3em;
}

/* The page's own crawler, named in its own prose: not a link, not a card, just the name —
 * set apart from the running text only by weight, so the eye still finds who the line is
 * about without being offered a trip to the page it is already on. */
.crawler-self {
  font-weight: 600;
}

/* --- faces (`sigil.js`) ------------------------------------------------------------------- */

/* A rounded-square portrait tile (R88, R89): the server's image in a dark tile that is there before
 * the face is, so a slow face is a quiet square and never a broken-image icon. The tile is the size
 * class's — nothing in the image's own box moves it. A quiet edge is drawn over the picture
 * (`::after`); death greys the face and strikes the tile corner to corner in
 * blood (the strike rides the same overlay), and a crawler on air wears the live dot on the
 * shoulder (`::before`). */
.sigil {
  --sigil-px: 28px;
  position: relative;
  display: inline-block;
  flex: none;
  align-self: center;
  vertical-align: middle;
  inline-size: var(--sigil-px);
  block-size: var(--sigil-px);
  border-radius: 20%;
  background: var(--ink-2);
}

.sigil--20 {
  --sigil-px: 20px;
}

.sigil--28 {
  --sigil-px: 28px;
}

.sigil--40 {
  --sigil-px: 40px;
}

.sigil--64 {
  --sigil-px: 64px;
}

/* The cam's portrait (R89): the whole person, so a softer corner and a dot that stays a dot —
 * 26% of 160 would be a 42 px blob on the shoulder. */
.sigil--160 {
  --sigil-px: 160px;
  border-radius: 12%;
}

.sigil--160.sigil--on-air::before {
  inset-block-start: 6px;
  inset-inline-end: 6px;
  inline-size: 14px;
  block-size: 14px;
}

.sigil-face {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.sigil::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--rule-strong);
  border-radius: inherit;
  pointer-events: none;
}

.sigil--dead .sigil-face {
  filter: grayscale(1) brightness(0.6);
}

.sigil--dead::after {
  border-color: var(--rule);
  background: linear-gradient(
    to top right,
    transparent calc(50% - 1.25px),
    var(--blood) calc(50% - 1.25px),
    var(--blood) calc(50% + 1.25px),
    transparent calc(50% + 1.25px)
  );
}

.sigil--on-air::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset-block-start: -2px;
  inset-inline-end: -2px;
  inline-size: max(7px, 26%);
  block-size: max(7px, 26%);
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--blood);
  pointer-events: none;
}

/* The placeholder a server-rendered page leaves for `hydrateSigils`, at the size the face
 * will be — so a face arriving moves nothing, and a page without script keeps the gap. */
[data-sigil] {
  display: inline-block;
  flex: none;
  align-self: center;
  inline-size: 28px;
  block-size: 28px;
  vertical-align: middle;
}

[data-sigil][data-size="20"] {
  inline-size: 20px;
  block-size: 20px;
}

[data-sigil][data-size="40"] {
  inline-size: 40px;
  block-size: 40px;
}

[data-sigil][data-size="64"] {
  inline-size: 64px;
  block-size: 64px;
}

[data-sigil][data-size="160"] {
  inline-size: 160px;
  block-size: 160px;
}

[data-sigil] > .sigil {
  display: block;
}

/* --- health, as a band ---------------------------------------------------------------------- */

/* Health is a word on the public channels, never a number (§12), and the word is one of six
 * bands. One colour per band, dim to loud as it gets worse — so a rail of eight names reads
 * at a glance — and the same colour whether it is written as a word or drawn as a bar
 * (`parts.bandTag`/`bandBar`, and the pages the server draws whole). Hurt is a parchment ramp
 * (SR2-VISUAL, H23: a monster's WOUNDED read as crawler on crawler); red is dying and the dead, and a
 * monster's own bands are the fray (`blocks/fight_frame.css`). */
.band-tag {
  font-family: var(--font-prose);
  font-size: var(--text-12);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  white-space: nowrap;
}

.band--unharmed {
  color: var(--parchment-faint);
}

.band--bruised {
  color: var(--parchment-dim);
}

.band--wounded {
  color: var(--parchment);
}

.band--dying,
.band--dead {
  color: var(--blood);
}

.band-tag.band--dead {
  text-decoration: line-through;
}

/* The band's word as its card (`parts.bandTerm`) is a button inside the tag, and a line-through
 * never reaches inside one: the word is struck on itself. */
.band-tag.band--dead .band-term {
  text-decoration: line-through;
}

/* Out of reach rather than out of health — backed out of a fight, or never seen at all. */
.band--gone,
.band--unknown {
  color: var(--parchment-faint);
}

/* The bar: a fixed hairline track and a fill scaled to the band. A transform rather than a
 * width, because a width is a style the CSP forbids and a transform glides on the compositor;
 * the fill takes the band's colour through `currentColor`. */
.band-bar {
  --band-fill: 1;
  display: block;
  block-size: 4px;
  background: var(--rule);
  overflow: hidden;
}

.band-bar-fill {
  display: block;
  block-size: 100%;
  background: currentColor;
  transform: scaleX(var(--band-fill));
  transform-origin: left center;
  transition: transform var(--duration-normal) var(--ease-out);
}

.band-bar.band--bruised {
  --band-fill: 0.75;
}

.band-bar.band--wounded {
  --band-fill: 0.5;
}

.band-bar.band--dying {
  --band-fill: 0.2;
}

.band-bar.band--dead {
  --band-fill: 0;
}

/* Gone is not empty: the track itself goes dashed, so "out of the fight" never reads as dead. */
.band-bar.band--gone,
.band-bar.band--unknown {
  --band-fill: 0;
  background: repeating-linear-gradient(90deg, var(--rule-strong) 0 4px, transparent 4px 7px);
}

/* --- rarity ----------------------------------------------------------------------------------- */

/* Rarity, on an item card: the word in muted caps, common the faintest. No colour of its own: acid is the System's
 * mono and cyan a party's, and the word says it (L36-CAMPAGE, R18). */
.rarity-common {
  color: var(--muted);
}

.rarity-uncommon,
.rarity-rare,
.rarity-epic,
.rarity-legendary {
  color: var(--parchment-dim);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* A party's name carries a small flag in front of it (2026-10-08, R12): its name once read like a
 * room's, and the flag is what tells a crew from a place wherever a party is named. Drawn by
 * CSS so the text a reader copies, and a link's name, stay the party's own. */
.party-name::before {
  content: "\2691\00a0";
  color: var(--cyan);
}
