/* Impeccable Design System */
:root {
  /* Dark Mode (Default) - OKLCH */
  --bg-color: oklch(0.15 0.02 260); /* Very dark cool gray/blue */
  --surface-1: oklch(0.2 0.02 260);
  --surface-2: oklch(0.25 0.03 260);
  --text-primary: oklch(0.95 0.01 260);
  --text-secondary: oklch(0.7 0.02 260);
  --accent-color: oklch(0.6 0.15 250); /* Sci-fi blue */
  --accent-glow: oklch(0.6 0.15 250 / 0.4);
  
  --card-bg: oklch(1 0 0 / 0.03);
  --card-border: oklch(1 0 0 / 0.08);
  --code-bg: oklch(0.1 0.02 260);
  
  --btn-bg: oklch(0.95 0 0);
  --btn-text: oklch(0.1 0 0);
  
  /* Shared scales */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;
  --space-7: 6rem;
  
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1); /* Swapped from bounce to expo out */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  /* Light Mode */
  --bg-color: oklch(0.98 0.01 260); /* Off-white cool */
  --surface-1: oklch(1 0 0);
  --surface-2: oklch(0.95 0.01 260);
  --text-primary: oklch(0.2 0.02 260);
  --text-secondary: oklch(0.4 0.02 260);
  --accent-color: oklch(0.55 0.15 250);
  --accent-glow: oklch(0.55 0.15 250 / 0.2);
  
  --card-bg: oklch(1 0 0 / 0.6);
  --card-border: oklch(0 0 0 / 0.08);
  --code-bg: oklch(0.95 0.01 260);
  
  --btn-bg: oklch(0.1 0 0);
  --btn-text: oklch(0.95 0 0);
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  transition: background-color 0.4s var(--ease-out-expo), color 0.4s var(--ease-out-expo);
}

/* Typography refinements */
h1, h2, h3, h4 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, sans-serif;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  /* Hero clamp maxing out at ~88px, min 48px */
  font-size: clamp(3rem, 5.5vw + 1rem, 5.5rem); 
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  text-wrap: balance;
}

h2 {
  font-size: clamp(2rem, 3vw + 1rem, 2.5rem);
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
  text-wrap: balance;
}

p {
  max-width: 65ch; /* Optimal line length */
  text-wrap: pretty;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

/* Layout basics */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* Nav */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) 0;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.nav-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
}

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

/* Theme Toggle */
.theme-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: color 0.2s, background-color 0.2s;
}

.theme-toggle:hover {
  color: var(--text-primary);
  background-color: var(--surface-2);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

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

/* Language Switch */
#lang-switch {
  background: var(--surface-1);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 8px;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s;
}
#lang-switch:hover {
  border-color: var(--text-secondary);
}

/* Hero Section */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-7) 0;
  gap: var(--space-6);
  min-height: 80vh;
}

.hero-content {
  flex: 1;
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
}

.hero-visual {
  flex: 1;
  perspective: 1200px;
  display: flex;
  justify-content: center;
  position: relative;
}

/* Remove AI slop shadow, use refined soft shadow */
.app-screenshot {
  width: 100%;
  max-width: 560px;
  border-radius: 12px; /* Not 32px */
  box-shadow: 0 24px 48px oklch(0 0 0 / 0.2), 0 0 0 1px var(--card-border);
  transform: rotateY(-12deg) rotateX(4deg);
  transition: transform 0.6s var(--ease-out-expo);
}

.hero-visual:hover .app-screenshot {
  transform: rotateY(-4deg) rotateX(2deg);
}

/* Background glow */
.bg-glow {
  position: absolute;
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 60%);
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  z-index: -1;
  pointer-events: none;
  opacity: 0.6;
}

/* Buttons */
.cta-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background-color: var(--btn-bg);
  color: var(--btn-text);
  font-weight: 600;
  font-size: 1.05rem;
  padding: 14px 28px;
  border-radius: 100px; /* pill shape for primary CTA is ok */
  text-decoration: none;
  transition: transform 0.2s var(--ease-out-expo), box-shadow 0.2s var(--ease-out-expo);
  box-shadow: 0 0 0 var(--accent-glow);
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.sponsor-btn {
  background: oklch(0.7 0.15 340 / 0.1);
  color: oklch(0.7 0.15 340);
  border: 1px solid oklch(0.7 0.15 340 / 0.3);
  padding: 6px 16px;
  border-radius: 100px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}
.sponsor-btn:hover {
  background: oklch(0.7 0.15 340 / 0.2);
}

.hotkey-badge {
  display: inline-block;
  background: var(--surface-1);
  border: 1px solid var(--card-border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text-secondary);
}

/* Top banner */
.top-banner {
  background: linear-gradient(90deg, var(--accent-color), oklch(0.6 0.15 300));
  color: white;
  text-align: center;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Features Grid */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-4);
  padding: var(--space-7) 0;
}

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: var(--space-5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color 0.3s;
}

.feature-card:hover {
  border-color: var(--text-secondary);
}

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

.feature-card p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.feature-card.large {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-6) var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: center;
}

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

.install-section h2 {
  margin-bottom: var(--space-3);
}

.install-section p {
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.warning-section {
  border-color: oklch(0.6 0.2 25 / 0.3);
}
.warning-text {
  color: oklch(0.6 0.2 25);
}

/* Syntax Grid */
.syntax-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3);
}

.syntax-item {
  background: var(--surface-1);
  padding: var(--space-4);
  border-radius: 12px;
  border: 1px solid var(--card-border);
}

.syntax-item code {
  color: var(--accent-color);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.05rem;
  display: block;
  margin-bottom: var(--space-1);
}

.syntax-item span {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Code block */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--card-border);
  padding: var(--space-3);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  overflow-x: auto;
}

.copy-btn {
  background: var(--surface-2);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  font-weight: 500;
  font-size: 0.85rem;
}
.copy-btn:hover {
  background: var(--card-border);
}

/* FAQ */
.faq-item {
  margin-bottom: var(--space-4);
}
.faq-item h4 {
  font-size: 1.1rem;
  margin-bottom: var(--space-1);
  color: var(--text-primary);
}
.faq-item p {
  color: var(--text-secondary);
}

/* Footer */
footer {
  text-align: center;
  padding: var(--space-6) 0;
  border-top: 1px solid var(--card-border);
  color: var(--text-secondary);
  font-size: 0.9rem;
}
footer a {
  color: var(--accent-color);
  text-decoration: none;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: oklch(0 0 0 / 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--surface-1);
  border: 1px solid var(--card-border);
  padding: var(--space-5);
  border-radius: 16px;
  width: 90%;
  max-width: 440px;
  position: relative;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.3s var(--ease-out-expo);
  box-shadow: 0 24px 48px oklch(0 0 0 / 0.4);
}
.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover {
  color: var(--text-primary);
}

.sponsor-tabs {
  display: flex;
  gap: 8px;
  margin: 24px 0;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 8px;
}
.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--card-border);
  color: var(--text-primary);
}

@media (max-width: 900px) {
  .hero { flex-direction: column; text-align: center; padding: var(--space-5) 0; min-height: auto;}
  .hero-visual { width: 100%; perspective: none; }
  .app-screenshot { transform: none; box-shadow: 0 12px 24px oklch(0 0 0 / 0.2), 0 0 0 1px var(--card-border); }
  .hero-visual:hover .app-screenshot { transform: none; }
  .cta-group { align-items: center; width: 100%; }
  .nav-links { gap: var(--space-2); flex-wrap: wrap;}
  .nav-links a { display: none; } /* Hide text links on mobile */
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
