/* ==========================================================================
   Chrono Trace — track-support.php only (Appily Seventythree / Aira)
   Independent of Frost Meridian, Arc Relay, Cobalt Dispatch, Pulse Relay,
   Kinetic Vault, Tilt Loom, and prior Appily track UIs.
   Metaphor: delivery chronograph — keydesk lookup, waypoint beam, telemetry.
   ========================================================================== */

:root {
  --ct-ink: #152033;
  --ct-slate: #2a3a52;
  --ct-mist: #e4ebf3;
  --ct-paper: #f3f6fa;
  --ct-gold: #e9b949;
  --ct-gold-deep: #c9941f;
  --ct-emerald: #1f8a70;
  --ct-emerald-soft: #3aaf91;
  --ct-mute: #5a6b82;
  --ct-line: rgba(21, 32, 51, 0.11);
  --ct-warn: #c45c26;
  --font-ct: "Lexend", system-ui, sans-serif;
  --font-ct-serif: "Source Serif 4", Georgia, serif;
  --ct-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ct-snap: cubic-bezier(0.34, 1.45, 0.64, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body.ct-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ct);
  color: var(--ct-ink);
  background:
    radial-gradient(70% 50% at 90% 0%, rgba(233, 185, 73, 0.16), transparent 55%),
    radial-gradient(60% 45% at 0% 100%, rgba(31, 138, 112, 0.12), transparent 50%),
    linear-gradient(175deg, #d7e0eb 0%, var(--ct-mist) 40%, var(--ct-paper) 100%);
}
body.ct-body > main {
  display: block;
  margin: 0;
  padding: 0;
  max-width: none;
}

.ct-app {
  width: min(100% - 1.6rem, 56rem);
  margin: 0 auto;
  padding: 1.15rem 0 3.25rem;
}

.ct-escape {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.ct-escape__brand {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ct-ink);
}
.ct-escape__brand em {
  font-style: normal;
  color: var(--ct-emerald);
}
.ct-escape__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}
.ct-escape__links a {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ct-mute);
  transition: color 0.25s var(--ct-ease);
}
.ct-escape__links a:hover { color: var(--ct-gold-deep); }

/* Mast */
.ct-mast {
  position: relative;
  margin-bottom: 1.5rem;
  padding-right: 5rem;
}
.ct-mast__kicker {
  margin: 0 0 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ct-emerald);
}
.ct-mast h1 {
  margin: 0;
  font-family: var(--font-ct-serif);
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.ct-mast__lede {
  margin: 0.65rem 0 0;
  max-width: 40ch;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ct-mute);
}
.ct-mast__dial {
  position: absolute;
  top: 0;
  right: 0;
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 50%;
  border: 2px solid var(--ct-line);
  background:
    conic-gradient(from 210deg, var(--ct-gold), var(--ct-emerald), transparent 70%);
  mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
  animation: ct-spin 12s linear infinite;
}
@keyframes ct-spin {
  to { transform: rotate(360deg); }
}

/* Keydesk lookup */
.ct-keydesk {
  margin-bottom: 1.35rem;
  padding: 1.25rem 1.25rem 1.35rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--ct-line);
  position: relative;
  overflow: hidden;
}
.ct-keydesk::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ct-emerald), var(--ct-gold));
}
.ct-keydesk__head {
  margin-bottom: 1rem;
}
.ct-keydesk__head h2 {
  margin: 0;
  font-family: var(--font-ct-serif);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.ct-keydesk__head p {
  margin: 0.3rem 0 0;
  font-size: 0.9rem;
  color: var(--ct-mute);
}
.ct-keydesk__grid {
  display: grid;
  gap: 0.85rem;
}
@media (min-width: 700px) {
  .ct-keydesk__grid {
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
  }
}
.ct-field {
  display: grid;
  gap: 0.35rem;
}
.ct-field label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ct-mute);
}
.ct-field input {
  width: 100%;
  min-height: 3rem;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--ct-line);
  background: rgba(243, 246, 250, 0.9);
  font-family: var(--font-ct);
  font-size: 0.95rem;
  color: var(--ct-ink);
  transition: border-color 0.25s var(--ct-ease), box-shadow 0.25s var(--ct-ease), background 0.25s var(--ct-ease);
}
.ct-field input.ct-mono {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}
.ct-field input:focus {
  outline: none;
  border-color: var(--ct-emerald);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 138, 112, 0.16);
}
.ct-keydesk__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.ct-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.6rem 1.15rem;
  border: 1.5px solid transparent;
  font-family: var(--font-ct);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.3s var(--ct-ease), background 0.3s var(--ct-ease), color 0.3s var(--ct-ease), border-color 0.3s var(--ct-ease);
}
.ct-btn:hover { transform: translateY(-2px); }
.ct-btn--gold {
  background: linear-gradient(120deg, var(--ct-gold), #f0c96a);
  color: var(--ct-ink);
}
.ct-btn--gold:hover { filter: brightness(1.04); }
.ct-btn--emerald {
  background: var(--ct-emerald);
  color: #fff;
}
.ct-btn--emerald:hover { background: #176f5a; }
.ct-btn--ghost {
  background: transparent;
  color: var(--ct-ink);
  border-color: rgba(21, 32, 51, 0.22);
}
.ct-btn--ghost:hover {
  background: var(--ct-ink);
  color: #fff;
}
.ct-btn--sm {
  min-height: 2.4rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.68rem;
}
.ct-btn.is-busy {
  pointer-events: none;
  opacity: 0.7;
}

/* Status banner */
.ct-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.9rem 1.05rem;
  background: var(--ct-ink);
  color: #eef2f7;
}
.ct-banner__label {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ct-gold);
}
.ct-banner__status {
  margin: 0.2rem 0 0;
  font-family: var(--font-ct-serif);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.ct-banner__hint {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(238, 242, 247, 0.65);
  max-width: 28ch;
  text-align: right;
}
.ct-banner.is-miss {
  background: #4a2a22;
}
.ct-banner.is-miss .ct-banner__label { color: #ffb088; }
.ct-banner.is-idle {
  background: rgba(21, 32, 51, 0.88);
}

/* Chronograph path */
.ct-path {
  position: relative;
  margin-bottom: 1.35rem;
  padding: 1.35rem 0.5rem 0.5rem;
}
.ct-path__rail {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 2.15rem;
  height: 3px;
  background: rgba(21, 32, 51, 0.12);
  border-radius: 2px;
  overflow: hidden;
}
.ct-path__beam {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--ct-emerald), var(--ct-gold));
  border-radius: 2px;
  transition: width 1.1s var(--ct-ease);
}
.ct-path[data-step="1"] .ct-path__beam { width: 0%; }
.ct-path[data-step="2"] .ct-path__beam { width: 33.33%; }
.ct-path[data-step="3"] .ct-path__beam { width: 66.66%; }
.ct-path[data-step="4"] .ct-path__beam { width: 100%; }
.ct-path.is-animate .ct-path__beam {
  animation: ct-beam-glow 1.8s ease-in-out infinite;
}
@keyframes ct-beam-glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}

.ct-path__nodes {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.ct-node {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 0.55rem;
}
.ct-node__dot {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  border: 2.5px solid rgba(21, 32, 51, 0.2);
  background: var(--ct-paper);
  position: relative;
  transition: background 0.4s var(--ct-ease), border-color 0.4s var(--ct-ease), transform 0.45s var(--ct-snap), box-shadow 0.4s var(--ct-ease);
}
.ct-node__dot::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.35s var(--ct-ease);
}
.ct-node.is-done .ct-node__dot {
  border-color: var(--ct-emerald);
  background: var(--ct-emerald);
  box-shadow: 0 0 0 4px rgba(31, 138, 112, 0.18);
}
.ct-node.is-done .ct-node__dot::after {
  background: #fff;
  clip-path: polygon(14% 52%, 0 38%, 38% 72%, 100% 18%, 86% 5%, 36% 52%);
  inset: 3px;
  border-radius: 0;
}
.ct-node.is-active .ct-node__dot {
  border-color: var(--ct-gold);
  background: var(--ct-gold);
  transform: scale(1.2);
  box-shadow: 0 0 0 6px rgba(233, 185, 73, 0.28);
  animation: ct-pulse 1.6s ease-in-out infinite;
}
.ct-node.is-active .ct-node__dot::after {
  background: var(--ct-ink);
}
@keyframes ct-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(233, 185, 73, 0.22); }
  50% { box-shadow: 0 0 0 9px rgba(233, 185, 73, 0.08); }
}
.ct-node__label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ct-mute);
  transition: color 0.3s var(--ct-ease);
}
.ct-node.is-done .ct-node__label,
.ct-node.is-active .ct-node__label {
  color: var(--ct-ink);
}
.ct-node__hint {
  font-size: 0.72rem;
  color: var(--ct-mute);
  line-height: 1.3;
  max-width: 10ch;
}
@media (max-width: 560px) {
  .ct-path__nodes { gap: 0.2rem; }
  .ct-node__hint { display: none; }
  .ct-node__label { font-size: 0.68rem; }
  .ct-path__rail { left: 10%; right: 10%; }
}

/* Telemetry */
.ct-tele {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}
@media (min-width: 640px) {
  .ct-tele {
    grid-template-columns: repeat(2, 1fr);
  }
}
.ct-metric {
  padding: 1rem 1.05rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--ct-line);
  transition: transform 0.35s var(--ct-ease), border-color 0.3s var(--ct-ease);
}
.ct-metric:hover {
  transform: translateY(-3px);
  border-color: rgba(31, 138, 112, 0.35);
}
.ct-metric__k {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ct-mute);
}
.ct-metric__v {
  margin: 0.35rem 0 0;
  font-family: var(--font-ct-serif);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  word-break: break-word;
}
.ct-metric__v.ct-mono {
  font-family: ui-monospace, monospace;
  font-size: 1.05rem;
}

.ct-result {
  padding: 1.15rem 1.2rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--ct-line);
  margin-bottom: 1.25rem;
}
.ct-result h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-ct-serif);
  font-size: 1.5rem;
  font-weight: 600;
}
.ct-result p {
  margin: 0 0 1rem;
  color: var(--ct-mute);
  line-height: 1.45;
}
.ct-result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.ct-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.9rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--ct-line);
}
.ct-links a {
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ct-mute);
  transition: color 0.25s var(--ct-ease);
}
.ct-links a:hover { color: var(--ct-emerald); }

.ct-foot {
  margin-top: 1.5rem;
  font-size: 0.78rem;
  color: var(--ct-mute);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
