/* ============================================================
   ZAR TRACK RECORD — Industrial Project Command Center
   Compact, HUD-driven, engineering-grade motion.
   ============================================================ */

:root {
  --tr-bg: var(--surface);
  --tr-line: var(--line);
  --tr-brand: var(--brand);
  --tr-ease: cubic-bezier(.22,.95,.32,1);
}

/* ---- PAGE COMPRESSION (kills empty space) ---- */
body.zar-track-page .page-hero {
  min-height: 34svh;
  padding: 88px 0 26px;
}
body.zar-track-page .page-hero h1 {
  font-size: clamp(2.15rem, 4.8vw, 4.05rem);
  margin: .28rem 0 .65rem;
}
body.zar-track-page .page-hero .btn.ghost {
  min-height: 36px;
  padding: 6px 14px;
  font-size: .82rem;
}
body.zar-track-page .living-strip {
  margin: -16px auto 6px;
  padding: 6px 14px;
  font-size: .7rem;
}
body.zar-track-page .section,
body.zar-track-page .related-intel.section {
  padding: 24px 0 36px;
}
body.zar-track-page .related-intel h2 {
  font-size: clamp(1.35rem, 2.8vw, 2.05rem);
  line-height: 1.15;
  margin: .3rem 0 .4rem;
}
body.zar-track-page .related-intel .section-head {
  margin-bottom: 14px;
  gap: 12px;
  align-items: start;
}
body.zar-track-page .related-intel .section-head p {
  font-size: .88rem;
}

/* Single compact command shell — replaces 4 stacked .section blocks */
.tr-shell {
  padding: 18px 0 10px;
  position: relative;
}

/* ---- TELEMETRY KPIs ---- */
.tr-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 720px;
  margin: 0 auto 16px;
}
.tr-kpi {
  background: var(--surface);
  border: 1px solid var(--tr-line);
  border-radius: 14px;
  padding: 8px 8px 10px;
  text-align: center;
}
.tr-ring {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 2px;
}
.tr-ring svg {
  width: 72px;
  height: 72px;
  display: block;
  transform: rotate(-90deg);
}
.tr-ring-track {
  fill: none;
  stroke: var(--tr-line);
  stroke-width: 3.5;
}
.tr-ring-fill {
  fill: none;
  stroke: var(--tr-brand);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 201;
  stroke-dashoffset: 201;
  transition: stroke-dashoffset 1.15s var(--tr-ease);
}
.tr-kpis.counted .tr-ring-fill { stroke-dashoffset: 48; }
.tr-kpis.counted .tr-kpi:nth-child(2) .tr-ring-fill { stroke-dashoffset: 78; }
.tr-kpis.counted .tr-kpi:nth-child(3) .tr-ring-fill { stroke-dashoffset: 92; }
.tr-kpis.counted .tr-kpi:nth-child(4) .tr-ring-fill { stroke-dashoffset: 110; }

.tr-kpi .num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
}
.tr-kpi .label {
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--muted);
}

/* Scan tick on locked KPIs so the cards are not dead-empty */
.tr-kpis[data-kpi-locked]:not(.counted) .tr-ring-fill {
  stroke-dasharray: 12 189;
  animation: trRingScan 1.8s linear infinite;
}
@keyframes trRingScan {
  to { stroke-dashoffset: -201; }
}

/* ---- SEARCH ---- */
.tr-search {
  max-width: 920px;
  margin: 0 auto 14px;
  background: var(--surface);
  border: 1px solid var(--tr-line);
  border-radius: 16px;
  padding: 12px 14px 10px;
}
.tr-search label {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .12em;
  color: var(--muted);
}
.tr-search-row { position: relative; margin-top: 6px; }
.tr-search input {
  width: 100%;
  font-size: 1rem;
  padding: 11px 14px;
  border: 1px solid var(--tr-line);
  border-radius: 10px;
  background: var(--bg);
}
.tr-search-beam {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--tr-brand), transparent);
  transform: scaleX(0);
  transform-origin: center;
  opacity: 0;
  pointer-events: none;
}
.tr-search.is-live .tr-search-beam {
  opacity: 1;
  animation: trBeam 900ms var(--tr-ease);
}
@keyframes trBeam {
  0% { transform: scaleX(0); }
  40% { transform: scaleX(1); }
  100% { transform: scaleX(.15); opacity: 0; }
}
.tr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.tr-chip {
  font-size: .7rem;
  font-weight: 800;
  padding: 4px 10px;
  border: 1px solid var(--tr-line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease, box-shadow .15s ease;
}
.tr-chip.active, .tr-chip:hover {
  border-color: var(--tr-brand);
  color: var(--tr-brand);
  background: color-mix(in srgb, var(--tr-brand) 8%, var(--surface));
}
.tr-chip.active {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tr-brand) 16%, transparent);
}
.tr-result-count {
  min-height: 0;
  margin-top: 4px;
  font-size: .74rem;
  color: var(--muted);
}

/* ---- VIEW SWITCH ---- */
.tr-views {
  display: flex;
  gap: 4px;
  margin: 0 0 8px;
  flex-wrap: wrap;
}
.tr-view-btn {
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 6px 12px;
  border: 1px solid var(--tr-line);
  background: var(--surface);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tr-view-btn.active {
  background: var(--tr-brand);
  color: #fff;
  border-color: var(--tr-brand);
}

/* ---- CANVAS + HUD ---- */
.tr-canvas {
  background: var(--surface);
  border: 1px solid var(--tr-line);
  border-radius: 16px;
  min-height: 460px;
  height: 460px;
  position: relative;
  overflow: hidden;
}
.tr-pane {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  filter: blur(5px);
  transition: opacity 380ms var(--tr-ease), transform 380ms var(--tr-ease), filter 380ms var(--tr-ease);
  overflow: auto;
  padding: 10px;
}
.tr-pane.is-on {
  opacity: 1;
  pointer-events: auto;
  transform: none;
  filter: none;
  z-index: 2;
}

.tr-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.tr-hud-c {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: color-mix(in srgb, var(--tr-brand) 55%, var(--tr-line));
  border-style: solid;
  border-width: 0;
}
.tr-hud-c.tl { top: 8px; left: 8px; border-top-width: 2px; border-left-width: 2px; }
.tr-hud-c.tr { top: 8px; right: 8px; border-top-width: 2px; border-right-width: 2px; }
.tr-hud-c.bl { bottom: 8px; left: 8px; border-bottom-width: 2px; border-left-width: 2px; }
.tr-hud-c.br { bottom: 8px; right: 8px; border-bottom-width: 2px; border-right-width: 2px; }

.tr-hud-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(74,144,217,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74,144,217,.06) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at 50% 48%, black 40%, transparent 78%);
  opacity: .7;
}
html[data-theme=dark] .tr-hud-grid {
  background-image:
    linear-gradient(rgba(90,167,232,.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90,167,232,.1) 1px, transparent 1px);
}

.tr-hud-radar {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(72%, 520px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 74%, color-mix(in srgb, var(--tr-brand) 18%, transparent) 100%);
  animation: trRadar 5.4s linear infinite;
  opacity: .42;
  mix-blend-mode: multiply;
}
html[data-theme=dark] .tr-hud-radar { mix-blend-mode: screen; opacity: .28; }
@keyframes trRadar { to { transform: translate(-50%, -50%) rotate(360deg); } }

.tr-hud-scan {
  position: absolute;
  left: 0; right: 0;
  height: 18%;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--tr-brand) 16%, transparent), transparent);
  opacity: 0;
  pointer-events: none;
}
.tr-canvas.scanning .tr-hud-scan {
  animation: trScanSweep 780ms var(--tr-ease);
}
@keyframes trScanSweep {
  from { top: -10%; opacity: .7; }
  to { top: 100%; opacity: 0; }
}

.tr-hud-meta {
  position: absolute;
  top: 10px;
  left: 28px;
  right: 28px;
  display: flex;
  justify-content: space-between;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .14em;
  color: var(--muted);
}
.tr-hud-live {
  color: var(--tr-brand);
  position: relative;
  padding-left: 10px;
}
.tr-hud-live::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  width: 6px; height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--tr-brand);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--tr-brand) 50%, transparent);
  animation: livingPulse 2.2s infinite;
}

/* ---- UNIVERSE ---- */
.tr-universe svg { width: 100%; height: 100%; display: block; }
.tr-universe .node { cursor: pointer; }
.tr-universe .hub-core { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--tr-brand) 35%, transparent)); }
.tr-edge {
  fill: none;
  stroke: color-mix(in srgb, var(--tr-brand) 42%, var(--tr-line));
  stroke-width: 1.15;
  stroke-dasharray: 5 9;
  animation: trDash 1.7s linear infinite;
}
@keyframes trDash { to { stroke-dashoffset: -28; } }
.tr-proj {
  cursor: pointer;
  transition: r 160ms ease, opacity 160ms ease;
}
.tr-proj:hover { opacity: 1; }
.tr-svc-label { pointer-events: none; }
.tr-pulse {
  fill: var(--tr-brand);
  opacity: .85;
  offset-distance: 0%;
  animation: trPulseRide 2.8s linear infinite;
}
@keyframes trPulseRide {
  to { offset-distance: 100%; }
}

/* ---- TIMELINE RAIL ---- */
.tr-timeline {
  position: relative;
  padding: 28px 12px 12px !important;
}
.tr-rail-line {
  position: absolute;
  left: 78px;
  top: 18px;
  bottom: 18px;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--tr-brand), transparent);
  overflow: hidden;
}
.tr-rail-packet {
  position: absolute;
  left: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tr-brand);
  box-shadow: 0 0 10px color-mix(in srgb, var(--tr-brand) 70%, transparent);
  animation: trPacket 4.6s linear infinite;
}
@keyframes trPacket {
  0% { top: 0; opacity: 0; }
  8% { opacity: 1; }
  92% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
.tr-timeline .year-row {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  align-items: flex-start;
}
.tr-timeline .year {
  width: 62px;
  font-weight: 900;
  padding-top: 4px;
  flex-shrink: 0;
  font-size: .84rem;
}
.tr-timeline .projects {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tr-timeline .proj-pill {
  font-size: .7rem;
  padding: 3px 8px;
  border: 1px solid var(--tr-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 80%, var(--bg));
  cursor: pointer;
  transition: border-color .12s ease, transform .12s ease;
}
.tr-timeline .proj-pill:hover {
  border-color: var(--tr-brand);
  transform: translateY(-1px);
}

/* ---- LOCATION FIELD ---- */
.tr-locations {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 8px;
  align-content: start;
}
.tr-loc {
  border: 1px solid var(--tr-line);
  border-radius: 12px;
  padding: 10px 12px 10px 32px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition: border-color .15s ease;
}
.tr-loc::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tr-brand);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--tr-brand) 45%, transparent);
  animation: trPin 2.4s ease-out infinite;
}
.tr-loc:nth-child(2n)::before { animation-delay: .4s; }
.tr-loc:nth-child(3n)::before { animation-delay: .8s; }
@keyframes trPin {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tr-brand) 50%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.tr-loc.active { border-color: var(--tr-brand); }
.tr-loc b { display: block; font-size: .82rem; line-height: 1.2; }
.tr-loc .n { font-size: .68rem; color: var(--muted); margin-top: 2px; }

/* ---- CARDS ---- */
.tr-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  align-content: start;
}
.tr-card {
  background: color-mix(in srgb, var(--surface) 88%, var(--bg));
  border: 1px solid var(--tr-line);
  border-radius: 12px;
  padding: 11px 12px;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease;
}
.tr-card:hover { transform: translateY(-1px); border-color: var(--tr-brand); }
.tr-card .name { font-weight: 800; line-height: 1.2; font-size: .88rem; }
.tr-card .meta { font-size: .68rem; color: var(--muted); margin: 3px 0 6px; }
.tr-card .tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tr-card .tag {
  font-size: .6rem;
  font-weight: 700;
  padding: 1px 7px;
  border: 1px solid var(--tr-line);
  border-radius: 999px;
}

/* ---- DETAIL ---- */
.tr-detail {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: min(420px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--tr-line);
  box-shadow: -12px 0 30px rgba(0,0,0,.12);
  z-index: 120;
  padding: 22px;
  overflow: auto;
  transform: translateX(100%);
  transition: transform .28s var(--tr-ease);
}
.tr-detail.open { transform: none; }
.tr-detail .close { float: right; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.tr-detail h3 { margin: 4px 0 12px; }
.tr-detail .field { margin-bottom: 8px; }
.tr-detail .field-label { font-size: .66rem; font-weight: 800; letter-spacing: .08em; color: var(--muted); }
.tr-detail .rels { margin-top: 16px; }
.tr-detail .rel-link {
  display: inline-block;
  font-size: .78rem;
  padding: 3px 9px;
  border: 1px solid var(--tr-line);
  border-radius: 999px;
  margin: 2px 4px 2px 0;
  cursor: pointer;
}

.tr-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 0;
}
.tr-active-filters .pill {
  font-size: .7rem;
  padding: 2px 8px;
  border: 1px solid var(--tr-line);
  border-radius: 999px;
  background: var(--surface);
}
.tr-active-filters .clear { color: var(--muted); cursor: pointer; }

/* ---- CTA + REGISTER (tight) ---- */
.tr-cta {
  padding: 18px 0 8px;
  text-align: center;
}
.tr-cta p {
  max-width: 640px;
  margin: 0 auto;
  font-size: .88rem;
  color: var(--muted);
}
.tr-cta .actions { margin-top: 10px; }

.tr-register {
  margin: 8px 0 12px;
  padding: 0 0 8px;
}
.tr-register summary {
  cursor: pointer;
  font-weight: 800;
  padding: 8px 0;
}
.tr-register table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.tr-register th, .tr-register td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--tr-line);
  text-align: left;
}
.tr-register thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}

/* ---- MOBILE ---- */
@media (max-width: 820px) {
  body.zar-track-page .page-hero { min-height: 28svh; padding: 86px 0 20px; }
  .tr-kpis { grid-template-columns: repeat(2, 1fr); max-width: none; }
  .tr-canvas { min-height: 380px; height: 380px; }
  .tr-detail { width: 100%; border-left: none; }
  .tr-cards { grid-template-columns: 1fr; }
  .tr-hud-radar { width: 88%; }
}

/* ---- REDUCED MOTION ---- */
@media (prefers-reduced-motion: reduce) {
  .tr-card, .tr-universe .node, .tr-detail, .tr-pane,
  .tr-ring-fill, .tr-chip, .tr-view-btn { transition: none !important; }
  .tr-edge, .tr-hud-radar, .tr-hud-scan, .tr-hud-live::before,
  .tr-rail-packet, .tr-pulse, .tr-loc::before,
  .tr-kpis[data-kpi-locked]:not(.counted) .tr-ring-fill,
  .tr-search-beam { animation: none !important; }
  .tr-pane { filter: none; transform: none; }
}
