/* ==========================================================================
   Technology Stack — interactive architecture map
   10 modules across 4 conceptual layers (edge/access, intelligence,
   foundation, operations), connected by a JS-drawn SVG relationship
   graph. Depth comes from per-row elevation + scroll parallax rather
   than true 3D transforms, so the connection lines (read from real
   getBoundingClientRect positions) never drift out of sync.
   ========================================================================== */

.techstack { position: relative; }

.techstack-intro { max-width: 660px; margin-top: 16px; }

.techstack-canvas {
  position: relative;
  margin-top: var(--space-5);
  padding: var(--space-4) 0;
  border-radius: var(--radius-lg);
}

.techstack-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--hairline-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--hairline-soft) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 45%, #000 40%, transparent 90%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 45%, #000 40%, transparent 90%);
  pointer-events: none;
}

.techstack-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}

#techstackGradient stop:nth-child(1) { stop-color: var(--blue); }
#techstackGradient stop:nth-child(2) { stop-color: var(--cyan); }
#techstackGradient stop:nth-child(3) { stop-color: var(--violet); }

.techstack-edge {
  fill: none;
  stroke: url(#techstackGradient);
  stroke-linecap: round;
  opacity: 0.22;
  transition: opacity 0.35s ease, stroke-width 0.35s ease;
}

.techstack-edge-glow {
  fill: none;
  stroke: url(#techstackGradient);
  stroke-linecap: round;
  opacity: 0.05;
  filter: blur(4px);
  transition: opacity 0.35s ease;
}

.techstack-edge.is-active,
.techstack-edge-glow.is-active { opacity: 0.85; }
.techstack-edge-glow.is-active { opacity: 0.35; }

/* ---- Rows = conceptual layers, each with its own elevation ---- */

.techstack-row {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
  max-width: 1180px;
  margin: 0 auto var(--space-4);
  will-change: transform;
}

.techstack-row:last-child { margin-bottom: 0; }

.techstack-row-label {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--silver-dim);
  margin-bottom: 2px;
}

/* progressively deeper surfaces read as depth without 3D transforms */
.techstack-row[data-row="1"] .tech-module { background: linear-gradient(165deg, var(--graphite-2), var(--graphite)); }
.techstack-row[data-row="2"] .tech-module { background: linear-gradient(165deg, var(--graphite), var(--ink-raised)); }
.techstack-row[data-row="3"] .tech-module { background: linear-gradient(165deg, var(--ink-raised), var(--ink)); }
.techstack-row[data-row="4"] .tech-module { background: linear-gradient(165deg, var(--ink-raised), var(--ink)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.02); }

/* ---- Module card ---- */

.tech-module {
  position: relative;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  cursor: pointer;
  transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s var(--ease-out);
}

.tech-module:hover,
.tech-module.is-open {
  border-color: var(--cyan-dim);
  box-shadow: 0 18px 40px -20px rgba(0,0,0,0.6), 0 0 0 1px rgba(95,212,216,0.12);
  transform: translateY(-3px);
}

.tech-module-core {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tech-module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tech-module-index {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--silver-dim);
}

.tech-module-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  transition: color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.tech-module-icon svg { width: 18px; height: 18px; }

.tech-module.is-open .tech-module-icon,
.tech-module:hover .tech-module-icon {
  border-color: var(--cyan-dim);
  box-shadow: 0 0 14px -2px rgba(95,212,216,0.5);
}

.tech-module-title { font-size: 17px; color: var(--paper); font-weight: 600; }
.tech-module-tagline { font-size: 13.5px; line-height: 1.5; color: var(--silver); }

.tech-module-chevron {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 16px;
  height: 16px;
  color: var(--silver-dim);
  transition: transform 0.4s var(--ease-out), color 0.4s ease;
}

.tech-module.is-open .tech-module-chevron { transform: rotate(180deg); color: var(--cyan); }

/* ---- Expand panel ---- */

.tech-module-expand {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.5s var(--ease-out), opacity 0.4s ease;
}

.tech-module.is-open .tech-module-expand {
  grid-template-rows: 1fr;
  opacity: 1;
}

.tech-module-expand-inner { overflow: hidden; }

.tech-expand-block {
  padding-top: var(--space-2);
  margin-top: var(--space-2);
  border-top: 1px solid var(--hairline-soft);
}

.tech-expand-block:first-child { border-top: none; margin-top: 14px; padding-top: 0; }

.tech-expand-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 5px;
}

.tech-expand-block p {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--paper-dim);
}

/* ---- Legend ---- */

.techstack-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: var(--space-4);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--silver);
}

.techstack-legend span { display: inline-flex; align-items: center; gap: 6px; }
.techstack-legend .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px 1px rgba(95,212,216,0.5); }

@media (max-width: 640px) {
  .techstack-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .tech-module, .tech-module-expand, .techstack-edge, .techstack-edge-glow { transition: none !important; }
}
