/* OSS Diagram Scoped Styles - Wispgate Engine */

/* 4-Column Asymmetrical Grid */
.grid-asym {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 1440px) {
  .grid-asym {
    grid-template-columns: 1fr 280px;
    gap: 34px;
    align-items: start;
  }
}

.grid-asym > .oss-diagram-wrapper {
  width: 100%;
  overflow: visible;
}

/* 3-Column Diagram Stage Structure */
.wg-architecture-stage {
  position: relative;
  display: grid;
  grid-template-columns: 260px minmax(400px, 1fr) 290px;
  gap: 28px;
  align-items: center;
  min-height: 620px;
  border-radius: 22px;
}

.wg-side-stack, 
.wg-right-layers {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.wg-node-card, 
.wg-layer-card {
  position: relative;
  overflow: visible !important;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 22px;
  padding: 22px;
  z-index: 1;
}

.wg-node-card { animation: wgFloat 7s ease-in-out infinite; }
.wg-node-card:nth-child(2) { animation-delay: -1.4s; }
.wg-node-card:nth-child(3) { animation-delay: -2.8s; }

.wg-shelf {
  position: absolute; 
  inset: auto 20px 0; 
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--orange, #f60), transparent);
  box-shadow: 0 2px 14px rgba(var(--orange-rgb, 255,102,0), 0.85);
  opacity: 0.9; 
  z-index: 2; 
  pointer-events: none;
}

.wg-node-card h4, 
.wg-layer-card h4 {
  font-size: 0.92rem !important; 
  font-weight: 700; 
  margin-bottom: 6px !important;
  color: var(--text-primary, #fff) !important;
}

.wg-node-card p, 
.wg-layer-card p, 
.text-meta {
  font-size: 0.75rem !important; 
  line-height: 1.45 !important; 
  color: var(--muted, #999); 
  margin: 0;
}

.wg-node-icon {
  width: 38px; 
  height: 38px; 
  border-radius: 13px; 
  display: grid; 
  place-items: center;
  margin-bottom: 12px; 
  background: rgba(var(--orange-rgb, 255,102,0), 0.13);
  border: 1px solid rgba(var(--orange-rgb, 255,102,0), 0.32);
  color: var(--orange2, #ff8533); 
  box-shadow: 0 0 30px rgba(var(--orange-rgb, 255,102,0), 0.2);
  font-size: 12px; 
  font-weight: 900;
}

.wg-layer-card::before {
  content: ''; 
  position: absolute; 
  left: 0; 
  top: 20px; 
  bottom: 20px; 
  width: 3px;
  border-radius: 99px; 
  background: var(--orange, #f60); 
  box-shadow: 0 0 16px rgba(var(--orange-rgb, 255,102,0), 0.7);
}

/* Core Shell & Inner 3-Column Module Grid */
.wg-core-shell {
  position: relative;
  padding: 26px 22px;
  min-height: 560px;
  background: radial-gradient(circle at center, rgba(var(--orange-rgb, 255,102,0), 0.12), transparent 45%), linear-gradient(145deg, rgba(24,48,86,0.76), rgba(8,14,26,0.88));
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 1;
}

.wg-core-shell::before {
  content: ''; 
  position: absolute; 
  inset: 14px; 
  border: 1px solid rgba(var(--orange-rgb, 255,102,0), 0.24);
  border-radius: 22px; 
  pointer-events: none; 
  box-shadow: inset 0 0 30px rgba(var(--orange-rgb, 255,102,0), 0.05);
}

.wg-orbit {
  position: absolute; 
  inset: 50px; 
  border: 1px dashed rgba(var(--orange-rgb, 255,102,0), 0.32);
  border-radius: 50%; 
  animation: wgRotate 26s linear infinite; 
  opacity: 0.5;
}
.wg-orbit:nth-child(2) { inset: 96px; animation-direction: reverse; animation-duration: 18s; opacity: 0.34; }

.wg-core-heading { position: relative; text-align: center; margin-bottom: 22px; }
.wg-core-heading small { color: var(--orange2, #ff8533); font-size: 0.68rem; text-transform: uppercase; font-weight: 800; letter-spacing: 0.1em; }
.wg-core-heading h3 { color: var(--text-primary, #fff) !important; font-size: 1.5rem !important; margin: 4px 0 8px !important; }
.wg-core-heading p { font-size: 0.8rem !important; line-height: 1.45 !important; color: var(--muted, #999); margin: 0; }

.wg-module-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  z-index: 2;
}

.wg-module {
  position: relative;
  min-height: 118px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 18px;
  padding: 14px 12px;
  background: rgba(8,14,26,0.74);
  transform: translateY(18px);
  opacity: 0;
  animation: wgReveal 0.8s ease forwards;
  transition: transform .28s ease, border-color .28s ease, box-shadow .28s ease;
}

.wg-module:nth-child(1) { animation-delay: 0.05s; }
.wg-module:nth-child(2) { animation-delay: 0.14s; }
.wg-module:nth-child(3) { animation-delay: 0.23s; }
.wg-module:nth-child(4) { animation-delay: 0.32s; }
.wg-module:nth-child(5) { animation-delay: 0.41s; }
.wg-module:nth-child(6) { animation-delay: 0.50s; }

.wg-module::before {
  content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(var(--orange-rgb, 255,102,0), 0.14), transparent 54%);
  opacity: 0; transition: opacity .28s ease;
}
.wg-module:hover { border-color: rgba(var(--orange-rgb, 255,102,0), 0.46); box-shadow: 0 0 30px rgba(var(--orange-rgb, 255,102,0), 0.12); transform: translateY(-3px); }
.wg-module:hover::before { opacity: 1; }

.wg-module b { font-size: 0.9rem; margin-bottom: 6px; display: block; color: var(--text-primary, #fff) !important; font-weight: 700; }
.wg-module span { color: var(--muted, #999); font-size: 0.72rem !important; line-height: 1.4 !important; display: block; }

.wg-ai-module { border-color: rgba(var(--orange-rgb, 255,102,0), 0.56); box-shadow: 0 0 30px rgba(var(--orange-rgb, 255,102,0), 0.14); }

/* SVG Flow Lines Alignment */
.wg-flow-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.9;
}

.wg-flow-path {
  fill: none;
  stroke: var(--orange, #f60);
  stroke-width: 2;
  stroke-dasharray: 10 14;
  animation: wgDash 1.5s linear infinite;
  filter: drop-shadow(0 0 8px rgba(var(--orange-rgb, 255,102,0), 0.32));
}

/* 4th Column (.arch-copy) */
.arch-copy {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (min-width: 1440px) {
  .arch-copy {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }
}

.arch-copy .panel {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 22px;
  padding: 24px;
}

.arch-copy h3 {
  font-size: 1.2rem !important;
  color: var(--text-primary, #fff) !important;
  margin: 0 0 10px !important;
}

.arch-copy p {
  font-size: 0.82rem !important;
  line-height: 1.5 !important;
  color: var(--muted, #999);
  margin: 0;
}

/* Keyframe Animations */
@keyframes wgDash { to { stroke-dashoffset: -24; } }
@keyframes wgRotate { to { transform: rotate(360deg); } }
@keyframes wgFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes wgReveal { to { opacity: 1; transform: translateY(0); } }

/* Mobile & Tablet Fallbacks */
@media (max-width: 1024px) {
  .wg-architecture-stage {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 28px;
  }
  .wg-flow-lines { display: none; }
  .wg-side-stack, .wg-right-layers { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
  .wg-core-shell { min-height: auto; padding: 28px 18px !important; }
  .wg-module-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .arch-copy { grid-template-columns: 1fr; }
}
