/* Security Knowledge: index cards, training pages, and visual components.
   Loaded only on /security pages. Builds on the tokens defined at the top of styles.css,
   so light and dark mode follow the site automatically. All classes are prefixed tr-. */

/* ---- Local tokens: status colors that the main palette does not include ---- */
:root {
  --tr-green: #2E7D4F;  --tr-green-bg: #E6F2EA;
  --tr-amber: #B7791F;  --tr-amber-bg: #FBF0DC;
  --tr-red:   #B23B2E;  --tr-red-bg:   #F8E5E2;
  --tr-p1: #6B7A90; --tr-p2: #1F5FA8; --tr-p3: #0E2A47; --tr-p4: #EE7623; --tr-p5: #B23B2E;
  --tr-shadow: 0 1px 2px rgba(14, 42, 71, .06), 0 6px 18px rgba(14, 42, 71, .06);
  --tr-radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --tr-green: #6CC28E;  --tr-green-bg: #143A2A;
    --tr-amber: #E9B44C;  --tr-amber-bg: #3A2E14;
    --tr-red:   #F08A7A;  --tr-red-bg:   #3D1E1A;
    --tr-p1: #8FA3BC; --tr-p2: #7FB0EA; --tr-p3: #4F7BB0; --tr-p4: #F28A3E; --tr-p5: #F08A7A;
    --tr-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
  }
}

/* ---- Icons ---- */
.tr-ico { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.2em; }

/* =========================================================
   Index page
   ========================================================= */
.tr-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 22px;
}
.tr-card-link {
  --tone: var(--accent);
  position: relative; display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--tr-radius);
  padding: 22px 22px 18px; box-shadow: var(--tr-shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tr-card-link::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--tone); border-radius: var(--tr-radius) var(--tr-radius) 0 0; }
.tr-card-tone-1 { --tone: var(--signal); }
.tr-card-tone-2 { --tone: var(--tr-green); }
.tr-card-tone-3 { --tone: var(--tr-p3); }
.tr-card-link:hover { transform: translateY(-2px); border-color: var(--tone); }
.tr-card-top { display: flex; align-items: center; gap: 12px; }
.tr-card-icon {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 10px;
  background: var(--fill); color: var(--tone); font-size: 1.35rem;
}
.tr-card-link h3 { font-family: var(--font-display); font-size: 1.65rem; line-height: 1.1; }
.tr-card-link h3 a { color: var(--heading); text-decoration: none; }
.tr-card-link h3 a::after { content: ""; position: absolute; inset: 0; }
.tr-card-link h3 a:focus-visible { outline: none; }
.tr-card-link:has(h3 a:focus-visible) { outline: 3px solid var(--signal); outline-offset: 3px; }
.tr-card-link > p { color: var(--muted); }
.tr-kicker {
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--signal) !important; font-weight: 600;
}
.tr-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .93rem; color: var(--fg); }
.tr-checks li { display: flex; gap: 8px; align-items: flex-start; }
.tr-checks .tr-ico { color: var(--tr-green); margin-top: 3px; }
.tr-card-foot {
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: .76rem; color: var(--muted);
}
.tr-card-foot span { display: inline-flex; gap: 6px; align-items: center; }
.tr-card-go { color: var(--accent); font-weight: 600; }

.tr-planned { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.tr-planned li { background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--rule); padding: 18px 20px; border-radius: var(--tr-radius); }
.tr-planned h3 { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 6px; }
.tr-planned p { color: var(--muted); font-size: .95rem; }

/* =========================================================
   Training page frame
   ========================================================= */
.tr-overview { background: var(--surface); border-bottom: 1px solid var(--rule); }
.tr-overview-inner { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px; align-items: center; padding-top: 30px; padding-bottom: 30px; }
.tr-overview-main { display: flex; gap: 18px; align-items: flex-start; }
.tr-overview-icon {
  display: grid; place-items: center; flex: none; width: 64px; height: 64px; border-radius: 14px;
  background: var(--band); color: var(--signal); font-size: 2rem;
}
.tr-key-idea { font-family: var(--font-display); font-size: 1.55rem; line-height: 1.2; color: var(--heading); margin: 4px 0 14px !important; max-width: 40ch; }
.tr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tr-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: .74rem; color: var(--heading);
  border: 1px solid var(--rule); background: var(--bg); padding: 4px 10px; border-radius: 999px;
}
.tr-chip .tr-ico { color: var(--accent); }
.tr-chip-draft { border-color: var(--signal); color: var(--signal); }

.tr-toolbar { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--rule); }
.tr-toolbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.tr-toc { display: flex; flex-wrap: wrap; gap: 2px; }
.tr-toc a {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: .75rem; color: var(--muted);
  text-decoration: none; padding: 6px 9px; border-radius: 4px;
}
.tr-toc-num {
  display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  background: var(--fill); color: var(--heading); font-size: .66rem; font-weight: 600;
}
.tr-toc a:hover { background: var(--fill); color: var(--heading); }
.tr-toc a.is-active { color: var(--heading); background: var(--fill); font-weight: 600; }
.tr-toc a.is-active .tr-toc-num { background: var(--signal); color: #fff; }
.tr-view { display: flex; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.tr-view[hidden] { display: none; }
.tr-view button {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: .75rem; border: 0; cursor: pointer;
  background: transparent; color: var(--muted); padding: 7px 12px;
}
.tr-view button[aria-pressed="true"] { background: var(--accent); color: var(--surface); font-weight: 600; }
.tr-progress { height: 3px; background: transparent; }
.tr-progress[hidden] { display: none; }
.tr-progress span { display: block; height: 100%; width: 0; background: var(--signal); transition: width .1s linear; }

.tr-body .section { scroll-margin-top: 60px; }
html.tr-exec .tr-tech { display: none !important; }

/* Part headings: pill label with a short bar */
.tr-body .section-head { margin-bottom: 22px; }
.tr-body .section-head .label {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--band); color: var(--band-fg); padding: 4px 12px; border-radius: 999px;
}
.tr-body .section-head h2 { margin-top: 12px; }
.tr-body .section-head h2::after { content: ""; display: block; width: 56px; height: 4px; background: var(--signal); margin-top: 12px; }

.tr-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 28px; align-items: start; }
.tr-prose { max-width: 72ch; margin-bottom: 22px; }
.tr-prose p + p { margin-top: 1em; }
.tr-objectives { list-style: none; counter-reset: obj; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.tr-objectives li { counter-increment: obj; display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; }
.tr-objectives li::before {
  content: counter(obj); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--fill); color: var(--heading); font-family: var(--font-mono); font-size: .78rem; font-weight: 600;
}
.tr-body code {
  font-family: var(--font-mono); font-size: .84em; white-space: nowrap;
  background: var(--fill); color: var(--heading); padding: 1px 6px; border-radius: 3px;
}

/* =========================================================
   Callouts (icons drawn with CSS masks, allowed by img-src data:)
   ========================================================= */
.tr-callout { position: relative; padding: 18px 22px 18px 64px; margin: 24px 0 0; border-radius: var(--tr-radius); }
.tr-callout::before {
  content: ""; position: absolute; left: 20px; top: 18px; width: 28px; height: 28px; background: currentColor;
  -webkit-mask: var(--tr-mask) center / contain no-repeat; mask: var(--tr-mask) center / contain no-repeat;
}
.tr-callout h4 { font-family: var(--font-display); font-size: 1.25rem; color: var(--heading); margin: 0 0 .35em; }
.tr-callout p + p { margin-top: .7em; }
.tr-callout ul, .tr-callout ol { margin: .5em 0 0; padding-left: 1.2em; }
.tr-callout li + li { margin-top: .3em; }
.tr-callout-exec {
  background: var(--fill); border-left: 5px solid var(--accent); color: var(--accent);
  --tr-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='7' width='18' height='13' rx='2'/%3E%3Cpath d='M9 7V5h6v2M3 13h18'/%3E%3C/svg%3E");
}
.tr-callout-tech {
  background: var(--surface); border: 1px dashed var(--soft); color: var(--soft);
  --tr-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 8l-4 4 4 4M16 8l4 4-4 4M14 5l-4 14'/%3E%3C/svg%3E");
}
.tr-callout-note {
  background: var(--surface); border-left: 5px solid var(--signal); color: var(--signal);
  --tr-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3L2 20h20zM12 9v5M12 17v.5'/%3E%3C/svg%3E");
}
.tr-callout > * { color: var(--fg); }
.tr-callout > h4 { color: var(--heading); }
.tr-space-top { margin-top: 36px; }

/* =========================================================
   Cards and grids
   ========================================================= */
.tr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.tr-card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--tr-radius);
  padding: 20px; box-shadow: var(--tr-shadow);
}
.tr-card h3 { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.4rem; line-height: 1.15; margin-bottom: 8px; }
.tr-card h3 .tr-ico { color: var(--accent); font-size: 1.2rem; }
.tr-card p { color: var(--fg); }
.tr-card p + p, .tr-card p + ul, .tr-card ul + p { margin-top: .6em; }
.tr-card ul { margin: .4em 0 0; padding-left: 1.1em; }
.tr-card li + li { margin-top: .25em; }
.tr-card-accent { border-top: 4px solid var(--accent); }
.tr-card-signal { border-top: 4px solid var(--signal); }
.tr-card-good { border-top: 4px solid var(--tr-green); }
.tr-card-bad { border-top: 4px solid var(--tr-red); }

/* Icon card: large icon tile at the top */
.tr-icard .tr-icard-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; margin-bottom: 12px;
  background: var(--fill); color: var(--accent); font-size: 1.3rem;
}
.tr-icard.tr-card-signal .tr-icard-icon { color: var(--signal); }
.tr-icard.tr-card-bad .tr-icard-icon { color: var(--tr-red); background: var(--tr-red-bg); }
.tr-icard.tr-card-good .tr-icard-icon { color: var(--tr-green); background: var(--tr-green-bg); }

/* =========================================================
   Stat tiles
   ========================================================= */
.tr-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 14px; margin: 0 0 24px; }
.tr-stat {
  display: flex; flex-direction: column; gap: 2px; padding: 18px 18px 16px;
  background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--signal);
  border-radius: var(--tr-radius); box-shadow: var(--tr-shadow);
}
.tr-stat-value { font-family: var(--font-display); font-weight: 700; font-size: 2.6rem; line-height: 1; color: var(--heading); }
.tr-stat-label { font-weight: 700; color: var(--heading); font-size: .95rem; margin-top: 6px; }
.tr-stat-note { font-size: .82rem; color: var(--muted); }
.tr-stats-overview { margin: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tr-stats-overview .tr-stat { box-shadow: none; background: var(--bg); padding: 14px; }
.tr-stats-overview .tr-stat-value { font-size: 2rem; }

/* =========================================================
   Flow diagram
   ========================================================= */
.tr-flow {
  list-style: none; margin: 8px 0 24px; padding: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 28px;
}
.tr-flow-step {
  position: relative; display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--tr-radius);
  padding: 16px; box-shadow: var(--tr-shadow);
}
.tr-flow-step::after {
  content: ""; position: absolute; right: -22px; top: 30px; width: 16px; height: 16px;
  background: var(--soft);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.tr-flow-step:last-child::after { display: none; }
.tr-flow-icon {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--fill); color: var(--accent); font-size: 1.15rem;
}
.tr-tone-attack .tr-flow-icon { background: var(--tr-red-bg); color: var(--tr-red); }
.tr-tone-defend .tr-flow-icon { background: var(--tr-green-bg); color: var(--tr-green); }
.tr-tone-signal .tr-flow-icon { background: var(--fill); color: var(--signal); }
.tr-flow-step strong { color: var(--heading); font-size: .98rem; line-height: 1.25; }
.tr-flow-text { font-size: .86rem; color: var(--muted); line-height: 1.45; }
.tr-flow-stop {
  display: flex; gap: 6px; align-items: flex-start; margin-top: auto; padding-top: 8px; width: 100%;
  border-top: 1px dashed var(--rule); font-size: .8rem; color: var(--tr-green); font-weight: 600; line-height: 1.35;
}
.tr-flow-stop .tr-ico { margin-top: 1px; }
/* Many steps: wrap into rows */
.tr-flow-wrap { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); }
.tr-flow-compact .tr-flow-step { padding: 12px; }
.tr-flow-compact .tr-flow-icon { width: 32px; height: 32px; font-size: 1rem; }

/* =========================================================
   Cycle diagram
   ========================================================= */
.tr-cycle { margin: 8px 0 24px; display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 32px; align-items: center; }
.tr-cycle-svg { width: 100%; height: auto; max-width: 340px; display: block; margin: 0 auto; }
.tr-svg-ring { fill: none; stroke: var(--rule); stroke-width: 2; }
.tr-svg-arc { fill: none; stroke: var(--soft); stroke-width: 2.5; }
.tr-svg-arrowhead { fill: var(--soft); }
.tr-svg-center { fill: var(--band); }
.tr-svg-center-text { fill: var(--band-fg); font-family: var(--font-display); font-weight: 700; font-size: 21px; }
.tr-svg-node { stroke: var(--surface); stroke-width: 4; }
.tr-svg-node-text { fill: #fff; font-family: var(--font-display); font-weight: 700; font-size: 21px; }
.tr-svg-node-0 { fill: var(--tr-p2); } .tr-svg-node-1 { fill: var(--tr-p4); } .tr-svg-node-2 { fill: var(--tr-green); }
.tr-svg-node-3 { fill: var(--tr-p3); } .tr-svg-node-4 { fill: var(--tr-red); } .tr-svg-node-5 { fill: var(--tr-p1); }
.tr-cycle-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tr-cycle-legend li {
  display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--tr-radius); padding: 10px 14px;
}
.tr-cycle-legend strong { display: block; color: var(--heading); }
.tr-cycle-legend span:not(.tr-cycle-key) { display: block; font-size: .9rem; color: var(--muted); }
.tr-cycle-key {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
}
.tr-key-0 { background: var(--tr-p2); } .tr-key-1 { background: var(--tr-p4); } .tr-key-2 { background: var(--tr-green); }
.tr-key-3 { background: var(--tr-p3); } .tr-key-4 { background: var(--tr-red); } .tr-key-5 { background: var(--tr-p1); }

/* =========================================================
   Pyramid and funnel
   ========================================================= */
.tr-pyramid { display: grid; gap: 6px; margin: 8px 0 24px; }
.tr-pyr-level { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 22px; align-items: center; }
.tr-pyr-bar {
  justify-self: center; display: grid; place-items: center; text-align: center; min-height: 64px; padding: 8px 18px;
  color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; line-height: 1.1;
  clip-path: polygon(6% 0, 94% 0, 100% 100%, 0 100%);
}
.tr-pyr-bar small { display: block; font-family: var(--font-mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; opacity: .85; }
.tr-pyr-desc { font-size: .95rem; }
.tr-pyr-desc strong { color: var(--heading); }
.tr-pyr-1 .tr-pyr-bar { width: 40%; background: var(--tr-p5); }
.tr-pyr-2 .tr-pyr-bar { width: 60%; background: var(--tr-p4); }
.tr-pyr-3 .tr-pyr-bar { width: 80%; background: var(--tr-p2); }
.tr-pyr-4 .tr-pyr-bar { width: 100%; background: var(--tr-p3); }
/* Funnel: widest at the top */
.tr-funnel .tr-pyr-bar { clip-path: polygon(0 0, 100% 0, 94% 100%, 6% 100%); }
.tr-funnel .tr-pyr-1 .tr-pyr-bar { width: 100%; background: var(--tr-p3); }
.tr-funnel .tr-pyr-2 .tr-pyr-bar { width: 80%; background: var(--tr-p2); }
.tr-funnel .tr-pyr-3 .tr-pyr-bar { width: 60%; background: var(--tr-p4); }
.tr-funnel .tr-pyr-4 .tr-pyr-bar { width: 40%; background: var(--tr-p5); }

/* =========================================================
   Layer stack
   ========================================================= */
.tr-layers { display: grid; gap: 8px; margin: 8px 0 24px; }
.tr-layer {
  display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 16px; align-items: center;
  background: var(--surface); border: 1px solid var(--rule); border-left: 6px solid var(--tr-p1);
  border-radius: var(--tr-radius); padding: 14px 18px; box-shadow: var(--tr-shadow);
}
.tr-layer:nth-child(2) { border-left-color: var(--tr-p2); margin-inline: 2%; }
.tr-layer:nth-child(3) { border-left-color: var(--tr-p4); margin-inline: 4%; }
.tr-layer:nth-child(4) { border-left-color: var(--tr-green); margin-inline: 6%; }
.tr-layer:nth-child(5) { border-left-color: var(--tr-red); margin-inline: 8%; }
.tr-layer-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 10px; background: var(--fill); color: var(--accent); font-size: 1.3rem; }
.tr-layer h4 { font-family: var(--font-display); font-size: 1.25rem; color: var(--heading); margin: 0; }
.tr-layer h4 small { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--signal); margin-left: 8px; font-weight: 600; }
.tr-layer p { font-size: .93rem; color: var(--muted); margin-top: 2px; }

/* =========================================================
   2x2 matrix
   ========================================================= */
.tr-matrix { display: grid; grid-template-columns: 28px minmax(0, 1fr); grid-template-rows: auto 28px; gap: 8px; margin: 8px 0 24px; }
.tr-mx-y { writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-family: var(--font-mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tr-mx-x { grid-column: 2; text-align: center; font-family: var(--font-mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tr-mx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tr-mx-cell { border-radius: var(--tr-radius); padding: 16px 18px; border: 1px solid var(--rule); }
.tr-mx-cell h4 { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 1.2rem; margin: 0 0 4px; color: var(--heading); }
.tr-mx-cell p { font-size: .9rem; }
.tr-mx-hi  { background: var(--tr-red-bg);   border-color: var(--tr-red); }
.tr-mx-hi h4 .tr-ico { color: var(--tr-red); }
.tr-mx-med { background: var(--tr-amber-bg); border-color: var(--tr-amber); }
.tr-mx-med h4 .tr-ico { color: var(--tr-amber); }
.tr-mx-low { background: var(--surface); }
.tr-mx-low h4 .tr-ico { color: var(--tr-green); }

/* =========================================================
   Meter
   ========================================================= */
.tr-meter { display: grid; gap: 10px; margin: 8px 0 24px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--tr-radius); padding: 18px 20px; box-shadow: var(--tr-shadow); }
.tr-meter-row { display: grid; grid-template-columns: minmax(0, 230px) minmax(0, 1fr) 170px; gap: 16px; align-items: center; }
.tr-meter-label { font-weight: 600; color: var(--heading); font-size: .95rem; line-height: 1.25; }
.tr-meter-label small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
.tr-meter-track { display: block; height: 12px; background: var(--fill); border-radius: 999px; overflow: hidden; }
.tr-meter-fill { display: block; height: 100%; border-radius: 999px; }
.tr-lvl-1 { width: 20%; background: var(--tr-red); }
.tr-lvl-2 { width: 40%; background: var(--tr-amber); }
.tr-lvl-3 { width: 60%; background: var(--tr-p2); }
.tr-lvl-4 { width: 80%; background: var(--tr-p2); }
.tr-lvl-5 { width: 100%; background: var(--tr-green); }

/* Badges */
.tr-badge {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  font-family: var(--font-mono); font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap;
}
.tr-badge-lvl-1, .tr-badge-bad  { color: var(--tr-red);   background: var(--tr-red-bg); }
.tr-badge-lvl-2, .tr-badge-warn { color: var(--tr-amber); background: var(--tr-amber-bg); }
.tr-badge-lvl-3, .tr-badge-lvl-4, .tr-badge-info { color: var(--accent); background: var(--fill); }
.tr-badge-lvl-5, .tr-badge-good { color: var(--tr-green); background: var(--tr-green-bg); }

/* =========================================================
   Traffic light
   ========================================================= */
.tr-traffic { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 8px 0 24px; }
.tr-light { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--tr-radius); overflow: hidden; box-shadow: var(--tr-shadow); }
.tr-light-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; color: #fff; }
.tr-light-head h4 { margin: 0; font-family: var(--font-display); font-size: 1.35rem; color: #fff; }
.tr-light-head small { display: block; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; opacity: .9; }
.tr-light-dot { width: 26px; height: 26px; border-radius: 50%; background: #fff; opacity: .9; flex: none; box-shadow: inset 0 0 0 6px rgba(0,0,0,.12); }
.tr-light-green .tr-light-head { background: var(--tr-green); }
.tr-light-amber .tr-light-head { background: var(--tr-amber); }
.tr-light-red   .tr-light-head { background: var(--tr-red); }
@media (prefers-color-scheme: dark) { .tr-light-head, .tr-light-head h4 { color: #0B1F35; } }
.tr-light-body { padding: 14px 18px 18px; font-size: .93rem; }
.tr-light-body dt { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.tr-light-body dt:first-child { margin-top: 0; }
.tr-light-body dd { margin: 2px 0 0; }

/* =========================================================
   Email mockup with numbered warning markers
   ========================================================= */
.tr-mock { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; align-items: start; margin: 8px 0 24px; }
.tr-email { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--tr-shadow); overflow: hidden; font-size: .93rem; }
.tr-email-bar { display: flex; gap: 6px; padding: 10px 14px; background: var(--fill); border-bottom: 1px solid var(--rule); }
.tr-email-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--rule); }
.tr-email-head { padding: 14px 18px; border-bottom: 1px solid var(--rule); display: grid; gap: 6px; }
.tr-email-head div { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tr-email-head b { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); width: 64px; flex: none; }
.tr-email-body { padding: 16px 18px 20px; display: grid; gap: 10px; }
.tr-email-body .tr-fake-btn { display: inline-block; background: var(--accent); color: var(--surface); padding: 8px 14px; border-radius: 4px; font-weight: 600; font-size: .88rem; }
.tr-mark {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: var(--tr-red); color: #fff; font-family: var(--font-mono); font-size: .72rem; font-weight: 700; vertical-align: middle;
}
@media (prefers-color-scheme: dark) { .tr-mark { color: #0B1F35; } }
.tr-hl { background: var(--tr-red-bg); outline: 1px dashed var(--tr-red); border-radius: 2px; padding: 0 2px; }
.tr-marks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tr-marks li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--tr-radius); padding: 10px 14px; }
.tr-marks strong { color: var(--heading); display: block; }
.tr-marks span:not(.tr-mark) { font-size: .9rem; color: var(--muted); }

/* =========================================================
   Mini ATT&CK matrix
   ========================================================= */
.tr-mini-matrix { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 112px), 1fr)); gap: 6px; margin: 8px 0 12px; }
.tr-mm-col { border-radius: 4px; overflow: hidden; background: var(--surface); border: 1px solid var(--rule); }
.tr-mm-head { padding: 8px; color: #fff; font-size: .78rem; font-weight: 700; line-height: 1.2; min-height: 52px; }
@media (prefers-color-scheme: dark) { .tr-mm-head { color: #0B1F35; } }
.tr-mm-head span { display: block; font-family: var(--font-mono); font-size: .64rem; opacity: .85; font-weight: 600; }
.tr-mm-cells { display: grid; gap: 3px; padding: 6px; }
.tr-mm-cells i { display: block; height: 6px; border-radius: 2px; background: var(--fill); }
.tr-mm-cells i:nth-child(odd) { width: 80%; }
.tr-ph-1 .tr-mm-head, .tr-legend .tr-ph-1::before { background: var(--tr-p1); }
.tr-ph-2 .tr-mm-head, .tr-legend .tr-ph-2::before { background: var(--tr-p2); }
.tr-ph-3 .tr-mm-head, .tr-legend .tr-ph-3::before { background: var(--tr-p3); }
.tr-ph-4 .tr-mm-head, .tr-legend .tr-ph-4::before { background: var(--tr-p4); }
.tr-ph-5 .tr-mm-head, .tr-legend .tr-ph-5::before { background: var(--tr-p5); }
.tr-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 24px; padding: 0; list-style: none; font-size: .85rem; color: var(--muted); }
.tr-legend li { display: inline-flex; align-items: center; gap: 8px; }
.tr-legend li::before { content: ""; width: 14px; height: 14px; border-radius: 3px; }

/* =========================================================
   Interactive checklist
   ========================================================= */
.tr-checklist-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; align-items: start; }
.tr-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tr-checklist label {
  display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; cursor: pointer;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--tr-radius); padding: 12px 16px;
}
.tr-checklist input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--tr-green); }
.tr-checklist input:checked + span { color: var(--muted); }
.tr-checklist label:has(input:checked) { border-color: var(--tr-green); background: var(--tr-green-bg); }
.tr-checklist strong { color: var(--heading); }
.tr-score-card {
  position: sticky; top: 72px; background: var(--band); color: var(--band-fg); border-radius: var(--tr-radius); padding: 20px; text-align: center;
}
.tr-score-card[hidden] { display: none; }
.tr-score-big { display: block; font-family: var(--font-display); font-weight: 700; font-size: 3.4rem; line-height: 1; }
.tr-score-of { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--band-muted); }
.tr-score-bar { display: block; height: 10px; background: var(--band-line); border-radius: 999px; margin: 14px 0 12px; overflow: hidden; }
.tr-score-bar span { display: block; height: 100%; width: 0; background: var(--signal); transition: width .2s ease; }
.tr-score-msg { font-size: .9rem; color: var(--band-muted); margin: 0; }

/* =========================================================
   Existing components, refreshed
   ========================================================= */
/* TTP ladder (kept for compatibility) */
.tr-ladder { display: grid; gap: 10px; }
.tr-rung { display: grid; grid-template-columns: 170px 1fr; gap: 16px; align-items: start; background: var(--surface); border: 1px solid var(--rule); padding: 16px 18px; }
.tr-q-label { display: block; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--signal); }
.tr-rung-name { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; color: var(--heading); }

/* Expandable cards */
.tr-tactics { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; margin-top: 22px; align-items: start; }
.tr-tac { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--tr-radius); box-shadow: var(--tr-shadow); }
.tr-tac[open] { border-color: var(--accent); }
.tr-tac summary { list-style: none; cursor: pointer; padding: 14px 16px; display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center; }
.tr-tac summary::-webkit-details-marker { display: none; }
.tr-tac summary:hover .tr-tac-name { color: var(--accent); }
.tr-tac summary:focus-visible { outline: 3px solid var(--signal); outline-offset: -3px; }
.tr-num { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: var(--band); color: var(--band-fg); font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }
.tr-tac.tr-ph-1 .tr-num { background: var(--tr-p1); } .tr-tac.tr-ph-2 .tr-num { background: var(--tr-p2); }
.tr-tac.tr-ph-3 .tr-num { background: var(--tr-p3); } .tr-tac.tr-ph-4 .tr-num { background: var(--tr-p4); }
.tr-tac.tr-ph-5 .tr-num { background: var(--tr-p5); }
@media (prefers-color-scheme: dark) { .tr-tac[class*="tr-ph-"] .tr-num { color: #0B1F35; } }
.tr-tac-name { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--heading); line-height: 1.1; }
.tr-tac-goal { display: block; font-size: .88rem; color: var(--muted); margin-top: 2px; }
.tr-plus { font-family: var(--font-mono); color: var(--accent); font-size: 1.2rem; transition: transform .15s; }
.tr-tac[open] .tr-plus { transform: rotate(45deg); }
.tr-new { font-family: var(--font-mono); font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; background: var(--signal); color: #fff; padding: 2px 6px; margin-left: 8px; vertical-align: middle; font-weight: 600; border-radius: 3px; white-space: nowrap; display: inline-block; }
.tr-tac-body { margin: 0; padding: 0 16px 16px 66px; font-size: .95rem; }
.tr-tac-body dt { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--signal); margin-top: 10px; }
.tr-tac-body dd { margin: 2px 0 0; }

/* Vertical timeline */
.tr-timeline { list-style: none; margin: 0; padding: 0; }
.tr-timeline li { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 0 0 16px 50px; }
.tr-timeline li::before { content: ""; position: absolute; left: 17px; top: 36px; bottom: 0; width: 2px; background: var(--rule); }
.tr-timeline li:last-child::before { display: none; }
.tr-step { position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--surface); font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; box-shadow: 0 0 0 4px var(--bg); }
.section-tint .tr-step { box-shadow: 0 0 0 4px var(--fill); }
.tr-atk, .tr-def { padding: 14px 16px; font-size: .95rem; border-radius: var(--tr-radius); }
.tr-atk { background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--tr-red); }
.tr-def { background: var(--tr-green-bg); border: 1px solid var(--tr-green); border-left-width: 4px; }
.tr-tag { display: block; margin-bottom: 4px; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.tr-atk .tr-tag { color: var(--tr-red); }
.tr-def .tr-tag { color: var(--tr-green); }
.tr-ids { margin-top: 8px !important; font-size: .85rem; }
.tr-ids code { white-space: normal; }
.tr-timeline li > div, .tr-split > *, .tr-rung > *, .tr-mock > *, .tr-cycle > *, .tr-checklist-wrap > * { min-width: 0; }

/* Tables */
.tr-table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--tr-radius); box-shadow: var(--tr-shadow); }
.tr-table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .95rem; }
.tr-table thead th {
  background: var(--band); color: var(--band-fg); text-align: left; padding: 13px 14px;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600;
}
.tr-table td, .tr-table tbody th { padding: 13px 14px; border-top: 1px solid var(--rule); vertical-align: top; text-align: left; }
.tr-table tbody tr:nth-child(even) { background: var(--bg); }
.tr-table tbody tr:hover { background: var(--fill); }
.tr-table tbody th { color: var(--heading); width: 22%; border-left: 4px solid var(--accent); }
.tr-table .tr-badge { margin-top: 2px; }

/* Numbered steps */
.tr-steps { counter-reset: tr; list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tr-steps li { counter-increment: tr; position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--tr-radius); padding: 16px 18px 16px 70px; box-shadow: var(--tr-shadow); }
.tr-steps li::before {
  content: counter(tr, decimal-leading-zero); position: absolute; left: 16px; top: 14px; width: 40px; height: 40px;
  display: grid; place-items: center; border-radius: 8px; background: var(--fill);
  font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--signal);
}
.tr-steps strong { color: var(--heading); }

/* Quiz */
.tr-quiz { display: grid; gap: 16px; }
.tr-q { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--tr-radius); padding: 20px; box-shadow: var(--tr-shadow); }
.tr-q-text { font-weight: 700; color: var(--heading); margin-bottom: 12px !important; }
.tr-opts { display: grid; gap: 8px; }
.tr-opt { font: inherit; font-size: .95rem; text-align: left; cursor: pointer; background: var(--bg); color: var(--fg); border: 1px solid var(--rule); padding: 10px 14px; border-radius: 6px; }
.tr-opt:hover:not(:disabled) { border-color: var(--accent); }
.tr-opt:disabled { cursor: default; }
.tr-opt.is-right { background: var(--tr-green-bg); border-color: var(--tr-green); color: var(--fg); font-weight: 600; }
.tr-opt.is-wrong { background: var(--tr-red-bg); border-color: var(--tr-red); color: var(--fg); }
.tr-fb { margin-top: 10px !important; padding: 10px 14px; background: var(--fill); font-size: .93rem; border-radius: 6px; }
.tr-score { font-family: var(--font-display); font-size: 1.5rem; color: var(--heading); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tr-score:empty { display: none; }
.tr-reset { font-family: var(--font-mono); font-size: .76rem; cursor: pointer; background: transparent; color: var(--accent); border: 1px solid var(--accent); padding: 7px 12px; border-radius: 4px; }

/* Glossary */
.tr-gloss { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; margin: 0; }
.tr-gloss-item { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--tr-radius); padding: 14px 16px; }
.tr-gloss-item dt { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--heading); }
.tr-gloss-item dd { margin: 4px 0 0; font-size: .93rem; }
.tr-attrib { margin-top: 28px !important; font-size: .82rem; color: var(--soft); max-width: 80ch; }
.tr-after { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* =========================================================
   Small screens
   ========================================================= */
@media (max-width: 900px) {
  .tr-overview-inner { grid-template-columns: 1fr; }
  .tr-flow { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: 1fr; gap: 26px; }
  .tr-flow-step::after { right: auto; left: 28px; top: auto; bottom: -21px; transform: rotate(90deg); }
  .tr-flow-wrap { grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 12px; }
  .tr-flow-wrap .tr-flow-step::after { display: none; }
  .tr-cycle { grid-template-columns: 1fr; }
  .tr-mock { grid-template-columns: 1fr; }
  .tr-checklist-wrap { grid-template-columns: 1fr; }
  .tr-score-card { position: static; order: -1; }
}
@media (max-width: 720px) {
  .tr-toc { display: none; }
  .tr-toolbar-inner { justify-content: flex-end; }
  .tr-rung { grid-template-columns: 1fr; gap: 4px; }
  .tr-timeline li { grid-template-columns: 1fr; gap: 8px; }
  .tr-tac-body { padding-left: 16px; }
  .tr-pyr-level { grid-template-columns: 1fr; gap: 6px; }
  .tr-pyr-bar { min-height: 52px; }
  .tr-pyr-desc { text-align: center; }
  .tr-mx-grid { grid-template-columns: 1fr; }
  .tr-matrix { grid-template-columns: 1fr; }
  .tr-mx-y, .tr-mx-x { display: none; }
  .tr-meter-row { grid-template-columns: 1fr; gap: 6px; }
  .tr-meter-row .tr-badge { justify-self: start; }
  .tr-traffic { grid-template-columns: 1fr; }
  .tr-stats-overview { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .tr-stats-overview .tr-stat { padding: 10px; }
  .tr-stats-overview .tr-stat-value { font-size: 1.5rem; }
  .tr-stats-overview .tr-stat-note { display: none; }
  .tr-layer:nth-child(n) { margin-inline: 0; }
  .tr-callout { padding-left: 20px; padding-top: 56px; }
  .tr-overview-main { flex-direction: column; gap: 12px; }
  .tr-overview-icon { width: 52px; height: 52px; font-size: 1.6rem; }
}

/* =========================================================
   Print: full detail, everything expanded, no interactive chrome
   ========================================================= */
@media print {
  .tr-toolbar, .tr-reset, .tr-score-card { display: none; }
  html.tr-exec .tr-tech { display: revert !important; }
  .tr-tac, .tr-q, .tr-timeline li, .tr-card, .tr-flow-step, .tr-layer, .tr-light, .tr-cycle { break-inside: avoid; }
  .tr-card, .tr-tac, .tr-q, .tr-stat, .tr-flow-step, .tr-meter, .tr-table-wrap { box-shadow: none; }
}

/* =========================================================
   Small additions used by the content files
   ========================================================= */
.tr-sub { font-family: var(--font-display); font-size: 1.45rem; color: var(--heading); margin: 28px 0 14px; }
.tr-sub:first-child { margin-top: 0; }
.tr-caption { font-size: .85rem; color: var(--muted); margin: -12px 0 22px !important; }
.tr-legend .tr-legend-note { font-style: italic; }
.tr-legend .tr-legend-note::before { display: none; }

/* Wrapped flows read left to right in rows; numbers carry the order, so no arrows */
.tr-flow-wrap { gap: 12px; }
.tr-flow-wrap .tr-flow-step::after { display: none; }

/* Five-tile backup rule: big numbers */
.tr-stats-rule { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tr-stats-rule .tr-stat { align-items: center; text-align: center; border-left: 1px solid var(--rule); border-top: 4px solid var(--tr-green); }
.tr-stats-rule .tr-stat-value { font-size: 3.4rem; color: var(--tr-green); }
@media (max-width: 900px) { .tr-stats-rule { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }

/* Incident first hour: "do" in blue, "avoid" in red */
.tr-atk.tr-do { border-left-color: var(--accent); }
.tr-atk.tr-do .tr-tag { color: var(--accent); }
.tr-def.tr-avoid { background: var(--tr-red-bg); border-color: var(--tr-red); }
.tr-def.tr-avoid .tr-tag { color: var(--tr-red); }

/* =========================================================
   Resources learning path
   ========================================================= */
.tr-path { list-style: none; margin: 0 0 28px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; counter-reset: none; }
.tr-path-stage a {
  position: relative; display: flex; gap: 16px; align-items: flex-start; height: 100%;
  padding: 22px 30px 22px 22px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--tr-shadow);
}
.tr-path-stage:first-child a { border-radius: var(--tr-radius) 0 0 var(--tr-radius); }
.tr-path-stage:last-child a { border-radius: 0 var(--tr-radius) var(--tr-radius) 0; }
.tr-path-stage + .tr-path-stage a { border-left: 0; }
.tr-path-stage:not(:last-child) a::after {
  content: ""; position: absolute; right: -13px; top: 50%; width: 24px; height: 24px; z-index: 1;
  background: var(--surface); border-top: 1px solid var(--rule); border-right: 1px solid var(--rule);
  transform: translateY(-50%) rotate(45deg);
}
.tr-path-stage a:hover strong { color: var(--accent); }
.tr-path-num, .tr-stage-num {
  display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 50%;
  font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; color: #fff;
}
.tr-path-1 .tr-path-num, #fundamentals .tr-stage-num { background: var(--tr-p2); }
.tr-path-2 .tr-path-num, #resiliency .tr-stage-num { background: var(--signal); }
.tr-path-3 .tr-path-num, #guides .tr-stage-num { background: var(--tr-green); }
@media (prefers-color-scheme: dark) { .tr-path-num, .tr-stage-num { color: #0B1F35; } }
.tr-path-body { display: grid; gap: 4px; }
.tr-path-body strong { font-family: var(--font-display); font-size: 1.45rem; line-height: 1.1; color: var(--heading); }
.tr-path-body > span:last-child { font-size: .92rem; color: var(--muted); }

.tr-stage-head { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 18px; align-items: start; margin-bottom: 26px; }
.tr-stage-head .tr-stage-num { width: 64px; height: 64px; font-size: 2.2rem; }
.tr-stage-head .label { margin: 0; }
.tr-stage-head h2 { font-family: var(--font-display); font-size: 2.4rem; margin: 4px 0 8px; }
.tr-stage-head p:last-child { color: var(--muted); max-width: 72ch; }

.tr-modules { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.tr-module {
  position: relative; display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 20px; align-items: center;
  background: var(--surface); border: 1px solid var(--rule); border-left: 5px solid var(--signal);
  border-radius: var(--tr-radius); padding: 18px 22px; box-shadow: var(--tr-shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.tr-module:hover { transform: translateX(3px); border-color: var(--signal); }
.tr-module-num { font-family: var(--font-display); font-weight: 700; font-size: 2.8rem; line-height: 1; color: var(--signal); }
.tr-module h3 { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.1; margin-bottom: 4px; }
.tr-module h3 a { color: var(--heading); text-decoration: none; }
.tr-module h3 a::after { content: ""; position: absolute; inset: 0; }
.tr-module:has(h3 a:focus-visible) { outline: 3px solid var(--signal); outline-offset: 3px; }
.tr-module h3 a:focus-visible { outline: none; }
.tr-module-body > p { color: var(--muted); font-size: .95rem; }
.tr-module-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px !important; }
.tr-module-go { font-family: var(--font-mono); font-size: .76rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
.tr-start-here { margin-top: 4px; }

/* Breadcrumb */
.tr-crumbs { background: var(--bg); border-bottom: 1px solid var(--rule); font-family: var(--font-mono); font-size: .75rem; }
.tr-crumbs .wrap { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; padding-bottom: 10px; color: var(--muted); }
.tr-crumbs a { color: var(--accent); text-decoration: none; }
.tr-crumbs a:hover { text-decoration: underline; }
.tr-crumbs [aria-current] { color: var(--heading); }

/* Previous and next */
.tr-pager { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; }
.tr-pager a {
  display: flex; flex-direction: column; gap: 4px; justify-content: center; text-decoration: none; color: var(--heading);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--tr-radius); padding: 18px 22px; box-shadow: var(--tr-shadow);
}
.tr-pager a:hover { border-color: var(--accent); }
.tr-pager-prev { font-weight: 600; }
.tr-pager-next { border-left: 5px solid var(--signal) !important; }
.tr-pager-next strong { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.15; }
.tr-pager-sum { font-size: .92rem; color: var(--muted); }

@media (max-width: 900px) {
  .tr-path { grid-template-columns: 1fr; gap: 10px; }
  .tr-path-stage a, .tr-path-stage:first-child a, .tr-path-stage:last-child a { border-radius: var(--tr-radius); border-left: 1px solid var(--rule); }
  .tr-path-stage:not(:last-child) a::after { right: auto; left: 34px; top: auto; bottom: -13px; transform: rotate(135deg); }
  .tr-module { grid-template-columns: 56px minmax(0, 1fr); }
  .tr-module-num { font-size: 2.1rem; }
  .tr-module-go { display: none; }
  .tr-pager { grid-template-columns: 1fr; }
  .tr-pager-next { order: -1; }
}
@media (max-width: 720px) {
  .tr-stage-head { grid-template-columns: 1fr; gap: 10px; }
  .tr-stage-head .tr-stage-num { width: 48px; height: 48px; font-size: 1.6rem; }
  .tr-stage-head h2 { font-size: 2rem; }
}

/* Two-stage path strip (used when no guides are published, and on the home page) */
.tr-path.tr-path-2col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .tr-path.tr-path-2col { grid-template-columns: 1fr; } }
