/* ================================================================
   DATA FLOW ARCHITECTURE DIAGRAM - Shared Component
   Analytic Endeavors Inc.

   Used by: medallion-architecture guide, offerings page
   Contains: .arch-* and .overlay-* styles for the full
   architecture flow diagram (Source > Engineering > Semantic > Reporting > Governance)
   ================================================================ */


/* ===== FULL ARCHITECTURE DIAGRAM ===== */

.arch-diagram {
  max-width: 1500px;
  margin: 2rem auto 0;
  position: relative;
}

/* Background ambient flow */
.arch-bg-flow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.arch-bg-flow path {
  fill: none;
  stroke: rgba(0, 153, 153, 0.06);
  stroke-width: 1.5;
  stroke-dasharray: 20 12;
  animation: bgFlow 25s linear infinite;
}
.arch-bg-flow path:nth-child(2) {
  stroke: rgba(0, 88, 124, 0.04);
  animation-duration: 32s;
  animation-direction: reverse;
}
.arch-bg-flow path:nth-child(3) {
  stroke: rgba(101, 84, 192, 0.035);
  animation-duration: 40s;
}
@keyframes bgFlow {
  to { stroke-dashoffset: -60; }
}

/* Main grid layout */
.arch-top {
  display: grid;
  grid-template-columns: 1fr 4.3fr 1.1fr 4.1fr;
  grid-template-rows: 1fr auto;
  gap: 0 1.25rem;
  align-items: stretch;
  position: relative;
  z-index: 1;
  min-height: 400px;
}

/* Guide page step wrappers: zones are wrapped in .step > .reveal */
.arch-top > .step { display: flex; flex-direction: column; }
.arch-top > .step > .reveal { flex: 1; display: flex; flex-direction: column; }
.arch-top > .step > .reveal > .arch-zone { flex: 1; }
.arch-top > .step[data-step="5"] { grid-column: 2 / -1; }


/* ===== SOURCE COLUMN ===== */

.arch-sources {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem 0.6rem;
  flex: 1;
}
.arch-source-item {
  padding: 0.7rem 0.75rem;
  border: 1px solid rgba(255, 140, 66, 0.18);
  border-top: 3px solid rgba(255, 140, 66, 0.45);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary, rgba(255,255,255,0.7));
  background: linear-gradient(135deg, rgba(255, 140, 66, 0.05) 0%, rgba(13, 13, 26, 0.8) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.3rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  flex: 1;
  justify-content: center;
}
.arch-source-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 2px 14px rgba(255, 140, 66, 0.12);
}
.arch-source-item svg {
  width: 20px; height: 20px;
  stroke: rgba(255, 140, 66, 0.6);
  flex-shrink: 0;
}
.arch-source-item--erp {
  border-top-color: rgba(66,165,245,0.6);
  border-color: rgba(66,165,245,0.18);
  background: linear-gradient(135deg, rgba(66,165,245,0.06) 0%, rgba(13,13,26,0.8) 100%);
}
.arch-source-item--erp svg { stroke: rgba(66,165,245,0.7); }
.arch-source-item--erp:hover { box-shadow: 0 2px 14px rgba(66,165,245,0.12); }

.arch-source-item--crm {
  border-top-color: rgba(102,187,106,0.6);
  border-color: rgba(102,187,106,0.18);
  background: linear-gradient(135deg, rgba(102,187,106,0.06) 0%, rgba(13,13,26,0.8) 100%);
}
.arch-source-item--crm svg { stroke: rgba(102,187,106,0.7); }
.arch-source-item--crm:hover { box-shadow: 0 2px 14px rgba(102,187,106,0.12); }

.arch-source-item--files {
  border-top-color: rgba(255,140,66,0.6);
  border-color: rgba(255,140,66,0.18);
  background: linear-gradient(135deg, rgba(255,140,66,0.06) 0%, rgba(13,13,26,0.8) 100%);
}
.arch-source-item--files svg { stroke: rgba(255,140,66,0.7); }
.arch-source-item--files:hover { box-shadow: 0 2px 14px rgba(255,140,66,0.12); }


/* ===== FLOW OVERLAY SVG ===== */

.arch-flow-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
.arch-flow-overlay svg {
  opacity: 0;
  transition: opacity 0.4s ease;
}
.arch-flow-overlay svg.built {
  opacity: 1;
}

/* Overlay stages hidden by default -- consuming pages must trigger visibility
   Guide pages: use .reveal.active triggers
   Static pages: override .overlay-stageN { opacity: 1 } */
.overlay-stage0, .overlay-stage1,
.overlay-stage2, .overlay-stage3 {
  opacity: 0;
  transition: opacity 0.8s ease 0.6s;
}

/* Scroll mode: all stages appear together when first step reveals -- scroll mode only */
body:not(.present) .arch-top:has([data-step="2"] .reveal.active) .overlay-stage0,
body:not(.present) .arch-top:has([data-step="2"] .reveal.active) .overlay-stage1,
body:not(.present) .arch-top:has([data-step="2"] .reveal.active) .overlay-stage2,
body:not(.present) .arch-top:has([data-step="2"] .reveal.active) .overlay-stage3 {
  opacity: 1;
}

/* Static base lines -- always visible, show connection structure */
.overlay-base {
  fill: none;
  stroke-linecap: round;
  stroke-width: 1;
  opacity: 0.25;
}

/* Traveling pulse glow (soft bloom around core) */
.overlay-glow {
  fill: none;
  stroke-linecap: round;
  stroke-width: 4;
  opacity: 0.15;
  stroke-dasharray: 0.12 0.88;
  animation: overlayPulse 4s linear infinite;
}

/* Traveling pulse core (bright line, similar width to glow) */
.overlay-core {
  fill: none;
  stroke-linecap: round;
  stroke-width: 2.5;
  opacity: 0.55;
  stroke-dasharray: 0.10 0.90;
  animation: overlayPulse 4s linear infinite;
}

/* Static arrowheads via markers */
.overlay-head { opacity: 0.55; }

@keyframes overlayPulse {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

/* Color variants */
.overlay-base--bronze, .overlay-glow--bronze, .overlay-core--bronze { stroke: #CD7F32; }
.overlay-head--bronze { fill: #CD7F32; }
.overlay-base--blue, .overlay-glow--blue, .overlay-core--blue { stroke: #00B8B8; }
.overlay-head--blue { fill: #00B8B8; }
.overlay-base--purple, .overlay-glow--purple, .overlay-core--purple { stroke: #9C8FE0; }
.overlay-head--purple { fill: #9C8FE0; }


/* ===== ZONE REGIONS ===== */

.arch-zone {
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  z-index: 1;
  transition: box-shadow 0.3s ease;
}
.arch-zone--engineering:hover {
  box-shadow: 0 0 20px rgba(205,127,50,0.08), 0 4px 20px rgba(0,0,0,0.15);
}
.arch-zone--semantic:hover {
  box-shadow: 0 0 20px rgba(0,88,124,0.1), 0 4px 20px rgba(0,0,0,0.15);
}
.arch-zone--reporting:hover {
  box-shadow: 0 0 20px rgba(101,84,192,0.08), 0 4px 20px rgba(0,0,0,0.15);
}
.arch-zone--engineering {
  background: linear-gradient(180deg, rgba(205,127,50,0.12) 0%, rgba(0,153,153,0.05) 100%);
  border: 1px solid rgba(205,127,50,0.22);
  border-top: 3px solid rgba(205,127,50,0.5);
}
.arch-zone--semantic {
  background: linear-gradient(180deg, rgba(0,88,124,0.14) 0%, rgba(0,88,124,0.05) 100%);
  border: 1px solid rgba(0,88,124,0.25);
  border-top: 3px solid rgba(0,88,124,0.55);
  display: flex;
  flex-direction: column;
}
.arch-zone--reporting {
  background: linear-gradient(180deg, rgba(101,84,192,0.12) 0%, rgba(101,84,192,0.04) 100%);
  border: 1px solid rgba(101,84,192,0.22);
  border-top: 3px solid rgba(101,84,192,0.5);
  display: flex;
  flex-direction: column;
}
.arch-zone--reporting .arch-sublayer {
  flex: 1;
}
.arch-zone--sources {
  background: linear-gradient(180deg, rgba(140,160,180,0.10) 0%, rgba(13,13,26,0.85) 100%);
  border: 1px solid rgba(140,160,180,0.20);
  border-top: 3px solid rgba(140,160,180,0.45);
  display: flex;
  flex-direction: column;
}
.arch-zone--sources:hover {
  box-shadow: 0 0 20px rgba(140,160,180,0.08), 0 4px 20px rgba(0,0,0,0.15);
}


/* ===== ZONE HEADER ===== */

.arch-zone-header {
  padding: 0.6rem 0.8rem;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  min-height: 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.arch-zone-header h4 {
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 0.1rem;
  white-space: nowrap;
}
.arch-zone-header p {
  font-size: 0.65rem;
  color: var(--text-secondary);
  white-space: nowrap;
}


/* ===== SUB-LAYER BANDS ===== */

.arch-sublayer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.arch-sublayer:last-child { border-bottom: none; }
.arch-sublayer-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  min-width: 68px;
  flex-shrink: 0;
}
.arch-sublayer-content {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}


/* ===== MINI NODES ===== */

.arch-mini-node {
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  white-space: nowrap;
}
.arch-mini-node svg { width: 16px; height: 16px; flex-shrink: 0; }
.arch-mini-node--bronze { border-color: rgba(205,127,50,0.3); color: #CD7F32; }
.arch-mini-node--bronze svg { stroke: #CD7F32; }
.arch-mini-node--silver { border-color: rgba(192,192,192,0.3); color: #C0C0C0; }
.arch-mini-node--silver svg { stroke: #C0C0C0; }
.arch-mini-node--gold { border-color: rgba(244,208,63,0.3); color: #f4d03f; }
.arch-mini-node--gold svg { stroke: #f4d03f; }
.arch-mini-node--purple {
  border-color: rgba(101,84,192,0.25);
  background: rgba(101,84,192,0.06);
}
.arch-mini-node--purple svg { stroke: rgba(101,84,192,0.7); }
.arch-zone--reporting .arch-mini-node {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.15rem;
  flex: 1;
  min-width: 68px;
}
.arch-zone--reporting .arch-mini-node .node-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}
.arch-mini-node--teal { border-color: rgba(0,153,153,0.3); color: var(--teal, #009999); }
.arch-mini-node--teal svg { stroke: var(--teal, #009999); }
.arch-mini-node--orange { border-color: rgba(255,140,66,0.3); color: #FF8C42; }
.arch-mini-node--orange svg { stroke: #FF8C42; }

/* Detailed node variant (with subtitle) */
.arch-mini-node--detailed {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.45rem 0.55rem;
  white-space: normal;
  gap: 0.1rem;
}
.arch-mini-node--detailed .node-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}
.arch-mini-node--detailed svg { width: 20px; height: 20px; }
.node-sub {
  font-size: 0.52rem;
  font-weight: 400;
  opacity: 0.6;
  line-height: 1.2;
}


/* ===== ENGINEERING ZONE: sublayer rows with internal grid ===== */

.arch-zone--engineering {
  display: flex;
  flex-direction: column;
}
.arch-zone--engineering .arch-sublayer {
  flex: 1;
}
.arch-sublayer--ingest {
  flex: 0 0 auto !important;
}
/* 6-column grid: transform cards span boundaries between store cards */
.arch-sublayer--transform .arch-sublayer-content,
.arch-sublayer--store .arch-sublayer-content {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.3rem 0.5rem;
  align-items: center;
  justify-items: center;
}
/* Ingest row: centered Data Factory */
.arch-sublayer--ingest .arch-sublayer-content {
  justify-content: center;
}
.arch-sublayer--ingest .arch-mini-node--detailed {
  white-space: nowrap;
}
/* Transform: Prepare spans cols 2-3, Curate spans cols 4-5 */
.arch-sublayer--transform [data-flow-id="prepare"] { grid-column: 2 / span 2; }
.arch-sublayer--transform [data-flow-id="curate"] { grid-column: 4 / span 2; }
/* Store: Bronze at cols 1-2, Silver at cols 3-4, Gold at cols 5-6 */
.arch-sublayer--store [data-flow-id="bronze"] { grid-column: 1 / span 2; }
.arch-sublayer--store [data-flow-id="silver"] { grid-column: 3 / span 2; }
.arch-sublayer--store [data-flow-id="gold"] { grid-column: 5 / span 2; }

/* Engineering cards: horizontal layout (icon left, text right) */
.arch-zone--engineering .arch-mini-node--detailed {
  padding: 0.5rem 0.75rem;
}
.arch-zone--engineering .arch-mini-node--detailed .node-row {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
}
.arch-zone--engineering .arch-mini-node--detailed .node-sub {
  text-align: left;
  white-space: nowrap;
}
/* Transform cards: same size, tight line-height */
.arch-sublayer--transform .arch-mini-node--detailed {
  width: 100%;
  max-width: 130px;
  line-height: 1.2;
}
/* Store cards: uniform size */
.arch-sublayer--store .arch-mini-node--detailed {
  padding: 0.5rem 0.75rem;
  min-width: 90px;
  min-height: 48px;
  justify-content: center;
}

/* Engineering sublayer band backgrounds */
.arch-sublayer--ingest {
  background: linear-gradient(90deg,
    rgba(255,140,66,0.06), rgba(205,127,50,0.08), rgba(255,140,66,0.04));
}
.arch-sublayer--transform {
  background: linear-gradient(90deg,
    rgba(0,153,153,0.04), rgba(205,127,50,0.05), rgba(0,153,153,0.03));
}
.arch-sublayer--store {
  background: linear-gradient(90deg,
    rgba(205,127,50,0.03), rgba(244,208,63,0.04), rgba(205,127,50,0.03));
}


/* ===== SEMANTIC ZONE ===== */

/* Data Science: Semantic Link left, Notebooks right */
.arch-sublayer--datascience .arch-sublayer-content {
  align-items: stretch;
  justify-content: space-between;
}
.arch-notebook-stack {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.arch-sublayer--datascience .arch-mini-node {
  flex: 0 0 auto;
  min-width: auto;
  white-space: normal;
}
.arch-sublayer--datascience .arch-mini-node .node-row {
  flex-direction: row;
  align-items: center;
  gap: 0.3rem;
}
/* Semantic Link: vertical icon, stretches to match notebook stack height */
.arch-mini-node--semantic-link {
  flex-direction: column !important;
  align-items: center;
  text-align: center;
  justify-content: center;
}
.arch-mini-node--semantic-link .node-row {
  flex-direction: column !important;
  align-items: center;
  gap: 0.15rem !important;
  line-height: 1.2;
}

/* Reporting sublayer backgrounds (purple) */
.arch-sublayer--datascience {
  background: linear-gradient(90deg, rgba(101,84,192,0.05), rgba(101,84,192,0.08), rgba(101,84,192,0.04));
}
/* Insights: AI/Copilot card right-aligned */
.arch-sublayer--insights .arch-sublayer-content {
  justify-content: flex-end;
}
.arch-sublayer--insights .arch-mini-node {
  flex: 0 0 auto;
  min-width: auto;
}
.arch-sublayer--insights {
  background: linear-gradient(90deg, rgba(101,84,192,0.04), rgba(101,84,192,0.06), rgba(101,84,192,0.03));
}
.arch-sublayer--reports {
  background: linear-gradient(90deg, rgba(101,84,192,0.03), rgba(101,84,192,0.05), rgba(101,84,192,0.03));
}


/* ===== INTERNAL ARROWS (within engineering zone) ===== */

.internal-base {
  stroke: var(--text-muted); stroke-width: 1.5;
  opacity: 0.2; fill: none;
}
.internal-pulse {
  stroke: rgba(205,127,50,0.6); stroke-width: 3;
  fill: none; stroke-dasharray: 0.2 0.8;
  animation: pulseTravel 2.5s linear infinite;
}
.internal-head { fill: rgba(205,127,50,0.3); }

@keyframes pulseTravel {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}


/* ===== MINI ARROW (between nodes) ===== */

.arch-mini-arrow {
  color: var(--text-muted);
  font-size: 0.65rem;
  flex-shrink: 0;
  opacity: 0.5;
}


/* ===== SEMANTIC ZONE BODY ===== */

.arch-semantic-body {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  flex: 1;
  justify-content: flex-start;
}
.arch-semantic-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.75rem;
  width: 100%;
  border-radius: 8px;
  flex: 1;
}
/* SQL Endpoint pushed to bottom with border */
.arch-semantic-item--bordered {
  margin-top: auto;
  background: rgba(0,88,124,0.06);
  border: 1px solid rgba(0,88,124,0.14);
}
.arch-semantic-item svg {
  width: 22px; height: 22px;
  stroke: var(--blue, #00587C);
  flex-shrink: 0;
}
.arch-semantic-item span {
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.arch-semantic-item--primary {
  background: rgba(0,88,124,0.1);
  border: 1px solid rgba(0,88,124,0.18);
}


/* ===== GOVERNANCE BAR ===== */

.arch-governance {
  border: 1px solid rgba(0, 153, 153, 0.2);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 153, 153, 0.08) 0%, rgba(13, 13, 26, 0.85) 100%);
  padding: 1rem 1.25rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.arch-governance::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--teal, #009999), var(--blue, #00587C), rgba(101,84,192,0.6), transparent);
  background-size: 300% 100%;
  animation: governanceFlow 10s linear infinite;
}
@keyframes governanceFlow {
  to { background-position: -300% 0; }
}
.arch-governance h4 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}
.arch-governance p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}
.arch-gov-items {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.6rem;
}
.arch-gov-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 0.45rem 0.4rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 153, 153, 0.12);
  background: rgba(0, 153, 153, 0.04);
  transition: background 0.3s ease;
}
.arch-gov-item:hover {
  background: rgba(0, 153, 153, 0.1);
}
.arch-gov-item svg {
  width: 22px; height: 22px;
  stroke: var(--teal, #009999);
}


/* ===== PRESENTATION MODE: OVERLAY STAGING ===== */

/* All stages hidden until their step is current/revealed */
body.present .arch-flow-overlay .overlay-stage0,
body.present .arch-flow-overlay .overlay-stage1,
body.present .arch-flow-overlay .overlay-stage2,
body.present .arch-flow-overlay .overlay-stage3 {
  opacity: 0;
  transition: opacity 0.5s ease;
}
/* Stage 0 (internal Engineering) + Stage 1 (Sources->Factory): both appear with Engineering step 2 */
body.present .arch-top:has([data-step="2"].step--current) .arch-flow-overlay .overlay-stage0,
body.present .arch-top:has([data-step="2"].step--revealed) .arch-flow-overlay .overlay-stage0,
body.present .arch-top:has([data-step="2"].step--current) .arch-flow-overlay .overlay-stage1,
body.present .arch-top:has([data-step="2"].step--revealed) .arch-flow-overlay .overlay-stage1,
/* Stage 2 (Gold->Semantic): appears with Semantic step 3 */
body.present .arch-top:has([data-step="3"].step--current) .arch-flow-overlay .overlay-stage2,
body.present .arch-top:has([data-step="3"].step--revealed) .arch-flow-overlay .overlay-stage2,
/* Stage 3 (Semantic->Reporting): appears with Reporting step 4 */
body.present .arch-top:has([data-step="4"].step--current) .arch-flow-overlay .overlay-stage3,
body.present .arch-top:has([data-step="4"].step--revealed) .arch-flow-overlay .overlay-stage3 {
  filter: none;
  opacity: 1;
}
/* Pulses off by default in presentation mode (no animation = clean restart) */
body.present .arch-flow-overlay .overlay-glow,
body.present .arch-flow-overlay .overlay-core {
  animation: none;
}
/* Pulses restart fresh when stage becomes active */
body.present .arch-top:has([data-step="2"].step--current) .arch-flow-overlay .overlay-stage0 .overlay-glow,
body.present .arch-top:has([data-step="2"].step--revealed) .arch-flow-overlay .overlay-stage0 .overlay-glow,
body.present .arch-top:has([data-step="2"].step--current) .arch-flow-overlay .overlay-stage1 .overlay-glow,
body.present .arch-top:has([data-step="2"].step--revealed) .arch-flow-overlay .overlay-stage1 .overlay-glow,
body.present .arch-top:has([data-step="3"].step--current) .arch-flow-overlay .overlay-stage2 .overlay-glow,
body.present .arch-top:has([data-step="3"].step--revealed) .arch-flow-overlay .overlay-stage2 .overlay-glow,
body.present .arch-top:has([data-step="4"].step--current) .arch-flow-overlay .overlay-stage3 .overlay-glow,
body.present .arch-top:has([data-step="4"].step--revealed) .arch-flow-overlay .overlay-stage3 .overlay-glow,
body.present .arch-top:has([data-step="2"].step--current) .arch-flow-overlay .overlay-stage0 .overlay-core,
body.present .arch-top:has([data-step="2"].step--revealed) .arch-flow-overlay .overlay-stage0 .overlay-core,
body.present .arch-top:has([data-step="2"].step--current) .arch-flow-overlay .overlay-stage1 .overlay-core,
body.present .arch-top:has([data-step="2"].step--revealed) .arch-flow-overlay .overlay-stage1 .overlay-core,
body.present .arch-top:has([data-step="3"].step--current) .arch-flow-overlay .overlay-stage2 .overlay-core,
body.present .arch-top:has([data-step="3"].step--revealed) .arch-flow-overlay .overlay-stage2 .overlay-core,
body.present .arch-top:has([data-step="4"].step--current) .arch-flow-overlay .overlay-stage3 .overlay-core,
body.present .arch-top:has([data-step="4"].step--revealed) .arch-flow-overlay .overlay-stage3 .overlay-core {
  animation: overlayPulse 4s linear 0s infinite;
}


/* ===== LIGHT MODE OVERRIDES ===== */

[data-theme="light"] .arch-bg-flow path { stroke: rgba(0,153,153,0.03); }
[data-theme="light"] .arch-zone {
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
[data-theme="light"] .arch-zone--engineering {
  background: linear-gradient(180deg, rgba(205,127,50,0.06), rgba(255,255,255,0.85));
  border-top-color: rgba(205,127,50,0.35);
}
[data-theme="light"] .arch-zone--semantic {
  background: linear-gradient(180deg, rgba(0,88,124,0.07), rgba(255,255,255,0.85));
  border-top-color: rgba(0,88,124,0.4);
}
[data-theme="light"] .arch-zone--reporting {
  background: linear-gradient(180deg, rgba(101,84,192,0.06), rgba(255,255,255,0.85));
  border-top-color: rgba(101,84,192,0.35);
}
[data-theme="light"] .arch-zone-header h4 { color: #333; }
[data-theme="light"] .arch-zone-header p { color: #666; }
[data-theme="light"] .arch-sublayer { border-bottom-color: rgba(205,127,50,0.08); }
[data-theme="light"] .arch-sublayer-label { color: #999; }
[data-theme="light"] .internal-base { opacity: 0.15; }
[data-theme="light"] .internal-pulse { stroke: rgba(180,120,50,0.5); }
[data-theme="light"] .internal-head { fill: rgba(180,120,50,0.25); }
[data-theme="light"] .arch-sublayer--ingest {
  background: linear-gradient(90deg, rgba(255,140,66,0.04), rgba(205,127,50,0.05), rgba(255,140,66,0.03));
}
[data-theme="light"] .arch-sublayer--transform {
  background: linear-gradient(90deg, rgba(0,153,153,0.03), rgba(205,127,50,0.04), rgba(0,153,153,0.02));
}
[data-theme="light"] .arch-sublayer--store {
  background: linear-gradient(90deg, rgba(205,127,50,0.02), rgba(244,208,63,0.03), rgba(205,127,50,0.02));
}
[data-theme="light"] .arch-semantic-item--bordered {
  background: rgba(0,88,124,0.04);
  border-color: rgba(0,88,124,0.12);
}
[data-theme="light"] .node-sub { color: #999; }
[data-theme="light"] .arch-mini-node {
  background: rgba(255,255,255,0.85);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
[data-theme="light"] .arch-mini-node--bronze { border-color: rgba(180,120,50,0.3); color: #a0703c; }
[data-theme="light"] .arch-mini-node--bronze svg { stroke: #a0703c; }
[data-theme="light"] .arch-mini-node--silver { border-color: rgba(160,160,160,0.3); color: #777; }
[data-theme="light"] .arch-mini-node--silver svg { stroke: #777; }
[data-theme="light"] .arch-mini-node--gold { border-color: rgba(200,170,40,0.3); color: #b89a1e; }
[data-theme="light"] .arch-mini-node--gold svg { stroke: #b89a1e; }
[data-theme="light"] .arch-mini-node--teal { border-color: rgba(0,120,120,0.25); color: #007878; }
[data-theme="light"] .arch-mini-node--teal svg { stroke: #007878; }
[data-theme="light"] .arch-mini-node--orange { border-color: rgba(200,110,40,0.25); color: #c06e28; }
[data-theme="light"] .arch-mini-node--orange svg { stroke: #c06e28; }
[data-theme="light"] .arch-semantic-item {
  background: rgba(255,255,255,0.85);
  border-color: rgba(0,88,124,0.12);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
[data-theme="light"] .arch-semantic-item svg { stroke: #00587C; }
[data-theme="light"] .arch-subgroup-item {
  background: rgba(255,255,255,0.85);
  border-color: rgba(101,84,192,0.12);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
[data-theme="light"] .arch-subgroup-item svg { stroke: rgba(101,84,192,0.7); }
[data-theme="light"] .arch-subgroup-label { color: #666; }
[data-theme="light"] .arch-zone--sources {
  background: linear-gradient(180deg, rgba(140,160,180,0.06), rgba(255,255,255,0.85));
  border-top-color: rgba(140,160,180,0.35);
}
[data-theme="light"] .arch-source-item {
  background: linear-gradient(135deg, rgba(140,160,180,0.03), rgba(255,255,255,0.85));
  border-color: rgba(140,160,180,0.12); border-top-color: rgba(140,160,180,0.25);
}
[data-theme="light"] .arch-source-item--erp {
  border-top-color: rgba(33,120,200,0.4);
  background: linear-gradient(135deg, rgba(33,120,200,0.04), rgba(255,255,255,0.85));
}
[data-theme="light"] .arch-source-item--erp svg { stroke: #2178C8; }
[data-theme="light"] .arch-source-item--crm {
  border-top-color: rgba(56,142,60,0.4);
  background: linear-gradient(135deg, rgba(56,142,60,0.04), rgba(255,255,255,0.85));
}
[data-theme="light"] .arch-source-item--crm svg { stroke: #388E3C; }
[data-theme="light"] .arch-source-item--files {
  border-top-color: rgba(200,110,40,0.4);
  background: linear-gradient(135deg, rgba(200,110,40,0.04), rgba(255,255,255,0.85));
}
[data-theme="light"] .arch-source-item--files svg { stroke: #C86E28; }
[data-theme="light"] .arch-mini-node--purple {
  border-color: rgba(101,84,192,0.25);
  color: #6b5baa;
}
[data-theme="light"] .arch-mini-node--purple svg { stroke: #6b5baa; }
[data-theme="light"] .arch-sublayer--datascience {
  background: linear-gradient(90deg, rgba(101,84,192,0.03), rgba(101,84,192,0.05), rgba(101,84,192,0.02));
}
[data-theme="light"] .arch-sublayer--insights {
  background: linear-gradient(90deg, rgba(101,84,192,0.02), rgba(101,84,192,0.04), rgba(101,84,192,0.02));
}
[data-theme="light"] .arch-sublayer--reports {
  background: linear-gradient(90deg, rgba(101,84,192,0.02), rgba(101,84,192,0.03), rgba(101,84,192,0.02));
}
[data-theme="light"] .overlay-base { opacity: 0.12; }
[data-theme="light"] .overlay-glow { opacity: 0.10; }
[data-theme="light"] .overlay-core { opacity: 0.45; }
[data-theme="light"] .overlay-head { opacity: 0.35; }
[data-theme="light"] .arch-governance {
  background: linear-gradient(135deg, rgba(0,153,153,0.03), rgba(255,255,255,0.9));
  border-color: rgba(0,153,153,0.12);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
[data-theme="light"] .arch-gov-item {
  background: rgba(255,255,255,0.85);
  border-color: rgba(0,153,153,0.1);
}
[data-theme="light"] .arch-gov-item svg { filter: none; }


/* ===== REDUCED MOTION ===== */

@media (prefers-reduced-motion: reduce) {
  .overlay-glow, .overlay-core, .internal-pulse {
    animation: none;
    opacity: 0;
  }
  .overlay-base { opacity: 0.25; }
  .arch-bg-flow path { animation: none; }
  .arch-governance::before { animation: none; }
}


/* ===== RESPONSIVE ===== */

/* Narrow desktop: enable horizontal scroll before full mobile breakpoint */
@media (max-width: 1100px) {
  .arch-diagram {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .arch-top { min-width: 1080px; }
}

@media (max-width: 768px) {
  .arch-bg-flow { display: none; }
  .arch-diagram {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  /* Visible scrollbar as scroll affordance */
  .arch-diagram::-webkit-scrollbar { height: 6px; }
  .arch-diagram::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 3px; }
  .arch-diagram::-webkit-scrollbar-thumb { background: var(--teal, #009999); border-radius: 3px; min-width: 40px; }
  .arch-top { min-width: 1080px; }
  .arch-sublayer-content { flex-wrap: wrap; }
  .arch-sublayer-label { min-width: 44px; font-size: 0.5rem; }
  .arch-mini-node--detailed { padding: 0.3rem 0.4rem; }
  .arch-semantic-body { flex-direction: column; gap: 0.5rem; }
  .arch-gov-items { flex-wrap: wrap; justify-content: center; }
}
