/* ── Redirect trail ─────────────────────────────────────────────────────────── */
/* Shared by HTTP Inspector, the Short URL Expander and Website Recon's Link
   Trail card (/scripts/redirect-trail.js draws the markup). Class names keep
   the hti- prefix of the HTTP Inspector timeline they came from. Every state
   pairs a colour with an icon and a word, so colour is never the only signal. */
.hti-page,
.redirect-trail {
  --hti-ok: var(--green);
  --hti-redirect: var(--primary);
  --hti-client: var(--amber);
  --hti-server: var(--red);
  --hti-ok-ink: color-mix(in srgb, var(--green) 82%, var(--txt));
  --hti-redirect-ink: var(--primary-ink);
  --hti-client-ink: color-mix(in srgb, var(--amber) 80%, var(--txt));
  --hti-server-ink: color-mix(in srgb, var(--red) 88%, var(--txt));
  --hti-warn-ink: color-mix(in srgb, var(--amber) 80%, var(--txt));
}

.hti-icon { flex: none; }

.hti-status {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 999px; white-space: nowrap;
  font-family: var(--font-data); font-size: var(--text-compact); line-height: 1.2;
  background: color-mix(in srgb, var(--hti-c) 12%, var(--surface)); color: var(--hti-ink);
  border: 1px solid color-mix(in srgb, var(--hti-c) 30%, transparent);
}
.hti-status strong {
  display: inline-flex; align-items: center; justify-content: center; min-width: 38px; padding: 3px 8px; box-sizing: border-box;
  border-radius: 999px; background: var(--hti-c); color: #fff; font-weight: 700; font-variant-numeric: tabular-nums;
}
.hti-status.is-large { font-size: var(--text-small); padding: 5px 12px 5px 5px; }
.hti-status.is-large strong { min-width: 46px; padding: 4px 10px; font-size: 1rem; }
.is-ok      { --hti-c: var(--hti-ok);       --hti-ink: var(--hti-ok-ink); }
.is-redirect{ --hti-c: var(--hti-redirect); --hti-ink: var(--hti-redirect-ink); }
.is-client  { --hti-c: var(--hti-client);   --hti-ink: var(--hti-client-ink); }
.is-server  { --hti-c: var(--hti-server);   --hti-ink: var(--hti-server-ink); }
.is-info    { --hti-c: var(--txt-3);        --hti-ink: var(--txt-2); }
/* White text needs a dark enough fill in both themes. */
.hti-status.is-ok strong { background: #15803d; }
.hti-status.is-redirect strong { background: var(--primary-fill); }
.hti-status.is-client strong { background: #b45309; }
.hti-status.is-server strong { background: #b91c1c; }
.hti-status.is-info strong { background: #475569; }

.hti-url { display: inline-flex; align-items: baseline; gap: 0; min-width: 0; font-family: var(--font-mono); font-size: var(--text-small); overflow-wrap: anywhere; word-break: break-all; }
.hti-url .hti-icon { align-self: center; margin-right: 6px; }
.hti-url.is-secure .hti-icon { color: var(--hti-ok-ink); }
.hti-url.is-plain .hti-icon { color: var(--hti-warn-ink); }
.hti-url-scheme { color: var(--txt-3); }
.hti-url-host { color: var(--txt); font-weight: 600; }
.hti-url-path { color: var(--txt-2); }

.hti-chain { list-style: none; margin: 0; padding: 0; }
.hti-hop { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 14px; }
.hti-hop::before {
  content: ""; position: absolute; left: 17px; top: 34px; bottom: -2px; width: 2px;
  background: linear-gradient(var(--hti-c), color-mix(in srgb, var(--hti-c) 25%, var(--border)));
}
.hti-hop.is-last::before { display: none; }
.hti-hop-dot {
  position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center; font-family: var(--font-data); font-weight: 700; font-size: var(--text-small);
  background: var(--surface); color: var(--hti-ink); border: 2px solid var(--hti-c);
  box-shadow: 0 0 0 4px var(--surface);
}
.hti-hop.is-last .hti-hop-dot { background: var(--hti-c); color: #fff; }
.hti-hop.is-last.is-ok .hti-hop-dot { background: #15803d; border-color: #15803d; }
.hti-hop.is-last.is-client .hti-hop-dot { background: #b45309; border-color: #b45309; }
.hti-hop.is-last.is-server .hti-hop-dot { background: #b91c1c; border-color: #b91c1c; }
.hti-hop.is-last.is-redirect .hti-hop-dot { background: var(--primary-fill); border-color: var(--primary-fill); }
.hti-hop-card { min-width: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); padding: 14px 16px; }
.hti-hop.is-last .hti-hop-card { border-color: color-mix(in srgb, var(--hti-c) 40%, var(--border)); }
.hti-hop-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.hti-hop-head .hti-url { flex: 1 1 260px; }
.hti-hop-time { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; font-family: var(--font-data); font-size: var(--text-compact); font-weight: 600; color: var(--txt-2); font-variant-numeric: tabular-nums; }
.hti-bar { height: 4px; margin: 12px 0 10px; border-radius: 4px; background: var(--surface2); overflow: hidden; }
.hti-bar span { display: block; height: 100%; width: var(--w); border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--hti-c) 55%, transparent), var(--hti-c)); }
.hti-hop-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.hti-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; background: var(--surface2); color: var(--txt-2); font-size: var(--text-caption); font-weight: 600; }
.hti-badge.is-cache { font-family: var(--font-mono); }
.hti-step {
  grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 10px 0 14px; padding: 0 4px;
  font-size: var(--text-compact); color: var(--txt-3);
}
.hti-step strong { color: var(--txt-2); font-weight: 600; }
.hti-step .hti-icon { color: var(--txt-4); }
.hti-step.is-good strong, .hti-step.is-good .hti-icon { color: var(--hti-ok-ink); }
.hti-step.is-warn strong, .hti-step.is-warn .hti-icon { color: var(--hti-warn-ink); }
.hti-step.is-bad strong, .hti-step.is-bad .hti-icon { color: var(--hti-server-ink); }
.hti-step span::before { content: "·"; margin-right: 8px; color: var(--txt-4); }
.trail-stopped .hti-hop-dot { color: var(--txt-3); }
.trail-stop-reason { margin: 8px 0 0; color: var(--txt-2); font-size: var(--text-small); }

@media (max-width: 640px) {
  .hti-hop { grid-template-columns: 28px minmax(0, 1fr); column-gap: 10px; }
  .hti-hop::before { left: 13px; top: 28px; }
  .hti-hop-dot { width: 28px; height: 28px; font-size: var(--text-caption); }
  .hti-hop-card { padding: 12px; }
  .hti-hop-time { margin-left: 0; }
}
