/* ===================================================================
   Software Stem — cinematic AI services site
   Dark depth theme · parallax · scroll-driven reveals
   =================================================================== */

:root {
  --bg:        #05060f;
  --bg-2:      #0a0c1c;
  --ink:       #eef1ff;
  --muted:     #9aa3c7;
  --line:      rgba(140,160,255,.14);
  --card:      rgba(20,24,48,.55);
  --card-brd:  rgba(140,160,255,.16);
  --accent:    #6c8cff;
  --accent-2:  #b06cff;
  --accent-3:  #36e6c8;
  --grad:      linear-gradient(100deg, #6c8cff 0%, #b06cff 45%, #36e6c8 100%);
  --maxw:      1180px;
  --r:         18px;
  --shadow:    0 24px 60px -20px rgba(0,0,0,.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand { font-family: "Space Grotesk", system-ui, sans-serif; line-height: 1.1; letter-spacing: -.02em; }

a { color: inherit; text-decoration: none; }
em { color: var(--ink); font-style: normal; }

/* ---------- background layers ---------- */
#bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; display: block; }
.grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body::after { /* vignette for cinematic depth */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 80% at 50% 0%, transparent 40%, rgba(0,0,0,.55) 100%);
}

/* ---------- scroll progress ---------- */
.scroll-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0%; z-index: 100; background: var(--grad); box-shadow: 0 0 14px var(--accent); }

/* ---------- layout helpers ---------- */
section { position: relative; padding: clamp(72px, 11vh, 150px) clamp(20px, 6vw, 64px); }
.section-head, .band-inner, .contact-inner { max-width: var(--maxw); margin: 0 auto; text-align: center; }
.section-title { font-size: clamp(1.9rem, 4.6vw, 3.4rem); font-weight: 700; }
.eyebrow { text-transform: uppercase; letter-spacing: .28em; font-size: .72rem; color: var(--accent-3); margin-bottom: 14px; font-weight: 600; }
.lead { color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.18rem); max-width: 760px; margin: 18px auto 0; }
.muted { color: var(--muted); }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; background: rgba(140,160,255,.12); padding: .1em .4em; border-radius: 6px; font-size: .88em; color: var(--accent-3); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  background: var(--grad); color: #06070f; font-weight: 600;
  padding: 13px 24px; border-radius: 100px; border: 0; cursor: pointer;
  font-family: "Space Grotesk", sans-serif; font-size: .98rem;
  transition: transform .25s ease, box-shadow .25s ease;
  box-shadow: 0 10px 30px -8px rgba(108,140,255,.6);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -8px rgba(176,108,255,.7); }
.btn-sm { padding: 9px 18px; font-size: .9rem; }
.btn-lg { padding: 17px 34px; font-size: 1.08rem; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--card-brd); box-shadow: none; }
.btn-ghost:hover { border-color: var(--accent); background: rgba(108,140,255,.08); }

/* ---------- header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  padding: 16px clamp(20px, 6vw, 64px);
  transition: background .3s ease, backdrop-filter .3s ease, padding .3s ease;
}
.site-header.scrolled { background: rgba(5,6,15,.72); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 700; font-size: 1.25rem; display: inline-flex; align-items: center; gap: .4em; }
.brand-mark { color: var(--accent); font-size: .9em; letter-spacing: -2px; }
.brand-accent { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.nav { display: flex; gap: 26px; margin-left: auto; }
.nav a { color: var(--muted); font-size: .95rem; transition: color .2s; }
.nav a:hover { color: var(--ink); }
.site-header .btn { margin-left: 8px; }
.nav-toggle { display: none; background: none; border: 0; color: var(--ink); font-size: 1.5rem; cursor: pointer; margin-left: auto; }

/* ---------- hero ---------- */
.hero { min-height: 100svh; display: grid; place-items: center; text-align: center; padding-top: 120px; }
.hero-inner { max-width: 960px; }
.hero-title { font-size: clamp(2.4rem, 7vw, 5.2rem); font-weight: 700; margin: 10px 0 20px; }
.hero-sub { color: var(--muted); font-size: clamp(1.02rem, 1.9vw, 1.3rem); max-width: 700px; margin: 0 auto; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 34px 0 44px; }
.hero-stats { display: flex; gap: clamp(22px, 5vw, 64px); justify-content: center; list-style: none; flex-wrap: wrap; }
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats strong { font-family: "Space Grotesk", sans-serif; font-size: clamp(1.3rem, 3vw, 2rem); background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-stats span { color: var(--muted); font-size: .82rem; }

/* ---------- split hero: copy + 3D centerpiece ---------- */
.hero-split { grid-template-columns: 1.05fr 0.95fr; align-items: center; gap: clamp(24px, 5vw, 72px); text-align: left; max-width: var(--maxw); margin: 0 auto; padding-left: clamp(20px, 6vw, 64px); padding-right: clamp(20px, 6vw, 64px); }
.hero-split .hero-inner { max-width: 620px; }
.hero-split .hero-sub { margin: 0; }
.hero-split .hero-cta,
.hero-split .hero-stats { justify-content: flex-start; }
.hero-visual { position: relative; width: 100%; aspect-ratio: 1 / 1; max-width: 560px; justify-self: center; }
.hero-visual #hero-canvas { position: relative; z-index: 1; width: 100%; height: 100%; display: block; }
.hero-visual-glow { position: absolute; inset: 6%; z-index: 0; border-radius: 50%; background: radial-gradient(circle at 50% 45%, rgba(176,108,255,.30), rgba(108,140,255,.16) 42%, transparent 70%); filter: blur(14px); animation: heroGlow 6s ease-in-out infinite; }
.hero-visual-tag { position: absolute; bottom: 4%; left: 50%; transform: translateX(-50%); z-index: 2; font-family: "Space Grotesk", sans-serif; font-size: .72rem; letter-spacing: .12em; color: var(--accent-3); opacity: .7; pointer-events: none; }
@keyframes heroGlow { 0%, 100% { opacity: .8; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }

/* refined scroll cue — animated chevron, no text */
.scroll-cue { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); width: 28px; height: 44px; border: 1px solid var(--card-brd); border-radius: 100px; display: grid; place-items: start center; padding-top: 8px; opacity: .8; transition: opacity .3s, border-color .3s; }
.scroll-cue:hover { opacity: 1; border-color: var(--accent); }
.scroll-cue span { width: 4px; height: 8px; border-radius: 4px; background: var(--accent-3); animation: cue 1.8s cubic-bezier(.5,0,.5,1) infinite; }
@keyframes cue { 0%{ transform: translateY(0); opacity: 0; } 30%{ opacity: 1; } 100%{ transform: translateY(16px); opacity: 0; } }

/* ---------- band / intro ---------- */
.band-inner .lead { font-size: clamp(1.1rem, 2.2vw, 1.5rem); color: var(--ink); opacity: .9; max-width: 880px; }

/* ---------- grids & cards ---------- */
.grid { max-width: var(--maxw); margin: 48px auto 0; display: grid; gap: 22px; }
.grid-services { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-proj { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 18px; }

.card {
  background: var(--card); border: 1px solid var(--card-brd); border-radius: var(--r);
  padding: 30px 28px; backdrop-filter: blur(10px);
  transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease;
  position: relative; overflow: hidden;
}
.card::before { content: ""; position: absolute; inset: 0; background: var(--grad); opacity: 0; transition: opacity .3s; mix-blend-mode: overlay; }
.card:hover { transform: translateY(-6px); border-color: var(--accent); box-shadow: var(--shadow); }
.card:hover::before { opacity: .06; }
.card-ico { font-size: 2rem; margin-bottom: 14px; }
.card h3 { font-size: 1.28rem; margin-bottom: 10px; }
.card p { color: var(--muted); font-size: .98rem; }
.card a { color: var(--accent-3); font-weight: 600; }
.card-feature { border-color: var(--accent); background: linear-gradient(160deg, rgba(108,140,255,.14), rgba(176,108,255,.06)); }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tags li { font-size: .74rem; color: var(--muted); border: 1px solid var(--line); padding: 4px 10px; border-radius: 100px; }

/* ---------- visibility / engines ---------- */
.engines { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 860px; margin: 36px auto 10px; }
.engine { font-family: "Space Grotesk", sans-serif; font-weight: 600; padding: 10px 20px; border: 1px solid var(--card-brd); border-radius: 100px; background: var(--card); backdrop-filter: blur(8px); font-size: .95rem; transition: .3s; }
.engine:hover { border-color: var(--accent-3); color: var(--accent-3); transform: translateY(-3px); }

/* ---------- projects ---------- */
.proj-group { max-width: var(--maxw); margin: 44px auto 0; }
.proj-cat { font-size: 1.15rem; color: var(--ink); border-left: 3px solid var(--accent); padding-left: 12px; }
.proj {
  display: block; background: var(--card); border: 1px solid var(--card-brd); border-radius: 14px;
  padding: 20px; transition: transform .25s ease, border-color .25s ease, background .25s ease;
}
.proj:hover { transform: translateY(-4px); border-color: var(--accent-2); background: rgba(176,108,255,.08); }
.proj h4 { font-size: 1.02rem; margin-bottom: 6px; }
.proj p { color: var(--muted); font-size: .86rem; }
.proj-more { text-align: center; margin-top: 40px; color: var(--muted); }
.proj-more a { color: var(--accent-3); font-weight: 600; }

/* ---------- process ---------- */
.steps { max-width: var(--maxw); margin: 48px auto 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 22px; }
.steps li { background: var(--card); border: 1px solid var(--card-brd); border-radius: var(--r); padding: 28px; position: relative; }
.steps span { font-family: "Space Grotesk", sans-serif; font-size: 2.4rem; font-weight: 700; opacity: .18; }
.steps h3 { margin: 6px 0 8px; font-size: 1.2rem; }
.steps p { color: var(--muted); font-size: .92rem; }

/* ---------- faq ---------- */
.faq-list { max-width: 820px; margin: 40px auto 0; display: flex; flex-direction: column; gap: 12px; }
details { background: var(--card); border: 1px solid var(--card-brd); border-radius: 14px; padding: 4px 22px; transition: border-color .25s; }
details[open] { border-color: var(--accent); }
summary { cursor: pointer; padding: 18px 0; font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 1.05rem; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--accent-3); font-size: 1.5rem; transition: transform .25s; }
details[open] summary::after { transform: rotate(45deg); }
details p { color: var(--muted); padding-bottom: 20px; }
details a { color: var(--accent-3); }

/* ---------- contact ---------- */
.contact { text-align: center; }
.contact .btn-lg { margin: 30px 0 26px; }
.contact-meta { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.contact-meta a { color: var(--accent-3); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 54px clamp(20px, 6vw, 64px) 40px; background: var(--bg-2); }
.footer-grid { max-width: var(--maxw); margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 24px; }
.footer-grid nav { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-grid nav a { color: var(--muted); transition: color .2s; }
.footer-grid nav a:hover { color: var(--ink); }
.copyright { max-width: var(--maxw); margin: 34px auto 0; color: var(--muted); font-size: .82rem; text-align: center; }

/* ---------- reveal animation (JS-driven; safe fallback visible) ---------- */
/* content is always visible — no scroll-reveal animation (stable, professional) */
.reveal { opacity: 1; transform: none; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .nav { display: none; }
  .site-header > .btn { display: none; }
  .nav-toggle { display: block; }
  .site-header.menu-open { flex-wrap: wrap; background: rgba(5,6,15,.96); backdrop-filter: blur(14px); }
  .site-header.menu-open .nav { display: flex; flex-direction: column; width: 100%; gap: 4px; margin: 12px 0 6px; }
  .site-header.menu-open .nav a { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .site-header.menu-open > .btn { display: inline-flex; }
  .footer-grid { flex-direction: column; }
  /* stack the split hero: copy first, then 3D centerpiece, centered */
  .hero-split { grid-template-columns: 1fr; text-align: center; gap: 8px; padding-top: 110px; }
  .hero-split .hero-inner { max-width: 700px; margin: 0 auto; }
  .hero-split .hero-sub { margin: 0 auto; }
  .hero-split .hero-cta,
  .hero-split .hero-stats { justify-content: center; }
  .hero-visual { order: 2; max-width: 360px; margin-top: 12px; }
}

/* ===================================================================
   MULTI-PAGE COMPONENTS (professional)
   =================================================================== */

/* active nav link */
.nav a.active { color: var(--ink); }
.nav a { position: relative; }
.nav a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; background: var(--grad); border-radius: 2px; }

/* page banner (inner page hero) */
.page-banner { padding-top: 150px; padding-bottom: 60px; text-align: center; }
.page-banner .eyebrow { justify-content: center; }
.page-banner h1 { font-size: clamp(2.2rem, 5.5vw, 4rem); font-weight: 700; margin-bottom: 16px; }
.page-banner .lead { margin-top: 14px; }

/* breadcrumb */
.breadcrumb { max-width: var(--maxw); margin: 0 auto; padding: 100px 0 0; font-size: .85rem; color: var(--muted); display: flex; gap: 8px; justify-content: center; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent-3); }
.breadcrumb span { color: var(--line); }

/* prose / article content */
.prose { max-width: 760px; margin: 0 auto; }
.prose > * + * { margin-top: 18px; }
.prose h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-top: 48px; }
.prose h3 { font-size: 1.25rem; margin-top: 32px; }
.prose p, .prose li { color: var(--muted); font-size: 1.04rem; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-top: 8px; }
.prose strong { color: var(--ink); }
.prose a { color: var(--accent-3); text-decoration: underline; text-underline-offset: 3px; }

/* detailed service block */
.svc-detail { max-width: var(--maxw); margin: 0 auto; display: grid; gap: 26px; }
.svc-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 40px; align-items: center; background: var(--card); border: 1px solid var(--card-brd); border-radius: var(--r); padding: 38px; }
.svc-row:nth-child(even) { direction: rtl; }
.svc-row:nth-child(even) > * { direction: ltr; }
.svc-row .svc-ico { font-size: 2.6rem; }
.svc-row h2 { font-size: 1.6rem; margin: 10px 0 12px; }
.svc-row p { color: var(--muted); }
.svc-row .tags { margin-top: 18px; }
@media (max-width: 760px) { .svc-row, .svc-row:nth-child(even) { grid-template-columns: 1fr; direction: ltr; padding: 28px; } }

/* metric strip */
.metrics { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; }
.metric { text-align: center; background: var(--card); border: 1px solid var(--card-brd); border-radius: var(--r); padding: 30px 18px; }
.metric strong { display: block; font-family: "Space Grotesk", sans-serif; font-size: 2.2rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.metric span { color: var(--muted); font-size: .9rem; }

/* CTA band */
.cta-band { text-align: center; }
.cta-band .inner { max-width: 720px; margin: 0 auto; background: linear-gradient(160deg, rgba(108,140,255,.14), rgba(176,108,255,.06)); border: 1px solid var(--accent); border-radius: 24px; padding: 56px 32px; }

/* structured footer */
.footer-cols { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; }
.footer-cols h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .18em; color: var(--muted); margin-bottom: 14px; }
.footer-cols a { display: block; color: var(--muted); padding: 5px 0; transition: color .2s; }
.footer-cols a:hover { color: var(--ink); }
.footer-cols .footer-brand p { color: var(--muted); font-size: .92rem; margin-top: 10px; max-width: 260px; }
.footer-cols .footer-brand .brand { font-size: 1.2rem; }
@media (max-width: 760px) { .footer-cols { grid-template-columns: 1fr 1fr; } }

/* contact form */
.contact-form { max-width: 620px; margin: 0 auto; display: grid; gap: 18px; }
.field { display: grid; gap: 7px; text-align: left; }
.field label { font-size: .9rem; color: var(--muted); font-family: "Space Grotesk", sans-serif; }
.field input, .field select, .field textarea {
  background: var(--card); border: 1px solid var(--card-brd); border-radius: 12px;
  padding: 13px 15px; color: var(--ink); font: inherit; font-size: 1rem; transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,140,255,.18); }
.field textarea { resize: vertical; }
.contact-form .btn { justify-self: start; }
.form-note { color: var(--accent-3); font-size: .92rem; min-height: 1.2em; }
.form-note.error { color: #ff8a8a; }
@media (max-width: 760px) { .contact-form .btn { justify-self: stretch; justify-content: center; } }

/* ===================================================================
   ANIMATED PROJECT DEMOS (motion graphics — no images needed)
   =================================================================== */
.demo { max-width: 780px; margin: 0 auto; }
.demo-stage { position: relative; aspect-ratio: 16 / 9; border: 1px solid var(--card-brd); border-radius: 16px; overflow: hidden; background: radial-gradient(circle at 28% 18%, rgba(108,140,255,.16), transparent 60%), linear-gradient(160deg, #0a0c1c, #05060f); box-shadow: var(--shadow); }
.demo-cap { text-align: center; color: var(--muted); font-size: .9rem; margin-top: 14px; }

/* — object/PPE/zone/theft/currency detection — */
.scanline { position: absolute; top: 0; bottom: 0; width: 2px; background: linear-gradient(transparent, var(--accent-3), transparent); box-shadow: 0 0 14px var(--accent-3); animation: scanx 5s ease-in-out infinite; }
@keyframes scanx { 0% { left: 2%; } 100% { left: 98%; } }
.bbox { position: absolute; border: 2px solid var(--accent-3); border-radius: 4px; animation: boxpulse 4.5s ease-in-out infinite; }
.bbox i { position: absolute; top: -19px; left: -2px; background: var(--accent-3); color: #04101a; font-size: .62rem; font-style: normal; padding: 1px 7px; border-radius: 5px 5px 5px 0; font-family: "Space Grotesk", sans-serif; white-space: nowrap; }
.bbox.b1 { top: 24%; left: 13%; width: 26%; height: 48%; }
.bbox.b2 { top: 38%; left: 56%; width: 24%; height: 40%; border-color: var(--accent); animation-delay: .5s; }
.bbox.b2 i { background: var(--accent); }
.bbox.b3 { top: 13%; left: 45%; width: 16%; height: 26%; border-color: var(--accent-2); animation-delay: 1s; }
.bbox.b3 i { background: var(--accent-2); }
.bbox .obj { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(26px, 7vw, 60px); line-height: 1; filter: drop-shadow(0 4px 12px rgba(0,0,0,.55)); animation: objfloat 6s ease-in-out infinite; }
@keyframes objfloat { 0%, 100% { transform: translateY(-2%); } 50% { transform: translateY(2%); } }
@keyframes boxpulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* — face recognition — */
.face-img { position: absolute; top: 13%; left: 50%; transform: translateX(-50%); width: 34%; height: 74%; color: var(--accent-3); opacity: .42; animation: faceglow 4s ease-in-out infinite; }
.face-img svg { width: 100%; height: 100%; display: block; }
.face-svg path, .face-svg ellipse { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@keyframes faceglow { 0%, 100% { opacity: .32; } 50% { opacity: .5; } }
.face-oval { position: absolute; top: 13%; left: 50%; transform: translateX(-50%); width: 34%; height: 74%; border: 2px dashed rgba(54,230,200,.5); border-radius: 50% 50% 46% 46%; }
.fd { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-3); box-shadow: 0 0 9px var(--accent-3); animation: fdp 3.4s ease-in-out infinite; }
@keyframes fdp { 0%, 100% { transform: scale(.7); opacity: .6; } 50% { transform: scale(1); opacity: 1; } }
.id-chip { position: absolute; bottom: 9%; left: 50%; transform: translateX(-50%); background: rgba(54,230,200,.15); border: 1px solid var(--accent-3); color: var(--accent-3); font-family: "Space Grotesk", sans-serif; font-size: .8rem; padding: 5px 14px; border-radius: 100px; animation: chip 3s ease-in-out infinite; }
@keyframes chip { 0%, 40% { opacity: 0; } 55%, 100% { opacity: 1; } }

/* — score / prediction gauge — */
.gauge { position: absolute; inset: 0; display: grid; place-items: center; }
.gauge svg { width: 190px; height: 190px; }
.gauge .track { fill: none; stroke: rgba(140,160,255,.16); stroke-width: 13; }
.gauge .val { fill: none; stroke: url(#gaugeGrad); stroke-width: 13; stroke-linecap: round; stroke-dasharray: 377; stroke-dashoffset: 377; transform: rotate(-90deg); transform-origin: center; animation: gauge 1.8s .3s cubic-bezier(.5,0,.3,1) forwards; }
@keyframes gauge { to { stroke-dashoffset: var(--off, 120); } }
.gauge .num { position: absolute; text-align: center; }
.gauge .num strong { display: block; font-family: "Space Grotesk", sans-serif; font-size: 2.6rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.gauge .num span { color: var(--muted); font-size: .82rem; }

/* — generative typing — */
.term { position: absolute; inset: 9%; background: rgba(5,6,15,.6); border: 1px solid var(--card-brd); border-radius: 12px; padding: 22px; font-family: ui-monospace, monospace; }
.term .pr { color: var(--accent-3); font-size: .8rem; }
.term .typed { margin-top: 12px; color: var(--ink); white-space: nowrap; overflow: hidden; border-right: 2px solid var(--accent-3); width: 0; font-size: .92rem; animation: type 5s steps(48) infinite alternate, caret .75s step-end infinite; }
@keyframes type { 0% { width: 0; } 65%, 100% { width: 100%; } }
@keyframes caret { 50% { border-color: transparent; } }

/* — pipeline / system flow — */
.pipe { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0 5%; }
.pstage { flex: 1; text-align: center; padding: 14px 6px; border: 1px solid var(--card-brd); border-radius: 10px; margin: 0 5px; color: var(--muted); font-size: .76rem; font-family: "Space Grotesk", sans-serif; animation: plight 4.5s ease-in-out infinite; }
@keyframes plight { 0%, 100% { border-color: var(--card-brd); color: var(--muted); box-shadow: none; } 50% { border-color: var(--accent-3); color: var(--ink); box-shadow: 0 0 18px rgba(54,230,200,.3); } }

/* — game / interactive — */
.arena { position: absolute; inset: 10%; border: 1px solid var(--card-brd); border-radius: 12px; overflow: hidden; }
.ball { position: absolute; width: 15px; height: 15px; border-radius: 50%; background: var(--accent-3); box-shadow: 0 0 16px var(--accent-3); animation: bx 6.5s ease-in-out infinite alternate, by 4.4s ease-in-out infinite alternate; }
@keyframes bx { from { left: 6%; } to { left: 90%; } }
@keyframes by { from { top: 12%; } to { top: 78%; } }
.paddle { position: absolute; width: 8px; height: 30%; border-radius: 6px; background: var(--accent); animation: pad 4.4s ease-in-out infinite alternate; }
.paddle.l { left: 4%; } .paddle.r { right: 4%; background: var(--accent-2); animation-delay: .6s; }
@keyframes pad { from { top: 8%; } to { top: 62%; } }

/* live badge on project cards */
.live-dot { display: inline-block; margin-left: 8px; font-size: .62rem; font-weight: 600; letter-spacing: .04em; color: var(--accent-3); border: 1px solid var(--accent-3); border-radius: 100px; padding: 1px 9px 1px 16px; vertical-align: middle; position: relative; font-family: "Space Grotesk", sans-serif; }
.live-dot::before { content: ""; position: absolute; left: 7px; top: 50%; transform: translateY(-50%); width: 6px; height: 6px; border-radius: 50%; background: var(--accent-3); box-shadow: 0 0 8px var(--accent-3); animation: livep 2.8s ease-in-out infinite; }
@keyframes livep { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* project page bits */
.proj-meta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.related { max-width: var(--maxw); margin: 0 auto; }

/* ---------- accessibility: respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* =================================================================
   Stem Assistant — chatbot widget (matches the cinematic theme)
   ================================================================= */
.stem-chat { position: fixed; right: 22px; bottom: 22px; z-index: 9999; font-family: "Inter", system-ui, sans-serif; }

/* launcher */
.stem-chat-fab {
  position: relative; width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--grad); color: #06070f; display: grid; place-items: center; padding: 0;
  box-shadow: 0 10px 30px rgba(108,140,255,.45), 0 0 0 1px rgba(255,255,255,.08) inset;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s;
}
.stem-chat-fab:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 14px 40px rgba(176,108,255,.55); }
.stem-chat-fab:active { transform: scale(.96); }
.stem-fab-icon { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity .2s, transform .3s; }
.stem-fab-icon svg { width: 28px; height: 28px; }
.stem-fab-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.stem-chat.open .stem-fab-open { opacity: 0; transform: rotate(90deg) scale(.6); }
.stem-chat.open .stem-fab-close { opacity: 1; transform: none; }
.stem-fab-ping { position: absolute; inset: 0; border-radius: 50%; background: var(--accent-2); opacity: .55; animation: stemPing 2.6s ease-out infinite; z-index: -1; }
.stem-chat.open .stem-fab-ping { display: none; }
@keyframes stemPing { 0% { transform: scale(1); opacity: .5; } 80%,100% { transform: scale(1.9); opacity: 0; } }
.stem-chat-fab.nudge { animation: stemNudge 1s ease-in-out 3; }
@keyframes stemNudge { 0%,100% { transform: translateY(0); } 30% { transform: translateY(-8px); } 60% { transform: translateY(-3px); } }

/* panel */
.stem-panel {
  position: absolute; right: 0; bottom: 76px; width: 380px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 120px); display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(14,16,34,.96), rgba(8,9,22,.98));
  border: 1px solid var(--card-brd); border-radius: 20px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(140,160,255,.05);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  opacity: 0; transform: translateY(16px) scale(.96); transform-origin: bottom right; pointer-events: none;
  transition: opacity .26s ease, transform .3s cubic-bezier(.34,1.4,.64,1);
}
.stem-chat.open .stem-panel { opacity: 1; transform: none; pointer-events: auto; }

.stem-panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--card-brd); background: rgba(108,140,255,.06); }
.stem-avatar { width: 38px; height: 38px; border-radius: 11px; background: var(--grad); color: #06070f; display: grid; place-items: center; font-weight: 700; font-size: .8rem; letter-spacing: -1px; flex: none; }
.stem-head-meta { display: flex; flex-direction: column; line-height: 1.3; }
.stem-head-meta strong { color: var(--ink); font-size: .98rem; font-family: "Space Grotesk", sans-serif; }
.stem-head-meta span { color: var(--muted); font-size: .76rem; display: flex; align-items: center; gap: 6px; }
.stem-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-3); box-shadow: 0 0 8px var(--accent-3); animation: stemBlink 2.4s ease-in-out infinite; }
@keyframes stemBlink { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.stem-min { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; transition: background .2s, color .2s; }
.stem-min:hover { background: rgba(140,160,255,.12); color: var(--ink); }
.stem-min svg { width: 20px; height: 20px; }

/* messages */
.stem-msgs { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; scrollbar-color: rgba(140,160,255,.3) transparent; }
.stem-msgs::-webkit-scrollbar { width: 7px; }
.stem-msgs::-webkit-scrollbar-thumb { background: rgba(140,160,255,.25); border-radius: 4px; }
.stem-msg { display: flex; max-width: 88%; animation: stemPop .3s cubic-bezier(.34,1.4,.64,1); }
@keyframes stemPop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stem-msg.stem-user { align-self: flex-end; }
.stem-msg.stem-bot { align-self: flex-start; }
.stem-bubble { padding: 11px 14px; border-radius: 16px; font-size: .9rem; line-height: 1.55; color: var(--ink); }
.stem-bot .stem-bubble { background: rgba(140,160,255,.10); border: 1px solid var(--card-brd); border-bottom-left-radius: 5px; }
.stem-user .stem-bubble { background: var(--grad); color: #06070f; font-weight: 500; border-bottom-right-radius: 5px; }
.stem-bubble a { color: var(--accent-3); text-decoration: underline; text-underline-offset: 2px; }
.stem-user .stem-bubble a { color: #06070f; }
.stem-bubble code { font-size: .82em; }

/* typing indicator */
.stem-dots { display: inline-flex; gap: 4px; align-items: center; padding: 2px 0; }
.stem-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); opacity: .6; animation: stemType 1.2s ease-in-out infinite; }
.stem-dots i:nth-child(2) { animation-delay: .18s; }
.stem-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes stemType { 0%,60%,100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* quick-reply chips */
.stem-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 12px; }
.stem-chip {
  font-family: inherit; font-size: .8rem; padding: 7px 13px; border-radius: 100px; cursor: pointer;
  background: rgba(108,140,255,.10); border: 1px solid var(--card-brd); color: var(--ink);
  text-decoration: none; transition: background .2s, border-color .2s, transform .15s;
}
.stem-chip:hover { background: rgba(108,140,255,.2); border-color: var(--accent); transform: translateY(-1px); }

/* input */
.stem-input { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--card-brd); background: rgba(8,9,22,.6); }
.stem-input input { flex: 1; background: rgba(140,160,255,.08); border: 1px solid var(--card-brd); border-radius: 100px; padding: 11px 16px; color: var(--ink); font-family: inherit; font-size: .9rem; outline: none; transition: border-color .2s, background .2s; }
.stem-input input:focus { border-color: var(--accent); background: rgba(140,160,255,.12); }
.stem-input input::placeholder { color: var(--muted); }
.stem-input button { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--grad); color: #06070f; cursor: pointer; display: grid; place-items: center; transition: transform .15s; }
.stem-input button:hover { transform: scale(1.08); }
.stem-input button:active { transform: scale(.92); }
.stem-input button svg { width: 19px; height: 19px; }
.stem-foot { text-align: center; font-size: .68rem; color: var(--muted); padding: 0 0 10px; margin: -2px 0 0; }
.stem-foot a { color: var(--muted); text-decoration: underline; }

/* mobile: full-width sheet */
@media (max-width: 480px) {
  .stem-chat { right: 16px; bottom: 16px; }
  .stem-panel { width: calc(100vw - 24px); height: calc(100vh - 96px); bottom: 72px; right: -4px; }
}
@media (prefers-reduced-motion: reduce) {
  .stem-fab-ping, .stem-chat-fab.nudge { animation: none; }
}
