/* IntelCit public VC visuals (F1-15) — scoped, additive styles.
   Owns the operational-loop engine, operations dashboard, five-stage flow strip,
   science method cycle, and the image-led problem/team/service/storyboard cards.
   Never overrides the Home hero, service grammars, or F1-14 story motion. */

:root {
  --vc-navy: #0b1f38;
  --vc-navy-2: #0e2748;
  --vc-cyan: #7eeeff;
  --vc-cyan-deep: #12a8bd;
  --vc-blue: #176ab2;
  --vc-green: #30d47f;
  --vc-ink: #10233b;
  --vc-line: rgba(18, 71, 122, 0.16);
  --vc-clean: #2f9e6b;
  --vc-attention: #c8892a;
  --vc-urgent: #c0473a;
}

/* Shared pause: offscreen or tab hidden. Also stops any nested SVG animation. */
.is-motion-paused,
.is-motion-paused * { animation-play-state: paused !important; }

/* ============================ Operational loop ============================ */
.vc-loop {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}
.vc-loop-compact { grid-template-columns: 1fr; max-width: 420px; margin-inline: auto; }
.vc-loop-stage { position: relative; width: 100%; max-width: 360px; margin-inline: auto; }
.vc-loop-graphic { display: block; width: 100%; height: auto; overflow: visible; }

.vc-loop-ring { fill: none; stroke: var(--vc-line); stroke-width: 6; }
.vc-loop-ring-lit {
  fill: none;
  stroke: url(#vc-loop-flow);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 0.2 0.8;
  animation: vc-ring-travel 9s linear infinite;
}
@keyframes vc-ring-travel { to { stroke-dashoffset: -1; } }

.vc-loop-node-halo { fill: rgba(126, 238, 255, 0.18); opacity: 0.35; animation: vc-node-halo 9s ease-in-out infinite; }
.vc-loop-node-dot {
  fill: #fff; stroke: var(--vc-blue); stroke-width: 3;
  animation: vc-node-pulse 9s ease-in-out infinite;
}
.vc-loop-node-halo,
.vc-loop-node-dot { animation-delay: calc(var(--vc-node) * -1.8s); }
.vc-loop-node-num { fill: var(--vc-ink); font: 700 16px/1 system-ui, sans-serif; text-anchor: middle; }
@keyframes vc-node-pulse {
  0%, 100% { fill: #fff; stroke: var(--vc-blue); }
  10% { fill: var(--vc-cyan); stroke: var(--vc-cyan-deep); }
  20% { fill: #fff; stroke: var(--vc-blue); }
}
@keyframes vc-node-halo {
  0%, 100% { opacity: 0.28; transform: scale(1); }
  10% { opacity: 0.7; transform: scale(1.12); }
  20% { opacity: 0.28; transform: scale(1); }
}
.vc-loop-node-halo { transform-box: fill-box; transform-origin: center; }

.vc-loop-center {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
}
.vc-loop-center-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--vc-cyan-deep); text-align: center; max-width: 8rem;
}

.vc-loop-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.65rem; }
.vc-loop-legend-item { display: grid; grid-template-columns: auto 1fr; gap: 0.75rem; align-items: start; }
.vc-loop-legend-num {
  width: 1.9rem; height: 1.9rem; border-radius: 999px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--vc-blue), var(--vc-cyan-deep)); color: #fff; font-weight: 700;
}
.vc-loop-legend-copy { display: grid; gap: 0.1rem; }
.vc-loop-legend-copy strong { color: var(--vc-ink); }
.vc-loop-legend-copy span { color: #46617e; font-size: 0.92rem; }

/* ============================ Five-stage flow ============================ */
.vc-flow-wrap { width: 100%; }
.vc-flow {
  list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap;
  align-items: center; justify-content: center; gap: 0.5rem 0.75rem;
}
.vc-flow-step { display: inline-flex; align-items: center; gap: 0.6rem; }
.vc-flow-dot {
  width: 2rem; height: 2rem; border-radius: 999px; display: grid; place-items: center;
  background: #fff; border: 2px solid var(--vc-blue); color: var(--vc-ink); font-weight: 700;
  animation: vc-flow-pulse 6s ease-in-out infinite; animation-delay: calc(var(--vc-node) * -1.2s);
}
@keyframes vc-flow-pulse {
  0%, 100% { background: #fff; border-color: var(--vc-blue); color: var(--vc-ink); }
  8% { background: var(--vc-cyan); border-color: var(--vc-cyan-deep); }
  16% { background: #fff; border-color: var(--vc-blue); }
}
.vc-flow-label { font-weight: 600; color: var(--vc-ink); }
.vc-flow-link { width: 1.4rem; height: 2px; background: var(--vc-line); border-radius: 2px; }

/* ============================ Operations dashboard ============================ */
.vc-dash-wrap { width: 100%; }
.vc-dash {
  background: radial-gradient(120% 120% at 15% 0%, var(--vc-navy-2), var(--vc-navy));
  color: #eaf4ff; border-radius: 22px; padding: clamp(1.1rem, 3vw, 1.9rem);
  border: 1px solid rgba(126, 238, 255, 0.18);
  box-shadow: 0 30px 60px -32px rgba(6, 21, 40, 0.85);
}
.vc-dash-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.1rem; }
.vc-dash-dot { width: 0.65rem; height: 0.65rem; border-radius: 999px; background: var(--vc-green); box-shadow: 0 0 0 4px rgba(48, 212, 127, 0.2); }
.vc-dash-title { font-size: 1.05rem; }
.vc-dash-live {
  margin-inline-start: auto; width: 2.6rem; height: 0.4rem; border-radius: 999px;
  background: linear-gradient(90deg, var(--vc-cyan-deep), var(--vc-cyan));
  animation: vc-live 3.2s ease-in-out infinite;
}
@keyframes vc-live { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

.vc-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.7rem; margin-bottom: 1rem; }
.vc-kpi {
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(126, 238, 255, 0.14);
  border-radius: 14px; padding: 0.8rem 0.7rem; display: grid; gap: 0.25rem;
}
.vc-kpi-value { font-size: clamp(1.3rem, 4vw, 1.75rem); font-weight: 800; color: #fff; }
.vc-kpi-label { font-size: 0.76rem; color: #a9c6e4; line-height: 1.25; }

.vc-dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 0.7rem; }
.vc-panel {
  margin: 0; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(126, 238, 255, 0.12);
  border-radius: 14px; padding: 0.85rem 0.9rem; min-width: 0;
}
.vc-panel-trend { grid-column: 1; grid-row: 1; }
.vc-panel-map { grid-column: 2; grid-row: 1 / span 2; }
.vc-panel-queue { grid-column: 1; grid-row: 2; }
.vc-panel-eff { grid-column: 1 / -1; grid-row: 3; }
.vc-panel-title { font-size: 0.82rem; font-weight: 700; color: #cfe6ff; margin-bottom: 0.55rem; }
.vc-panel-summary { font-size: 0.76rem; color: #9fbfe0; margin: 0.55rem 0 0; line-height: 1.4; }

.vc-trend { display: block; width: 100%; height: 88px; overflow: visible; }
.vc-trend-area { fill: url(#vc-trend-fill); opacity: 0; animation: vc-fade-in 1.4s ease forwards; }
.vc-trend-line { fill: none; stroke: rgba(126, 238, 255, 0.4); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.vc-trend-line-lit {
  stroke: var(--vc-cyan); stroke-width: 3; stroke-dasharray: 0.25 0.75;
  animation: vc-trend-travel 6s linear infinite;
}
@keyframes vc-trend-travel { to { stroke-dashoffset: -1; } }
@keyframes vc-fade-in { to { opacity: 1; } }

.vc-map { display: block; width: 100%; height: auto; overflow: visible; }
.vc-map-seg { fill: none; stroke-width: 5; stroke-linecap: round; }
.vc-map-seg.vc-clean { stroke: var(--vc-green); }
.vc-map-seg.vc-attention { stroke: #f2c14e; }
.vc-map-seg.vc-urgent { stroke: #ff7a6b; }
.vc-map-node { fill: #eaf4ff; animation: vc-map-blink 6s ease-in-out infinite; animation-delay: calc(var(--vc-node) * -0.5s); }
@keyframes vc-map-blink { 0%, 100% { opacity: 0.55; } 12% { opacity: 1; } 24% { opacity: 0.55; } }
.vc-map-legend { list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }

.vc-tag {
  display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; font-weight: 700;
  padding: 0.15rem 0.55rem; border-radius: 999px; white-space: nowrap;
}
.vc-tag::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 999px; background: currentColor; }
.vc-tag.vc-clean { color: #7ce0ac; background: rgba(48, 212, 127, 0.16); }
.vc-tag.vc-attention { color: #f2c14e; background: rgba(242, 193, 78, 0.16); }
.vc-tag.vc-urgent { color: #ff9c8f; background: rgba(255, 122, 107, 0.16); }

.vc-queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.vc-queue-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.82rem; color: #dcecff; }
.vc-queue-name { font-weight: 600; }

.vc-eff { display: grid; gap: 0.5rem; }
.vc-eff-bar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0.5rem; }
.vc-eff-fill { height: 0.7rem; border-radius: 999px; transform-origin: left center; animation: vc-grow 1.6s ease forwards; }
.vc-eff-before { background: linear-gradient(90deg, #6b7f96, #90a6bd); width: 92%; }
.vc-eff-after { background: linear-gradient(90deg, var(--vc-cyan-deep), var(--vc-green)); width: 46%; }
.vc-eff-cap { font-size: 0.74rem; color: #a9c6e4; white-space: nowrap; }
@keyframes vc-grow { from { transform: scaleX(0.02); } to { transform: scaleX(1); } }

/* ============================ Science method cycle ============================ */
.vc-cycle { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
.vc-cycle-stage { position: relative; width: 100%; max-width: 420px; margin-inline: auto; }
.vc-cycle-graphic { display: block; width: 100%; height: auto; overflow: visible; }
.vc-cycle-ring { fill: none; stroke: var(--vc-line); stroke-width: 5; }
.vc-cycle-ring-lit {
  fill: none; stroke: var(--vc-cyan-deep); stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 0.18 0.82; animation: vc-ring-travel 12s linear infinite;
}
.vc-cycle-halo { fill: rgba(18, 168, 189, 0.14); opacity: 0.3; transform-box: fill-box; transform-origin: center; animation: vc-node-halo 12s ease-in-out infinite; animation-delay: calc(var(--vc-node) * -2s); }
.vc-cycle-dot { fill: #fff; stroke: var(--vc-cyan-deep); stroke-width: 3; animation: vc-node-pulse 12s ease-in-out infinite; animation-delay: calc(var(--vc-node) * -2s); }
.vc-cycle-num { fill: var(--vc-ink); font: 700 15px/1 system-ui, sans-serif; text-anchor: middle; }
.vc-cycle-center {
  position: absolute; inset: 0; margin: auto; width: 8.5rem; height: 8.5rem; border-radius: 18px;
  display: grid; place-items: center; text-align: center; padding: 0.6rem;
  background: #fff; border: 1px solid var(--vc-line); color: var(--vc-ink); font-weight: 700; font-size: 0.85rem;
  box-shadow: 0 14px 30px -18px rgba(16, 35, 59, 0.5);
}
.vc-cycle-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.vc-cycle-legend-item { display: grid; grid-template-columns: auto 1fr; gap: 0.7rem; align-items: center; color: var(--vc-ink); }
.vc-cycle-legend-num { width: 1.8rem; height: 1.8rem; border-radius: 999px; display: grid; place-items: center; background: linear-gradient(135deg, var(--vc-cyan-deep), var(--vc-green)); color: #fff; font-weight: 700; }

/* ============================ Image-led cards ============================ */
.vc-media { position: relative; overflow: hidden; border-radius: 14px; aspect-ratio: 16 / 9; background: #dfeaf5; }
.vc-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Content photos must never mirror in RTL. */
[dir="rtl"] .vc-media img,
[dir="rtl"] .vc-svc-media img,
[dir="rtl"] .vc-story-media img { transform: none; }

.vc-problem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.vc-problem-card { display: grid; gap: 0.75rem; }
.vc-problem-card h3 { margin: 0.2rem 0 0; }
.vc-problem-card p { margin: 0; color: #46617e; }

.vc-team-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.1rem; }
.vc-team-card { display: grid; gap: 0.75rem; align-content: start; }
.vc-team-card h3 { margin: 0.2rem 0 0; }
.vc-team-card p { margin: 0; color: #46617e; }

/* Storyboard (Solutions) */
.vc-storyboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.vc-story-step { display: grid; gap: 0.7rem; align-content: start; }
.vc-story-step:last-child { grid-column: 1 / -1; }
.vc-story-step h3 { margin: 0; font-size: 1.02rem; }
.vc-story-step p { margin: 0; color: #46617e; font-size: 0.92rem; }
.vc-story-frame { position: relative; }
.vc-story-num {
  position: absolute; inset-inline-start: 0.6rem; inset-block-start: 0.6rem; z-index: 2;
  width: 1.9rem; height: 1.9rem; border-radius: 999px; display: grid; place-items: center;
  background: rgba(11, 31, 56, 0.82); color: #fff; font-weight: 700;
}

/* Science service gallery + detection overlay */
.vc-science-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.vc-svc-card { display: grid; gap: 0.7rem; align-content: start; background: #fff; border: 1px solid var(--vc-line); border-radius: 16px; padding: 0.9rem; }
.vc-svc-media { position: relative; overflow: hidden; border-radius: 12px; aspect-ratio: 16 / 9; background: #dfeaf5; }
.vc-svc-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.vc-svc-card h3 { margin: 0; font-size: 1.02rem; }
.vc-svc-card p { margin: 0; color: #46617e; font-size: 0.9rem; }
.vc-svc-foundation { font-size: 0.85rem; word-break: break-word; }
.vc-svc-card-wide { grid-column: span 2; }
.vc-svc-card-wide .vc-seasonal { grid-template-columns: repeat(2, 1fr); }

/* Code-native detection overlay drawn over a content photo */
.vc-overlay { position: absolute; inset: 0; pointer-events: none; }
.vc-overlay-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.vc-box { fill: none; stroke: var(--vc-cyan); stroke-width: 2.5; }
.vc-box-glow { fill: none; stroke: var(--vc-cyan); stroke-width: 2.5; opacity: 0.9; animation: vc-box-scan 3.2s ease-in-out infinite; }
@keyframes vc-box-scan { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.vc-chip {
  position: absolute; font-size: 0.66rem; font-weight: 700; color: var(--vc-navy);
  background: var(--vc-cyan); border-radius: 6px; padding: 0.1rem 0.4rem; direction: ltr;
}

/* Observation → Inference → Confirmation chain */
.vc-chain { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 0.75rem; align-items: center; }
.vc-chain-step { background: #fff; border: 1px solid var(--vc-line); border-radius: 16px; padding: 0.9rem; display: grid; gap: 0.6rem; align-content: start; }
.vc-chain-step h3 { margin: 0; font-size: 1rem; }
.vc-chain-step p { margin: 0; color: #46617e; font-size: 0.9rem; }
.vc-chain-arrow { color: var(--vc-cyan-deep); font-size: 1.5rem; font-weight: 700; text-align: center; }
[dir="rtl"] .vc-chain-arrow { transform: scaleX(-1); }
.vc-chain-record { display: grid; gap: 0.35rem; font-size: 0.82rem; }
.vc-chain-record .vc-tag { justify-self: start; }

/* Seasonal split (leaves / snow) */
.vc-seasonal { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.1rem; }
.vc-seasonal-card { display: grid; gap: 0.7rem; }

/* Grid children must be allowed to shrink (prevents horizontal overflow). */
.vc-problem-grid > *, .vc-team-grid > *, .vc-science-gallery > *,
.vc-storyboard > *, .vc-chain > *, .vc-seasonal > *,
.vc-dash-grid > *, .vc-kpi-row > * { min-width: 0; }

/* ============================ Responsive ============================ */
@media (max-width: 900px) {
  .vc-loop, .vc-cycle { grid-template-columns: 1fr; }
  .vc-loop-stage, .vc-cycle-stage { max-width: 320px; }
  .vc-dash-grid { grid-template-columns: 1fr; }
  .vc-panel-map { grid-column: 1; grid-row: auto; }
  .vc-panel-trend, .vc-panel-queue, .vc-panel-eff { grid-column: 1; grid-row: auto; }
  .vc-problem-grid, .vc-team-grid, .vc-science-gallery, .vc-storyboard { grid-template-columns: 1fr; }
  .vc-story-step:last-child, .vc-svc-card-wide { grid-column: auto; }
  .vc-chain { grid-template-columns: 1fr; }
  .vc-chain-arrow { transform: rotate(90deg); }
  [dir="rtl"] .vc-chain-arrow { transform: rotate(90deg); }
  .vc-seasonal, .vc-svc-card-wide .vc-seasonal { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .vc-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* ============================ Reduced motion: complete stable state ============================ */
@media (prefers-reduced-motion: reduce) {
  .vc-loop-ring-lit { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; opacity: 0.85; }
  .vc-loop-node-halo { animation: none; opacity: 0.5; }
  .vc-loop-node-dot { animation: none; fill: var(--vc-cyan); stroke: var(--vc-cyan-deep); }
  .vc-flow-dot { animation: none; background: var(--vc-cyan); border-color: var(--vc-cyan-deep); }
  .vc-dash-live { animation: none; opacity: 1; }
  .vc-trend-area { animation: none; opacity: 1; }
  .vc-trend-line-lit { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; opacity: 0.9; }
  .vc-map-node { animation: none; opacity: 1; }
  .vc-eff-fill { animation: none; transform: none; }
  .vc-cycle-ring-lit { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; opacity: 0.85; }
  .vc-cycle-halo { animation: none; opacity: 0.45; }
  .vc-cycle-dot { animation: none; fill: var(--vc-cyan); stroke: var(--vc-cyan-deep); }
  .vc-box-glow { animation: none; opacity: 0.85; }
}
