/* ==========================================================================
   components.css - reusable blocks: image frames, stats, cards, finder,
   pillars, pills, CTA band, SBIR timeline, forms
   ========================================================================== */

/* ---------- image frame (all illustrations sit in one) ---------- */
.frame {
  margin: 0; overflow: hidden; position: relative;
  background: var(--navy-2); border: 1px solid rgba(79, 237, 240, 0.25);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.frame img { width: 100%; height: auto; transition: transform 0.6s ease; }
@media (hover: hover) and (pointer: fine) { .frame:hover img { transform: scale(1.04); } }

/* ---------- stats ---------- */
.stats { display: grid; gap: 14px; position: relative; z-index: 2; }
.stat {
  background: var(--surf); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow);
}
.stat strong { display: block; font: 700 clamp(1.7rem, 4vw, 2.4rem)/1.1 var(--font-head); color: var(--pri); }
.stat span { color: var(--mut); font-size: 0.95rem; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(3, 1fr); gap: 20px; } }

/* ---------- capability cards ---------- */
.cap-grid { display: grid; gap: 22px; grid-template-columns: 1fr; }
.cap-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surf); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
@media (hover: hover) and (pointer: fine) { .cap-card:hover { border-color: var(--pri); box-shadow: var(--shadow); } }
.cap-card__img { aspect-ratio: 4 / 3; overflow: hidden; background: var(--navy-2); }
.cap-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
@media (hover: hover) and (pointer: fine) { .cap-card:hover .cap-card__img img { transform: scale(1.07); } }
.cap-card__body { padding: 22px 24px 26px; display: flex; flex-direction: column; flex: 1; }
.cap-card__body p { color: var(--mut); font-size: 0.97rem; margin-bottom: 14px; }
.cap-card__more { margin-top: auto; font-weight: 700; color: var(--pri); display: inline-flex; align-items: center; gap: 6px; }
.cap-card__more svg { width: 18px; height: 18px; transition: transform 0.2s; }
@media (hover: hover) and (pointer: fine) { .cap-card:hover .cap-card__more svg { transform: translateX(6px); } }

@media (min-width: 640px) {
  .cap-grid { grid-template-columns: repeat(2, 1fr); }
  .cap-card:last-child { grid-column: 1 / -1; flex-direction: row; }
  .cap-card:last-child .cap-card__img { width: 45%; aspect-ratio: auto; }
}
@media (min-width: 1024px) {
  .cap-grid { grid-template-columns: repeat(6, 1fr); }
  .cap-card { grid-column: span 2; }
  .cap-card:nth-child(4) { grid-column: 2 / span 2; }
  .cap-card:nth-child(5) { grid-column: 4 / span 2; }
  .cap-card:last-child { flex-direction: column; }
  .cap-card:last-child .cap-card__img { width: 100%; aspect-ratio: 4 / 3; }
}

/* ---------- finder ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 28px; padding: 0; list-style: none; }
.chip {
  min-height: 46px; padding: 0.55rem 1.1rem; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surf); color: var(--ink);
  font: 600 0.95rem var(--font-body); cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}
@media (hover: hover) and (pointer: fine) { .chip:hover { border-color: var(--pri); transform: translateY(-2px); } }
.chip[aria-pressed="true"] { background: var(--pri); border-color: var(--pri); color: var(--on-pri); }

.finder-result {
  display: grid; gap: 22px; align-items: center; min-height: 160px;
  background: var(--surf); border: 1px solid var(--line); border-left: 6px solid var(--pri);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.finder-result .frame { max-width: 360px; }
.finder-result h3 { margin-bottom: 8px; }
.finder-result p { color: var(--mut); }
.finder-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (min-width: 760px) { .finder-result.has-image { grid-template-columns: 300px 1fr; padding: 26px; } }

/* ---------- pillars ---------- */
.pillars { display: grid; gap: 18px; margin: 0 0 32px; padding: 0; list-style: none; }
.pillar {
  padding: 26px; border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14);
  transition: transform 0.3s, background 0.3s, border-color 0.3s;
}
@media (hover: hover) and (pointer: fine) { .pillar:hover { transform: translateY(-6px); background: rgba(79, 237, 240, 0.1); border-color: var(--cyan); } }
.pillar svg { width: 44px; height: 44px; margin-bottom: 14px; stroke: var(--cyan); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pillar h3 { color: #fff; margin: 0; }
@media (min-width: 760px) { .pillars { grid-template-columns: repeat(3, 1fr); } }

/* ---------- pills & cards ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.pills li {
  padding: 8px 18px; border-radius: 999px; background: var(--surf); border: 1px solid var(--line);
  font-weight: 600; font-size: 0.95rem; transition: background 0.2s, color 0.2s, transform 0.2s;
}
@media (hover: hover) and (pointer: fine) { .pills li:hover { background: var(--pri); color: var(--on-pri); transform: translateY(-2px); } }

.card {
  background: var(--surf); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px;
}
.card--accent { border-left: 5px solid var(--pri); }
.card-grid { display: grid; gap: 20px; }
@media (min-width: 720px) { .card-grid--2 { grid-template-columns: repeat(2, 1fr); } }

/* ---------- CTA band ---------- */
.cta-band {
  display: flex; flex-direction: column; gap: 22px; align-items: flex-start;
  padding: clamp(28px, 5vw, 56px); border-radius: calc(var(--radius) + 6px);
  background: var(--navy-2); color: #fff; position: relative; overflow: hidden;
  border: 1px solid rgba(79, 237, 240, 0.28);
}
.cta-band h2, .cta-band h3 { color: #fff; margin-bottom: 6px; }
.cta-band p { color: var(--on-dark-mut); margin: 0; }
.cta-band::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  border: 2px solid rgba(79, 237, 240, 0.3); box-shadow: 0 0 0 36px rgba(79, 237, 240, 0.06), 0 0 0 72px rgba(79, 237, 240, 0.04);
  pointer-events: none;
}
.cta-band > * { position: relative; z-index: 1; }
@media (min-width: 760px) { .cta-band { flex-direction: row; align-items: center; justify-content: space-between; } }

/* ---------- SBIR timeline ---------- */
.timeline { --progress: 0; position: relative; list-style: none; margin: 0; padding: 0 0 0 54px; counter-reset: step; }
.timeline::before, .timeline::after { content: ""; position: absolute; left: 19px; top: 20px; width: 3px; border-radius: 3px; }
.timeline::before { bottom: 20px; background: var(--line); }
.timeline::after { height: calc((100% - 40px) * var(--progress)); background: var(--pri); transition: height 0.4s ease-out; }
.timeline li {
  position: relative; margin-bottom: 18px; padding: 22px 24px;
  background: var(--surf); border: 1px solid var(--line); border-radius: var(--radius);
  counter-increment: step; transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}
.timeline li::before {
  content: counter(step); position: absolute; left: -54px; top: 18px; width: 40px; height: 40px;
  display: grid; place-items: center; border-radius: 50%; z-index: 1;
  background: var(--bg); border: 3px solid var(--line); font: 700 0.95rem var(--font-head);
  transition: background 0.3s, border-color 0.3s, color 0.3s, transform 0.3s;
}
.timeline li.is-active { border-color: var(--pri); box-shadow: var(--shadow); transform: translateX(6px); }
.timeline li.is-active::before, .timeline li.is-done::before { background: var(--pri); border-color: var(--pri); color: var(--on-pri); }
.timeline li.is-active::before { transform: scale(1.18); }
.timeline h3 { margin-bottom: 6px; }
.timeline p { margin: 0; color: var(--mut); }

/* ---------- forms ---------- */
.form-card { background: var(--surf); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 4vw, 36px); box-shadow: var(--shadow); }
.form { display: grid; gap: 18px; }
.field label { display: block; font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 50px; padding: 12px 14px;
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { min-height: 150px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--pri); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pri) 25%, transparent);
}
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: #d93a3a; }
.error { color: #c62828; font-size: 0.9rem; min-height: 1.2em; margin: 4px 0 0; }
:root[data-theme="dark"] .error { color: #ff9c94; }
.field--check { display: flex; gap: 12px; align-items: flex-start; }
.field--check input { width: 22px; min-height: 22px; height: 22px; margin-top: 4px; flex: none; }
.field--check label { font-weight: 400; margin: 0; }
.form-progress { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.form-progress i { display: block; height: 100%; width: 0; background: var(--pri); transition: width 0.4s; }
.hp { position: absolute; left: -9999px; }
.form-status { display: none; padding: 18px 20px; border-radius: var(--radius-sm); border: 1px solid var(--pri); border-left-width: 6px; background: var(--bg); }
.form-status.is-shown { display: block; }
.form-status.is-error { border-color: #d93a3a; }
.form-status a { overflow-wrap: anywhere; }

/* ---------- capability videos (see js/video-cards.js) ---------- */
[data-video] { position: relative; }
.media-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 0.5s; pointer-events: none; background: var(--navy-2);
}
[data-video].is-playing .media-video { opacity: 1; }


/* ---------- send loader (see js/contact-form.js) ---------- */
.form-card { position: relative; }
.btn.is-loading svg { display: none; }
.btn.is-loading::after {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid currentColor; border-right-color: transparent; animation: sl-spin 0.8s linear infinite;
}
.btn:disabled { cursor: progress; opacity: 0.9; transform: none; box-shadow: none; }
@keyframes sl-spin { to { transform: rotate(360deg); } }

.send-loader {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 20px;
  border-radius: inherit; background: rgba(4, 34, 42, 0.94);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 0.3s;
}
.send-loader[hidden] { display: none; }
.send-loader.is-on { opacity: 1; }
.send-loader__box { width: min(340px, 100%); text-align: center; color: #fff; }
.send-loader__art { width: 100%; height: auto; overflow: visible; }
.sl-track { fill: none; stroke: rgba(79, 237, 240, 0.22); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.sl-trace {
  fill: none; stroke: var(--cyan); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 22 78; stroke-dashoffset: 22; filter: drop-shadow(0 0 6px var(--cyan));
  animation: sl-run 1.6s linear infinite;
}
@keyframes sl-run { to { stroke-dashoffset: -78; } }
.sl-packet { fill: var(--coral); filter: drop-shadow(0 0 6px var(--coral)); }
.sl-node polygon { fill: #073642; stroke: var(--cyan); stroke-width: 3; stroke-linejoin: round; }
.sl-node circle { fill: #fff; }
.sl-node--a polygon { animation: sl-glow 1.6s ease-in-out infinite; }
.sl-node--b polygon { animation: sl-glow 1.6s ease-in-out 0.8s infinite; }
@keyframes sl-glow { 50% { fill: rgba(79, 237, 240, 0.35); } }
.sl-done { opacity: 0; transform-box: fill-box; transform-origin: center; }
.sl-done circle { fill: var(--cyan); }
.sl-done path { fill: none; stroke: #04222a; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.send-loader.is-done .sl-track, .send-loader.is-done .sl-trace, .send-loader.is-done .sl-packet { opacity: 0; transition: opacity 0.25s; }
.send-loader.is-done .sl-done { opacity: 1; animation: sl-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1); }
.send-loader.is-done .sl-done path { animation: sl-check 0.5s 0.2s ease forwards; }
@keyframes sl-pop { from { transform: translate(160px, 55px) scale(0.3); } }
@keyframes sl-check { to { stroke-dashoffset: 0; } }
.send-loader__text { margin: 6px 0 10px; font: 700 1.05rem var(--font-head); letter-spacing: 0.01em; }
.send-loader__dots { display: flex; justify-content: center; gap: 7px; }
.send-loader__dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); animation: sl-bounce 1s ease-in-out infinite; }
.send-loader__dots i:nth-child(2) { animation-delay: 0.15s; }
.send-loader__dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes sl-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-7px); opacity: 1; } }
.send-loader.is-done .send-loader__dots { visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
  .sl-trace { stroke-dasharray: none; stroke-dashoffset: 0; }
  .send-loader.is-done .sl-done path { stroke-dashoffset: 0; }
}
