/* Freight (set FRT): /freight/ and its pages. Colours are the site's own tokens, so light and dark follow the theme. No
   operator or shipping-line brand colour is used for the interface: the swatches show a box's colour as data. */
:root { --fr-port: var(--fg); --fr-term: #2E6DA4; --fr-yard: #A35A1E; --fr-land: #ECEAE4; --fr-coast: #CFCCC4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --fr-term: #7DB3E0; --fr-yard: #E3A066; --fr-land: #24272D; --fr-coast: #3A3D44; } }
:root[data-theme="dark"] { --fr-term: #7DB3E0; --fr-yard: #E3A066; --fr-land: #24272D; --fr-coast: #3A3D44; }

.fr-nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 18px; padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
.fr-nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.fr-nav a[aria-current="page"] { color: var(--fg); border-bottom: 2px solid var(--fg); }
.fr-nav a:hover { color: var(--fg); }

.fr-fig { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 10px 12px; margin: 14px 0; }
.fr-map { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; }
.fr-map text { font-family: inherit; font-size: 11.5px; fill: var(--fg); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.fr-map .land { fill: var(--fr-land); stroke: var(--fr-coast); stroke-width: .8; }
.fr-map .pt rect, .fr-map rect.pt { fill: var(--fr-port); stroke: var(--surface); stroke-width: 1.5; }
.fr-map .tm circle, .fr-map circle.tm { fill: var(--fr-term); stroke: var(--surface); stroke-width: 1.5; }
.fr-map .yd path, .fr-map path.yd { fill: var(--fr-yard); stroke: var(--surface); stroke-width: 1.2; }

.fr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 14px 0; }
.fr-card { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 12px 14px; color: var(--fg); text-decoration: none; }
.fr-card:hover { border-color: var(--fg); }
.fr-card b { font-size: 1.05rem; }
.fr-owner { font-size: 0.9rem; }
.fr-classes { font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-top: auto; }

/* Set FOC (Kyle, 21 November 2026): each operator's mark. --c is its colour and --cd its dark-page colour, where it has
   one; operators without a colour share a hatched neutral. The name, and the code tag, always stay beside the mark. */
.fr-c { --cc: var(--c); }
:root[data-theme="dark"] .fr-c { --cc: var(--cd, var(--c)); }
.fr-card.fr-c, .fr-card.fr-hatch { position: relative; padding-left: 20px; overflow: hidden; }
.fr-card.fr-c::before, .fr-card.fr-hatch::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; }
.fr-card.fr-c::before { background: var(--cc); }
.fr-card.fr-hatch::before, .fr-opsw.fr-hatch, .fr-titlebar.fr-hatch { background: repeating-linear-gradient(135deg, var(--muted) 0 2px, transparent 2px 5px); }
.fr-opsw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--cc); margin-right: 5px; vertical-align: -1px; }
:root[data-theme="light"] .fr-card[data-kl~="light"]::before, :root[data-theme="light"] .fr-opsw[data-kl~="light"],
:root[data-theme="light"] .fr-titlebar[data-kl~="light"] { box-shadow: inset 0 0 0 1px var(--kl-ink); }
:root[data-theme="dark"] .fr-card[data-kl~="dark"]::before, :root[data-theme="dark"] .fr-opsw[data-kl~="dark"],
:root[data-theme="dark"] .fr-titlebar[data-kl~="dark"] { box-shadow: inset 0 0 0 1px var(--kl-ink); }
.fr-code { display: inline-block; font-size: 0.75rem; font-weight: 600; line-height: 1.25; padding: 1px 6px; border: 1px solid var(--rule);
  border-radius: 4px; color: var(--muted); background: var(--surface); margin-left: 6px; vertical-align: 1px; white-space: nowrap; }
td .fr-code { margin-left: 0; margin-right: 4px; }
.fr-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.fr-title h1 { margin-bottom: 4px; }
.fr-titlebar { flex: 0 0 100%; height: 8px; background: var(--cc); margin-bottom: 14px; }

.fr-table { width: 100%; font-size: 0.88rem; }
.fr-table :is(th, td) { vertical-align: top; }
.fr-locos, .fr-wagons { min-width: 980px; }
/* Fit the page's 1,237 px (Kyle, 9 November 2026: no scrollbar on a desktop screen): no 9em floor on each text column, and
   fixed shares so the long builder and note columns don't take all the room. They still scroll below about 1,020 px. */
.fr-table td.wrap { min-width: 0; }
.fr-locos, .fr-wagons { table-layout: fixed; }
.fr-locos th:nth-child(1), .fr-locos th:nth-child(2) { width: 14%; }
.fr-locos th:nth-child(3), .fr-locos th:nth-child(4) { width: 10%; }
.fr-locos th:nth-child(5) { width: 8%; } .fr-locos th:nth-child(6) { width: 6%; }
.fr-locos th:nth-child(7), .fr-locos th:nth-child(8), .fr-locos th:nth-child(10) { width: 9%; }
.fr-locos th:nth-child(9) { width: 11%; }
.fr-wagons th:nth-child(1) { width: 14%; }
.fr-wagons th:nth-child(2), .fr-wagons th:nth-child(4), .fr-wagons th:nth-child(12) { width: 10%; }
.fr-wagons th:nth-child(3), .fr-wagons th:nth-child(8) { width: 5%; }
.fr-wagons th:nth-child(5), .fr-wagons th:nth-child(6), .fr-wagons th:nth-child(7), .fr-wagons th:nth-child(9) { width: 7%; }
.fr-wagons th:nth-child(10), .fr-wagons th:nth-child(11) { width: 9%; }
.fr-fleet { table-layout: fixed; }
.fr-fleet th:nth-child(1), .fr-fleet td:nth-child(1) { width: 7.5rem; }
.fr-fleet th:nth-child(2), .fr-fleet td:nth-child(2) { width: 5.5rem; }
.fr-fleet th:nth-child(4), .fr-fleet td:nth-child(4) { width: 8.5rem; }
.fr-routes { table-layout: fixed; min-width: 900px; }
.fr-routes th:nth-child(1), .fr-routes td:nth-child(1) { width: 15%; }
.fr-routes th:nth-child(2), .fr-routes td:nth-child(2) { width: 19%; }
.fr-routes th:nth-child(3), .fr-routes td:nth-child(3) { width: 30%; }
.fr-routes th:nth-child(4), .fr-routes td:nth-child(4) { width: 16%; }
.fr-flows { table-layout: fixed; min-width: 760px; }
.fr-flows th:nth-child(1), .fr-flows td:nth-child(1) { width: 22%; }
.fr-flows th:nth-child(2), .fr-flows td:nth-child(2) { width: 12%; }
.fr-flows th:nth-child(3), .fr-flows td:nth-child(3) { width: 24%; }
.fr-flows th:nth-child(4), .fr-flows td:nth-child(4) { width: 24%; }
.fr-table .ft-m { display: block; font-size: 0.8em; color: var(--muted); }
.fr-tbd { font-weight: 650; color: var(--muted); }
.fr-unv { font-size: 0.82rem; margin-top: 4px; color: var(--muted); }
.fr-unv summary { cursor: pointer; }
.fr-unv ul { margin: 4px 0; padding-left: 1.1em; }
.fr-fold { margin: 8px 0; border-top: 1px solid var(--rule); }
.fr-fold summary { cursor: pointer; padding: 6px 0; }
.fr-fold summary h3 { display: inline; font-size: 1.05rem; margin: 0; }

.fr-livs { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.fr-liv { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 10px 12px; }
.fr-tag { display: inline-block; font-size: 0.72rem; font-weight: 600; border: 1px solid var(--rule); border-radius: 999px; padding: 0 7px; color: var(--muted); white-space: nowrap; }
.fr-current { color: var(--fg); }

.fr-cos { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; margin: 10px 0 18px; }
.fr-co { display: flex; gap: 10px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 8px 12px; font-size: 0.92rem; }
.fr-sws { display: flex; gap: 3px; flex: none; }
.fr-sw { width: 22px; height: 34px; border-radius: 3px; border: 1px solid var(--rule); display: inline-block; }
.fr-sw.fr-none { background: repeating-linear-gradient(45deg, var(--rule) 0 4px, transparent 4px 8px); color: var(--muted); font-size: 0.75rem; text-align: center; line-height: 34px; }

@media (max-width: 640px) {
  .fr-locos, .fr-wagons { min-width: 900px; }
  /* set FRS: the fleet table's fixed widths left its Note column a word wide on phones; it lays out by its contents
     and scrolls sideways in its own box (.table-wrap) instead */
  .fr-fleet { table-layout: auto; min-width: 560px; }
  .fr-fleet th:nth-child(n), .fr-fleet td:nth-child(n) { width: auto; }
  .fr-fleet td:nth-child(1) { white-space: nowrap; }   /* "Class 66" on one line (Kyle, 25 Nov) */
  .fr-cards { grid-template-columns: 1fr; }
  .fr-map text { font-size: 17px; stroke-width: 4px; }   /* the map is drawn to its panel's width, so its labels shrink with it */
  .fr-cos, .fr-livs { grid-template-columns: 1fr; }
}

/* Whole trains (set FTR, FTRC): the two strips under the map. Fitted to the page's width; the 'Full size' switch (the site's .inop switch) shows
   them at 10 px a metre, scrolling sideways. The svg carries its full-size width and height as --fw and --fh (px). The scale's
   two label sets follow the switch, and take the page's muted colour so they read in both themes. */
.fr-tr h3 { font-size: 1.05rem; margin: 0 0 2px; }
.fr-tr-n { margin: 0 0 8px; font-size: 0.9rem; color: var(--muted); }
.fr-trs .ft-train { display: block; width: 100%; min-width: 720px; height: auto; }   /* a phone scrolls the strip rather than shrinking its scale to nothing */
.fr-trs .ft-tk-fit, .fr-trs .ft-tk-full { fill: var(--muted); stroke: var(--muted); }
.fr-trs .ft-tk-fit text, .fr-trs .ft-tk-full text { stroke: none; }
.fr-tr-cb:checked ~ .fr-trs .ft-train { width: calc(var(--fw) * 1px); max-width: none; height: calc(var(--fh) * 1px); }
.fr-tr-cb:checked ~ .fr-trs .ft-tk-fit { display: none; }
.fr-tr-cb:checked ~ .fr-trs .ft-tk-full { display: inline; }

/* set FRS P1 (Kyle, 25 November 2026: FRS1, FRS2): the locomotive drawings and the Freight page's landing pieces. Drawings
   keep the site's one scale: an image is its viewBox width (--w, px at 10 px a metre) times --k. Colours are the site's
   tokens; an operator's colour only marks that operator (set FOC). */
.frd-img { display: block; width: calc(var(--w) * var(--k, 1) * 1px); max-width: none; height: auto; }
.frd-lineup { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 18px; padding: 12px 12px 8px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius); --k: .62; }
.frd-lineup figure { margin: 0; text-align: center; }
.frd-lineup figure a { display: block; }
.frd-lineup figcaption { font-size: .8rem; font-weight: 650; margin-top: 2px; }
.frd-lineup figcaption span { display: block; font-weight: 400; color: var(--muted); }
.frd-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin: 12px 0; }
.frd-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; display: flex;
  flex-direction: column; gap: 6px; min-width: 0; }
.frd-card h3 { margin: 0; font-size: 1.08rem; }
.frd-pic { min-height: 54px; display: flex; align-items: flex-end; overflow: hidden; --k: 1; }
.frd-pic .frd-img { max-width: 100%; }
.frd-tbd { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 12px; border: 1.5px dashed var(--rule);
  border-radius: 6px; color: var(--muted); font-size: .85rem; font-weight: 600; }
.frd-pic .frd-tbd { width: 100%; }
.frd-card dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; font-size: .86rem; }
.frd-card dt { color: var(--muted); }
.frd-card dd { margin: 0; }
.frd-stack { display: flex; height: 10px; border-radius: 3px; overflow: hidden; background: var(--rule); }
.frd-seg { display: block; height: 100%; background: var(--cc); border-right: 1px solid var(--surface); }
.frd-seg.fr-hatch, .frd-bars .bar.fr-hatch { background: repeating-linear-gradient(135deg, var(--muted) 0 2px, transparent 2px 5px); }
.frd-by { font-size: .82rem; display: flex; flex-wrap: wrap; gap: 2px 10px; }
.frd-gallery { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 22px; background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 14px; --k: .9; }
.frd-gallery figure { margin: 0; }
.frd-gallery figcaption { font-size: .82rem; margin-top: 3px; }
.frd-gallery figcaption b { display: block; }
.frd-grid2 { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.frd-bars { list-style: none; margin: 0; padding: 0; }
.frd-bars li { display: grid; grid-template-columns: 10rem 1fr 3rem; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--rule); font-size: .92rem; }
.frd-bars li a { color: var(--fg); text-decoration: none; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frd-bars .bar { height: 12px; border-radius: 3px; background: var(--cc); min-width: 2px; }
.frd-bars .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.frd-mix { display: flex; height: 26px; border-radius: 6px; overflow: hidden; border: 1px solid var(--rule); margin: 6px 0 4px; }
.frd-mix span { display: flex; align-items: center; padding: 0 8px; font-size: .78rem; font-weight: 650; white-space: nowrap; overflow: hidden; color: #fff; }
.frd-mix .m1 { background: #2E6DA4; } .frd-mix .m2 { background: #8F4E18; } .frd-mix .m3 { background: #5F636C; }
.frd-stories { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 12px; }
.frd-story { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; display: flex;
  flex-direction: column; gap: 6px; min-width: 0; }
.frd-story h3 { margin: 0; font-size: 1.05rem; }
.frd-story .big { font-size: 1.45rem; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.1; }
.frd-story .big small { display: block; font-size: .82rem; font-weight: 500; color: var(--muted); margin-top: 2px; }
.frd-story .big .unverified { font-size: 0.75rem; vertical-align: middle; }   /* the badge size, not the big figure's (Kyle, 25 Nov) */
.frd-story p { margin: 0; font-size: .92rem; }
.frd-story .frd-img { margin-top: auto; max-width: 100%; }
.frd-then { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.frd-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.frd-menu a { display: block; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px;
  color: var(--fg); text-decoration: none; font-weight: 650; }
.frd-menu a:hover { border-color: var(--fg); }
.frd-menu a span { display: block; font-weight: 400; color: var(--muted); font-size: .88rem; }
@media (max-width: 860px) { .frd-grid2 { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .frd-lineup { --k: .42; gap: 10px 12px; }
  .frd-gallery { --k: .6; }
  .frd-bars li { grid-template-columns: 7.2rem 1fr 2.6rem; font-size: .86rem; }
  .frd-mix span { font-size: .68rem; padding: 0 4px; }
  .frd-then { grid-template-columns: 1fr; }
}
/* /set FRS P1 */

/* set FRS P2 (Kyle, 25 November 2026: FRS3, FRS7): the Operators page, the Size and Where it works panels, the small maps.
   An operator's colour only marks that operator (set FOC); the land and dots use the freight map's tokens. */
.frd-mini { display: block; width: 100%; max-width: 170px; height: auto; }
.frd-mini .land { fill: var(--fr-land); stroke: var(--fr-coast); stroke-width: .6; }
.frd-mini .dots circle { fill: var(--fg); stroke: var(--surface); stroke-width: 1.1; }
.frd-mini.fr-c .dots circle { fill: var(--cc); stroke: var(--fg); stroke-width: .8; }
.frd-where { display: grid; grid-template-columns: 170px 1fr; gap: 18px; align-items: start; }
.frd-where h3 { margin: 0 0 4px; font-size: 1rem; }
.frd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 12px; padding: 0; list-style: none; }
.frd-chips li { font-size: .84rem; border: 1px solid var(--rule); border-radius: 999px; padding: 2px 10px; background: var(--surface); }
.frd-rank { list-style: none; padding: 0; margin: 10px 0 4px; display: flex; align-items: flex-end; gap: 3px; height: 64px; max-width: 560px; }
.frd-rank li { flex: 1; background: var(--rule); border-radius: 2px 2px 0 0; min-height: 2px; }
.frd-rank li.me { background: var(--cc, var(--fg)); }
.frd-rank li.me.fr-hatch { background: repeating-linear-gradient(135deg, var(--fg) 0 2px, transparent 2px 5px); }
.frd-opcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.frd-opcard { position: relative; display: grid; grid-template-columns: 88px 1fr; gap: 12px; align-items: start; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px 12px 20px; color: var(--fg); text-decoration: none; overflow: hidden; }
.frd-opcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--cc); }
.frd-opcard.fr-hatch::before { background: repeating-linear-gradient(135deg, var(--muted) 0 2px, transparent 2px 5px); }
.frd-opcard:hover { border-color: var(--fg); }
.frd-opcard b { font-size: 1.02rem; }
.frd-opcard .note { display: block; }
.frd-bars li > span:first-child { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frd-ops { min-width: 720px; table-layout: fixed; }
.frd-ops th:nth-child(1), .frd-ops td:nth-child(1) { width: 2.5rem; }
.frd-ops th:nth-child(2), .frd-ops td:nth-child(2) { width: 24%; }
.frd-ops th:nth-child(3), .frd-ops td:nth-child(3) { width: 9rem; }
.frd-ops th:nth-child(4), .frd-ops td:nth-child(4) { width: 6.5rem; }
.frd-ops td.wrap { min-width: 0; }
@media (max-width: 640px) {
  .frd-where { grid-template-columns: 120px 1fr; gap: 12px; }
  .frd-opcard { grid-template-columns: 72px 1fr; }
}
/* /set FRS P2 */

/* set FRS P4 (Kyle, 25 November 2026: FRS4): the freight maps on the OS grid. Never wider than drawn (560 px; UMAP's rule).
   Lines: the freight-only lines in ink, the rest of the network pale; W12 and W10 in two teals that read in both themes. */
:root { --frm-fo: #1B1D22; --frm-net: #BDB8AD; --frm-w12: #0E6E73; --frm-w10: #6FB3B0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --frm-fo: #F1EEE6; --frm-net: #4A4E57; --frm-w12: #5CC7C2; --frm-w10: #2D6E6C; } }
:root[data-theme="dark"] { --frm-fo: #F1EEE6; --frm-net: #4A4E57; --frm-w12: #5CC7C2; --frm-w10: #2D6E6C; }
.frm-map { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; }
.frm-map text { font-family: inherit; font-size: 11.5px; fill: var(--fg); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.frm-map .land { fill: var(--fr-land); stroke: var(--fr-coast); stroke-width: .8; }
.frm-map .net { fill: none; stroke: var(--frm-net); stroke-width: .9; stroke-linejoin: round; stroke-linecap: round; }
.frm-map .fo { fill: none; stroke: var(--frm-fo); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.frm-map .g-w12 { fill: none; stroke: var(--frm-w12); stroke-width: 2.2; stroke-linecap: round; }
.frm-map .g-w10 { fill: none; stroke: var(--frm-w10); stroke-width: 2; stroke-linecap: round; }
.frm-map .pt rect, .frm-map rect.pt { fill: var(--fr-port); stroke: var(--surface); stroke-width: 1.5; }
.frm-map .tm circle, .frm-map circle.tm { fill: var(--fr-term); stroke: var(--surface); stroke-width: 1.5; }
.frm-map .yd path, .frm-map path.yd { fill: var(--fr-yard); stroke: var(--surface); stroke-width: 1.2; }
@media (max-width: 640px) { .frm-map text { font-size: 17px; stroke-width: 4px; } }   /* drawn to the panel's width, so its labels shrink with it */
/* /set FRS P4 */

/* set FRS P6 (25 November 2026): the six 'what freight carries' panels in one pattern: heading, a figure with its unit,
   plain sentences, the sources line, and the locomotive at the foot (pinned, so the drawings in a row line up). */
.frd-story { display: flex; flex-direction: column; gap: 6px; }
.frd-story .frd-fig { margin: 0; font-size: 1.35rem; font-weight: 750; line-height: 1.15; font-variant-numeric: tabular-nums; }
.frd-story .frd-fig .unverified { display: flex; width: max-content; margin-top: 4px; font-size: 0.75rem; font-weight: 400; }   /* its own line under every headline, so none wraps differently */
.frd-story .frd-src { margin: 0; font-size: .78rem; color: var(--muted); }
.frd-story .frd-src a { color: inherit; }
.frd-story .frd-pic { margin-top: auto; padding-top: 6px; min-height: 32px; display: flex; align-items: flex-end; }
.frd-story .frd-pic .frd-img { margin-top: 0; max-width: 100%; }
/* /set FRS P6 */
