/*
 * CITY OF LEGENDS: Track B, threats and reference. Every class starts th-.
 * Loaded after guide.css on the lattice, bestiary, ICE, Bleedthrough, titans, streets, dives, status, FAQ and glossary pages.
 *
 * Neon Ink rules, same as the rest of the site: hard edges, flat colour, halftone dots for shade. No blur, no glow,
 * no soft gradients. Mobile first; the min-width blocks are wider layouts. Nothing here animates.
 * It never restyles a g- class: it styles its own wrappers and the markup inside them.
 */

/* ── colour swatches (strata, heat) ────────────────────────────────── */

.th-sw {
  display: inline-flex;
  width: 56px;
  height: 22px;
  border: 2px solid var(--paper);
  vertical-align: middle;
}
.th-sw i {
  flex: 1;
}

/* ── heat table: the tier, its swatch and its name ─────────────────── */

.th-tier {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}
.th-tier-no {
  font-family: var(--display);
  font-weight: 900;
  font-size: 22px;
  text-transform: uppercase;
  color: var(--paper);
}
.th-tier-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--sodium);
}

/* ── tables that carry markup in a cell ────────────────────────────── */

.th-table td b {
  color: var(--paper);
}

/* ── codex cards: two names, a canon line, a habit ─────────────────── */

.th-codex-grid {
  display: grid;
  gap: 24px;
  margin: 28px 0;
}
.th-codex {
  scroll-margin-top: calc(var(--head-h) + 16px);
  border: 3px solid var(--paper);
  background: var(--night);
  box-shadow: 6px 6px 0 var(--registry);
}
.th-codex-head {
  padding: 16px 18px 14px;
  background-color: var(--ink);
  background-image: radial-gradient(rgba(56, 232, 255, 0.1) 1.2px, transparent 1.6px);
  background-size: 9px 9px;
  border-bottom: 3px solid var(--paper);
}
.th-codex-head h3 {
  margin: 0 0 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.th-formal {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(28px, 6vw, 38px);
  line-height: 0.95;
  text-transform: uppercase;
  color: var(--paper);
  overflow-wrap: anywhere;
}
.th-street {
  font-size: 19px;
  font-style: italic;
  color: var(--lattice);
}
.th-codex-head .g-status {
  margin: 0;
}
.th-note {
  margin: 0;
  font-size: 15px;
  color: var(--muted, var(--text));
}
.th-line {
  margin: 18px 18px 6px;
  padding: 2px 0 2px 16px;
  border-left: 6px solid var(--registry);
}
.th-line p {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  line-height: 1.15;
  color: var(--paper);
}
.th-rows {
  margin: 0;
  padding: 8px 18px 18px;
}
.th-rows div {
  display: grid;
  gap: 2px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.th-rows div:first-child {
  border-top: 0;
}
.th-rows dt {
  font-family: var(--display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sodium);
}
.th-rows dd {
  margin: 0;
  color: var(--text);
}

/* ── the designed run: a track of beats ────────────────────────────── */

.th-loop {
  display: grid;
  margin: 32px 0;
  padding: 0;
  list-style: none;
  counter-reset: beat;
}
.th-beat {
  position: relative;
  counter-increment: beat;
  margin: 0 0 0 16px;
  padding: 4px 0 28px 40px;
  border-left: 6px solid var(--paper);
}
.th-beat:last-child {
  padding-bottom: 4px;
  border-left-color: transparent;
}
.th-beat::before {
  content: counter(beat);
  position: absolute;
  left: -22px;
  top: 0;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--ink);
  border: 3px solid var(--paper);
  font-family: var(--display);
  font-weight: 900;
  font-size: 20px;
  color: var(--sodium);
}
.th-beat > b {
  display: block;
  margin: 0 0 4px;
  font-family: var(--display);
  font-weight: 900;
  font-size: 26px;
  line-height: 1;
  text-transform: uppercase;
  color: var(--paper);
}
.th-beat > span {
  display: block;
  max-width: 26rem;
  color: var(--text);
}
.th-branches {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  max-width: 26rem;
}
.th-branches li {
  padding: 10px 12px;
  border: 3px solid var(--sodium);
  background: var(--ink);
}
.th-branches b {
  display: block;
  font-family: var(--display);
  font-weight: 900;
  font-size: 20px;
  text-transform: uppercase;
  color: var(--sodium);
}
.th-branches span {
  color: var(--text);
}

/* ── status page, FAQ and glossary: intro bands ────────────────────── */

.th-intro {
  padding: 28px 0 8px;
}
.th-opening {
  max-width: 36em;
  margin: 0 0 22px;
  font-size: clamp(20px, 3.4vw, 26px);
  line-height: 1.35;
  color: var(--paper);
}
.th-closing {
  padding: 20px 0 36px;
}
.th-closing p {
  margin: 0;
  font-size: 16px;
  color: var(--dim);
}

/* ── glossary ──────────────────────────────────────────────────────── */

.th-gloss {
  margin: 0;
  max-width: 60rem;
}
.th-gloss > div {
  display: grid;
  gap: 4px;
  padding: 16px 0;
  border-top: 2px solid var(--line);
}
.th-gloss > div:last-child {
  border-bottom: 2px solid var(--line);
}
.th-gloss dt {
  scroll-margin-top: calc(var(--head-h) + 16px);
  font-family: var(--display);
  font-weight: 900;
  font-size: 24px;
  line-height: 1;
  text-transform: uppercase;
  color: var(--paper);
}
.th-gloss dfn {
  font-style: normal;
}
.th-gloss dt:target {
  color: var(--sodium);
}
.th-gloss dd {
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
}

/* ── wider screens ─────────────────────────────────────────────────── */

@media (min-width: 640px) {
  .th-gloss > div {
    grid-template-columns: 13em 1fr;
    gap: 24px;
  }
  .th-rows div {
    grid-template-columns: 7em 1fr;
    gap: 14px;
  }
}

@media (min-width: 760px) {
  .th-codex-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

/* the run reads left to right once there is room: the track runs along the top of each beat */
@media (min-width: 960px) {
  .th-loop {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0 20px;
  }
  .th-beat {
    margin: 22px 0 0;
    padding: 30px 0 4px;
    border-left: 0;
    border-top: 6px solid var(--paper);
  }
  .th-beat:last-child {
    padding-bottom: 4px;
    border-top-color: var(--paper);
  }
  .th-beat::before {
    left: 0;
    top: -22px;
  }
}
