/* Metro tunnel page. Site tokens from /styles.css; phase colours validated for colour-vision deficiency
   (rust / gold / blue, all checks pass) and always paired with text labels. */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-top: 26px; }
.stat { background: var(--panel-strong); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.stat strong { display: block; font-family: "Space Grotesk", sans-serif; font-size: 1.85rem; letter-spacing: -0.03em; color: #8a5a2b; }
.stat span { color: var(--muted); font-size: 0.88rem; line-height: 1.5; }

.mt-hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; }
.mt-cat svg, .mt-footcat svg, .mt-hud svg { image-rendering: pixelated; display: block; }
.mt-cat { filter: drop-shadow(0 10px 18px rgba(58, 40, 28, 0.18)); }
@media (max-width: 720px) {
  .mt-hero { grid-template-columns: 1fr; }
  .mt-cat { justify-self: start; }
  .mt-cat svg { width: 96px; height: 96px; }
}

.mt-controls { display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: center; margin: 22px 0 10px; }
.mt-controls fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.mt-controls legend { float: left; margin-right: 10px; font-weight: 700; font-size: 0.88rem; }
.mt-controls label { font-size: 0.9rem; color: var(--text); cursor: pointer; }
.mt-range { display: flex; align-items: center; gap: 10px; }
.mt-range input { width: 140px; accent-color: #8a5a2b; }
.mt-controls .button { padding: 10px 18px; min-height: 0; }

.mt-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.84rem; color: var(--muted); margin: 6px 0 10px; }
.mt-legend i { display: inline-block; width: 22px; height: 6px; border-radius: 3px; margin-right: 7px; vertical-align: middle; }
.mt-legend[hidden] { display: none; }
.mt-legend .ramp i { width: 120px; background: linear-gradient(90deg, #dbe4f7, #9fb3e6, #5f7fd3, #2f4fb8, #1b2f7a); }

.mt-stage { position: relative; }
#tube3d {
  position: relative; height: min(68vh, 620px); min-height: 380px; border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(120% 90% at 50% 10%, #fffdf9 0%, #f3ede4 70%, #ebe3d6 100%);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
#tube3d canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#tube3d.nogl { display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: var(--muted); }
.stlabel {
  position: absolute; left: 0; top: 0; pointer-events: none; font: 700 0.78rem "Space Grotesk", sans-serif;
  background: rgba(255, 255, 255, 0.88); border: 1px solid var(--line); border-radius: 8px; padding: 2px 7px; color: var(--text);
}
.mt-tip {
  position: absolute; z-index: 3; pointer-events: none; max-width: 280px; background: rgba(32, 28, 36, 0.92); color: #fff;
  font-size: 0.8rem; line-height: 1.5; padding: 8px 11px; border-radius: 10px;
}
.mt-hud {
  position: absolute; left: 14px; bottom: 14px; display: flex; gap: 10px; align-items: center; max-width: calc(100% - 28px);
  background: rgba(255, 255, 255, 0.92); border: 1px solid var(--line); border-radius: 16px; padding: 6px 14px 6px 6px;
  font-size: 0.84rem; line-height: 1.45; box-shadow: 0 8px 22px rgba(58, 40, 28, 0.12);
}
.mt-hud b { font-family: "Space Grotesk", sans-serif; }
.ph { font-weight: 700; }
.ph-traction { color: #c2410c; }
.ph-cruise { color: #8a6a12; }
.ph-braking { color: #1d4ed8; }
.mt-note { color: var(--muted); font-size: 0.86rem; line-height: 1.6; margin: 12px 0 0; }

.mt-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 22px; }
.mt-step { background: var(--panel-strong); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.mt-step h3 { font-family: "Space Grotesk", sans-serif; letter-spacing: -0.03em; margin: 0 0 10px; }
.mt-step h3 small { display: block; color: #8a5a2b; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 6px; }
.mt-step p { margin: 0; color: var(--muted); font-size: 0.94rem; line-height: 1.6; }

.mt-panel { background: var(--panel-strong); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-top: 22px; }
.mt-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.mt-chart .ax { font: 500 11px Manrope, sans-serif; fill: var(--muted); }
.mt-chart .stt { font: 700 11px "Space Grotesk", sans-serif; fill: var(--text); }
.mt-chart .lbl { font: 600 12px Manrope, sans-serif; fill: var(--text); }
.mt-chart .lbl.muted { fill: var(--muted); }
.mt-chart .val { font: 700 12px "Space Grotesk", sans-serif; fill: var(--text); }
.mt-chart .grid { stroke: var(--line); stroke-width: 1; }
.mt-chart .base { stroke: rgba(43, 39, 50, 0.35); stroke-width: 1; }
.mt-chart .stl { stroke: rgba(43, 39, 50, 0.1); stroke-width: 1; stroke-dasharray: 2 3; }
.mt-chart .rail { fill: none; stroke: #8a5a2b; stroke-width: 2; stroke-dasharray: 6 4; }
.mt-chart .ground { fill: none; stroke: #9aa39a; stroke-width: 2; }
.mt-chart .dot { fill: #8a5a2b; stroke: #fff; stroke-width: 2; }
.mt-chart .dot.est { fill: #fff; stroke: #8a5a2b; }

.tbl-wrap { overflow-x: auto; }
.mt-table { border-collapse: collapse; width: 100%; font-size: 0.86rem; }
.mt-table th, .mt-table td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mt-table th:first-child, .mt-table td:first-child { text-align: left; }
.mt-table th { color: var(--muted); font-weight: 600; }
.mt-table .muted { color: var(--muted); font-size: 0.8rem; }
.mt-limits { max-width: 760px; padding-left: 20px; color: var(--muted); line-height: 1.7; }
.mt-limits strong { color: var(--text); }
.mt-footcat { align-self: center; }
.mt-legend i.sw-rail { height: 0; border-top: 2px dashed #8a5a2b; border-radius: 0; }
.mt-legend i.sw-ground { height: 2px; background: #9aa39a; }
@media (max-width: 720px) {
  #tube3d { height: 340px; min-height: 0; }
  .mt-hud { font-size: 0.78rem; left: 8px; bottom: 8px; }
  .mt-hud svg { width: 40px; height: 40px; }
}
