/* Issue 01 figures — lab-grade context visuals. Copy stays in the HTML. */

.flow,.dvc,.fcheck,.lag,.stat{
  position:relative;
  isolation:isolate;
  border:1px solid rgba(143,227,198,.18);
  background-color:#0c1214;
  background-image:
    linear-gradient(rgba(143,227,198,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143,227,198,.045) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, rgba(143,227,198,.12), transparent 55%),
    linear-gradient(180deg, rgba(16,24,27,.96), rgba(10,15,17,.98));
  background-size:28px 28px, 28px 28px, auto, auto;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    inset 0 0 80px rgba(143,227,198,.04),
    0 28px 60px -34px rgba(0,0,0,.85);
}

/* HUD corners */
.flow::before,.dvc::before,.fcheck::before,.lag::before,.stat::before{
  content:"";
  position:absolute;inset:11px;pointer-events:none;z-index:0;opacity:.45;
  background:
    linear-gradient(#8fe3c6,#8fe3c6) 0 0/14px 1px no-repeat,
    linear-gradient(#8fe3c6,#8fe3c6) 0 0/1px 14px no-repeat,
    linear-gradient(#8fe3c6,#8fe3c6) 100% 0/14px 1px no-repeat,
    linear-gradient(#8fe3c6,#8fe3c6) 100% 0/1px 14px no-repeat,
    linear-gradient(#8fe3c6,#8fe3c6) 0 100%/14px 1px no-repeat,
    linear-gradient(#8fe3c6,#8fe3c6) 0 100%/1px 14px no-repeat,
    linear-gradient(#8fe3c6,#8fe3c6) 100% 100%/14px 1px no-repeat,
    linear-gradient(#8fe3c6,#8fe3c6) 100% 100%/1px 14px no-repeat;
}

.flow figcaption,.dvc figcaption,.fcheck figcaption,.lag figcaption,.stat figcaption{
  position:relative;z-index:1;
  color:#9fb8b0;letter-spacing:.01em;
}

/* ---------------- typographic hierarchy ---------------- */
.flow .row-k,.lag-k{
  letter-spacing:.16em;
  font-weight:600;
  text-transform:uppercase;
}
.flow .row-k,.lag-k{color:#8fe3c6;font-size:11px}
.dvc-t,.lag-q{
  color:#e7eeeb;
  letter-spacing:-.02em;
  font-weight:500;
}
.dvc-t{position:relative;padding-bottom:.35rem}
.dvc-t::after{
  content:"";display:block;width:1.4rem;height:1px;margin-top:.4rem;
  background:linear-gradient(90deg,#8fe3c6,transparent);
}
.dvc-s{color:#9fb8b0;letter-spacing:.04em;font-size:13px;margin-top:.15rem}
.layer-sub{color:#cfe9df;font-size:14.5px;letter-spacing:.01em;line-height:1.45}

/* ---------------- FLOW ---------------- */
.flow{padding:1.2rem 1.2rem 1.05rem;border-radius:24px}
.flow .f-box,.flow .m-slot,.flow .in-chip{
  position:relative;z-index:1;
  border:1px solid rgba(143,227,198,.28);
  color:#e7eeeb;
  background:linear-gradient(180deg, #1a2a28, #10181b);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.07), 0 8px 22px -16px rgba(143,227,198,.4);
}
.flow .m-slot,.flow .f-box{border-radius:14px}
.flow .in-chip{border-radius:999px}
.flow.is-in .f-box,.flow.is-in .in-chip,.flow.is-in .m-slot{animation:bv-rise .7s cubic-bezier(.16,1,.3,1) both}
.flow.is-in .f-box:nth-child(2),.flow.is-in .in-chip:nth-child(2),.flow.is-in .m-slot:nth-child(2){animation-delay:.08s}
.flow.is-in .f-box:nth-child(3),.flow.is-in .in-chip:nth-child(3),.flow.is-in .m-slot:nth-child(3){animation-delay:.16s}
.flow.is-in .f-box:nth-child(4),.flow.is-in .in-chip:nth-child(4),.flow.is-in .m-slot:nth-child(4){animation-delay:.24s}
.flow.is-in .in-chip:nth-child(5){animation-delay:.32s}

.flow .inputs,.flow .r-models,.flow .r-found,.flow .layer{position:relative;z-index:1}
.flow .layer{
  border:1px solid rgba(143,227,198,.28);
  background:
    radial-gradient(circle at 50% 42%, rgba(143,227,198,.14), transparent 58%),
    linear-gradient(180deg, rgba(12,22,24,.88), rgba(8,14,16,.92));
  border-radius:20px;
  box-shadow:inset 0 0 50px rgba(143,227,198,.08), 0 0 0 1px rgba(255,255,255,.03);
}
.flow .layer-graph svg{overflow:visible;max-width:100%}
.flow .mg-e path,.flow .mg-p{
  fill:none;stroke:#8fe3c6;stroke-width:1.25;stroke-linecap:round;
  stroke-opacity:.75;stroke-dasharray:1;stroke-dashoffset:0;
}
.flow.is-in .mg-e path,.flow.is-in .mg-p{
  stroke-dashoffset:1;
  animation:bv-draw 1.15s cubic-bezier(.16,1,.3,1) forwards;
  animation-delay:var(--d,0s);
}
.flow .mg-n circle{
  fill:#8fe3c6;opacity:1;
  filter:url(#flow-glow);
  transform-box:fill-box;transform-origin:center;
}
.flow.is-in .mg-n circle{
  animation:bv-pop .55s cubic-bezier(.16,1,.3,1) both;
  animation-delay:var(--d,0s);
}
.flow .mg-pulse{
  fill:#c9f7e6;opacity:0;filter:url(#flow-glow);
}
.flow.is-in .mg-pulse{
  animation:bv-travel 2.8s linear infinite;
  animation-delay:var(--d,0s);
}
.flow .loop path{
  stroke:#8fe3c6;stroke-opacity:.7;filter:drop-shadow(0 0 6px rgba(143,227,198,.45));
}
.flow .pipe,.flow .in-pipe{position:relative}
.flow .pipe i,.flow .in-pipe i{
  background:linear-gradient(180deg,rgba(143,227,198,0),#8fe3c6,rgba(143,227,198,0));
  box-shadow:0 0 12px rgba(143,227,198,.4);
}
.flow.is-in .pipe i,.flow.is-in .in-pipe i{animation:bv-pipe 2.4s linear infinite}
.flow .pipe-dot{
  position:absolute;left:50%;top:0;width:6px;height:6px;margin:-3px 0 0 -3px;
  border-radius:50%;background:#c9f7e6;opacity:0;
  box-shadow:0 0 10px #8fe3c6;pointer-events:none;
}
.flow.is-in .pipe-dot{animation:bv-pipe-dot 2s linear infinite}
.flow.is-in .in-pipe .pipe-dot{animation-direction:reverse}

/* ---------------- DATA VS CONTEXT ---------------- */
.dvc{padding:1.15rem;border-radius:24px}
.dvc-col{border-radius:18px;position:relative;z-index:1}
.dvc-data{
  background:linear-gradient(180deg, rgba(16,22,24,.9), rgba(10,16,18,.92));
  border:1px solid rgba(231,238,235,.1);
  padding:.85rem .85rem 1rem;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}
.dvc-ctx{
  background:
    radial-gradient(circle at 50% 40%, rgba(143,227,198,.12), transparent 62%),
    linear-gradient(180deg, rgba(12,20,22,.92), rgba(8,14,16,.96));
  border:1px solid rgba(143,227,198,.22);
  padding:.85rem .7rem .7rem;
  box-shadow:inset 0 0 40px rgba(143,227,198,.05);
}
.dvc .dvc-graph{width:100%;height:auto;display:block;overflow:visible}
.dvc .de path,.dvc .de-p{
  fill:none;stroke:#8fe3c6;stroke-width:1.35;stroke-linecap:round;
  stroke-opacity:.8;stroke-dasharray:1;stroke-dashoffset:0;
}
.dvc.is-in .de path,.dvc.is-in .de-p{
  stroke-dashoffset:1;
  animation:bv-draw 1.2s cubic-bezier(.16,1,.3,1) forwards;
  animation-delay:var(--d,0s);
}
.dvc .dn{opacity:1}
.dvc .dn rect{
  fill:url(#dvc-fill);stroke:url(#dvc-stroke);stroke-width:1.2;
  filter:url(#dvc-glow);
  transform-box:fill-box;transform-origin:center;
}
.dvc .dn text{
  fill:#e7eeeb;font-size:13px;font-weight:500;letter-spacing:.02em;
  transform-box:fill-box;transform-origin:center;
}
.dvc.is-in .dn{animation:bv-fade .55s cubic-bezier(.16,1,.3,1) both;animation-delay:var(--d,0s)}
.dvc.is-in .dn rect,.dvc.is-in .dn text{animation:bv-pop .55s cubic-bezier(.16,1,.3,1) both;animation-delay:var(--d,0s)}
.dvc .dvc-pulse{fill:#c9f7e6;opacity:0;filter:url(#dvc-glow)}
.dvc.is-in .dvc-pulse{animation:bv-travel 2.6s linear infinite;animation-delay:var(--d,0s)}

.dvc-arrow{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.2rem;color:#8fe3c6}
.dvc-bridge{width:56px;height:22px;overflow:visible}
.dvc-bridge-head{fill:none;stroke:#8fe3c6;stroke-width:1.45;stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 0 6px rgba(143,227,198,.65))}
.dvc-bridge-p{fill:none;stroke:#8fe3c6;stroke-width:1.4;stroke-linecap:round;stroke-opacity:.7}
.dvc-bridge-pulse{fill:#c9f7e6;opacity:0;filter:url(#dvc-glow)}
.dvc.is-in .dvc-bridge-pulse{animation:bv-travel 1.8s linear infinite}
.dvc-arrow-mark{font-size:1.35rem;line-height:1;text-shadow:0 0 12px rgba(143,227,198,.6)}

.rec-list li{
  position:relative;overflow:hidden;
  border:1px solid rgba(143,227,198,.16)!important;
  background:rgba(10,18,20,.72)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
  transition:border-color .3s, box-shadow .3s;
}
.dvc.is-in .rec-list li{animation:bv-record 3.6s ease-in-out infinite}
.dvc.is-in .rec-list li:nth-child(1){animation-delay:.0s}
.dvc.is-in .rec-list li:nth-child(2){animation-delay:.45s}
.dvc.is-in .rec-list li:nth-child(3){animation-delay:.9s}
.dvc.is-in .rec-list li:nth-child(4){animation-delay:1.35s}
.rec-list li::after{
  content:"";position:absolute;right:-6px;top:50%;width:7px;height:7px;margin-top:-3.5px;
  border-radius:50%;background:#8fe3c6;opacity:0;box-shadow:0 0 10px #8fe3c6;pointer-events:none;
}
.dvc.is-in .rec-list li::after{animation:bv-emit 3.6s ease-out infinite}
.dvc.is-in .rec-list li:nth-child(1)::after{animation-delay:.0s}
.dvc.is-in .rec-list li:nth-child(2)::after{animation-delay:.45s}
.dvc.is-in .rec-list li:nth-child(3)::after{animation-delay:.9s}
.dvc.is-in .rec-list li:nth-child(4)::after{animation-delay:1.35s}

/* ---------------- LAG ---------------- */
.lag{padding:1.2rem 1.2rem 1.1rem;border-radius:24px}
.lag-q{margin-top:.35rem}
.lag-track{position:relative}
.lag-bar{
  background:rgba(231,238,235,.08)!important;
  overflow:visible!important;
  height:3px;
  box-shadow:0 0 0 1px rgba(143,227,198,.08);
}
.lag-bar i{
  display:block;height:100%;width:100%;
  background:linear-gradient(90deg, rgba(143,227,198,.15), #8fe3c6 45%, #d9cbb6 75%, #e8a0a0);
  box-shadow:0 0 16px rgba(143,227,198,.4);
}
.lag.is-in .lag-bar i{animation:none} /* the beam is static; the pulse travels */
.lag-pulse{
  position:absolute;top:50%;left:0;width:9px;height:9px;margin:-4.5px 0 0;
  border-radius:50%;background:#c9f7e6;opacity:0;pointer-events:none;
  box-shadow:0 0 12px #8fe3c6, 0 0 2px #fff;
}
.lag.is-in .lag-pulse{animation:bv-lag-pulse 3.2s linear infinite}
.lag-opt{
  border:1px solid rgba(143,227,198,.16);
  background:rgba(10,18,20,.55);
  border-radius:16px;
  padding:.35rem .4rem .55rem!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}
.lag-opt[aria-pressed="true"]{
  border-color:#8fe3c6;
  box-shadow:0 0 0 3px rgba(143,227,198,.14), inset 0 0 18px rgba(143,227,198,.08);
  color:#cfe9df;
}
.lag-dot.start,.lag-opt[aria-pressed="true"] .lag-dot{
  background:#8fe3c6;box-shadow:0 0 14px #8fe3c6;
}
.lag-notes{
  background:rgba(10,18,20,.65)!important;
  border:1px solid rgba(143,227,198,.1);
}

/* Keep the time-beam visible on small screens (base CSS hides .lag-bar). */
@media (max-width:640px){
  .lag .lag-track{grid-template-columns:1fr!important;gap:14px}
  .lag .lag-start{flex-direction:row;justify-content:flex-start}
  .lag .lag-opts{position:relative}
  .lag .lag-bar{
    display:block!important;
    position:absolute!important;
    left:12%!important;right:12%!important;
    top:18px!important;
    height:3px!important;
    width:auto!important;
    margin:0;
  }
}

/* ---------------- FOUNDATION ---------------- */
.fcheck{padding:1.2rem;border-radius:24px}
.fc-stage{position:relative}
.fcheck .fc-grid{gap:.7rem;position:relative;z-index:1}
.fcheck .fc-b{
  border:1px solid rgba(143,227,198,.22);
  background:
    linear-gradient(180deg, rgba(143,227,198,.08), rgba(10,18,20,.78));
  border-radius:14px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05), 0 10px 24px -18px rgba(143,227,198,.45);
}
.fcheck.is-in .fc-b{animation:bv-rise .7s cubic-bezier(.16,1,.3,1) both}
.fcheck.is-in .fc-1{animation-delay:.1s}
.fcheck.is-in .fc-2{animation-delay:.2s}
.fcheck.is-in .fc-3{animation-delay:.3s}
.fcheck .fc-c{
  position:relative;
  border:1px solid rgba(143,227,198,.4)!important;
  background:
    radial-gradient(circle at 50% 40%, rgba(143,227,198,.14), transparent 65%),
    rgba(10,18,20,.86)!important;
  border-radius:16px;
  box-shadow:0 0 36px rgba(143,227,198,.12), inset 0 0 30px rgba(143,227,198,.07);
}
.fcheck .fc-c::before{
  content:"";position:absolute;inset:-18px;border-radius:28px;pointer-events:none;z-index:-1;
  background:radial-gradient(circle, rgba(143,227,198,.12), transparent 70%);
}
.fcheck.is-in .fc-c{animation:bv-core-glow 3.6s ease-in-out infinite}

/* ---------------- STAT ---------------- */
.stat{padding:1.2rem;border-radius:24px}
.stat-num{
  font-variant-numeric:tabular-nums;
  color:#8fe3c6;
  letter-spacing:-.03em;
  text-shadow:0 0 24px rgba(143,227,198,.25);
}
.stat-row.b .stat-num{text-shadow:0 0 20px rgba(232,160,160,.2)}
.stat-l{color:#cfe9df;letter-spacing:.01em}
.stat-bar{
  position:relative;
  height:14px!important;
  background:rgba(231,238,235,.06)!important;
  border-radius:99px;overflow:hidden;
  box-shadow:inset 0 0 0 1px rgba(143,227,198,.12);
}
.stat-bar::before{
  content:"";position:absolute;inset:0;pointer-events:none;opacity:.35;z-index:1;
  background-image:repeating-linear-gradient(90deg, rgba(143,227,198,.35) 0 1px, transparent 1px 10%);
}
.stat-bar i{
  position:relative;z-index:0;
  background:linear-gradient(90deg,#5aa88f,#8fe3c6)!important;
  box-shadow:0 0 16px rgba(143,227,198,.5);
}
.stat-row.b .stat-bar i{
  background:linear-gradient(90deg,#b86a6a,#e8a0a0)!important;
  box-shadow:0 0 16px rgba(232,160,160,.35);
}
.stat.is-in .stat-bar i{transform-origin:left center;animation:bv-bar .9s cubic-bezier(.16,1,.3,1) both}

/* ---------------- motion ---------------- */
@keyframes bv-draw{from{stroke-dashoffset:1;stroke-opacity:0}to{stroke-dashoffset:0;stroke-opacity:.8}}
@keyframes bv-fade{from{opacity:0}to{opacity:1}}
@keyframes bv-pop{0%{opacity:0;transform:scale(.7)}to{opacity:1;transform:scale(1)}}
@keyframes bv-rise{0%{opacity:0;transform:translateY(.4rem)}to{opacity:1;transform:none}}
@keyframes bv-pipe{0%{transform:translateY(-100%)}100%{transform:translateY(100%)}}
@keyframes bv-pipe-dot{
  0%{opacity:0;top:0}
  12%{opacity:1}
  88%{opacity:1}
  100%{opacity:0;top:100%}
}
@keyframes bv-bar{from{transform:scaleX(0)}to{transform:scaleX(1)}}
@keyframes bv-travel{
  0%{offset-distance:0%;opacity:0}
  10%{opacity:1}
  88%{opacity:1}
  100%{offset-distance:100%;opacity:0}
}
@keyframes bv-record{
  0%,70%,100%{border-color:rgba(143,227,198,.16);box-shadow:inset 0 1px 0 rgba(255,255,255,.04)}
  18%,32%{border-color:rgba(143,227,198,.7);box-shadow:0 0 0 1px rgba(143,227,198,.18), 0 0 16px rgba(143,227,198,.12)}
}
@keyframes bv-emit{
  0%{opacity:0;transform:translateX(0)}
  12%{opacity:1}
  100%{opacity:0;transform:translateX(2.4rem)}
}
@keyframes bv-lag-pulse{
  0%{left:0%;opacity:0}
  8%{opacity:1}
  90%{opacity:1}
  100%{left:100%;opacity:0}
}
@keyframes bv-core-glow{
  0%,100%{box-shadow:0 0 28px rgba(143,227,198,.1), inset 0 0 24px rgba(143,227,198,.06)}
  50%{box-shadow:0 0 42px rgba(143,227,198,.22), inset 0 0 36px rgba(143,227,198,.12)}
}

@media (max-width:640px){
  .dvc.is-in .rec-list li::after{animation-name:bv-emit-down}
}
@keyframes bv-emit-down{
  0%{opacity:0;transform:translate(0,0);right:12px;top:auto;bottom:-4px}
  12%{opacity:1}
  100%{opacity:0;transform:translateY(1.6rem)}
}

@media (prefers-reduced-motion:reduce){
  .flow.is-in .f-box,.flow.is-in .in-chip,.flow.is-in .m-slot,
  .flow.is-in .pipe i,.flow.is-in .in-pipe i,.flow.is-in .pipe-dot,
  .flow.is-in .mg-e path,.flow.is-in .mg-p,.flow.is-in .mg-n circle,.flow.is-in .mg-pulse,
  .dvc.is-in .de path,.dvc.is-in .de-p,.dvc.is-in .dn,.dvc.is-in .dn rect,.dvc.is-in .dn text,
  .dvc.is-in .dvc-pulse,.dvc.is-in .dvc-bridge-pulse,.dvc.is-in .rec-list li,.dvc.is-in .rec-list li::after,
  .fcheck.is-in .fc-b,.fcheck.is-in .fc-c,.lag.is-in .lag-bar i,.lag.is-in .lag-pulse,.stat.is-in .stat-bar i{
    animation:none!important
  }
  .flow .mg-e path,.flow .mg-p,.dvc .de path,.dvc .de-p{
    stroke-dashoffset:0;stroke-opacity:.8
  }
  .flow .mg-n circle,.dvc .dn{opacity:1}
  .flow .mg-pulse,.dvc .dvc-pulse,.dvc .dvc-bridge-pulse,.lag .lag-pulse,.flow .pipe-dot,
  .rec-list li::after{opacity:0!important}
}
