/* ============================================
   SplinterKB - OpenCode-inspired Design System
   ============================================ */

/* CSS Custom Properties */
:root {
  /* Colors - Light theme with white background */
  --color-bg: #ffffff;
  --color-bg-alt: #fafafa;
  --color-text: #1a1a1a;
  --color-text-muted: #666666;
  --color-accent: #0a0a0a;
  --color-border: #e5e5e5;
  --color-overlay-bg: rgba(255, 255, 255, 0.95);

  /* Typography */
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco, Consolas, monospace;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 8rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;
}

/* Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* ============================================
   Navigation
   ============================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--color-overlay-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

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

.nav-links a {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

.nav-cta {
  background: var(--color-accent);
  color: var(--color-bg) !important;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-weight: 500;
}

.nav-cta:hover {
  opacity: 0.9;
}

/* ============================================
   Hero Section with Scroll Animation
   ============================================ */
.hero {
  position: relative;
  height: 250vh;
  /* Scroll animation */
  background: var(--color-bg);
}

.hero-content {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding-top: calc(60px + var(--space-lg));
  text-align: center;
  z-index: 10;
  pointer-events: none;
  opacity: 1;
  transition: opacity var(--transition-base);
}

.hero-content.hidden {
  opacity: 0;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-sm);
  color: var(--color-text);
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

.scroll-indicator {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-muted);
  animation: bounce 2s infinite;
}

@keyframes bounce {

  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(10px);
  }

  60% {
    transform: translateY(5px);
  }
}

/* Canvas */
#keyboard-canvas {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90vw;
  max-height: 70vh;
  z-index: 5;
}

/* Text Overlays */
.text-overlay {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  opacity: 0;
  transition: opacity var(--transition-slow), transform var(--transition-slow);
  pointer-events: none;
}

.text-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.text-overlay-left {
  left: 5%;
  transform: translateY(-50%) translateX(-20px);
}

.text-overlay-left.visible {
  transform: translateY(-50%) translateX(0);
}

.text-overlay-right {
  right: 5%;
  text-align: right;
  transform: translateY(-50%) translateX(20px);
}

.text-overlay-right.visible {
  transform: translateY(-50%) translateX(0);
}

.text-overlay-content {
  max-width: 280px;
  padding: var(--space-md);
  background: var(--color-overlay-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.text-overlay-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
  letter-spacing: 0.05em;
}

.text-overlay-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
  letter-spacing: -0.02em;
}

.text-overlay-desc {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ============================================
   Features Section
   ============================================ */
.features {
  padding: var(--space-xl) 0;
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-lg);
  letter-spacing: -0.02em;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-md);
}

.feature-card {
  padding: var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
}

.feature-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

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

/* ============================================
   Specs Section
   ============================================ */
.specs {
  padding: 0 0 var(--space-xl);
}

.specs-render {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.specs-render-img {
  max-width: 100%;
  width: 700px;
  height: auto;
  border-radius: 8px;
}

.specs-table {
  max-width: 600px;
  margin: 0 auto;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
}

.spec-row:last-child {
  border-bottom: none;
}

.spec-label {
  font-weight: 500;
  color: var(--color-text-muted);
}

.spec-value {
  font-weight: 600;
  text-align: right;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  padding: var(--space-lg) 0;
  background: var(--color-accent);
  color: var(--color-bg);
}

.footer-content {
  text-align: center;
}

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

.footer-text {
  font-size: 0.875rem;
  opacity: 0.7;
  margin-top: var(--space-xs);
}

/* ============================================
   Dark Mode (System Preference)
   ============================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #000000;
    --color-bg-alt: #0a0a0a;
    --color-text: #e5e5e5;
    --color-text-muted: #999999;
    --color-accent: #f5f5f5;
    --color-border: #2a2a2a;
    --color-overlay-bg: rgba(0, 0, 0, 0.95);
  }

  #keyboard-canvas {
    filter: invert(1);
  }

  .footer {
    background: #111111;
    color: #e5e5e5;
  }

  .feature-card:hover {
    box-shadow: 0 10px 40px rgba(255, 255, 255, 0.05);
  }

  .nav-cta {
    background: #000000 !important;
    color: #ffffff !important;
    border: 1px solid #e5e5e5;
  }
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
  .nav-links a:not(.nav-cta) {
    display: none;
  }

  .text-overlay {
    position: fixed;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) translateY(-50%);
    top: auto;
    bottom: 10%;
    text-align: center !important;
  }

  .text-overlay.visible {
    transform: translateX(-50%) translateY(0);
  }

  .text-overlay-content {
    max-width: 90vw;
  }

  .text-overlay-right .text-overlay-content {
    text-align: center;
  }
}

/* Pin elements at bottom of hero when scrolled past */
body.past-hero #keyboard-canvas {
  position: absolute;
  top: calc(100% - 50vh);
  left: 50%;
  transform: translate(-50%, -50%);
}

body.past-hero .hero-content,
body.past-hero .text-overlay {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}