/* ============================================
   LaciaFlow Landing Page - Clean Rewrite
   ============================================ */

:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --accent-green: #22c55e;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-orange: #f97316;
  --accent-red: #ef4444;
  --accent-yellow: #eab308;
  --grid-color: rgba(148, 163, 184, 0.15);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] {
  --bg-primary: #121212;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #2a2a2a;
  --text-primary: #f5f5f5;
  --text-secondary: #b3b3b3;
  --text-muted: #737373;
  --border: #333333;
  --grid-color: rgba(60, 60, 60, 0.5);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Grid Background */
.grid-background {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 20px 20px;
  z-index: -1;
}

/* Particles */
.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--accent-blue);
  border-radius: 50%;
  opacity: 0.3;
  animation: floatUp 20s infinite ease-in-out;
}

.particle:nth-child(2n) { background: var(--accent-purple); }
.particle:nth-child(3n) { background: var(--accent-green); }

@keyframes floatUp {
  0%, 100% { transform: translateY(100vh); opacity: 0; }
  10% { opacity: 0.3; }
  90% { opacity: 0.3; }
  100% { transform: translateY(-100px); opacity: 0; }
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  box-shadow: var(--shadow);
  transition: all 0.2s;
}

.theme-toggle:hover {
  transform: scale(1.05);
  color: var(--text-primary);
}

.sun-icon { display: none; }
.moon-icon { display: block; }
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }

/* Navigation */
.nav-bar {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--accent-blue);
}

.nav-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}

.nav-version {
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
}

.nav-links a:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-btn {
  background: var(--accent-blue) !important;
  color: white !important;
}

.nav-btn:hover {
  background: #2563eb !important;
}

/* Main Content */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 140px 24px 60px;
}

/* Hero Section */
.hero-section {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 40px;
  align-items: center;
  min-height: calc(100vh - 200px);
  margin-bottom: 80px;
}

.hero-text {
  padding: 40px 30px 30px 30px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.typing-container {
  margin-bottom: 20px;
}

.typing-line {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.2;
  height: 58px;
  display: flex;
  align-items: center;
}

.typing-line:nth-child(1) { color: var(--accent-green); }
.typing-line:nth-child(2) { color: var(--accent-blue); }
.typing-line:nth-child(3) { color: var(--accent-purple); }

.typing-line .cursor {
  display: inline-block;
  width: 3px;
  height: 48px;
  background: var(--accent-blue);
  margin-left: 2px;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.hero-subtitle {
  font-size: 20px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.highlight {
  color: var(--accent-blue);
  font-weight: 600;
}

.hero-description {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.7;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-green { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.badge-blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.badge-purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.badge-orange { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); }

/* Demo Container */
.demo-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.demo-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--accent-purple);
  color: white;
  font-weight: 600;
  font-size: 13px;
}

.demo-canvas {
  position: relative;
  min-width: 550px;
  height: 240px;
  background-size: 15px 15px;
  overflow: visible;
}

/* Demo canvas theme inversion */
[data-theme="dark"] .demo-canvas {
  background-color: #f8fafc;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.2) 1px, transparent 1px);
}

[data-theme="light"] .demo-canvas {
  background-color: #1a1a1a;
  background-image:
    linear-gradient(rgba(60, 60, 60, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(60, 60, 60, 0.5) 1px, transparent 1px);
}

/* Demo Nodes */
.demo-node {
  position: absolute;
  min-width: 90px;
  border-radius: 8px;
  font-size: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  z-index: 1;
}

[data-theme="dark"] .demo-node {
  background: white;
  border: 1px solid #e2e8f0;
}

[data-theme="light"] .demo-node {
  background: #1a1a1a;
  border: 1px solid #333333;
}

.demo-node.wide {
  min-width: 130px;
}

.demo-node-header {
  padding: 6px 10px;
  border-radius: 8px 8px 0 0;
  color: white;
  font-weight: 600;
  font-size: 11px;
  text-align: center;
}

.demo-node-header.green { background: var(--accent-green); }
.demo-node-header.yellow { background: var(--accent-yellow); color: #1e293b; }
.demo-node-header.blue { background: var(--accent-blue); }
.demo-node-header.orange { background: var(--accent-orange); }
.demo-node-header.red { background: var(--accent-red); }

.demo-node-content {
  padding: 8px;
}

[data-theme="dark"] .demo-node-content { color: #475569; }
[data-theme="light"] .demo-node-content { color: #b3b3b3; }

.demo-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: white;
  border: 2px solid var(--accent-blue);
  border-radius: 50%;
  z-index: 2;
}

.demo-handle.input {
  left: -4px;
  top: 14px;
}

.demo-handle.output {
  right: -4px;
  top: 14px;
}

.demo-badge {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(234, 179, 8, 0.2);
  color: var(--accent-yellow);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 6px;
}

.demo-preview, .demo-select {
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 9px;
}

[data-theme="dark"] .demo-preview,
[data-theme="dark"] .demo-select {
  background: #f1f5f9;
  color: #475569;
}

[data-theme="light"] .demo-preview,
[data-theme="light"] .demo-select {
  background: #2a2a2a;
  color: #b3b3b3;
}

.demo-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  opacity: 0.7;
}

.demo-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  color: var(--accent-green);
  margin-top: 6px;
}

.demo-status::before {
  content: '✓';
}

.demo-info {
  padding: 6px 8px;
  background: rgba(249, 115, 22, 0.1);
  border-radius: 6px;
  font-size: 10px;
  color: var(--accent-orange);
  margin-bottom: 8px;
}

.demo-slider {
  display: flex;
  justify-content: center;
  font-size: 9px;
  opacity: 0.7;
}

.demo-output {
  padding: 6px;
  border-radius: 4px;
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  min-height: 32px;
  word-break: break-word;
}

[data-theme="dark"] .demo-output {
  background: #f1f5f9;
  color: #64748b;
}

[data-theme="light"] .demo-output {
  background: #2a2a2a;
  color: #999999;
}

.demo-output.success {
  color: var(--accent-green) !important;
  background: rgba(34, 197, 94, 0.1) !important;
}

/* Demo Connections */
.demo-connections {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}

.demo-connection {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 2.5;
  opacity: 0.7;
}

[data-theme="dark"] .demo-connection { stroke: #64748b; }
[data-theme="light"] .demo-connection { stroke: #9ca3af; }

.demo-connection.active {
  stroke: var(--accent-blue);
  opacity: 1;
  stroke-width: 2.5;
}

.demo-connection.flowing {
  stroke-dasharray: 5, 5;
  animation: flow 0.5s linear infinite;
}

@keyframes flow {
  0% { stroke-dashoffset: 20; }
  100% { stroke-dashoffset: 0; }
}

/* Demo Controls */
.demo-controls {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.demo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.demo-btn.run {
  background: var(--accent-green);
  color: white;
}

.demo-btn.run:hover { background: #16a34a; }
.demo-btn.run.running { background: var(--accent-orange); }

.demo-btn.reset {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.demo-btn.reset:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* Sections */
.section {
  margin-bottom: 100px;
}

.section-header {
  text-align: center;
  margin-bottom: 48px;
}

.section-header h2 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 12px;
}

.section-header p {
  font-size: 16px;
  color: var(--text-muted);
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.feature-card {
  padding: 28px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}

.feature-card:hover {
  box-shadow: var(--shadow-lg);
}

.feature-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  margin-bottom: 16px;
}

.feature-icon.green { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.feature-icon.purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.feature-icon.orange { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); }
.feature-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

.feature-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

.feature-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.feature-card ul {
  list-style: none;
}

.feature-card li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 5px 0;
}

.feature-card li::before {
  content: '✓';
  color: var(--accent-green);
  font-weight: 600;
}

/* Screenshots Grid */
.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.screenshot-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}

.screenshot-card:hover {
  box-shadow: var(--shadow-lg);
}

.screenshot-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  min-height: 200px;
}

.screenshot-placeholder svg {
  margin-bottom: 12px;
  opacity: 0.5;
}

.screenshot-placeholder span {
  font-size: 15px;
  font-weight: 500;
}

.screenshot-placeholder small {
  font-size: 12px;
  opacity: 0.6;
  margin-top: 4px;
}

.screenshot-img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

.screenshot-card:hover .screenshot-img {
  transform: scale(1.02);
}

.screenshot-label {
  padding: 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border);
}

.screenshot-card {
  cursor: pointer;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: white;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  z-index: 10000;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: lightboxZoom 0.3s ease;
}

@keyframes lightboxZoom {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.lightbox-caption {
  margin-top: 20px;
  color: white;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
}

/* Download Section */
.download-section {
  margin-bottom: 60px;
}

.download-card {
  text-align: center;
  padding: 60px 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}

.download-card h2 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 12px;
}

.download-card > p {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.download-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 32px;
}

.download-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border: none;
  border-radius: 14px;
  text-decoration: none;
  color: #ffffff;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
  position: relative;
  overflow: hidden;
}

.download-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.download-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.download-btn:hover::before {
  opacity: 1;
}

.download-btn > * {
  position: relative;
  z-index: 1;
}

.download-btn svg:first-child {
  flex-shrink: 0;
}

.download-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  flex: 1;
}

.download-label {
  font-size: 15px;
  font-weight: 600;
}

.download-file {
  font-size: 11px;
  opacity: 0.8;
  font-family: 'JetBrains Mono', monospace;
}

.windows-icon {
  flex-shrink: 0;
  opacity: 0.9;
}

.download-info {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.download-info span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.download-info svg {
  color: var(--accent-green);
}

/* Footer */
.footer {
  text-align: center;
  padding: 48px 24px;
  border-top: 1px solid var(--border);
}

.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-blue);
  margin-bottom: 16px;
}

.footer-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}

.footer > p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.footer-links a {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 50%;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.footer-links a:hover {
  background: var(--accent-blue);
  color: white;
  transform: translateY(-2px);
}

.copyright {
  font-size: 12px;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1200px) {
  .hero-section {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .hero-text {
    padding-top: 0;
    text-align: center;
  }

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

  .demo-container {
    max-width: 700px;
    margin: 0 auto;
  }
}

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

  .screenshots-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .nav-bar {
    left: 10px;
    right: 10px;
    padding: 10px 14px;
    gap: 12px;
  }

  .nav-links a:not(.nav-btn) {
    display: none;
  }

  .main-content {
    padding: 100px 16px 40px;
  }

  .typing-line {
    font-size: 32px;
    min-height: 40px;
  }

  .typing-line .cursor {
    height: 32px;
  }

  .section-header h2 {
    font-size: 28px;
  }

  .screenshots-grid {
    grid-template-columns: 1fr;
  }

  .download-buttons {
    flex-direction: column;
    align-items: center;
  }

  .download-btn {
    width: 100%;
    max-width: 320px;
    justify-content: center;
  }

  .download-info {
    flex-direction: column;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .theme-toggle {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
  }

  .demo-canvas {
    height: 320px;
  }

  .typing-line {
    font-size: 26px;
    min-height: 34px;
  }
}
