/* The Universe Map. The markup comes from channels/engine/map.mjs: two
   drawings of the same graph and a list that says the same thing in words.

   Colors, set by each site for both themes:
     --map-work  --map-on-work    a book or episode, and the number on it
     --map-person  --map-event    the two kinds of dot
     --map-edge  --map-guide      who is in what; the reading-order line
   Groups and record labels reuse --ink-2 and --muted, and the recurring ring
   --ink, so every site's existing contrast checks already cover them.

   Label sizes are load-bearing. channels/engine/layout.mjs reserves room for
   each name from its character count at exactly these sizes (12px names,
   13px titles, both Space Grotesk). Make a label bigger here and names start
   to print over each other; change the estimate there in the same commit. */

.umap { margin: 0; }

.umap__skip { margin-bottom: .75rem; font-size: .95rem; }
.umap__skip a {
  color: var(--accent);
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: .18em;
}

/* One drawing at a time. display: none also takes the other one away from
   keyboards and screen readers, so nobody meets every node twice. */
.umap__svg { height: auto; margin-inline: auto; }
.umap__svg--spine { width: min(100%, 520px); }
.umap__svg--orbit { display: none; width: auto; max-width: 100%; }
@media (min-width: 960px) {
  .umap__svg--spine { display: none; }
  .umap__svg--orbit { display: block; }
}

.umap__guide { fill: none; stroke: var(--map-guide); stroke-width: 1.5; stroke-dasharray: 1 8; stroke-linecap: round; }
.umap__edge { stroke: var(--map-edge); stroke-width: 1.3; transition: opacity .15s; }
/* A role is told by weight and dash, never by color alone: author solid,
   major long dashes, both heavy; minor short dashes; cameo dots. */
.umap__edge--author { stroke-width: 2.6; }
.umap__edge--major { stroke-width: 2.6; stroke-dasharray: 9 3; }
.umap__edge--minor { stroke-width: 1.6; stroke-dasharray: 5 4; }
.umap__edge--cameo { stroke-width: 1.6; stroke-dasharray: 1 4; stroke-linecap: round; }

.umap__node { text-decoration: none; cursor: pointer; }
.umap__hit { fill: transparent; }
.umap__dot { transition: stroke-width .15s; stroke: var(--bg); stroke-width: 2; }
.umap__node--work .umap__dot { fill: var(--map-work); }
.umap__node--person .umap__dot { fill: var(--map-person); }
.umap__node--event .umap__dot { fill: var(--map-event); }
.umap__node--group .umap__dot { fill: var(--ink-2); }
.umap__node--label .umap__dot { fill: var(--muted); }
.umap__ring { fill: none; stroke: var(--ink); stroke-width: 1.5; }

.umap__num { fill: var(--map-on-work); font: 700 17px var(--font-mono); }
/* The halo is the page color painted behind each letter, so a line passing
   under a name does not cut through it. */
.umap__label {
  fill: var(--ink);
  font: 500 12px var(--font-ui);
  paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round;
}
.umap__node--work .umap__label { font: 600 13px var(--font-ui); }

.umap__node:hover .umap__dot,
.umap__node:focus-visible .umap__dot { stroke: var(--focus); stroke-width: 3.5; }
.umap__node:hover .umap__label,
.umap__node:focus-visible .umap__label { text-decoration: underline; }
.umap__node:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

/* js/site.js adds these while a node is pointed at or focused. The lines
   that are not part of it fade. The names that are not part of it are still
   links, so they go quiet in a color that holds 4.5:1 and are never faded. */
.umap__svg.is-focused .umap__edge { opacity: .16; }
.umap__svg.is-focused .umap__edge.is-lit { opacity: 1; stroke-width: 2.4; }
.umap__svg.is-focused .umap__node:not(.is-lit) .umap__label { fill: var(--muted); }

/* The role filter (map.mjs says what each choice keeps). A browser without
   :has() shows everything, which is the All choice. */
.umap__filter { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .25rem 1rem; margin: 0 0 1rem; border: 0; padding: 0; }
.umap__filterhead { float: left; padding: 0; font-size: var(--step--1); color: var(--ink-2); }
.umap__pick { display: inline-flex; align-items: center; gap: .4rem; min-height: 24px; cursor: pointer; }
.umap__pick input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--accent); }
.umap:has(.umap__filter [value="major"]:checked) .umap__svg :not(.umap__edge--major, .umap__edge--author).umap__edge,
.umap:has(.umap__filter [value="minor"]:checked) .umap__svg :not(.umap__edge--minor, .umap__edge--author).umap__edge,
.umap:has(.umap__filter [value="cameo"]:checked) .umap__svg :not(.umap__edge--cameo, .umap__edge--author).umap__edge { opacity: .12; }
/* A subject left out goes hollow: an outline in a color that holds its
   contrast, never a fade, the same as a quiet name. Pointing at it or
   focusing it fills it again, with the usual focus ring. */
.umap:has(.umap__filter [value="major"]:checked) .umap__node:not(.umap__node--work, [data-roles~="major"], [data-roles~="author"], :hover, :focus-visible) .umap__dot,
.umap:has(.umap__filter [value="minor"]:checked) .umap__node:not(.umap__node--work, [data-roles~="minor"], [data-roles~="author"], :hover, :focus-visible) .umap__dot,
.umap:has(.umap__filter [value="cameo"]:checked) .umap__node:not(.umap__node--work, [data-roles~="cameo"], [data-roles~="author"], :hover, :focus-visible) .umap__dot { fill: var(--bg); stroke: var(--muted); stroke-width: 1.5; }
.umap:has(.umap__filter [value="major"]:checked) .umap__node:not(.umap__node--work, [data-roles~="major"], [data-roles~="author"]) .umap__ring,
.umap:has(.umap__filter [value="minor"]:checked) .umap__node:not(.umap__node--work, [data-roles~="minor"], [data-roles~="author"]) .umap__ring,
.umap:has(.umap__filter [value="cameo"]:checked) .umap__node:not(.umap__node--work, [data-roles~="cameo"], [data-roles~="author"]) .umap__ring { stroke: var(--muted); }
.umap:has(.umap__filter [value="major"]:checked) .umap__node:not(.umap__node--work, [data-roles~="major"], [data-roles~="author"]) .umap__label,
.umap:has(.umap__filter [value="minor"]:checked) .umap__node:not(.umap__node--work, [data-roles~="minor"], [data-roles~="author"]) .umap__label,
.umap:has(.umap__filter [value="cameo"]:checked) .umap__node:not(.umap__node--work, [data-roles~="cameo"], [data-roles~="author"]) .umap__label { fill: var(--muted); }

.umap__legend {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.5rem;
  margin-top: 1rem;
  font-size: var(--step--1); color: var(--ink-2);
}
.umap__legend li { display: inline-flex; align-items: center; gap: .5rem; }
.umap__key { flex: none; width: 14px; height: 14px; border-radius: 50%; }
.umap__key--work { width: 20px; height: 20px; background: var(--map-work); }
.umap__key--person { background: var(--map-person); }
.umap__key--event { width: 12px; height: 12px; border-radius: 0; background: var(--map-event); transform: rotate(45deg); }
.umap__key--group { width: 13px; height: 13px; border-radius: 0; background: var(--ink-2); }
.umap__key--label { border-radius: 0; background: var(--muted); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.umap__key--recurring { background: var(--map-person); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--ink); }
/* A line sample, dashed the way the line on the map is. */
.umap__key--line { width: 28px; height: 3px; border-radius: 0; }
.umap__key--author { background: var(--map-edge); }
.umap__key--major { background: repeating-linear-gradient(90deg, var(--map-edge) 0 9px, transparent 9px 12px); }
.umap__key--minor { height: 2px; background: repeating-linear-gradient(90deg, var(--map-edge) 0 5px, transparent 5px 9px); }
.umap__key--cameo { height: 2px; background: repeating-linear-gradient(90deg, var(--map-edge) 0 2px, transparent 2px 5px); }

.umap__empty { margin-top: 1.25rem; text-align: center; color: var(--ink-2); }

/* The list, set like the index at the back of a book: names down columns,
   each with what it is in. */
.umap__who { margin-top: clamp(2rem, 5vw, 3.5rem); }
.umap__whohead { margin-bottom: 1.25rem; }
.umap__who { columns: 18rem; column-gap: 2.5rem; }
.umap__whohead { column-span: all; }
.umap__entry {
  break-inside: avoid;
  padding-block: .8rem 1rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: 1rem;
}
.umap__entry:target { border-top: 3px solid var(--accent-strong); background: var(--surface); padding-inline: .75rem; }
.umap__name { font-family: var(--font-ui); font-size: var(--step-0); font-weight: 700; letter-spacing: 0; }
.umap__kind {
  margin-left: .4rem; padding: .1rem .45rem; border-radius: 999px;
  background: var(--mark); color: var(--on-mark);
  font-size: .72rem; font-weight: 600; vertical-align: .12em;
}
.umap__count, .umap__with { font-size: var(--step--1); color: var(--muted); }
.umap__with { margin-top: .5rem; }
.umap__in { margin-top: .35rem; display: grid; gap: .3rem; font-size: .95rem; }
.umap__in a {
  color: var(--accent);
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: .18em;
}
/* One book in the first run is called "Q". A one-letter link is 10px wide. */
.umap__in a { display: inline-block; min-width: 24px; }
.umap__note { display: block; color: var(--ink-2); }
.umap__role { font-size: var(--step--1); font-weight: 600; color: var(--ink-2); }
