/* ============================================
   SOLUTION SECTION — Connected Workflow Layer
   Minimal-tech: cards as nodes in a workflow,
   connected by a single animated gold thread.
   ============================================ */

.section.solution {
  position: relative;
}

/* === Vertical section marker (left rail) === */
.solution__rail {
  position: absolute;
  left: clamp(0.75rem, 2vw, 1.75rem);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  pointer-events: none;
  z-index: 2;
  font-family: 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(212, 151, 111, 0.5);
}
.solution__rail-num {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: rgba(232, 201, 168, 0.7);
  font-weight: 600;
}
.solution__rail-line {
  width: 1px;
  height: clamp(120px, 20vh, 200px);
  background: linear-gradient(
    to bottom,
    rgba(212, 151, 111, 0.05) 0%,
    rgba(212, 151, 111, 0.45) 50%,
    rgba(212, 151, 111, 0.05) 100%
  );
}
.solution__rail-label {
  writing-mode: vertical-rl;
  color: rgba(250, 250, 250, 0.4);
}

/* === Workflow connector — horizontal thread between cards === */
.solution__workflow {
  position: relative;
  margin-top: 3rem;
}

.solution__connector {
  position: absolute;
  top: calc(2.5rem + 24px);  /* aligns with center of icon (icon is 48px high, padding-top is 2.5rem) */
  left: 0;
  right: 0;
  height: 24px;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.solution__workflow.is-revealed .solution__connector {
  opacity: 1;
}

.solution__connector-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.solution__connector-path {
  fill: none;
  stroke: rgba(212, 151, 111, 0.25);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.solution__connector-fill {
  fill: none;
  stroke: url(#solution-grad);
  stroke-width: 1.4;
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
  filter: drop-shadow(0 0 4px rgba(212,151,111,0.4));
  transition: stroke-dashoffset 2.4s cubic-bezier(0.65, 0, 0.35, 1);
}
.solution__workflow.is-revealed .solution__connector-fill {
  stroke-dashoffset: 0;
}

/* Connector node dots — sit at each card's icon center */
.solution__connector-node {
  fill: rgba(20, 16, 13, 1);
  stroke: rgba(212, 151, 111, 0.55);
  stroke-width: 1;
  opacity: 0;
  transition: opacity 0.4s ease, r 0.3s ease;
}
.solution__workflow.is-revealed .solution__connector-node {
  opacity: 1;
}
.solution__connector-node--1 { transition-delay: 0.4s; }
.solution__connector-node--2 { transition-delay: 0.8s; }
.solution__connector-node--3 { transition-delay: 1.2s; }
.solution__connector-node--4 { transition-delay: 1.6s; }

/* Traveling pulse along the connector */
.solution__connector-pulse {
  fill: #E8C9A8;
  filter: drop-shadow(0 0 8px rgba(232, 201, 168, 0.9));
  opacity: 0;
}
.solution__workflow.is-revealed .solution__connector-pulse {
  opacity: 1;
  animation: solConnectorPulse 8s 2.4s linear infinite;
}

/* Card needs to layer above the connector line */
.solution-card {
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* === Per-card vertical accent line — works at all widths === */
.solution-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(212, 151, 111, 0.5) 20%,
    rgba(232, 201, 168, 0.9) 50%,
    rgba(212, 151, 111, 0.5) 80%,
    transparent 100%
  );
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 1.2s cubic-bezier(0.65, 0, 0.35, 1);
  pointer-events: none;
}
.solution-card[data-revealed="true"]::after,
.is-revealed .solution-card::after {
  transform: scaleY(1);
}
.solution-card:nth-child(1)::after { transition-delay: 0.2s; }
.solution-card:nth-child(2)::after { transition-delay: 0.5s; }
.solution-card:nth-child(3)::after { transition-delay: 0.8s; }
.solution-card:nth-child(4)::after { transition-delay: 1.1s; }

/* On hover — the line glows brighter and pulses */
.solution-card:hover::after {
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(232, 201, 168, 1) 50%,
    transparent 100%
  );
  width: 2px;
  box-shadow: 0 0 12px rgba(232, 201, 168, 0.6);
}

/* Active card — when hovered, brighten its connection node */
.solution-card:hover ~ .solution__connector .solution__connector-node {
  /* nothing — handled by JS */
}

/* === HUD readout above heading === */
.solution__readout {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-family: 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(212, 151, 111, 0.55);
}
.solution__readout-tick {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #D4976F;
  box-shadow: 0 0 6px rgba(212, 151, 111, 0.6);
  animation: solTick 1.8s ease-in-out infinite;
}
.solution__readout-bar {
  width: 24px;
  height: 1px;
  background: rgba(212, 151, 111, 0.4);
  margin-left: 0.4rem;
}

/* === Card hover: subtle node label === */
.solution-card {
  /* Add corner index marker */
}
.solution-card::before {
  content: attr(data-node-id);
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  font-family: 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  font-weight: 500;
  color: rgba(212, 151, 111, 0.4);
  pointer-events: none;
  transition: color 0.3s ease;
}
.solution-card:hover::before {
  color: rgba(232, 201, 168, 0.9);
}

/* When a card is hovered, dim siblings slightly */
.solution__grid:has(.solution-card:hover) .solution-card:not(:hover) {
  opacity: 0.55;
}

/* === Animations === */
@keyframes solTick {
  0%, 60%, 100% { opacity: 1; }
  70%, 90% { opacity: 0.25; }
}
@keyframes solConnectorPulse {
  0% { offset-distance: 0%; opacity: 0; }
  3% { opacity: 1; }
  47% { opacity: 1; }
  50% { opacity: 0; }
  100% { offset-distance: 0%; opacity: 0; }
}

/* Tablet: 2x2 grid — connector wraps to 2 lines */
@media (max-width: 1100px) and (min-width: 701px) {
  .solution__connector {
    /* Only show line between top-row cards (cards 1-2) since grid wraps */
    /* Hide complex 4-node line on tablet — too cramped */
    display: none;
  }
  .solution__rail { display: none; }
}

/* Mobile: stacked, no connector makes sense */
@media (max-width: 700px) {
  .solution__connector { display: none; }
  .solution__rail { display: none; }
  .solution-card::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .solution__connector-fill { stroke-dashoffset: 0 !important; }
  .solution__connector-pulse,
  .solution__readout-tick {
    animation: none;
  }
}
