/* Track catalogue pages, generated by raily/cli/build-module-pages.ts. They sit in the site's
   own layout, so the colours are the site's, and every rule stays inside .catalogue. */
.catalogue {
  --bg: var(--default-background-color); --fg: var(--default-foreground-color); --muted: var(--inactive-color);
  --line: var(--separator-color); --accent: var(--raily-red); --panel: var(--paper);
  --bed: light-dark(#d9d4c7, #5c5a52);
  font-size: 16px; line-height: 1.5;
}
.catalogue * { box-sizing: border-box; }
.catalogue h1 { font-size: 32px; margin: 0 0 4px; }
/* The site's heading rail stays; only the size is a list's rather than a section's. */
.catalogue h2 { font-size: 17px; margin: 0 0 8px; padding-bottom: 8px; }
.intro, .hint { color: var(--muted); }
.hint { font-size: 14px; }
.bar { margin-bottom: 16px; }
.bar .back { text-decoration: none; font-weight: 600; }
/* Sticky, so the letters stay in reach and a jump to one does not hide its heading under them. The
   site's own menu bar sticks above it; --menu-bar-height is its height, when the site has one. */
.tools { position: sticky; top: var(--menu-bar-height, 0px); z-index: 1; padding: 12px 0; background: var(--bg);
  border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.maker { scroll-margin-top: calc(var(--menu-bar-height, 0px) + 130px); }
.letters { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 8px; }
.letters a { min-width: 1.8em; padding: 2px 4px; text-align: center; text-decoration: none;
  font-weight: 600; border-radius: 3px; }
.letters a:hover { background: var(--panel); }
#filter { width: 100%; max-width: 30em; padding: 10px 12px;
  font-size: 16px; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 4px; }
.makers { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.maker ul { list-style: none; margin: 0; padding: 0; }
.maker li { padding: 3px 0; }
.gauge { color: var(--muted); font-size: 13px; margin-left: 6px; }
/* A fact about a system, not a warning: it stays out of the way of the names beside it. */
.badge { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 10px;
  font-size: 12px; font-weight: normal; line-height: 1.6; white-space: nowrap; vertical-align: middle; }
.badge.historic { color: var(--muted); border: 1px solid var(--line); }
.historic { display: inline-flex; margin-left: 4px; color: var(--muted); vertical-align: -2px;
  cursor: help; outline: none; }
.legend { font-size: 14px; color: var(--muted); margin: 0; }
.legend .historic { margin: 0 2px 0 0; cursor: auto; }
/* Under the row and no wider than it, placed against the list item rather than the icon: an icon at
   the end of a long name sits at the screen's edge on a phone, and a tip centred on it runs off. */
.maker li { position: relative; }
.historic[data-tip]:hover::after, .historic[data-tip]:focus::after {
  content: attr(data-tip); position: absolute; left: 0; top: 100%; max-width: 100%; width: max-content;
  z-index: 2; padding: 4px 8px; border-radius: 4px; font-size: 13px;
  color: var(--bg); background: var(--fg); pointer-events: none; }
.catalogue table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.catalogue th, .catalogue td { padding: 8px 10px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.facts th { width: 14em; color: var(--muted); font-weight: 600; }
.elements thead th { position: sticky; top: var(--menu-bar-height, 0px); background: var(--bg); }
.elements .num { text-align: right; white-space: nowrap; }
.elements .name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.elements .shape { width: 220px; }
svg.rail { width: 200px; height: 56px; display: block; }
/* The marker the app puts on links that leave it, so the two agree about what is external. */
a.external { background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNyIgaGVpZ2h0PSIxNyIgdmlld0JveD0iMCAwIDEwMCAxMDAiPjxwYXRoIHN0cm9rZS13aWR0aD0iMTAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzM2YyIgZD0iTTQ3IDMySDEyLjNWODdINjUuN1Y1ME00MSAxOCA4OCAxMC42IDc5LjYgNTcuNCA2OS4zIDQ2LjcgNDcuMyA2Ny4yIDMwIDUwIDUwIDI5WiIvPjwvc3ZnPg==');
  background-position: right center; background-repeat: no-repeat; padding-right: 20px; }
.catalogue svg path { fill: none; }
svg .bed { stroke: var(--bed); stroke-linecap: butt; stroke-linejoin: round; }
svg .track { stroke: var(--fg); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linecap: round; }
svg .deco, svg .connector { stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; }
svg .connector { stroke: var(--fg); stroke-width: 2; }
.elements tr[data-name] { cursor: pointer; }
.elements tr[data-name]:hover { background: var(--panel); }
.elements .name a { color: inherit; text-decoration: none; }
dialog { max-width: min(760px, calc(100vw - 32px)); padding: 16px 20px; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35); }
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog h2 { margin-right: 32px; }
dialog .close { position: absolute; top: 8px; right: 10px; border: 0; background: none; color: var(--fg);
  font-size: 26px; line-height: 1; cursor: pointer; }
dialog .figure { overflow: auto; }
svg.rail-detail { display: block; max-width: 100%; height: auto; margin: 0 auto; }
svg.rail-detail .track { stroke-width: 2; }
svg.rail-detail .dim { display: none; fill: var(--fg); }
/* A piece with several routes labels one at a time, or the dimensions of a switch pile up. */
svg.rail-detail .route:hover .dim, svg.rail-detail .route:focus .dim,
svg.rail-detail:not(:has(.route:hover, .route:focus)) .route:first-child .dim { display: inline; }
svg.rail-detail .route { outline: none; }
/* A route is a hairline; this is what the pointer actually has to find. */
svg.rail-detail .hit { stroke: transparent; stroke-width: 16; vector-effect: non-scaling-stroke; pointer-events: stroke; }
svg.rail-detail .route:hover .track, svg.rail-detail .route:focus .track { stroke: var(--accent); stroke-width: 3; }
@media (max-width: 700px) {
  .elements .shape { width: 120px; }
  svg.rail { width: 110px; height: 40px; }
  .facts th { width: auto; }
  .elements .name { white-space: normal; }
  /* Content wider than a phone widens its layout viewport, and the whole page with it; the table
     scrolls on its own instead, at the price of a header that no longer sticks. */
  .scroller { overflow-x: auto; }
  .catalogue th, .catalogue td { padding: 6px; }
}
