/* Timeline layout is independent of the form and the application shell. */
.timeline-report {
  padding: 26px 0 0;
  border-top: 1px solid var(--line);
}

.timeline-report-heading h3 {
  margin: 0 0 10px;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 550;
}

.timeline-analyzed-url {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.timeline-stats {
  margin: 12px 0 26px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.timeline-guidance {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.6;
}

.timeline-scroll-hint {
  color: var(--green);
}

.timeline-viewport {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--color-surface);
  scrollbar-color: var(--color-text-muted) var(--color-surface);
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}

.redirect-timeline {
  display: flex;
  align-items: stretch;
  width: max-content;
  min-width: 100%;
  list-style: none;
  margin: 0;
  padding: 32px 20px 28px;
}

.timeline-item {
  --status-color: var(--color-text-muted);
  --status-background: var(--color-surface);
  position: relative;
  flex: 0 0 276px;
  width: 276px;
  padding: 0 12px;
}

.status-success {
  --status-color: var(--color-success);
  --status-background: var(--color-success-surface);
}

.status-redirect {
  --status-color: var(--color-warning);
  --status-background: var(--color-warning-surface);
}

.status-client-error,
.status-network-error {
  --status-color: var(--color-error);
  --status-background: var(--color-error-surface);
}

.status-server-error {
  --status-color: var(--color-danger);
  --status-background: var(--color-danger-surface);
}

/* Connect the centre of this node to the centre of its neighbour. */
.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 9px;
  width: 100%;
  height: 2px;
  background: var(--color-border);
}

.timeline-marker {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  height: 76px;
  color: var(--status-color);
}

.timeline-dot {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: 4px solid var(--color-surface);
  border-radius: 50%;
  background: var(--status-color);
  box-shadow: 0 0 0 1px var(--status-color);
}

.timeline-marker-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .6px;
}

.timeline-item:not(.timeline-start) .timeline-marker::after {
  content: '';
  width: 1px;
  flex: 1;
  background: var(--color-border);
}

.timeline-card {
  position: relative;
  z-index: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 9px;
  box-shadow: 0 3px 10px transparent;
  overflow: hidden;
}

.timeline-card:hover,
.timeline-card[open] {
  border-color: var(--color-primary);
  box-shadow: 0 4px 14px transparent;
}

.timeline-card-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 218px;
  padding: 20px 18px;
  cursor: pointer;
  list-style: none;
}

.timeline-card-summary::-webkit-details-marker {
  display: none;
}

.timeline-card-summary:focus-visible {
  outline-offset: -4px;
  border-radius: 8px;
}

.timeline-card-heading {
  display: block;
  font-size: 12px;
  font-weight: 650;
}

.timeline-http {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-badge {
  align-self: flex-start;
  padding: 5px 8px;
  border-radius: 5px;
  background: var(--status-background);
  color: var(--status-color);
  font-size: 12px;
  font-weight: 700;
}

.timeline-reason {
  color: var(--color-text-muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.timeline-host {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 550;
}

.timeline-url {
  display: block;
  color: var(--color-text-muted);
  font: 11px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}

.timeline-card-summary .timeline-url {
  margin-top: -8px;
}

.timeline-card-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  font-size: 10px;
  color: var(--color-text-muted);
}

.timeline-expand {
  font-size: 10px;
  color: var(--color-text-muted);
}

.timeline-expand::after {
  content: 'View details +';
}

.timeline-card[open] .timeline-expand::after {
  content: 'Hide details −';
}

.timeline-details {
  padding: 0 18px 18px;
  border-top: 1px solid var(--color-border);
}

.timeline-details dl {
  margin: 16px 0;
}

.timeline-details dt {
  margin: 14px 0 5px;
  color: var(--color-text-muted);
  font-size: 10px;
}

.timeline-details dd {
  margin: 0;
  font: 11px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.timeline-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.timeline-copy-button {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  background: var(--color-background);
  color: var(--ink);
  font-size: 11px;
}

.timeline-copy-feedback {
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.6;
}

.timeline-start-info {
  padding: 14px 18px;
  text-align: center;
}

.timeline-start-info .timeline-url {
  margin-top: 12px;
}

.is-final .timeline-card {
  border-top: 3px solid var(--status-color);
}

.is-final .timeline-card-heading {
  color: var(--status-color);
}

.is-final .timeline-dot {
  box-shadow: 0 0 0 1px var(--status-color), 0 0 0 5px var(--status-background);
}

.timeline-error-message {
  color: var(--color-error);
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: no-preference) {
  .timeline-marker,
  .timeline-card,
  .timeline-start-info {
    animation: timeline-appear 180ms ease-out both;
    animation-delay: inherit;
  }
  .timeline-item:nth-child(2) { animation-delay: 35ms; }
  .timeline-item:nth-child(3) { animation-delay: 70ms; }
  .timeline-item:nth-child(4) { animation-delay: 105ms; }
  .timeline-item:nth-child(5) { animation-delay: 140ms; }
  .timeline-item:nth-child(6) { animation-delay: 175ms; }
  .timeline-item:nth-child(7) { animation-delay: 210ms; }
  .timeline-item:nth-child(8) { animation-delay: 245ms; }
  .timeline-item:nth-child(9) { animation-delay: 280ms; }
  .timeline-item:nth-child(10) { animation-delay: 315ms; }
  .timeline-item:nth-child(11) { animation-delay: 350ms; }
  .timeline-item:nth-child(n+12) { animation-delay: 385ms; }
}

@keyframes timeline-appear {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 650px) {
  .timeline-analyzed-url { font-size: 13px; }
  .timeline-scroll-hint { display: none; }
  .timeline-viewport { overflow: visible; }
  .redirect-timeline {
    display: block;
    width: 100%;
    padding: 24px 14px 10px;
  }
  .timeline-item {
    width: 100%;
    padding: 0 0 22px 40px;
  }
  .timeline-item:not(:last-child)::after {
    left: 9px;
    top: 10px;
    width: 2px;
    height: 100%;
  }
  .timeline-marker {
    position: relative;
    height: auto;
    min-height: 32px;
    align-items: flex-start;
  }
  .timeline-dot {
    position: absolute;
    left: -40px;
    top: 0;
    z-index: 1;
  }
  .timeline-marker-label { padding-top: 3px; }
  .timeline-item:not(.timeline-start) .timeline-marker::after { display: none; }
  .timeline-card-summary { min-height: 0; padding: 18px 14px; }
  .timeline-card::before { display: none; }
  .timeline-start-info { padding: 4px 0 8px; text-align: left; }
  .timeline-details { padding: 0 14px 16px; }
  .timeline-guidance { font-size: 10px; }
}
