/* ==========================================================================
   NodeSpace Landing Page Styles
   Design tokens matched to NodeSpace desktop app
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */

:root {
  /* Light Mode Colors */
  --background: hsl(0 0% 98%);
  --foreground: hsl(0 0% 15%);
  --primary: hsl(200 40% 45%);
  --primary-foreground: hsl(0 0% 98%);
  --secondary: hsl(200 12% 92%);
  --muted: hsl(200 12% 94%);
  --muted-foreground: hsl(0 0% 25%);
  --border: hsl(200 12% 88%);
  --ring: hsl(200 40% 55%);

  /* Semantic Colors */
  --success: hsl(142 76% 36%);

  /* Typography */
  --font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-base: 1rem;
  --line-height: 1.6;

  /* Spacing */
  --radius: 0.5rem;
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Transitions */
  --transition-fast: 150ms ease-out;
  --transition-medium: 250ms ease-out;

  /* Layout */
  --container-max-width: 1100px;
  --container-max-width-text: 650px;
  --container-padding: 2rem;
}

/* Dark Mode */
.dark {
  --background: hsl(0 0% 12%);
  --foreground: hsl(0 0% 90%);
  --primary: hsl(200 40% 55%);
  --primary-foreground: hsl(0 0% 95%);
  --secondary: hsl(200 12% 14%);
  --muted: hsl(200 12% 16%);
  --muted-foreground: hsl(0 0% 75%);
  --border: hsl(200 12% 24%);
  --ring: hsl(200 40% 65%);
}

/* --------------------------------------------------------------------------
   Base Styles
   -------------------------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  color: var(--foreground);
  background-color: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-medium), color var(--transition-medium);
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

section {
  padding: 4rem 0;
}

@media (min-width: 768px) {
  section {
    padding: 5rem 0;
  }
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1, h2, h3 {
  font-weight: 600;
  line-height: 1.3;
}

h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
}

h2 {
  font-size: clamp(1.5rem, 3vw, 1.75rem);
}

h3 {
  font-size: 1.125rem;
}

p {
  margin-bottom: var(--space-md);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.header {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--foreground);
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

.logo:hover {
  opacity: 0.8;
  text-decoration: none;
}

.logo svg {
  color: var(--primary);
  flex-shrink: 0;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.btn-primary:hover {
  background-color: hsl(200 40% 40%);
}

.dark .btn-primary:hover {
  background-color: hsl(200 40% 50%);
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

/* --------------------------------------------------------------------------
   Hero Section
   -------------------------------------------------------------------------- */

.hero {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

@media (min-width: 768px) {
  .hero {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }
}

/* Two-column hero grid */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }
}

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

@media (min-width: 900px) {
  .hero-content {
    text-align: left;
  }
}

.hero-headline {
  margin-bottom: 1.25rem;
  color: var(--foreground);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero-subheadline {
  font-size: clamp(1.125rem, 2vw, 1.25rem);
  color: var(--muted-foreground);
  margin: 0 auto 1rem;
  line-height: 1.5;
}

@media (min-width: 900px) {
  .hero-subheadline {
    margin: 0 0 1rem;
  }
}

.hero-audience {
  font-size: clamp(0.9375rem, 1.5vw, 1rem);
  color: var(--muted-foreground);
  margin-bottom: 1rem;
}

@media (min-width: 900px) {
  .hero-audience {
    margin-left: 0;
    margin-right: 0;
  }
}

/* Stats Row */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 1.5rem auto;
  flex-wrap: wrap;
}

@media (min-width: 600px) {
  .stats-row {
    gap: 3rem;
  }
}

@media (min-width: 900px) {
  .stats-row {
    justify-content: flex-start;
    margin: 1.5rem 0;
  }
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-number {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

.stats-note {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  opacity: 0.8;
  margin-top: 0.5rem;
}

@media (min-width: 900px) {
  .stats-note {
    text-align: left;
  }
}

.hero-cta {
  margin-bottom: 0;
}

.cta-note {
  margin-top: 0.75rem;
  font-size: 0.9375rem;
  color: var(--muted-foreground);
}

/* Demo Comparison */
.demo-comparison {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.comparison-intro {
  font-size: 0.9375rem;
  color: var(--muted-foreground);
  text-align: center;
  margin-bottom: 0.5rem;
  font-style: italic;
}

.comparison-item {
  border-radius: calc(var(--radius) * 1.5);
  overflow: hidden;
  background-color: var(--secondary);
  border: 1px solid var(--border);
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.2);
}

.dark .comparison-item {
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
}

.comparison-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.comparison-label {
  font-size: 0.875rem;
  font-weight: 600;
}

.comparison-label-before {
  color: var(--muted-foreground);
}

.comparison-label-after {
  color: var(--primary);
}

.comparison-stats {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  font-family: ui-monospace, monospace;
}

.comparison-video {
  position: relative;
  width: 100%;
}

.comparison-video::before {
  content: '';
  display: block;
  padding-top: 62.5%; /* ~16:10 aspect ratio for terminal recordings */
}

.comparison-video video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Video Replay Button - visible by default, hidden when video plays */
.video-replay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: hsla(0, 0%, 0%, 0.7);
  border: 2px solid hsla(0, 0%, 100%, 0.3);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  opacity: 1;
  visibility: visible;
  transition: opacity var(--transition-medium), visibility var(--transition-medium), transform var(--transition-fast);
}

.video-replay:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background-color: hsla(0, 0%, 0%, 0.85);
}

.video-replay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.video-replay svg {
  margin-left: 4px; /* Optical centering for play icon */
}

/* --------------------------------------------------------------------------
   Problem Section
   -------------------------------------------------------------------------- */

.problem {
  background-color: var(--secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.problem-content {
  text-align: center;
  max-width: var(--container-max-width-text);
  margin: 0 auto;
}

.problem-statement {
  font-size: clamp(1.0625rem, 2vw, 1.25rem);
  color: var(--muted-foreground);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.problem-solution {
  font-size: clamp(1.375rem, 2.5vw, 1.75rem);
  font-weight: 600;
  color: var(--foreground);
}

/* --------------------------------------------------------------------------
   How It Works Section
   -------------------------------------------------------------------------- */

.how-it-works {
  padding: 4rem 0;
}

@media (min-width: 768px) {
  .how-it-works {
    padding: 5rem 0;
  }
}

.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto 2rem;
}

@media (min-width: 768px) {
  .steps-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
  }
}

.step-card {
  text-align: center;
  padding: 1.5rem;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 1.25rem;
  background-color: var(--primary);
  color: var(--primary-foreground);
  font-size: 1.25rem;
  font-weight: 600;
  border-radius: 50%;
}

.step-title {
  margin-bottom: 0.75rem;
  color: var(--foreground);
  font-size: 1.125rem;
  font-weight: 600;
}

.step-description {
  font-size: 0.9375rem;
  color: var(--muted-foreground);
  line-height: 1.6;
}

.how-it-works-note {
  text-align: center;
  font-size: 0.9375rem;
  color: var(--muted-foreground);
  max-width: 600px;
  margin: 0 auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   Features Section
   -------------------------------------------------------------------------- */

.section-title {
  text-align: center;
  margin-bottom: 2.5rem;
  color: var(--foreground);
}

.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  max-width: 1000px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
  }
}

.feature-card {
  padding: 2rem;
  background-color: var(--secondary);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.feature-card:hover {
  transform: translateY(-2px);
}

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

.feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 1.25rem;
  background-color: var(--muted);
  border-radius: calc(var(--radius) * 1.25);
  color: var(--primary);
}

.feature-title {
  margin-bottom: 0.75rem;
  color: var(--foreground);
  font-size: 1.125rem;
}

.feature-description {
  font-size: 1rem;
  color: var(--muted-foreground);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Roadmap Section
   -------------------------------------------------------------------------- */

.roadmap {
  background-color: var(--secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.roadmap-items {
  max-width: 600px;
  margin: 0 auto 3rem;
}

.roadmap-item {
  display: flex;
  gap: 1.5rem;
  padding: 1.75rem 0;
}

.roadmap-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.roadmap-marker {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin-top: 8px;
  background-color: var(--primary);
  border-radius: 50%;
}

.roadmap-title {
  margin-bottom: 0.5rem;
  color: var(--foreground);
  font-size: 1.125rem;
  font-weight: 500;
}

.roadmap-description {
  font-size: 1rem;
  color: var(--muted-foreground);
  line-height: 1.6;
}

.roadmap-note {
  text-align: center;
  font-size: 1rem;
  color: var(--muted-foreground);
}

/* --------------------------------------------------------------------------
   Signup Section
   -------------------------------------------------------------------------- */

.signup {
  text-align: center;
  padding: 5rem 0;
}

.signup-subtitle {
  font-size: 1.125rem;
  color: var(--muted-foreground);
  margin-bottom: 2rem;
}

.signup-form {
  max-width: 480px;
  margin: 0 auto;
}

.form-group {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.form-group-optional {
  flex-direction: column;
  text-align: left;
}

.form-label {
  display: block;
  margin-bottom: var(--space-sm);
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.form-input,
.form-textarea,
.form-select {
  flex: 1;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--foreground);
  background-color: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px hsla(200, 40%, 55%, 0.2);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--muted-foreground);
  opacity: 0.6;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-note {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

/* Turnstile widget */
.cf-turnstile {
  margin: var(--space-lg) 0;
  text-align: left;
}

/* Signup Success State */
.signup-success {
  padding: var(--space-xl);
}

.success-icon {
  color: var(--success);
  margin-bottom: var(--space-md);
}

.success-title {
  margin-bottom: var(--space-sm);
  color: var(--foreground);
}

.success-message {
  color: var(--muted-foreground);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  padding: var(--space-2xl) 0;
  text-align: center;
  border-top: 1px solid var(--border);
}

.footer-credit {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: var(--space-lg);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  margin-bottom: var(--space-lg);
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.875rem;
  color: var(--muted-foreground);
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--foreground);
  text-decoration: none;
}

.footer-link svg {
  flex-shrink: 0;
}

.footer-note {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  opacity: 0.8;
}

/* --------------------------------------------------------------------------
   Responsive Design
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  :root {
    --container-padding: 1.5rem;
  }

  section {
    padding: 4rem 0;
  }

  .hero {
    padding-top: 4rem;
    padding-bottom: 3rem;
  }

  .form-group:not(.form-group-optional) {
    flex-direction: column;
  }

  .form-group .btn {
    width: 100%;
  }

  .footer-links {
    flex-direction: column;
    gap: var(--space-md);
  }
}

@media (max-width: 480px) {
  :root {
    --container-padding: 1rem;
  }
}

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

/* --------------------------------------------------------------------------
   Reduced Motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
