/* /tactics and /checkmates (2026-11-16): the reference pages built by
   scripts/training/build_training_pages.py. On top of telemetry.css (ink, panels, type),
   train.css (the header and logo, the board's square and last-move tokens) and lessons.css
   (the role colors, the Visual Why review pages' own). No hex here: every color is a token. */

/* ---- the page: the left bar, then the reading column ---- */
.tr{max-width:1480px; margin:0 auto; padding:0 clamp(16px, 3vw, 40px) 64px; display:grid;
  grid-template-columns:clamp(150px, 12vw, 210px) minmax(0, 1fr); gap:0 clamp(20px, 3vw, 48px); align-items:start}
.tr-body{min-width:0; padding-top:24px}
/* No smooth scrolling: a click in the left bar jumps straight to the entry (owner, 2026-11-18,
   "rather than the big scroll down"). */

/* The lobby's left bar (pages/lobby.html .stagerail, owner 2026-11-16): uppercase mono labels, no
   borders, the one being read lit gold. It stays in view as the page scrolls, and scrolls on its
   own when the list is taller than the window. */
.tr-rail{position:sticky; top:0; max-height:100vh; overflow-y:auto; display:flex; flex-direction:column;
  gap:1px; padding:24px 0; scrollbar-width:thin; scrollbar-color:var(--line) transparent}
.tr-rail .tr-rail-link{font-family:"IBM Plex Mono",ui-monospace,monospace; font-size:clamp(11px, .2vw + 8.5px, 12.5px);
  letter-spacing:.14em; text-transform:uppercase; line-height:1.35; color:var(--faint); text-decoration:none;
  padding:8px 10px 8px 0; transition:color .2s ease}
.tr-rail .tr-rail-link:hover{color:var(--muted)}
.tr-rail .tr-rail-link.on{color:var(--gold)}
.tr-rail .tr-rail-link:focus-visible{outline:2px solid var(--gold); outline-offset:-2px}
/* The group labels in the bar (checkmates: basic mates, then patterns). */
.tr-rail .tr-rail-group{margin:18px 10px 4px 0; padding-bottom:6px; border-bottom:1px solid var(--line);
  font:600 10.5px/1.3 "IBM Plex Mono",ui-monospace,monospace; letter-spacing:.18em; text-transform:uppercase;
  color:var(--muted)}
.tr-rail .tr-rail-group:first-child{margin-top:0}

/* A plain heading, not a newspaper masthead (owner, 2026-11-16). */
.tr-intro h1{font-size:clamp(22px, .8vw + 14px, 30px); margin:0 0 6px}
.tr-lede{margin:0 0 14px; color:var(--muted); font-size:15.5px; max-width:70ch}
.tr-read{max-width:75ch; margin:0 0 8px; color:var(--muted); font-size:15px; line-height:1.6}

/* ---- one tactic ---- */
.tr-entry{padding:34px 0 10px; border-top:1px solid var(--line); margin-top:26px; scroll-margin-top:12px}

.tr-name{font-family:'Playfair Display',Georgia,serif; font-weight:700; color:var(--ink);
  font-size:clamp(25px, 1vw + 16px, 33px); margin:0 0 12px}

/* Checkmates (owner, 2026-11-18): the basic mates, then the patterns, each group under a label.
   Each mate: its name, the two final positions side by side (plain), the description, then the
   two lines playing themselves side by side. */
.tr-group{margin:48px 0 0; padding-top:16px; border-top:2px solid var(--gold);
  font:600 13px/1.2 "IBM Plex Mono",ui-monospace,monospace; letter-spacing:.16em; text-transform:uppercase;
  color:var(--gold); scroll-margin-top:12px}
.tr-group + .tr-entry{border-top:0; margin-top:0; padding-top:18px}
.tr-finals, .tr-plays{display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:20px 28px; max-width:900px}
.tr-mate .tr-text{margin:22px 0 4px}
.tr-plays{margin-top:14px}
.tr-play-bar{display:flex; align-items:center; justify-content:space-between; gap:10px; margin:8px 0 0}
.tr-play-move{font:500 14.5px/1.4 "IBM Plex Mono",ui-monospace,monospace; font-variant-numeric:tabular-nums;
  color:var(--ink)}
.tr-play-toggle{background:none; border:1px solid var(--line); border-radius:4px; padding:3px 10px;
  font:600 11px/1.3 "IBM Plex Mono",ui-monospace,monospace; letter-spacing:.12em; text-transform:uppercase;
  color:var(--muted); cursor:pointer}
.tr-play-toggle:hover{color:var(--ink); border-color:var(--muted)}
.tr-play-toggle:focus-visible{outline:2px solid var(--gold); outline-offset:2px}

/* Tactics (owner, 2026-11-22): one big board playing the examples one after the other, with what
   is happening beside it; under 1000px the words go below the board. Then the sources. */
.tr-reel{margin:22px 0 6px; display:grid; grid-template-columns:clamp(320px, 40vw, 600px) minmax(0, 360px);
  gap:16px 32px; align-items:start}
.tr-reel-side{display:flex; flex-direction:column; align-items:flex-start; gap:8px; min-width:0}
.tr-reel-side p{margin:0}
.tr-reel-ex{font:600 11px/1.2 "IBM Plex Mono",ui-monospace,monospace; letter-spacing:.12em;
  text-transform:uppercase; color:var(--gold)}
.tr-reel-title{font-family:Merriweather,Georgia,serif; font-size:15px; line-height:1.5; color:var(--muted)}
.tr-reel-move{font:600 clamp(20px, 0.6vw + 13px, 26px)/1.3 "IBM Plex Mono",ui-monospace,monospace;
  font-variant-numeric:tabular-nums; color:var(--ink); min-height:1.3em}
.tr-reel-note{font-family:Merriweather,Georgia,serif; font-size:16px; line-height:1.65; color:var(--ink);
  min-height:5em}
@media (max-width: 1000px){
  .tr-reel{grid-template-columns:minmax(0, 1fr)}
  .tr-reel .tr-board{max-width:520px}
  .tr-reel-note{min-height:0}
}
.tr-sources{margin-top:40px; padding-top:22px; border-top:1px solid var(--line); max-width:75ch;
  color:var(--muted); font-size:15px; line-height:1.6}
.tr-sources-title{font:600 13px/1.2 "IBM Plex Mono",ui-monospace,monospace; letter-spacing:.16em;
  text-transform:uppercase; color:var(--gold); margin:0 0 10px}
.tr-sources p{margin:0 0 8px}
.tr-sources ul{margin:0; padding-left:20px}
.tr-sources a{color:var(--teal)}
.tr-sources a:hover{color:var(--ink)}
.tr-sources .tr-sources-license{margin-top:12px; font-size:13px; color:var(--muted)}
/* a tactic's definition, quoted exactly from Wikipedia (owner, 2026-11-23) */
.tr-quote{margin:0 0 4px; padding:2px 0 2px 16px; border-left:3px solid var(--gold)}
.tr-text{max-width:75ch}
.tr-text p{margin:0 0 12px; font-family:Merriweather,Georgia,serif; font-size:16px; line-height:1.7; color:var(--ink)}

/* ---- one example: three boards, then the moves ---- */
.tr-example{margin:22px 0 8px; padding:16px; background:var(--panel); border:1px solid var(--line); border-radius:12px}
.tr-ex-head{margin:0 0 12px; color:var(--faint)}
.tr-boards{display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:18px}
.tr-fig{margin:0; min-width:0}
.tr-fig-label{margin:0 0 6px; font:600 11px/1.2 "IBM Plex Mono",ui-monospace,monospace; letter-spacing:.12em;
  text-transform:uppercase; color:var(--gold)}
.tr-board{aspect-ratio:1; border-radius:6px; overflow:hidden; background:var(--sq-dark)}
.tr-svg{display:block; width:100%; height:100%}
.tr-cap{margin:8px 0 0; font-size:14.5px; line-height:1.5; color:var(--ink)}
.tr-legend{list-style:none; margin:8px 0 0; padding:0; display:flex; flex-wrap:wrap; gap:4px 12px;
  font-size:12.5px; color:var(--muted)}
.tr-legend li{display:flex; align-items:center; gap:6px}
.tr-legend i{width:12px; height:12px; border-radius:3px; flex:none; background:var(--role-tint)}

/* The board's own colors, drawn in SVG by static/js/training_pages.js. */
.tr-sq.light{fill:var(--sq-light)}
.tr-sq.dark{fill:var(--sq-dark)}
.tr-last{fill:none; stroke:var(--mark-last); stroke-width:6}
.tr-coord{font:700 19px/1 system-ui, sans-serif; pointer-events:none}
.tr-coord.on-light{fill:var(--sq-coord-on-light)}
.tr-coord.on-dark{fill:var(--sq-coord-on-dark)}
.tr-arrow line{stroke:var(--teal); stroke-width:15; stroke-linecap:round; opacity:.85}
.tr-arrow polygon{fill:var(--teal); opacity:.85}
.tr-mark{fill:var(--role-tint)}
.tr-mark.role-attacker{--role-tint:var(--role-attacker); fill-opacity:.62}
.tr-mark.role-target{--role-tint:var(--role-target); fill-opacity:.58}
.tr-mark.role-pinned{--role-tint:var(--role-pinned); fill-opacity:.58}
.tr-mark.role-behind{--role-tint:var(--role-behind); fill-opacity:.62}
.tr-mark.role-line{--role-tint:var(--role-line); fill-opacity:.40}
/* lessons.css's box gray is nearly the dark square's own color, so the boxed squares (a king's
   own pieces, an overloaded piece's two jobs) use telemetry's lighter blue-gray here, on the
   board and in the key, so they show on both square colors. */
.tr-mark.role-box{--role-tint:var(--muted); fill-opacity:.75}
.tr-mark.role-moved{--role-tint:var(--role-moved); fill-opacity:.50}
.tr-mark.role-can-t-take{--role-tint:var(--role-cant-take); fill-opacity:.50}
/* Checkmates: the covered escape squares light blue (the line color: no mate has a line role),
   the pieces helping the mating piece purple. */
.tr-mark.role-covered{--role-tint:var(--role-line); fill-opacity:.40}
.tr-mark.role-helper{--role-tint:var(--role-moved); fill-opacity:.55}
.tr-mark.role-promotion{--role-tint:var(--role-promotion); fill-opacity:.62}
.tr-mark.role-pawn{--role-tint:var(--role-pawn); fill-opacity:.62}
.tr-legend i.role-attacker{--role-tint:var(--role-attacker)}
.tr-legend i.role-target{--role-tint:var(--role-target)}
.tr-legend i.role-pinned{--role-tint:var(--role-pinned)}
.tr-legend i.role-behind{--role-tint:var(--role-behind)}
.tr-legend i.role-line{--role-tint:var(--role-line)}
.tr-legend i.role-box{--role-tint:var(--muted)}
.tr-legend i.role-moved{--role-tint:var(--role-moved)}
.tr-legend i.role-can-t-take{--role-tint:var(--role-cant-take)}
.tr-legend i.role-covered{--role-tint:var(--role-line)}
.tr-legend i.role-helper{--role-tint:var(--role-moved)}
.tr-legend i.role-promotion{--role-tint:var(--role-promotion)}
.tr-legend i.role-pawn{--role-tint:var(--role-pawn)}

/* ---- the moves, stepped on the first board ---- */
.tr-play{display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px 16px;
  margin-top:14px; padding-top:12px; border-top:1px solid var(--line-soft)}
.tr-line{list-style:none; margin:0; padding:0; display:flex; flex-wrap:wrap; gap:4px 6px;
  font:500 14.5px/1.4 "IBM Plex Mono",ui-monospace,monospace; font-variant-numeric:tabular-nums}
.tr-line button{background:none; border:1px solid transparent; border-radius:4px; padding:1px 5px;
  color:var(--ink); font:inherit; cursor:pointer}
.tr-line button:hover{color:var(--teal)}
.tr-line button:focus-visible{outline:none; border-color:var(--teal)}
.tr-line button.now{background:var(--raised); border-color:var(--gold)}
.tr-tools{display:flex; gap:8px}

/* Narrow windows: the bar becomes a row across the top, pinned as the page scrolls, scrolling
   sideways, the one being read underlined (the lobby's horizontal rail does the same). */
@media (max-width: 900px){
  .tr{grid-template-columns:minmax(0, 1fr)}
  .tr-rail{flex-direction:row; max-height:none; overflow-x:auto; overflow-y:hidden; gap:0; padding:0;
    margin:0 calc(-1 * clamp(16px, 3vw, 40px)); padding-inline:clamp(16px, 3vw, 40px); z-index:5;
    background:var(--bg); border-bottom:1px solid var(--line); scrollbar-width:none}
  .tr-rail::-webkit-scrollbar{display:none}
  .tr-rail .tr-rail-link{white-space:nowrap; padding:13px 12px 11px; border-bottom:2px solid transparent}
  .tr-rail .tr-rail-link.on{border-bottom-color:var(--gold)}
  .tr-rail .tr-rail-group{display:none}
  .tr-entry, .tr-group{scroll-margin-top:58px}
}
/* Phones: the boards stack. */
@media (max-width: 760px){
  .tr-boards, .tr-finals, .tr-plays{grid-template-columns:1fr; gap:22px}
  .tr-fig{max-width:440px}
  .tr-example{padding:12px}
}
