/* ====================================================================
   Work card interactive visuals (3 cases)
   ==================================================================== */

.work-thumb {
  height: 220px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
}
.work-thumb::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  z-index: 0;
}
.work-thumb::after { display: none; }

.work-thumb-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 1;
}

.work-thumb-glow {
  position: absolute; inset: 0;
  background: radial-gradient(400px 200px at var(--gx, 50%) var(--gy, 60%),
                              var(--accent-soft), transparent 70%);
  opacity: 0.7;
  z-index: 0;
}

/* ---------- VIZ 1: Production line scanner ---------- */
.viz-line {
  position: absolute; inset: 0;
  z-index: 1;
}
.viz-line .belt {
  position: absolute;
  left: 0; right: 0; bottom: 60px; height: 10px;
  background:
    repeating-linear-gradient(90deg,
      rgba(255,255,255,0.08) 0 14px,
      rgba(255,255,255,0.02) 14px 28px);
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  animation: beltScroll 1.8s linear infinite;
}
@keyframes beltScroll {
  from { background-position: 0 0; }
  to { background-position: -28px 0; }
}
.viz-line .belt-edge {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong) 20%, var(--line-strong) 80%, transparent);
}
.viz-line .belt-edge.top { bottom: 70px; }
.viz-line .belt-edge.bot { bottom: 59px; }

.viz-line .part {
  position: absolute;
  bottom: 70px;
  width: 22px; height: 22px;
  background: linear-gradient(180deg, #2a3a55, #0e1422);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 3px;
  animation: partMove 4s linear infinite;
}
.viz-line .part::before {
  content: '';
  position: absolute; inset: 4px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 2px;
}
.viz-line .part.bad {
  animation: partMove 4s linear infinite, badPulse 0.4s ease-in-out 2.0s 2;
}
.viz-line .part:nth-child(2) { animation-delay: -1.3s; }
.viz-line .part:nth-child(3) { animation-delay: -2.6s; }
.viz-line .part.bad { animation-delay: -2.0s, 0s; }

@keyframes partMove {
  from { left: -30px; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  to { left: calc(100% + 30px); opacity: 0; }
}
@keyframes badPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 90, 90, 0); border-color: rgba(255,255,255,0.16); }
  50% { box-shadow: 0 0 16px 4px rgba(255, 120, 120, 0.6); border-color: rgba(255, 120, 120, 0.9); }
}

.viz-line .scanner {
  position: absolute;
  left: 50%; top: 18px;
  transform: translateX(-50%);
  width: 80px; height: 56px;
  border: 1px solid var(--accent-soft);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.4), transparent);
}
.viz-line .scanner::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -1px;
  transform: translateX(-50%);
  width: 60px; height: 4px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 14px var(--accent-glow);
  animation: scannerPulse 1.2s ease-in-out infinite;
}
@keyframes scannerPulse {
  0%, 100% { opacity: 0.4; transform: translateX(-50%) scaleX(0.7); }
  50% { opacity: 1; transform: translateX(-50%) scaleX(1); }
}
.viz-line .laser {
  position: absolute;
  left: 50%; top: 74px;
  width: 1px; height: 86px;
  background: linear-gradient(180deg, var(--accent), transparent);
  transform-origin: top center;
  box-shadow: 0 0 8px var(--accent-glow);
  animation: laserSweep 4s linear infinite;
}
@keyframes laserSweep {
  0% { transform: translateX(-50%) rotate(-22deg); }
  50% { transform: translateX(-50%) rotate(22deg); }
  100% { transform: translateX(-50%) rotate(-22deg); }
}

.viz-line .hud {
  position: absolute;
  top: 16px; right: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-align: right;
  line-height: 1.5;
}
.viz-line .hud .ok { color: var(--accent); }
.viz-line .hud .reject { color: #ff8585; }

/* ---------- VIZ 2: Document agent ---------- */
.viz-doc {
  position: absolute; inset: 0; z-index: 1;
}
.viz-doc .doc {
  position: absolute;
  width: 60px; height: 78px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 4px;
  padding: 8px 6px;
  display: flex; flex-direction: column; gap: 3px;
}
.viz-doc .doc::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 12px; height: 12px;
  background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.5) 50%);
}
.viz-doc .doc-line {
  height: 2px;
  background: rgba(255,255,255,0.15);
  border-radius: 1px;
}
.viz-doc .doc-line:nth-child(1) { width: 80%; }
.viz-doc .doc-line:nth-child(2) { width: 65%; }
.viz-doc .doc-line:nth-child(3) { width: 90%; }
.viz-doc .doc-line:nth-child(4) { width: 50%; }
.viz-doc .doc-line:nth-child(5) { width: 75%; }

.viz-doc .doc-1 { left: 20px; top: 28px; transform: rotate(-8deg); }
.viz-doc .doc-2 { left: 56px; top: 24px; transform: rotate(2deg); }
.viz-doc .doc-3 { left: 88px; top: 32px; transform: rotate(-3deg); animation: docHighlight 4s ease-in-out infinite; }
@keyframes docHighlight {
  0%, 100% { border-color: rgba(255,255,255,0.14); box-shadow: none; }
  50% {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
  }
}
.viz-doc .doc-3 .doc-line {
  animation: lineHighlight 4s ease-in-out infinite;
}
.viz-doc .doc-3 .doc-line:nth-child(2) { animation-delay: 0.2s; }
.viz-doc .doc-3 .doc-line:nth-child(3) { animation-delay: 0.4s; background: var(--accent); animation: lineFlag 4s ease-in-out infinite; }
.viz-doc .doc-3 .doc-line:nth-child(4) { animation-delay: 0.6s; }
.viz-doc .doc-3 .doc-line:nth-child(5) { animation-delay: 0.8s; }
@keyframes lineHighlight {
  0%, 40%, 100% { background: rgba(255,255,255,0.15); }
  50%, 90% { background: rgba(255,255,255,0.3); }
}
@keyframes lineFlag {
  0%, 40%, 100% { background: rgba(255,255,255,0.15); width: 90%; }
  50%, 90% { background: var(--accent); width: 90%; box-shadow: 0 0 6px var(--accent-glow); }
}

.viz-doc .agent {
  position: absolute;
  right: 22px; top: 50%;
  transform: translateY(-50%);
  width: 84px; height: 84px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, rgba(255,255,255,0.4), transparent 50%),
    radial-gradient(circle at 50% 50%, var(--accent), var(--accent-deep) 50%, transparent 70%);
  box-shadow: 0 0 36px var(--accent-glow), inset 0 0 16px rgba(255,255,255,0.2);
  animation: agentPulse 3s ease-in-out infinite;
}
.viz-doc .agent::before, .viz-doc .agent::after {
  content: '';
  position: absolute; inset: -8px;
  border-radius: 50%;
  border: 1px solid var(--accent-soft);
  animation: agentRing 3s ease-out infinite;
}
.viz-doc .agent::after { animation-delay: 1.5s; }
@keyframes agentRing {
  0% { transform: scale(0.85); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}
@keyframes agentPulse {
  0%, 100% { box-shadow: 0 0 36px var(--accent-glow), inset 0 0 16px rgba(255,255,255,0.2); }
  50% { box-shadow: 0 0 60px var(--accent-glow), inset 0 0 22px rgba(255,255,255,0.3); }
}

.viz-doc .beam {
  position: absolute;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent));
  box-shadow: 0 0 6px var(--accent-glow);
  transform-origin: right center;
  animation: beam 4s ease-in-out infinite;
  opacity: 0;
}
.viz-doc .beam-1 { right: 100px; width: 80px; top: 56%; animation-delay: 0.3s; }
.viz-doc .beam-2 { right: 100px; width: 100px; top: 50%; animation-delay: 0.9s; }
.viz-doc .beam-3 { right: 100px; width: 60px; top: 60%; animation-delay: 1.5s; }
@keyframes beam {
  0%, 30%, 100% { opacity: 0; transform: scaleX(0); }
  45% { opacity: 1; transform: scaleX(1); }
  75% { opacity: 0; transform: scaleX(1); }
}

/* ---------- VIZ 3: Workplace portal hub ---------- */
.viz-portal {
  position: absolute; inset: 0; z-index: 1;
}
.viz-portal-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.viz-portal-svg .ring {
  fill: none;
  stroke: var(--line-strong);
  stroke-dasharray: 2 4;
}
.viz-portal-svg .link {
  stroke: var(--line-strong);
  stroke-width: 1;
}
.viz-portal-svg .link.pulse {
  stroke: var(--accent);
  stroke-dasharray: 4 8;
  stroke-dashoffset: 0;
  animation: linkPulse 1.8s linear infinite;
  filter: drop-shadow(0 0 4px var(--accent-glow));
}
@keyframes linkPulse {
  to { stroke-dashoffset: -24; }
}

.viz-portal .node {
  position: absolute;
  width: 28px; height: 28px;
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border: 1px solid var(--line-strong);
  display: grid; place-items: center;
  transform: translate(-50%, -50%);
  z-index: 2;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text-dim);
  transition: all 300ms var(--ease);
}
.viz-portal .node.active {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-soft), transparent);
  color: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
}
.viz-portal .hub {
  position: absolute;
  left: 50%; top: 50%;
  width: 48px; height: 48px;
  transform: translate(-50%, -50%);
  border-radius: 12px;
  background:
    radial-gradient(circle at 35% 35%, rgba(255,255,255,0.3), transparent 60%),
    linear-gradient(180deg, var(--accent), var(--accent-deep));
  border: 1px solid var(--accent);
  box-shadow: 0 0 28px var(--accent-glow), inset 0 0 14px rgba(255,255,255,0.2);
  display: grid; place-items: center;
  z-index: 3;
  color: var(--bg-0);
}

/* Hover: speed things up */
.work-card:hover .viz-line .belt { animation-duration: 0.9s; }
.work-card:hover .viz-line .part { animation-duration: 2s; }
.work-card:hover .viz-line .laser { animation-duration: 2s; }
.work-card:hover .viz-portal-svg .link.pulse { animation-duration: 0.9s; }
.work-card:hover .viz-mar .vessel { animation-duration: 3s; }
.work-card:hover .viz-mar .route-dash { animation-duration: 0.6s; }

/* ---------- VIZ MARITIME: route + vessel + RFQ → quote ---------- */
.viz-mar {
  position: absolute; inset: 0;
  z-index: 1;
}
.viz-mar-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  overflow: visible;
}
.viz-mar-svg .route {
  fill: none;
  stroke: rgba(255,255,255,0.10);
  stroke-width: 1.4;
}
.viz-mar-svg .route-dash {
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-dasharray: 4 8;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 4px var(--accent-glow));
  animation: marDash 1.4s linear infinite;
}
@keyframes marDash {
  to { stroke-dashoffset: -24; }
}
.viz-mar-svg .port {
  fill: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent-glow));
}
.viz-mar-svg .port-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
  opacity: 0.6;
  transform-origin: center;
  transform-box: fill-box;
  animation: marPort 2.4s ease-out infinite;
}
.viz-mar-svg .port-ring:nth-of-type(4) { animation-delay: -1.2s; }
@keyframes marPort {
  0% { transform: scale(0.8); opacity: 0.9; }
  100% { transform: scale(1.8); opacity: 0; }
}
.viz-mar-svg .vessel {
  fill: #fff;
  stroke: #fff;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 3px var(--accent-glow));
  animation: marVessel 6s linear infinite;
  offset-path: path('M 36 150 Q 180 60 324 150');
  offset-rotate: auto;
}
@keyframes marVessel {
  0% { offset-distance: 0%; }
  100% { offset-distance: 100%; }
}
.viz-mar-svg .vessel path { stroke: #fff; }

.viz-mar-label {
  position: absolute;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  padding: 3px 7px;
  background: rgba(10, 14, 24, 0.7);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.viz-mar-label.l-origin { left: 16px; bottom: 14px; }
.viz-mar-label.l-dest { right: 16px; bottom: 14px; }

/* Incoming RFQ */
.viz-mar-rfq {
  position: absolute;
  top: 18px; left: 16px;
  width: 56px; height: 38px;
  padding: 6px 7px 7px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 4px;
  display: flex; flex-direction: column; gap: 3px;
  animation: marRfqIn 6s ease-in-out infinite;
}
.viz-mar-rfq::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 8px; height: 8px;
  background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.45) 50%);
}
.viz-mar-rfq .rfq-row {
  height: 2px;
  background: rgba(255,255,255,0.2);
  border-radius: 1px;
}
.viz-mar-rfq .rfq-row.r1 { width: 80%; }
.viz-mar-rfq .rfq-row.r2 { width: 60%; }
.viz-mar-rfq .rfq-row.r3 { width: 75%; }
.viz-mar-rfq .rfq-tag {
  position: absolute; bottom: -7px; left: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  background: var(--bg-2);
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid var(--line);
}
@keyframes marRfqIn {
  0%, 8% { transform: translateX(-30px); opacity: 0; }
  16%, 50% { transform: translateX(0); opacity: 1; }
  60%, 100% { transform: translateX(0); opacity: 0.4; }
}

/* Outgoing quote ticket */
.viz-mar-quote {
  position: absolute;
  top: 18px; right: 16px;
  width: 78px;
  padding: 8px 10px;
  background: linear-gradient(180deg, var(--accent-soft), rgba(20,26,42,0.6));
  border: 1px solid var(--accent-soft);
  border-radius: 6px;
  display: flex; flex-direction: column; gap: 2px;
  box-shadow: 0 0 18px var(--accent-glow);
  animation: marQuoteOut 6s ease-in-out infinite;
}
.viz-mar-quote .qt-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--accent);
}
.viz-mar-quote .qt-price {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.viz-mar-quote .qt-eta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}
@keyframes marQuoteOut {
  0%, 55% { transform: translateX(30px); opacity: 0; }
  65%, 92% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(0); opacity: 0; }
}
