/* Jarvis AI-Native Design System v1.0 */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

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

:root {
  /* AI-Native Color Palette */
  --primary: #7C3AED;
  --on-primary: #FFFFFF;
  --secondary: #A78BFA;
  --accent: #0891B2;
  --background: #FAF5FF;
  --foreground: #1E1B4B;
  --card: #FFFFFF;
  --muted: #ECEEF9;
  --border: #DDD6FE;
  --ring: #7C3AED;
  
  /* Typography */
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* Base styles */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-body);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  color: var(--foreground);
}

h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.875rem;
  font-weight: 600;
  margin-bottom: 0.875rem;
  margin-top: 2rem;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}

p {
  margin-bottom: 1rem;
  color: var(--foreground);
  opacity: 0.8;
}

strong {
  color: var(--foreground);
  font-weight: 700;
}

/* Links */
a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
  cursor: pointer;
}

a:hover {
  color: var(--secondary);
}

a:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip to content */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary);
  color: var(--on-primary);
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 0.875rem;
  z-index: 1000;
  transition: top var(--transition-fast);
}

.skip-to-content:focus {
  top: 6px;
}

/* Layout */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
}

.page-centered {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 4rem 1.5rem 2rem;
}

.page-centered .page {
  padding: 0;
}

body.home-page .page-centered {
  padding: 3rem 1.5rem 2rem;
}

/* Back navigation */
.back {
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
  color: var(--primary);
  margin-bottom: 2rem;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.back:hover {
  transform: translateX(-4px);
  color: var(--secondary);
}

.back:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Cards */
.card, a.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  text-decoration: none;
  min-height: 120px;
  cursor: pointer;
}

a.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

a.card:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.5rem;
}

.card-desc {
  font-size: 0.875rem;
  color: var(--foreground);
  opacity: 0.7;
  line-height: 1.5;
}

/* Grid layouts */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

body.home-page .grid {
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

/* Project list */
.projects {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

a.project {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  text-decoration: none;
  cursor: pointer;
}

a.project:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

a.project:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.project-name {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
}

.project-desc {
  font-size: 0.875rem;
  color: var(--foreground);
  opacity: 0.7;
  line-height: 1.5;
}

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: var(--muted);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tag-launched {
  background: #DCFCE7;
  color: #166534;
}

.tag-ideation {
  background: #F3F4F6;
  color: #6B7280;
}

/* Buttons & CTAs */
.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--on-primary);
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-normal);
  margin: 1rem 0;
  cursor: pointer;
  border: none;
}

.cta-button:hover {
  background: var(--secondary);
  color: var(--on-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.cta-button:active {
  transform: translateY(0);
}

.cta-secondary {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.cta-secondary:hover {
  background: var(--primary);
  color: var(--on-primary);
}

/* Hero sections */
.hero {
  text-align: center;
  padding: 3rem 0;
  max-width: 800px;
  margin: 0 auto;
}

body.home-page .hero {
  padding: 2.25rem 0 1.5rem;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.25rem;
  color: var(--foreground);
  opacity: 0.8;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Content sections */
.intro {
  font-size: 1.125rem;
  color: var(--foreground);
  opacity: 0.8;
  margin-bottom: 2rem;
  line-height: 1.7;
}

.home-about {
  margin-top: 2rem;
}

.subtitle {
  font-size: 1.125rem;
  color: var(--foreground);
  opacity: 0.7;
  margin-bottom: 2rem;
  font-style: italic;
}

.note {
  font-size: 0.875rem;
  color: var(--foreground);
  opacity: 0.7;
  margin-bottom: 1.5rem;
  font-style: italic;
}

/* Callouts */
.callout {
  background: var(--muted);
  border-left: 4px solid var(--primary);
  padding: 1rem 1.5rem;
  border-radius: 0 8px 8px 0;
  margin: 1.5rem 0;
  font-size: 0.875rem;
}

.tldr {
  background: linear-gradient(135deg, #EEF2FF, #E0E7FF);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
}

.tldr h3 {
  color: var(--primary);
  margin-bottom: 0.75rem;
  margin-top: 0;
}

/* Code blocks */
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  background: var(--muted);
  color: var(--foreground);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

pre {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.875rem;
}

th {
  text-align: left;
  font-weight: 600;
  color: var(--foreground);
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border);
  background: var(--muted);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

/* Lists */
ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
  color: var(--foreground);
  opacity: 0.8;
}

/* Section dividers */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* Footer */
.footer {
  margin-top: 3rem;
  padding-top: 2rem;
  font-size: 0.875rem;
  color: var(--foreground);
  opacity: 0.6;
  text-align: center;
  border-top: 1px solid var(--border);
}

body.home-page .footer {
  margin-top: 2.25rem;
}

.footer a {
  color: var(--foreground);
  opacity: 0.7;
  transition: opacity var(--transition-fast);
  cursor: pointer;
}

.footer a:hover {
  opacity: 1;
  color: var(--primary);
}

/* Animations */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fallback-show 0.01s 1s forwards; /* Fallback: show after 1s if JS fails */
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.slide-up {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive design */
@media (max-width: 1440px) {
  .page {
    max-width: 1000px;
  }
}

@media (max-width: 1024px) {
  .page {
    padding: 1.5rem 1rem;
  }
  
  .page-centered {
    padding: 3rem 1rem 2rem;
  }

  body.home-page .page-centered {
    padding: 2.5rem 1rem 2rem;
  }
  
  .hero h1 {
    font-size: 2.5rem;
  }
  
  .grid, .grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .hero p {
    font-size: 1.125rem;
  }
  
  .grid, .grid-3 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .card, a.card, a.project {
    padding: 1.25rem;
  }
  
  .page {
    padding: 1rem 0.75rem;
  }
  
  .page-centered {
    padding: 2rem 0.75rem 1.5rem;
  }

  body.home-page .page-centered {
    padding: 1.75rem 0.75rem 1.5rem;
  }
}

@media (max-width: 375px) {
  .page {
    padding: 0.75rem 0.5rem;
  }
  
  .page-centered {
    padding: 1.5rem 0.5rem 1rem;
  }

  body.home-page .page-centered {
    padding: 1.25rem 0.5rem 1rem;
  }
  
  .card, a.card, a.project {
    padding: 1rem;
  }
  
  .hero {
    padding: 2rem 0;
  }
  
  .hero h1 {
    font-size: 1.75rem;
  }
}

/* Special page styles */

/* Learn page specific styles */
.learn-hero {
  text-align: center;
  padding: 2rem 0 1rem;
  max-width: 800px;
  margin: 0 auto;
}

.learn-hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.learn-hero .subtitle {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.learn-hero .purpose {
  font-size: 1rem;
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto;
}

.cta-box {
  background: linear-gradient(135deg, var(--muted), #E0E7FF);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 2rem 0;
}

.cta-box h3 {
  color: var(--primary);
  margin: 0 0 0.75rem 0;
  font-size: 1.125rem;
}

.cta-box p {
  margin: 0 0 1rem 0;
  color: var(--foreground);
  opacity: 0.8;
}

/* Balance page styles - Hebrew support */
.hero-hebrew h1 {
  font-family: var(--font-heading);
  direction: rtl;
  text-align: center;
  font-size: 3rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-hebrew p {
  direction: rtl;
  text-align: center;
  font-size: 1.25rem;
  margin-bottom: 2rem;
  opacity: 0.8;
}

.emotional-section {
  background: linear-gradient(135deg, var(--background), var(--muted));
  border-radius: 16px;
  padding: 3rem 2rem;
  margin: 3rem 0;
  text-align: center;
}

.emotional-section h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--primary);
}

.emotional-section p {
  font-size: 1.125rem;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.whatsapp-cta {
  background: #25D366;
  color: white;
  font-size: 1.125rem;
  padding: 1rem 2rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  transition: all var(--transition-normal);
  cursor: pointer;
}

.whatsapp-cta:hover {
  background: #1DA851;
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Hebrew text direction support */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .back {
  transform: scaleX(-1);
}

[dir="rtl"] .back:hover {
  transform: scaleX(-1) translateX(-4px);
}

/* Version indicator */
.version {
  font-size: 0.75rem;
  color: var(--foreground);
  opacity: 0.5;
  text-align: center;
  margin-top: 0.5rem;
}
@keyframes fallback-show {
  to { opacity: 1; transform: translateY(0); }
}
