/* Extracted from `page/Distributed.html` and `page/celery-lifecycle.html` inline <style>.
   Keep this file focused on those two flow/diagram pages. */

/* ===================== Distributed.html (flow) ===================== */
:root {
  --bg: #0c0f1a;
  --panel: #111827;
  --panel-2: #0f172a;
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --accent: #22d3ee;
  --accent-2: #a855f7;
  --accent-3: #f97316;
  --success: #34d399;
  --danger: #f43f5e;
  --line: rgba(148, 163, 184, 0.35);
  --glow: 0 0 30px rgba(34, 211, 238, 0.35);
  --scale: 0.92;
  --card-w: 280px;
  --text-lh: 1.75;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Source Han Sans CN", system-ui, sans-serif;
  color: var(--ink);
  line-height: var(--text-lh);
  background: #020617;
  min-height: 100vh;
  padding: 18px 24px 26px;
  overflow-x: hidden;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 24px;
}

header h1 {
  font-family: "Source Han Sans CN", system-ui, sans-serif;
  font-size: 28px;
  letter-spacing: 0.5px;
  font-weight: 700;
  text-shadow: 0 0 18px rgba(56, 189, 248, 0.35);
}

header p {
  max-width: 720px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.canvas {
  position: relative;
  background: linear-gradient(140deg, rgba(15, 23, 42, 0.92), rgba(2, 6, 23, 0.92));
  border-radius: 24px;
  padding: 16px 16px 18px;
  box-shadow: 0 20px 60px rgba(8, 10, 24, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.2);
  overflow: visible;
}

.flow-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 3;
  pointer-events: none;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  position: relative;
  z-index: 2;
}

.lane {
  background: rgba(15, 23, 42, 0.75);
  border-radius: 16px;
  padding: 10px 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
}

.lane h3 {
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.lane-cards {
  display: flex;
  gap: 52px;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  padding-inline: 22px;
  overflow: visible;
}

/* Zigzag lanes: alternate visual reading direction to shorten inter-lane links */
#distGrid .lane:nth-child(even) .lane-cards {
  flex-direction: row-reverse;
}

.lane-cards .card {
  flex: 0 0 var(--card-w);
  max-width: var(--card-w);
}

.card {
  background: linear-gradient(160deg, rgba(30, 41, 59, 0.9), rgba(17, 24, 39, 0.9));
  border-radius: 12px;
  padding: 9px 10px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.38);
  position: relative;
  overflow: hidden;
}

.card[role="button"] {
  cursor: pointer;
  user-select: none;
}

.card[role="button"]:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.6);
  outline-offset: 2px;
}

.jump-highlight {
  border-color: rgba(34, 211, 238, 0.6) !important;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.35), 0 16px 34px rgba(34, 211, 238, 0.18) !important;
  transition: box-shadow 220ms ease, border-color 220ms ease;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(34, 211, 238, 0.2), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover::after { opacity: 1; }

.card strong {
  display: block;
  font-size: 12.5px;
  margin-bottom: 6px;
}

.card p {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.75;
  margin-top: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #0f172a;
}

.badge.edge { background: #22d3ee; }
.badge.app { background: #a855f7; }
.badge.data { background: #34d399; }
.badge.infra { background: #f97316; }
.badge.alert { background: #f43f5e; color: #0f172a; }

.flow {
  margin-top: 14px;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: 14px 16px;
  background: rgba(2, 6, 23, 0.6);
  position: relative;
  z-index: 2;
}

.flow h2 {
  font-size: 14px;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.timeline { display: grid; gap: 12px; }

.step {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 14px;
  align-items: start;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.75);
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.step .index {
  width: 20px;
  height: 20px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 11px;
  background: rgba(34, 211, 238, 0.15);
  color: var(--accent);
  border: 1px solid rgba(34, 211, 238, 0.4);
}

.step strong {
  font-size: 12.5px;
  line-height: 1.25;
  display: inline-block;
  margin-bottom: 4px;
}

.step p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.step ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
  list-style: disc outside;
}

.step li { margin: 4px 0; }
.step ul ul { margin-top: 6px; }
.step ul ul { list-style: circle outside; }
.step li::marker { color: rgba(148, 163, 184, 0.95); }

.step code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  color: rgba(226, 232, 240, 0.92);
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.16);
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
}

.tip-icon {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  color: rgba(103, 232, 249, 0.95);
  background: transparent;
  border: 1px solid rgba(103, 232, 249, 0.85);
  vertical-align: middle;
}

.tip-icon::after { display: none; }

.floating-tip {
  position: fixed;
  left: 0;
  top: 0;
  max-width: min(560px, calc(100vw - 24px));
  white-space: pre-wrap;
  text-align: left;
  font-size: 11px;
  line-height: 1.7;
  font-weight: 400;
  color: #e2e8f0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.36);
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.55);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.14s ease;
}

.floating-tip.show {
  opacity: 1;
  visibility: visible;
}

.divider {
  height: 1px;
  background: rgba(148, 163, 184, 0.14);
  margin: 16px 0;
  border-radius: 999px;
}

svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
  z-index: 3;
}

.flow-lines path {
  stroke-width: 2.6;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.28));
  stroke-linecap: round;
  opacity: 0.88;
}

.flow-lines .lane-down {
  stroke: rgba(56, 189, 248, 0.55);
  stroke-width: 1.7;
  opacity: 0.78;
  stroke-dasharray: 4 10;
  animation: dashFlow 10s linear infinite;
  filter: drop-shadow(0 0 7px rgba(56, 189, 248, 0.18));
}

.flow-lines .intra-link {
  stroke: rgba(226, 232, 240, 0.62);
  stroke-width: 2.0;
  opacity: 0.9;
  stroke-dasharray: 4 8;
  animation: dashFlow 8.5s linear infinite;
  filter: drop-shadow(0 0 6px rgba(226, 232, 240, 0.14));
}

@keyframes dashFlow {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -180; }
}

@media (max-width: 1100px) {
  header { flex-direction: column; align-items: flex-start; }
  .lane-cards { width: 100%; max-width: 100%; flex-wrap: wrap; overflow: visible; }
  .lane-cards .card { flex: 1 1 280px; max-width: none; }
}

@media (max-width: 700px) {
  body { padding: 28px 20px 40px; }
  header h1 { font-size: 30px; }
}

/* ===================== Celery lifecycle (flow) ===================== */
/* Reuse mostly identical styles; Celery page overrides below */
header p {
  max-width: 520px;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.badge.client { background: #22d3ee; }
.badge.broker { background: #a855f7; }
.badge.worker { background: #f97316; }
.badge.backend { background: #34d399; }

.flow-lines .lane-link {
  stroke: rgba(56, 189, 248, 0.65);
  stroke-dasharray: 5 12;
  animation: dashFlow 10s linear infinite;
}

.flow-lines .group-link {
  stroke: rgba(168, 85, 247, 0.78);
  stroke-width: 3.1;
  animation: groupPulse 6s ease-in-out infinite;
}

.flow-lines .group-link.return {
  stroke: rgba(52, 211, 153, 0.75);
  stroke-width: 2.6;
  stroke-dasharray: 10 14;
  animation: returnFlow 12s linear infinite;
}

.flow-lines circle {
  opacity: 0.85;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.35));
}

@keyframes groupPulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.7; }
}

@keyframes returnFlow {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 200; }
}

.footer {
  margin-top: 24px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

@media (max-width: 700px) {
  header h1 { font-size: 32px; }
}

