/* ============================================================
   AI Product Teams — Section 02 "What this does"
   Cinematic 6-stage assembly line with mini live mockups.
   ============================================================ */

.apt-what {
  position: relative;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(79,200,255,0.06), transparent 60%),
    linear-gradient(180deg, transparent 0%, rgba(94,255,164,0.025) 50%, transparent 100%);
  overflow: hidden;
}
.apt-what::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(79,200,255,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(79,200,255,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, transparent, black 30%, black 70%, transparent);
  pointer-events: none;
}

/* Override the empty-ring flow on this page; we render our own stages. */
.apt-what .aa-cv-flow { display: none; }

.apt-line {
  position: relative;
  margin-top: 56px;
  padding: 24px 0 0;
}

/* ------------------- rail ------------------- */
.apt-line-rail {
  position: absolute;
  top: 132px;       /* sits behind the screens, between header & screen */
  left: 4%;
  right: 4%;
  height: 2px;
  background: linear-gradient(90deg,
    rgba(79,200,255,0.08) 0%,
    rgba(79,200,255,0.18) 30%,
    rgba(94,255,164,0.18) 70%,
    rgba(94,255,164,0.08) 100%);
  border-radius: 2px;
  z-index: 0;
}
.apt-line-rail-fill {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg, #4FC8FF 0%, #5EFFA4 100%);
  border-radius: 2px;
  box-shadow: 0 0 14px rgba(94,255,164,0.6);
  transition: width 600ms cubic-bezier(0.16, 1, 0.3, 1);
}
.apt-line-rail-pulse {
  position: absolute;
  top: 50%;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #5EFFA4 40%, transparent 70%);
  transform: translate(-50%, -50%);
  transition: left 600ms cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 0 8px #5EFFA4);
}

/* ------------------- stages grid ------------------- */
.apt-stages {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}
@media (max-width: 1100px) {
  .apt-stages { grid-template-columns: repeat(3, 1fr); }
  .apt-line-rail { display: none; }
}
@media (max-width: 640px) {
  .apt-stages { grid-template-columns: repeat(2, 1fr); }
}

.apt-stage {
  --ac: var(--ac-cy, #4FC8FF);
  position: relative;
  display: flex; flex-direction: column;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(10,14,31,0.55);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 12px;
  transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1),
              border-color 400ms, box-shadow 400ms, opacity 400ms;
  opacity: 0.6;
}
.apt-stage.ac-cy { --ac: #4FC8FF; }
.apt-stage.ac-mt { --ac: #5EFFA4; }
.apt-stage.ac-am { --ac: #FFB04D; }
.apt-stage.past  { opacity: 0.85; border-color: rgba(94,255,164,0.18); }
.apt-stage.on {
  opacity: 1;
  transform: translateY(-4px);
  border-color: var(--ac);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04),
    0 14px 40px -12px rgba(0,0,0,0.6),
    0 0 32px -2px color-mix(in oklab, var(--ac) 35%, transparent);
}

.apt-stage-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.apt-stage-n {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px; letter-spacing: 0.16em;
  color: var(--ac);
  border: 1px solid var(--ac);
  background: rgba(10,14,31,0.6);
  padding: 3px 7px;
  border-radius: 4px;
  font-weight: 600;
}
.apt-stage-meta {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px; letter-spacing: 0.12em;
  color: var(--site-text-3, rgba(255,255,255,0.45));
  text-transform: uppercase;
}

.apt-stage-screen {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  background:
    radial-gradient(110% 90% at 50% 0%, rgba(79,200,255,0.08), transparent 60%),
    #060A18;
  overflow: hidden;
  margin-bottom: 12px;
}
.apt-stage.on .apt-stage-screen {
  border-color: rgba(255,255,255,0.12);
  box-shadow: inset 0 0 60px -10px color-mix(in oklab, var(--ac) 25%, transparent);
}
.apt-stage-scan {
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    transparent 0%, transparent 49%,
    color-mix(in oklab, var(--ac) 20%, transparent) 50%,
    transparent 51%, transparent 100%);
  background-size: 100% 220%;
  background-position: 0 -20%;
  opacity: 0;
  pointer-events: none;
}
.apt-stage.on .apt-stage-scan {
  opacity: 1;
  animation: apt-scan 2.4s linear infinite;
}
@keyframes apt-scan {
  from { background-position: 0 -20%; }
  to   { background-position: 0 120%; }
}

.apt-stage-foot { padding: 0 2px; }
.apt-stage-h {
  font-family: var(--font-display);
  font-size: 16px; line-height: 1.2;
  color: #fff; font-weight: 500;
  margin-bottom: 4px;
}
.apt-stage-s {
  font-size: 11.5px; line-height: 1.45;
  color: var(--site-text-2, rgba(230,236,250,0.62));
  font-family: var(--font-mono, ui-monospace, monospace);
  letter-spacing: 0.01em;
}

/* ============================================================
   Mini scenes — shared chrome
   ============================================================ */
.apt-st { position: absolute; inset: 0; padding: 0; }
.apt-st-chrome {
  position: relative;
  display: flex; align-items: center; gap: 4px;
  height: 18px;
  padding: 0 8px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.apt-st-chrome .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
}
.apt-st-chrome .dot:nth-child(1) { background: rgba(255,90,90,0.55); }
.apt-st-chrome .dot:nth-child(2) { background: rgba(255,180,77,0.55); }
.apt-st-chrome .dot:nth-child(3) { background: rgba(94,255,164,0.55); }
.apt-st-chrome .ttl {
  margin-left: 6px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  color: rgba(230,236,250,0.55);
  letter-spacing: 0.05em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.apt-st-body {
  position: absolute; left: 0; right: 0; top: 18px; bottom: 0;
  padding: 10px;
}

/* ============================================================
   01 — Idea wall
   ============================================================ */
.apt-st-idea .apt-st-body {
  background:
    radial-gradient(circle at 80% 90%, rgba(79,200,255,0.06), transparent 50%);
}
.apt-note {
  position: absolute;
  width: 50%; height: 26%;
  border-radius: 2px;
  padding: 6px 6px 4px;
  background: rgba(255,255,255,0.95);
  color: #0A0E1F;
  font-family: 'Caveat', 'Patrick Hand', 'Segoe Print', cursive;
  font-size: 10.5px; line-height: 1.15;
  box-shadow: 0 4px 8px rgba(0,0,0,0.4), 0 1px 0 rgba(0,0,0,0.2);
  display: flex; align-items: center;
  opacity: 0;
  animation: apt-note-in 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.apt-stage.on .apt-note { animation-name: apt-note-in; }
.apt-note.ac-cy { background: #cfe9ff; }
.apt-note.ac-mt { background: #d8ffe9; }
.apt-note.ac-am { background: #ffe6c2; }
.apt-note-pin {
  position: absolute; top: -3px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 6px; border-radius: 50%;
  background: #FF4D4F;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.apt-note-t { display: block; }
@keyframes apt-note-in {
  0%   { opacity: 0; transform: translateY(-4px) rotate(var(--r, 0)); }
  50%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) rotate(var(--r, 0)); }
}
.apt-st-cursor {
  position: absolute; width: 12px; height: 12px;
  animation: apt-cursor-drift 4s ease-in-out infinite;
}
@keyframes apt-cursor-drift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-30px, -8px); }
  50%  { transform: translate(-12px, -22px); }
  75%  { transform: translate(-28px, -16px); }
  100% { transform: translate(0, 0); }
}

/* ============================================================
   02 — Squad
   ============================================================ */
.apt-st-squad { display: flex; align-items: center; justify-content: center; }
.apt-squad-svg { width: 100%; height: 100%; }
.apt-squad-node {
  opacity: 0;
  animation: apt-fade-pop 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transform-origin: 110px 65px;
}
.apt-stage.on .apt-squad-node { animation-name: apt-fade-pop; }
@keyframes apt-fade-pop {
  0% { opacity: 0; transform: scale(0.7); }
  100% { opacity: 1; transform: scale(1); }
}

/* ============================================================
   03 — Build (code editor + kanban)
   ============================================================ */
.apt-st-build { display: grid; grid-template-rows: 60% 40%; }
.apt-build-code {
  padding: 8px 6px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 9px; line-height: 1.45;
  color: rgba(230,236,250,0.85);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background:
    linear-gradient(90deg, rgba(255,255,255,0.02) 0 22px, transparent 22px),
    rgba(0,0,0,0.25);
  overflow: hidden;
}
.apt-build-line { white-space: nowrap; padding-left: 4px; }
.apt-build-line .ln { display: inline-block; width: 16px; color: rgba(255,255,255,0.25); margin-right: 6px; }
.apt-build-line .kw { color: #c4a8ff; }
.apt-build-line .fn { color: #5EFFA4; }
.apt-build-cur .caret {
  display: inline-block;
  color: #5EFFA4;
  animation: apt-blink 0.9s steps(2) infinite;
}
@keyframes apt-blink { 50% { opacity: 0; } }
.apt-build-kanban {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 6px;
  background: rgba(255,255,255,0.015);
}
.apt-kb-col { display: flex; flex-direction: column; gap: 3px; }
.apt-kb-h {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 7.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(230,236,250,0.55);
  margin-bottom: 1px;
}
.apt-kb-card {
  height: 8px; border-radius: 1px;
  background: rgba(79,200,255,0.35);
  border-left: 2px solid #4FC8FF;
}
.apt-kb-card.b { background: rgba(255,180,77,0.35); border-left-color: #FFB04D; }
.apt-kb-card.wide { height: 10px; }
.apt-kb-card.mt { background: rgba(94,255,164,0.35); border-left-color: #5EFFA4; }
.apt-stage.on .apt-kb-card.mt { animation: apt-card-arrive 1.4s ease-out infinite; }
@keyframes apt-card-arrive {
  0%   { transform: translateX(-12px); opacity: 0; }
  35%  { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   04 — Approval
   ============================================================ */
.apt-app-body {
  position: absolute; left: 0; right: 0; top: 18px; bottom: 0;
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.apt-app-row {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  padding: 3px 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.02);
  border-left: 2px solid rgba(94,255,164,0.4);
}
.apt-app-row.pending { border-left-color: rgba(255,180,77,0.55); }
.apt-app-l { color: rgba(230,236,250,0.7); }
.apt-app-r { color: #fff; font-weight: 600; }
.apt-app-r.ok { color: #5EFFA4; }
.apt-app-r.am { color: #FFB04D; }
.apt-app-actions {
  display: flex; gap: 4px; margin-top: auto; padding-top: 6px;
}
.apt-app-btn {
  flex: 1; text-align: center;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 8.5px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 5px 4px;
  border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.apt-app-btn.ghost {
  background: rgba(255,255,255,0.04);
  color: rgba(230,236,250,0.55);
  border: 1px solid rgba(255,255,255,0.08);
}
.apt-app-btn.primary {
  background: linear-gradient(180deg, #5EFFA4, #38d886);
  color: #062014;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(94,255,164,0.45);
}
.apt-stage.on .apt-app-btn.primary { animation: apt-pulse-btn 1.6s ease-in-out infinite; }
@keyframes apt-pulse-btn {
  0%, 100% { box-shadow: 0 0 14px rgba(94,255,164,0.45); }
  50%      { box-shadow: 0 0 22px rgba(94,255,164,0.85); }
}
.apt-tick {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #062014;
  position: relative;
}
.apt-tick::after {
  content: ""; position: absolute; left: 2px; top: 1px;
  width: 3px; height: 4px;
  border: solid #5EFFA4;
  border-width: 0 1px 1px 0;
  transform: rotate(45deg);
}

/* ============================================================
   05 — Live
   ============================================================ */
.apt-live-pill {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 8px; letter-spacing: 0.14em;
  color: #5EFFA4;
  padding: 2px 5px;
  border: 1px solid rgba(94,255,164,0.4);
  border-radius: 2px;
}
.apt-live-pill .d {
  width: 4px; height: 4px; border-radius: 50%;
  background: #5EFFA4;
  box-shadow: 0 0 6px #5EFFA4;
  animation: apt-blink 1.4s ease-in-out infinite;
}
.apt-live-body {
  position: absolute; left: 0; right: 0; top: 18px; bottom: 0;
  padding: 10px 10px 0;
  display: flex; flex-direction: column; gap: 6px;
}
.apt-live-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.apt-live-stats > div {
  display: flex; flex-direction: column;
  gap: 1px;
  padding: 4px 6px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 3px;
}
.apt-live-stats b {
  font-family: var(--font-display);
  font-size: 13px; line-height: 1; color: #fff;
  font-weight: 500;
}
.apt-live-stats b.mt { color: #5EFFA4; }
.apt-live-stats span {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 7.5px; letter-spacing: 0.06em;
  color: rgba(230,236,250,0.55);
  text-transform: uppercase;
}
.apt-live-spark {
  width: 100%; flex: 1;
  margin-top: auto;
}

/* ============================================================
   06 — Audit log
   ============================================================ */
.apt-log-body {
  position: absolute; left: 0; right: 0; top: 18px; bottom: 0;
  padding: 6px 8px;
  display: flex; flex-direction: column; gap: 3px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 8.5px;
  overflow: hidden;
}
.apt-log-line {
  display: grid;
  grid-template-columns: 48px 56px 1fr;
  gap: 6px;
  align-items: center;
  padding: 2px 4px;
  border-left: 2px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.015);
  opacity: 0;
  animation: apt-log-in 500ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.apt-stage.on .apt-log-line { animation-name: apt-log-in; }
@keyframes apt-log-in {
  0%   { opacity: 0; transform: translateX(-6px); }
  100% { opacity: 1; transform: translateX(0); }
}
.apt-log-t { color: rgba(230,236,250,0.45); letter-spacing: 0.04em; }
.apt-log-k {
  font-weight: 700; letter-spacing: 0.08em;
  padding: 1px 4px;
  border-radius: 2px;
  text-align: center;
}
.apt-log-k.ac-mt { color: #5EFFA4; background: rgba(94,255,164,0.10); }
.apt-log-k.ac-cy { color: #4FC8FF; background: rgba(79,200,255,0.10); }
.apt-log-m { color: rgba(230,236,250,0.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   Foot — input/output pills
   ============================================================ */
.apt-line-foot {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; flex-wrap: wrap;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px dashed rgba(79,200,255,0.14);
}
.apt-foot-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.025);
  border-radius: 999px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px; letter-spacing: 0.14em;
  color: #fff; font-weight: 500;
}
.apt-foot-pill .d {
  width: 8px; height: 8px; border-radius: 50%;
  background: #4FC8FF; box-shadow: 0 0 8px #4FC8FF;
}
.apt-foot-pill .d.cy { background: #4FC8FF; box-shadow: 0 0 8px #4FC8FF; }
.apt-foot-pill .d.mt { background: #5EFFA4; box-shadow: 0 0 8px #5EFFA4; }
.apt-foot-arrow {
  font-size: 18px; color: rgba(230,236,250,0.4);
}
