/* ═══════════════════════════════════════════════════════════════
   Work Page — Case Studies + Reference Architecture
   ═══════════════════════════════════════════════════════════════ */

/* ─── CASE STUDY SECTION ──────────────────────────────────────── */
.case-study {
  padding-top: var(--space-4xl);
  padding-bottom: var(--space-3xl);
}

.case-study + .case-study {
  border-top: 1px solid var(--border-subtle);
}

.case-header {
  margin-bottom: var(--space-xl);
}

.case-header .mono-label {
  margin-bottom: var(--space-sm);
}

.case-headline {
  max-width: 720px;
}

/* ─── PROBLEM / OUTCOME COLUMNS ───────────────────────────────── */
.case-context {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.case-context__item .mono-label {
  margin-bottom: var(--space-xs);
}

.case-context__item p:last-child {
  color: var(--text-secondary);
  font-size: var(--fs-body);
  line-height: 1.6;
}

@media (max-width: 768px) {
  .case-context {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
}

/* ─── HIGHLIGHT LINE ──────────────────────────────────────────── */
.case-highlight {
  font-size: var(--fs-body);
  color: var(--signal);
  font-style: italic;
  border-left: 2px solid var(--signal);
  padding-left: var(--space-sm);
  margin-bottom: var(--space-xl);
  max-width: var(--max-prose);
  line-height: 1.6;
}

/* ─── STACK TAGS ──────────────────────────────────────────────── */
.case-stack {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-xl);
}

.stack-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 12px;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.stack-tag:hover {
  border-color: var(--accent);
  color: var(--text-secondary);
}

/* ─── VIDEO FRAME ─────────────────────────────────────────────── */
.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 0 20px rgba(94, 234, 255, 0.06), 0 8px 32px rgba(0, 0, 0, 0.4);
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-frame:hover {
  border-color: var(--border-strong);
  box-shadow: 0 0 30px rgba(94, 234, 255, 0.1), 0 12px 48px rgba(0, 0, 0, 0.5);
}

/* ─── BLUEPRINT PANEL (Reference Architecture) ────────────────── */
.case-blueprint {
  margin-bottom: var(--space-xl);
}

.blueprint-panel {
  padding: var(--space-xl);
}

.blueprint-panel__inner {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.blueprint-stage {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}

.blueprint-stage--source,
.blueprint-stage--activate {
  padding: var(--space-md) 0;
}

.blueprint-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  flex-shrink: 0;
}

.blueprint-stage .mono-label {
  margin-bottom: 4px;
}

.blueprint-stage p:last-child {
  color: var(--text-secondary);
  font-size: var(--fs-small);
  line-height: 1.5;
}

.blueprint-connector {
  width: 1px;
  height: 24px;
  background: var(--border-strong);
  margin-left: 14px;
}

@media (max-width: 768px) {
  .blueprint-panel {
    padding: var(--space-lg);
  }
}

/* ─── PULL-STAT ROW ───────────────────────────────────────────── */
.case-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
}

@media (max-width: 768px) {
  .case-stats {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
}

/* ─── ANIMATED DATA-FLOW VISUALIZATION ──────────────────────── */
.flow-viz {
  display: flex;
  justify-content: center;
  margin-top: var(--space-xl);
}

.flow {
  width: 100%;
  max-width: 600px;
  height: auto;
}

.flow-line {
  stroke: var(--signal);
  stroke-width: 1;
  fill: none;
  filter: drop-shadow(0 0 6px var(--signal-glow));
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transition: stroke-dashoffset 1.6s ease-out;
}

.flow.active .flow-line {
  stroke-dashoffset: 0;
}

@keyframes comet {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}

.flow-pulse {
  stroke: #fff;
  stroke-width: 1.5;
  fill: none;
  stroke-dasharray: 12 988;
  filter: drop-shadow(0 0 8px var(--signal));
  opacity: 0;
  transition: opacity 0.4s ease 1.6s;
}

.flow.active .flow-pulse {
  opacity: 1;
  animation: comet 2.4s linear infinite;
}

/* Reduced motion: show static completed line, no comet */
@media (prefers-reduced-motion: reduce) {
  .flow-line {
    stroke-dashoffset: 0;
    transition: none;
  }

  .flow-pulse {
    display: none;
  }
}
