/* ============================================================
   Demo page. Pipeline visualization, streaming trace, and the
   rubber-stamp verdict — the site's second signature moment.
   ============================================================ */

.section-label {
  font-size: 0.95rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.hero-section {
  position: relative;
  overflow: hidden;
  min-height: 340px;
  display: flex;
  align-items: center;
}

/* ---------------- Input panel ---------------- */

#input-text {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.5;
  padding: 16px;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#input-text::placeholder { color: var(--text-muted); opacity: 0.7; }
#input-text:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
  outline: none;
}

.btn-primary {
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-ghost:hover { transform: translateY(-1px); }

/* ---------------- Pipeline: flexbox nodes + connectors ---------------- */

.pipeline {
  display: flex;
  align-items: center;
  margin-top: 20px;
  padding: 28px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.pipe-node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-raised);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.35s ease, color 0.35s ease, background 0.35s ease,
              box-shadow 0.35s ease, transform 0.35s ease;
}
.pipe-node.wide { padding-left: 18px; padding-right: 18px; }

.pipe-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.pipe-node.active {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-wash);
  box-shadow: 0 0 20px rgba(193, 68, 45, 0.12);
  transform: scale(1.04);
}
.pipe-node.active .pipe-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(193, 68, 45, 0.22);
  animation: pulse-dot 1.1s ease-in-out infinite;
}

.pipe-node.done {
  border-color: var(--verified);
  color: var(--text);
  transform: scale(1);
}
.pipe-node.done .pipe-dot { background: var(--verified); box-shadow: none; animation: none; }

.pipe-node.linked {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
  transform: scale(1.06);
}

.pipe-connector {
  position: relative;
  flex: 1 1 40px;
  min-width: 30px;
  height: 2px;
  background: var(--border);
  margin: 0 2px;
  border-radius: 2px;
  overflow: visible;
  transition: background 0.3s ease;
}
.pipe-connector.flowing {
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
}
.pipe-connector.complete { background: var(--verified); opacity: 0.5; }

.pulse-dot {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px 2px rgba(193, 68, 45, 0.55);
  opacity: 0;
}
.pipe-connector.flowing .pulse-dot {
  opacity: 1;
  animation: travel 0.9s ease-in-out forwards;
}

@keyframes travel {
  from { left: 0%; opacity: 1; }
  to { left: calc(100% - 8px); opacity: 1; }
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(193, 68, 45, 0.22); }
  50% { box-shadow: 0 0 0 9px rgba(193, 68, 45, 0.06); }
}

@media (prefers-reduced-motion: reduce) {
  .pipe-node.active .pipe-dot { animation: none; }
  .pipe-connector.flowing .pulse-dot { animation: none; opacity: 1; left: 50%; }
  .pipe-node { transition: none; }
}

/* ---------------- Trace log ---------------- */

.trace-panel {
  height: 480px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trace-line {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
  border-left: 2px solid var(--border);
  animation: slideIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.trace-line.action { border-left-color: var(--accent); background: var(--accent-wash); }
.trace-line .trace-node { color: var(--accent); font-weight: 500; }
.trace-line .trace-detail { color: var(--text-muted); display: block; margin-top: 4px; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------------- Results panel ---------------- */

.result-card {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
  animation: cardIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}
.result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.result-card .claim-text { font-size: 0.95rem; margin-bottom: 12px; }
.result-card .result-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.result-card .confidence { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-muted); }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.escalated-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  border: 1px solid var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

/* ---------------- The stamp: signature verdict animation ---------------- */
/* A rubber stamp thuds down onto the result card the instant a verdict
   arrives — the physical, familiar act of grading a citation, made
   literal instead of just labeled with a colored pill. */

.stamp-wrap {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 118px;
  height: 74px;
  pointer-events: none;
  z-index: 2;
}

.stamp-mark {
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: scale(2.6) rotate(-14deg);
  transform-origin: center;
}

.stamp-mark.stamping {
  animation: stampDown 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.4) forwards;
}

@keyframes stampDown {
  0% { opacity: 0; transform: scale(2.6) rotate(-14deg); }
  55% { opacity: 1; transform: scale(0.92) rotate(-9deg); }
  70% { transform: scale(1.05) rotate(-9deg); }
  100% { opacity: 1; transform: scale(1) rotate(-9deg); }
}

.stamp-mark.settled {
  opacity: 1;
  transform: scale(1) rotate(-9deg);
}

@media (prefers-reduced-motion: reduce) {
  .stamp-mark.stamping { animation: none; opacity: 1; transform: scale(1) rotate(-9deg); }
}
