/* ============================================
   Nate - PHP Template Engine - Static Site CSS
   ============================================ */

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #818cf8;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --code-bg: #1e1e2e;
  --code-text: #cdd6f4;
  --sidebar-width: 260px;
  --header-height: 64px;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
}

.site-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
}

.site-header .logo svg {
  width: 32px;
  height: 32px;
}

.site-header .logo span {
  color: var(--gray-800);
}

.site-header .logo span.highlight {
  color: var(--primary);
}

.header-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-nav a {
  text-decoration: none;
  color: var(--gray-600);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.header-nav a:hover {
  color: var(--primary);
  background: var(--gray-100);
}

.header-nav a.github-link {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--gray-600);
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: #fff;
  border-right: 1px solid var(--gray-200);
  overflow-y: auto;
  padding: 24px 0;
  z-index: 50;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav .nav-section {
  padding: 0 16px;
  margin-bottom: 20px;
}

.sidebar-nav .nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar-nav a {
  display: block;
  padding: 7px 12px;
  text-decoration: none;
  color: var(--gray-600);
  font-size: 0.875rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.sidebar-nav a:hover {
  color: var(--primary);
  background: var(--gray-100);
}

.sidebar-nav a.active {
  color: var(--primary);
  background: #eef2ff;
  font-weight: 600;
}

/* Main content */
.main-content {
  margin-top: var(--header-height);
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 48px 64px;
  max-width: 900px;
}

.main-content.landing {
  margin-left: 0;
  max-width: none;
  padding: 0;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 100px 24px 80px;
  background: linear-gradient(135deg, #eef2ff 0%, #fff 50%, #fffbeb 100%);
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
  color: var(--gray-900);
}

.hero h1 .highlight {
  color: var(--primary);
}

.hero .subtitle {
  font-size: 1.25rem;
  color: var(--gray-500);
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.15s ease;
  border: none;
  cursor: pointer;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
  background: #fff;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
  border-color: var(--gray-400);
  background: var(--gray-50);
  transform: translateY(-1px);
}

/* Hero code block */
.hero-code {
  max-width: 640px;
  margin: 40px auto 0;
  text-align: left;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.hero-code .code-header {
  background: #181825;
  color: var(--gray-400);
  padding: 10px 16px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-code .code-header .dots {
  display: flex;
  gap: 6px;
}

.hero-code .code-header .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.hero-code .code-header .dot-red { background: #f38ba8; }
.hero-code .code-header .dot-yellow { background: #f9e2af; }
.hero-code .code-header .dot-green { background: #a6e3a1; }

.hero-code pre {
  margin: 0;
  padding: 20px 24px;
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 0.925rem;
  line-height: 1.7;
  overflow-x: auto;
}

.hero-code code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

/* Features section */
.features-section {
  padding: 80px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.features-section h2 {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 48px;
  color: var(--gray-900);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.feature-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 28px;
  transition: all 0.2s ease;
}

.feature-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.08);
  transform: translateY(-2px);
}

.feature-card .icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 1.25rem;
}

.feature-card .icon-purple { background: #eef2ff; color: var(--primary); }
.feature-card .icon-amber { background: #fffbeb; color: var(--accent); }
.feature-card .icon-green { background: #ecfdf5; color: #10b981; }
.feature-card .icon-blue { background: #eff6ff; color: #3b82f6; }
.feature-card .icon-rose { background: #fff1f2; color: #e11d48; }
.feature-card .icon-cyan { background: #ecfeff; color: #06b6d4; }

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--gray-900);
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--gray-500);
  line-height: 1.6;
}

/* Comparison section */
.comparison-section {
  background: #fff;
  padding: 80px 24px;
  border-top: 1px solid var(--gray-200);
}

.comparison-section h2 {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--gray-900);
}

.comparison-section > p {
  text-align: center;
  color: var(--gray-500);
  margin-bottom: 40px;
}

.comparison-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.comparison-card {
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
}

.comparison-card h3 {
  padding: 14px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border-bottom: 1px solid var(--gray-200);
}

.comparison-card.nate h3 {
  background: #eef2ff;
  color: var(--primary);
}

.comparison-card.twig h3 {
  background: var(--gray-100);
  color: var(--gray-600);
}

.comparison-card pre {
  margin: 0;
  padding: 20px;
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 0.875rem;
  line-height: 1.7;
  overflow-x: auto;
}

.comparison-card code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

/* CTA Section */
.cta-section {
  text-align: center;
  padding: 80px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
}

.cta-section h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.cta-section p {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 32px;
}

.cta-section .btn {
  background: #fff;
  color: var(--primary);
}

.cta-section .btn:hover {
  background: var(--gray-100);
  transform: translateY(-1px);
}

/* Footer */
.site-footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 40px 24px;
  text-align: center;
  font-size: 0.875rem;
}

.site-footer a {
  color: var(--primary-light);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ---- Documentation Pages ---- */

.page-header {
  margin-bottom: 40px;
}

.page-header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.page-header p {
  font-size: 1.1rem;
  color: var(--gray-500);
}

/* Content typography */
.content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
}

.content h2:first-of-type {
  margin-top: 0;
}

.content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-top: 32px;
  margin-bottom: 12px;
}

.content p {
  margin-bottom: 16px;
  color: var(--gray-600);
  line-height: 1.7;
}

.content ul, .content ol {
  margin-bottom: 20px;
  padding-left: 24px;
  color: var(--gray-600);
}

.content li {
  margin-bottom: 6px;
}

.content a {
  color: var(--primary);
  text-decoration: none;
}

.content a:hover {
  text-decoration: underline;
}

.content strong {
  color: var(--gray-800);
}

.content .note {
  background: #eef2ff;
  border-left: 4px solid var(--primary);
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 24px;
}

.content .note p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.content .note code {
  background: #dde3fc;
}

.content .tip {
  background: #fffbeb;
  border-left: 4px solid var(--accent);
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 24px;
}

.content .tip p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

/* Code blocks in docs */
.content pre {
  margin-bottom: 24px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--code-bg);
}

.content pre code {
  display: block;
  padding: 20px 24px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--code-text);
  overflow-x: auto;
}

.content :not(pre) > code {
  background: var(--gray-100);
  color: var(--primary-dark);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.85em;
}

/* API Reference Tables */
.api-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.api-table th {
  background: var(--gray-100);
  font-weight: 600;
  color: var(--gray-700);
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
}

.api-table td {
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  vertical-align: top;
}

.api-table td:first-child code {
  font-weight: 600;
  color: var(--primary-dark);
}

/* Feature table from README */
.feature-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.feature-table th {
  background: var(--gray-100);
  font-weight: 600;
  color: var(--gray-700);
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
}

.feature-table td {
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .main-content {
    padding: 32px 24px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-toggle {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: 24px 20px;
  }

  .hero h1 {
    font-size: 2.25rem;
  }

  .hero .subtitle {
    font-size: 1.05rem;
  }

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

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

  .page-header h1 {
    font-size: 1.75rem;
  }

  .header-nav a span.nav-label {
    display: none;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 60px 16px 50px;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
}
