/**
 * SoulEngine Page-Specific Styles
 */

/* ========================================
   Landing Page
   ======================================== */

.landing-page {
  padding-top: var(--nav-height);
  overflow-x: hidden;
}

.hero {
  position: relative;
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: var(--space-12) var(--space-8) var(--space-24);
  padding-left: clamp(2rem, 8vw, 10rem);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.brain-canvas-container {
  position: absolute;
  top: 50%;
  right: 8%;
  pointer-events: auto;
  /* Enable pointer events for cursor hiding */
  cursor: none;
  /* Hide cursor over brain visualization */
  transform: translateY(-50%);
  width: 500px;
  height: 500px;
  pointer-events: auto;
  z-index: 1;
}

#brain-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: none;
  /* Hide cursor over canvas */
}

@media (max-width: 1200px) {
  .brain-canvas-container {
    width: 400px;
    height: 400px;
    right: 4%;
  }

  .hero {
    padding-left: clamp(2rem, 5vw, 6rem);
  }
}

@media (max-width: 900px) {
  .brain-canvas-container {
    position: relative;
    top: auto;
    right: auto;
    transform: none;
    width: 100%;
    height: 300px;
    margin: var(--space-8) auto 0;
    order: 2;
  }

  .hero {
    flex-direction: column;
    text-align: center;
    padding: var(--space-8) var(--space-6) var(--space-24);
  }

  .hero-content {
    max-width: 100%;
    order: 1;
  }

  .hero-actions {
    justify-content: center;
  }
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 580px;
}

.hero-badge {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: var(--font-bold);
  line-height: 1.05;
  margin-bottom: var(--space-6);
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards 0.1s;
}

.hero-title .highlight-core {
  color: var(--color-pillar-core);
}

.hero-title .highlight-persona {
  color: var(--color-pillar-persona);
}

.hero-title .highlight-mcp {
  color: var(--color-pillar-mcp);
}

.hero-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  max-width: 520px;
  margin-bottom: var(--space-10);
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards 0.2s;
}

.hero-actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards 0.3s;
}

/* Pillar Tabs - Circle Segment Design */
.pillar-tabs-container {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: var(--space-4);
  z-index: 10;
}

.pillar-tab {
  --tab-size: 130px;
  width: var(--tab-size);
  height: var(--tab-size);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.3s ease;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Show minor segment - icon visible at top */
  transform: translateY(75%);
  position: relative;
}

.pillar-tab[data-pillar="core"] {
  background: var(--color-pillar-core);
}

.pillar-tab[data-pillar="daily"] {
  background: var(--color-pillar-daily);
}

.pillar-tab[data-pillar="weekly"] {
  background: var(--color-pillar-weekly);
}

.pillar-tab[data-pillar="persona"] {
  background: var(--color-pillar-persona);
}

.pillar-tab[data-pillar="mcp"] {
  background: var(--color-pillar-mcp);
}

.pillar-tab:hover {
  /* Rise to show just past diameter */
  transform: translateY(42%);
}

.pillar-tab-icon {
  font-size: 1.75rem;
  color: var(--color-bg-primary);
  font-weight: var(--font-bold);
  line-height: 1;
  /* Position icon in upper portion - visible by default */
  position: absolute;
  top: 18%;
}

.pillar-tab-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--color-bg-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  /* Position label at diameter line */
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.pillar-tab:hover .pillar-tab-label {
  opacity: 1;
}

@media (max-width: 900px) {
  .pillar-tabs-container {
    gap: var(--space-3);
  }

  .pillar-tab {
    --tab-size: 100px;
  }

  .pillar-tab-icon {
    font-size: 1.5rem;
    top: 16%;
  }

  .pillar-tab-label {
    font-size: 0.6rem;
  }
}

@media (max-width: 600px) {
  .pillar-tabs-container {
    gap: var(--space-2);
  }

  .pillar-tab {
    --tab-size: 70px;
  }

  .pillar-tab-icon {
    font-size: 1.25rem;
    top: 14%;
  }

  .pillar-tab-label {
    font-size: 0.5rem;
  }
}

/* Pillars Section */
.pillars-section {
  background: var(--color-bg-secondary);
  padding: var(--space-20) var(--space-6) var(--space-16);
  scroll-margin-top: var(--nav-height);
}

.pillars-section-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.pillars-section-header h2 {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-3);
}

.pillars-section-header p {
  color: var(--color-text-secondary);
  font-size: var(--text-lg);
  max-width: 600px;
  margin: 0 auto;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-5);
  max-width: 1300px;
  margin: 0 auto;
  position: relative;
}

/* Constellation thread: visible only in the gaps between cards, echoing the node motif */
.pillars-grid::before {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  top: calc(var(--space-6) + 24px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-border-hover) 18%, var(--color-border-hover) 82%, transparent);
  z-index: 0;
  pointer-events: none;
}

@media (max-width: 1200px) {
  .pillars-grid::before { display: none; }
}

@media (max-width: 1200px) {
  .pillars-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
  }
}

@media (max-width: 768px) {
  .pillars-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }
}

@media (max-width: 500px) {
  .pillars-grid {
    grid-template-columns: 1fr;
  }

  .pillars-section {
    padding: var(--space-12) var(--space-4) var(--space-10);
  }
}

.pillar-detail {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
  z-index: 1;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s cubic-bezier(0.2, 0.8, 0.25, 1),
    transform 0.5s cubic-bezier(0.2, 0.8, 0.25, 1),
    border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  .pillar-detail {
    opacity: 1;
    transform: none;
    transition: border-color 0.2s ease, background 0.2s ease;
  }
}

.pillar-detail.visible {
  opacity: 1;
  transform: translateY(0);
}

.pillar-detail:hover {
  border-color: var(--color-border-hover);
  background: var(--color-surface-2);
}

.pillar-detail::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.pillar-detail[data-pillar="core"]::before {
  background: var(--color-pillar-core);
}

.pillar-detail[data-pillar="daily"]::before {
  background: var(--color-pillar-daily);
}

.pillar-detail[data-pillar="weekly"]::before {
  background: var(--color-pillar-weekly);
}

.pillar-detail[data-pillar="persona"]::before {
  background: var(--color-pillar-persona);
}

.pillar-detail[data-pillar="mcp"]::before {
  background: var(--color-pillar-mcp);
}

.pillar-detail-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  font-size: var(--text-xl);
  margin-bottom: var(--space-4);
}

.pillar-detail[data-pillar="core"] .pillar-detail-icon {
  background: rgba(241, 166, 196, 0.15);
  color: var(--color-pillar-core);
}

.pillar-detail[data-pillar="daily"] .pillar-detail-icon {
  background: rgba(245, 194, 122, 0.15);
  color: var(--color-pillar-daily);
}

.pillar-detail[data-pillar="weekly"] .pillar-detail-icon {
  background: rgba(245, 226, 122, 0.15);
  color: var(--color-pillar-weekly);
}

.pillar-detail[data-pillar="persona"] .pillar-detail-icon {
  background: rgba(131, 224, 198, 0.15);
  color: var(--color-pillar-persona);
}

.pillar-detail[data-pillar="mcp"] .pillar-detail-icon {
  background: rgba(182, 166, 242, 0.15);
  color: var(--color-pillar-mcp);
}

.pillar-detail h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
  color: var(--color-text-primary);
}

.pillar-detail-tag {
  display: inline-block;
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  background: var(--color-surface-2);
  border-radius: var(--radius-full);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  font-weight: var(--font-medium);
}

.pillar-detail p {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  margin: 0;
}

/* Sections */
.section {
  padding: var(--space-24) var(--space-6);
}

.section-dark {
  background: var(--color-bg-secondary);
}

.section-title {
  text-align: center;
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-4);
}

.section-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto var(--space-12);
}

/* Scroll-reveal — percussive; JS adds .reveal then toggles .visible */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s cubic-bezier(0.2, 0.8, 0.25, 1),
    transform 0.55s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ============================================================
   Landing — post-hero rebuild (editorial instrument panel).
   Restraint: ink + a single ember accent. No rainbow.
   ============================================================ */

.lx-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--color-accent-primary);
  margin-bottom: var(--space-5);
}

.lx-head h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
}

.lx-head h2 em {
  font-style: italic;
  color: var(--color-accent-primary);
}

.lx-head p {
  margin-top: var(--space-5);
  font-size: var(--text-lg);
  line-height: 1.6;
  color: var(--color-text-secondary);
  max-width: 60ch;
}

.lx-head p em {
  font-style: normal;
  color: var(--color-text-primary);
}

/* --- Memory architecture --- */
.lx-memory {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(5rem, 10vw, 8rem) var(--space-6);
}

.lx-layers {
  list-style: none;
  margin: var(--space-16) 0 0;
  padding: 0;
}

.lx-layer {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: var(--space-8);
}

.lx-layer-when {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  text-align: right;
  padding-top: 3px;
}

.lx-layer-body {
  position: relative;
  border-left: 2px solid rgba(236, 230, 220, 0.13);
  padding: 0 0 var(--space-10) var(--space-8);
}

.lx-layer:last-child .lx-layer-body {
  padding-bottom: var(--space-1);
}

.lx-layer-body::before {
  content: '';
  position: absolute;
  left: -9px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-bg-primary);
  border: 2px solid var(--color-text-secondary);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Pillar colours on the timeline dots — matches the hero pillar tabs */
.lx-layer[data-pillar="core"] .lx-layer-body::before {
  border-color: var(--color-pillar-core);
  background: var(--color-pillar-core);
  box-shadow: 0 0 0 5px rgba(241, 166, 196, 0.15);
}

.lx-layer[data-pillar="daily"] .lx-layer-body::before {
  border-color: var(--color-pillar-daily);
  background: var(--color-pillar-daily);
  box-shadow: 0 0 0 5px rgba(245, 194, 122, 0.15);
}

.lx-layer[data-pillar="weekly"] .lx-layer-body::before {
  border-color: var(--color-pillar-weekly);
  background: var(--color-pillar-weekly);
  box-shadow: 0 0 0 5px rgba(245, 226, 122, 0.15);
}

.lx-layer[data-pillar="persona"] .lx-layer-body::before {
  border-color: var(--color-pillar-persona);
  background: var(--color-pillar-persona);
  box-shadow: 0 0 0 5px rgba(131, 224, 198, 0.15);
}

.lx-layer[data-pillar="mcp"] .lx-layer-body::before {
  border-color: var(--color-pillar-mcp);
  background: var(--color-pillar-mcp);
  box-shadow: 0 0 0 5px rgba(182, 166, 242, 0.15);
}

.lx-layer:hover .lx-layer-body::before,
.lx-layer.is-lit .lx-layer-body::before {
  transform: scale(1.3);
}

/* Tint the "when" label with the pillar colour too — subtle, neat */
.lx-layer[data-pillar="core"] .lx-layer-when { color: var(--color-pillar-core); }
.lx-layer[data-pillar="daily"] .lx-layer-when { color: var(--color-pillar-daily); }
.lx-layer[data-pillar="weekly"] .lx-layer-when { color: var(--color-pillar-weekly); }
.lx-layer[data-pillar="persona"] .lx-layer-when { color: var(--color-pillar-persona); }
.lx-layer[data-pillar="mcp"] .lx-layer-when { color: var(--color-pillar-mcp); }

.lx-layer-body h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-2xl);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.lx-layer-body p {
  color: var(--color-text-secondary);
  line-height: 1.6;
  max-width: 56ch;
}

/* --- How it works --- */
.lx-pipe {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(5rem, 10vw, 8rem) var(--space-6);
}

.lx-flow {
  margin-top: var(--space-16);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
  position: relative;
}

.lx-flow-track {
  position: absolute;
  top: 7px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-border);
  overflow: hidden;
}

.lx-flow-pulse {
  position: absolute;
  top: 0;
  left: -22%;
  width: 22%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--color-accent-primary), transparent);
  animation: lxPulse 3.4s linear infinite;
}

@keyframes lxPulse {
  to { left: 122%; }
}

.lx-stage {
  position: relative;
  padding-top: var(--space-6);
}

.lx-stage::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-bg-primary);
  border: 2px solid var(--color-text-secondary);
}

.lx-stage-out::before {
  border-color: var(--color-accent-primary);
  background: var(--color-accent-primary);
  box-shadow: 0 0 0 5px rgba(224, 120, 80, 0.16);
}

.lx-stage-k {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  color: var(--color-accent-primary);
}

.lx-stage h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-xl);
  margin: var(--space-2) 0;
  color: var(--color-text-primary);
}

.lx-stage p {
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--color-text-secondary);
}

/* --- Built for developers --- */
.lx-dev {
  padding: clamp(5rem, 10vw, 8rem) var(--space-6);
}

.lx-dev > .lx-head {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.lx-dev > .lx-head p {
  margin-left: auto;
  margin-right: auto;
}

.lx-dev-grid {
  margin: var(--space-16) auto 0;
  max-width: 1080px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.lx-code {
  background: #090a0d;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

.lx-code-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.02);
}

.lx-code-bar > span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(236, 230, 220, 0.16);
}

.lx-code-file {
  width: auto !important;
  height: auto !important;
  border-radius: 0 !important;
  background: none !important;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  letter-spacing: 0.04em;
}

.lx-code pre {
  margin: 0;
  padding: var(--space-5) var(--space-5) var(--space-6);
  overflow-x: auto;
}

.lx-code code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--color-text-secondary);
  white-space: pre;
}

.lx-code .c-c { color: var(--color-text-muted); }
.lx-code .c-k { color: var(--color-accent-primary); }
.lx-code .c-s { color: #83e0c6; }
.lx-code .c-p { color: var(--color-text-primary); }

.lx-benefits {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.lx-benefits li {
  padding-left: var(--space-5);
  border-left: 2px solid var(--color-accent-primary);
}

.lx-benefits h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-xl);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.lx-benefits p {
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--color-text-secondary);
}

/* --- CTA --- */
.lx-cta {
  text-align: center;
  padding: clamp(5rem, 11vw, 9rem) var(--space-6);
  background: radial-gradient(ellipse 60% 80% at 50% 28%, rgba(224, 120, 80, 0.10), transparent 70%);
}

.lx-cta-mark {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 110px;
  margin-bottom: var(--space-6);
}

.lx-whip {
  font-family: var(--font-wordmark);
  font-weight: 600;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  line-height: 1;
  color: var(--color-text-primary);
}

.lx-cta h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  letter-spacing: -0.02em;
}

.lx-cta p {
  color: var(--color-text-secondary);
  font-size: var(--text-lg);
  margin: var(--space-3) 0 var(--space-8);
}

/* --- Wordmark intro component (wave -> "SoulEngine") --- */
.wm-host { display: inline-block; }

.wm-surface { position: relative; }

.wm-bar {
  position: absolute;
  bottom: 50%;
  border-radius: 9px;
  background: var(--color-text-primary);
  transform: translate(-50%, 50%);
  will-change: height, transform, background-color;
}

.wm-letter {
  position: absolute;
  bottom: 50%;
  transform: translate(-50%, 50%) scale(0.2);
  font-family: var(--font-wordmark);
  font-weight: 600;
  line-height: 1;
  opacity: 0;
  white-space: nowrap;
  will-change: transform, opacity;
}

.wm-soul { color: var(--color-text-primary); }
.wm-engine { color: var(--color-accent-primary); }

.wm-measure {
  position: absolute;
  visibility: hidden;
  white-space: nowrap;
  left: 0;
  top: 0;
  font-family: var(--font-wordmark);
  font-weight: 600;
}

/* --- Conversation loop (How it works) --- */
.lx-convo {
  max-width: 460px;
  margin: var(--space-12) auto 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.lx-convo-row { display: flex; }
.lx-convo-user { justify-content: flex-end; }
.lx-convo-npc { justify-content: flex-start; }

.lx-bubble {
  max-width: 82%;
  padding: var(--space-3) var(--space-4);
  border-radius: 16px;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-text-primary);
  opacity: 0;
}

.lx-convo-user .lx-bubble {
  background: var(--color-surface-3);
  border: 1px solid var(--color-border);
  border-bottom-right-radius: 4px;
  animation: convoUser 7s ease-in-out infinite;
}

.lx-convo-npc .lx-bubble {
  background: rgba(224, 120, 80, 0.12);
  border: 1px solid rgba(224, 120, 80, 0.35);
  border-bottom-left-radius: 4px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  animation: convoNpc 7s ease-in-out infinite;
}

@keyframes convoUser {
  0%, 4% { opacity: 0; transform: translateY(8px); }
  10%, 46% { opacity: 1; transform: none; }
  54%, 100% { opacity: 0.25; transform: none; }
}

@keyframes convoNpc {
  0%, 50% { opacity: 0; transform: translateY(8px); }
  58%, 94% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(8px); }
}

.lx-voicebars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
  flex-shrink: 0;
}

.lx-voicebars i {
  width: 3px;
  height: 4px;
  background: var(--color-accent-primary);
  border-radius: 2px;
  animation: voiceEq 0.9s ease-in-out infinite;
}

.lx-voicebars i:nth-child(2) { animation-delay: 0.15s; }
.lx-voicebars i:nth-child(3) { animation-delay: 0.3s; }
.lx-voicebars i:nth-child(4) { animation-delay: 0.45s; }
.lx-voicebars i:nth-child(5) { animation-delay: 0.6s; }

@keyframes voiceEq {
  0%, 100% { height: 4px; }
  50% { height: 16px; }
}

/* --- NPC dropped into an engine (Built for developers) --- */
.lx-engine {
  position: relative;
  max-width: 560px;
  height: 190px;
  margin: var(--space-12) auto 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(224, 120, 80, 0.07), transparent 60%),
    linear-gradient(rgba(236, 230, 220, 0.04) 1px, transparent 1px) 0 0 / 100% 28px,
    linear-gradient(90deg, rgba(236, 230, 220, 0.04) 1px, transparent 1px) 0 0 / 28px 100%;
}

.lx-engine-label {
  position: absolute;
  top: var(--space-3);
  left: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

.lx-engine-npc {
  position: absolute;
  left: 50%;
  top: 52%;
  animation: engineDrop 0.9s cubic-bezier(0.5, 1.5, 0.5, 1) both;
}

.lx-engine-dot {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-accent-primary);
  box-shadow: 0 0 14px rgba(224, 120, 80, 0.7);
  animation: engineWander 11s ease-in-out 0.9s infinite;
}

.lx-engine-dot::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid var(--color-accent-primary);
  opacity: 0;
  animation: engineRing 2.6s ease-out 0.9s infinite;
}

@keyframes engineDrop {
  0% { transform: translateY(-200px); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes engineWander {
  0% { transform: translate(0, 0); }
  20% { transform: translate(150px, 30px); }
  40% { transform: translate(-120px, 52px); }
  60% { transform: translate(90px, -38px); }
  80% { transform: translate(-150px, -20px); }
  100% { transform: translate(0, 0); }
}

@keyframes engineRing {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2.4); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .lx-convo-user .lx-bubble,
  .lx-convo-npc .lx-bubble { opacity: 1; animation: none; transform: none; }
  .lx-voicebars i { animation: none; height: 10px; }
  .lx-engine-npc { animation: none; }
  .lx-engine-dot { animation: none; }
  .lx-engine-dot::before { animation: none; opacity: 0; }
}

/* --- Responsive --- */
@media (max-width: 860px) {
  .lx-dev-grid { grid-template-columns: 1fr; }
  .lx-flow { grid-template-columns: 1fr 1fr; gap: var(--space-10) var(--space-6); }
  .lx-flow-track { display: none; }
  .lx-stage::before { display: none; }
}

@media (max-width: 600px) {
  .lx-layer { grid-template-columns: 1fr; gap: var(--space-2); }
  .lx-layer-when { text-align: left; padding-top: 0; }
  .lx-layer-body { border-left: none; padding-left: 0; }
  .lx-layer-body::before { display: none; }
  .lx-flow { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .lx-flow-pulse { animation: none; opacity: 0.45; }
}

/* Pipeline — dual column: NPC context left, voice pipeline right */
.pipeline-dual {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
}

.pd-panel {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.pd-panel-header {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  text-align: center;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
}

.pd-bridge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
}

.pd-bridge-line {
  width: 1px;
  flex: 1;
  background: var(--color-border);
  min-height: 20px;
}

.pd-bridge-label {
  font-size: 9px;
  color: var(--color-text-tertiary);
  letter-spacing: 0.04em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
}

.pd-bridge-arrow {
  font-size: var(--text-xl);
  color: var(--color-accent-primary);
  opacity: 0.5;
  transform: rotate(90deg);
  animation: bridgePulse 2.4s ease-in-out infinite;
}

@keyframes bridgePulse {
  0%, 100% { opacity: 0.4; transform: rotate(90deg) translateX(-2px); }
  50% { opacity: 0.95; transform: rotate(90deg) translateX(3px); }
}

@media (prefers-reduced-motion: reduce) {
  .pd-bridge-arrow { animation: none; }
}

/* NPC Context nodes */
.nc-node {
  padding: var(--space-3);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  border-left-width: 3px;
  transition: border-color 0.15s ease;
}

.nc-node:hover {
  border-color: var(--color-accent-primary);
}

.nc-node-identity {
  border-left-color: rgba(var(--accent-primary-rgb, 99, 102, 241), 0.7);
}

.nc-node-anchor {
  border-left-color: rgba(251, 191, 36, 0.7);
}

.nc-node-personality {
  border-left-color: rgba(52, 211, 153, 0.7);
}

.nc-node-knowledge {
  border-left-color: rgba(251, 113, 73, 0.7);
}

.nc-node-network {
  border-left-color: rgba(56, 189, 248, 0.7);
}

.nc-node-memory {
  border-left-color: rgba(232, 121, 249, 0.7);
}

.nc-node-label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.nc-node-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.nc-tag {
  font-size: 9px;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

.nc-connector {
  width: 1px;
  height: var(--space-3);
  background: var(--color-border);
  margin: 0 auto;
}

/* Voice Pipeline nodes */
.vp-node {
  padding: var(--space-3);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  transition: border-color 0.15s ease;
}

.vp-node:hover {
  border-color: var(--color-accent-primary);
}

.vp-node-input {
  border-left: 3px solid var(--color-text-tertiary);
}

.vp-node-output {
  border-right: 3px solid var(--color-text-tertiary);
}

.vp-node-decision {
  border-color: rgba(251, 191, 36, 0.5);
}

.vp-node-security {
  border-color: rgba(251, 191, 36, 0.5);
}

.vp-node-streaming {
  border-color: rgba(var(--accent-primary-rgb, 99, 102, 241), 0.4);
}

.vp-node-context {
  border-color: rgba(52, 211, 153, 0.4);
}

.vp-node-llm {
  border-color: var(--color-accent-primary);
  border-width: 2px;
}

.vp-node-label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
}

.vp-node-detail {
  font-size: 9px;
  color: var(--color-text-tertiary);
}

.vp-badge {
  font-size: 9px;
  padding: 1px 6px;
  background: rgba(var(--accent-primary-rgb, 99, 102, 241), 0.15);
  color: var(--color-accent-primary);
  border-radius: 100px;
  font-weight: var(--font-medium);
  white-space: nowrap;
  flex-shrink: 0;
}

.vp-badge-accent {
  background: rgba(var(--accent-primary-rgb, 99, 102, 241), 0.25);
}

.vp-step-arrow {
  text-align: center;
  color: var(--color-accent-primary);
  opacity: 0.4;
  font-size: var(--text-base);
  line-height: var(--space-6);
}

@media (max-width: 700px) {
  .pipeline-dual {
    grid-template-columns: 1fr;
  }

  .pd-bridge {
    flex-direction: row;
    padding: var(--space-3) 0;
  }

  .pd-bridge-label {
    writing-mode: initial;
    transform: none;
  }

  .pd-bridge-arrow {
    transform: none;
  }

  .pd-bridge-line {
    height: 1px;
    width: auto;
    flex: 1;
    min-height: unset;
  }
}

/* Features */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
  max-width: 1200px;
  margin: 0 auto;
}

.feature-card {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  transition: all var(--transition-fast);
}

.feature-card:hover {
  border-color: var(--color-border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.feature-card-highlight {
  border-color: rgba(var(--accent-primary-rgb, 99, 102, 241), 0.4);
  background: linear-gradient(135deg,
      rgba(var(--accent-primary-rgb, 99, 102, 241), 0.06) 0%,
      var(--color-bg-tertiary) 100%);
}

.feature-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: var(--font-medium);
  padding: 1px 7px;
  background: rgba(var(--accent-primary-rgb, 99, 102, 241), 0.15);
  color: var(--color-accent-primary);
  border-radius: 100px;
  vertical-align: middle;
  margin-left: var(--space-2);
  letter-spacing: 0.03em;
}

.feature-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent-primary-muted);
  border-radius: var(--radius-xl);
  font-size: var(--text-xl);
  color: var(--color-accent-primary);
  margin-bottom: var(--space-4);
}

.feature-card h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}

.feature-card p {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

/* CTA */
.section-cta {
  background: linear-gradient(135deg, rgba(224, 120, 80, 0.1), rgba(201, 168, 108, 0.1));
  text-align: center;
  position: relative;
  overflow: hidden;
}

.section-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 0%, var(--color-bg-primary) 70%);
  pointer-events: none;
}

.section-cta .container {
  position: relative;
  z-index: 1;
}

.section-cta h2 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-3);
}

.section-cta p {
  margin-bottom: var(--space-8);
  font-size: var(--text-lg);
}

/* Footer */
.footer {
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  padding: var(--space-16) var(--space-6) var(--space-8);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--space-12);
  margin-bottom: var(--space-12);
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-8);
  }
}

@media (max-width: 600px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.footer-brand-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.footer-brand .brand-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-secondary));
  border-radius: var(--radius-lg);
  font-size: var(--text-lg);
  color: white;
}

.footer-brand .brand-icon-img {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  object-fit: contain;
}

.footer-brand .brand-text {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
}

.footer-brand p {
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
  max-width: 280px;
}

.footer-social-links {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.footer-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  color: var(--color-text-tertiary);
  transition: all var(--transition-fast);
}

.footer-social-link:hover {
  background: var(--color-accent-primary-muted);
  color: var(--color-accent-primary);
}

.footer-social-link svg {
  width: 18px;
  height: 18px;
}

.footer-links h4 {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-4);
}

.footer-links a {
  display: block;
  color: var(--color-text-tertiary);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.footer-links a:hover {
  color: var(--color-accent-primary);
  padding-left: var(--space-2);
}

.footer-bottom {
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer-bottom p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.footer-bottom-links {
  display: flex;
  gap: var(--space-6);
}

.footer-bottom-links a {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.footer-bottom-links a:hover {
  color: var(--color-accent-primary);
}

/* Hidden beware trigger — half-circle on right edge */
.beware-trigger {
  position: fixed;
  right: -28px;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 80px;
  background: var(--color-bg-secondary, #1a1a2e);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
  border-right: none;
  border-radius: 48px 0 0 48px;
  cursor: pointer;
  z-index: 500;
  transition: right 0.25s ease;
}

.beware-trigger::after {
  content: '';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: var(--color-accent-primary, #6366f1);
  border-radius: 2px;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.beware-trigger:hover {
  right: -4px;
}

.beware-trigger:hover::after {
  opacity: 1;
}

/* Beware popup panel */
.beware-popup {
  position: fixed;
  right: -300px;
  top: 50%;
  transform: translateY(-50%);
  width: 240px;
  background: var(--color-bg-secondary, #1a1a2e);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
  border-right: none;
  border-radius: var(--radius-xl, 16px) 0 0 var(--radius-xl, 16px);
  padding: 28px 24px;
  z-index: 499;
  transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.beware-popup.open {
  right: 0;
}

.beware-line {
  margin: 0 0 16px;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--color-text-primary, #f5f0eb);
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.beware-line:last-child {
  margin-bottom: 0;
}