/* ========================================
   Step Ahead AI Tools — Main Stylesheet
   ======================================== */

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

:root {
  --primary: #1a56db;
  --primary-dark: #1345b5;
  --primary-light: #e8effc;
  --accent: #0d9488;
  --accent-light: #e6f7f5;
  --dark: #111827;
  --text: #1f2937;
  --text-secondary: #4b5563;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --bg: #ffffff;
  --bg-alt: #f9fafb;
  --bg-card: #ffffff;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --max-width: 1200px;
  --header-height: 72px;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--dark);
  line-height: 1.3;
  font-weight: 700;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
p { margin-bottom: 1rem; }

/* Layout */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 5rem 0; }
.section-alt { background: var(--bg-alt); }
.section-header { text-align: center; margin-bottom: 3rem; }
.section-header h2 { margin-bottom: 0.75rem; }
.section-header p { color: var(--text-secondary); max-width: 640px; margin: 0 auto; font-size: 1.125rem; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-height);
  max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem;
}
.logo { font-size: 1.25rem; font-weight: 800; color: var(--dark); display: flex; align-items: center; gap: 0.5rem; }
.logo:hover { text-decoration: none; }
.logo-icon { width: 32px; height: 32px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; font-weight: 800; font-size: 1rem; }
.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a { color: var(--text-secondary); font-size: 0.9375rem; font-weight: 500; transition: color 0.15s; }
.nav-links a:hover, .nav-links a.active { color: var(--primary); text-decoration: none; }
.nav-cta {
  background: var(--primary); color: white !important; padding: 0.5rem 1.25rem;
  border-radius: var(--radius); font-weight: 600; transition: background 0.15s;
}
.nav-cta:hover { background: var(--primary-dark); }

/* Mobile Menu */
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0.5rem; }
.menu-toggle span { display: block; width: 24px; height: 2px; background: var(--dark); margin: 5px 0; transition: 0.3s; }
.mobile-menu {
  display: none; position: fixed; top: var(--header-height); left: 0; right: 0; bottom: 0;
  background: white; z-index: 99; padding: 1.5rem;
  flex-direction: column; gap: 0.5rem;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  display: block; padding: 0.75rem 1rem; color: var(--text); font-size: 1.125rem;
  font-weight: 500; border-radius: var(--radius); transition: background 0.15s;
}
.mobile-menu a:hover { background: var(--bg-alt); text-decoration: none; }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .menu-toggle { display: block; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.75rem; border-radius: var(--radius); font-weight: 600;
  font-size: 1rem; border: none; cursor: pointer; transition: all 0.15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-alt); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: #0b7f74; }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-lg { padding: 1rem 2.25rem; font-size: 1.125rem; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }

/* Hero */
.hero {
  padding: 6rem 0 5rem;
  background: linear-gradient(135deg, var(--bg) 0%, var(--primary-light) 100%);
}
.hero-content { max-width: 720px; }
.hero h1 { font-size: 3rem; margin-bottom: 1.25rem; letter-spacing: -0.025em; }
.hero .subtitle { font-size: 1.25rem; color: var(--text-secondary); margin-bottom: 2rem; line-height: 1.6; }
.hero-ctas { display: flex; gap: 1rem; flex-wrap: wrap; }

@media (max-width: 640px) {
  .hero h1 { font-size: 2rem; }
  .hero .subtitle { font-size: 1.0625rem; }
  .hero-ctas { flex-direction: column; }
  .hero-ctas .btn { text-align: center; justify-content: center; }
}

/* Cards */
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.75rem; transition: box-shadow 0.2s, border-color 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); border-color: #d1d5db; }
.card-grid { display: grid; gap: 1.5rem; }
.card-grid-2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.card-grid-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card-grid-4 { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

/* Tool Card */
.tool-card .tool-category { font-size: 0.8125rem; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.tool-card h3 { margin-bottom: 0.5rem; }
.tool-card .tool-tagline { color: var(--text-secondary); font-size: 0.9375rem; margin-bottom: 1rem; }
.tool-card .tool-meta { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tool-card .meta-item { font-size: 0.8125rem; color: var(--text-light); display: flex; align-items: center; gap: 0.25rem; }
.tool-card .tool-score { display: inline-flex; align-items: center; gap: 0.25rem; background: var(--accent-light); color: var(--accent); padding: 0.25rem 0.75rem; border-radius: 100px; font-weight: 700; font-size: 0.875rem; }
.tool-card .tool-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }

/* Tags */
.tag {
  display: inline-block; padding: 0.25rem 0.75rem; border-radius: 100px;
  font-size: 0.8125rem; font-weight: 500; background: var(--bg-alt); color: var(--text-secondary);
  border: 1px solid var(--border);
}
.tag-primary { background: var(--primary-light); color: var(--primary); border-color: transparent; }
.tag-accent { background: var(--accent-light); color: var(--accent); border-color: transparent; }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Score */
.score-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.score-fill { height: 100%; background: var(--accent); border-radius: 3px; }
.score-label { font-size: 0.8125rem; color: var(--text-light); display: flex; justify-content: space-between; margin-bottom: 0.25rem; }

/* Filters */
.filters-bar {
  display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 2rem;
  padding: 1.25rem; background: var(--bg-alt); border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.filter-btn {
  padding: 0.5rem 1rem; border-radius: 100px; border: 1px solid var(--border);
  background: white; color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.search-input {
  width: 100%; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 1rem; margin-bottom: 1rem; transition: border-color 0.15s;
}
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* Quiz */
.quiz-container { max-width: 720px; margin: 0 auto; }
.quiz-progress { margin-bottom: 2rem; }
.quiz-progress-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.quiz-progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s; }
.quiz-progress-text { font-size: 0.875rem; color: var(--text-light); margin-top: 0.5rem; text-align: right; }
.quiz-question { margin-bottom: 2rem; }
.quiz-question h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }
.quiz-options { display: flex; flex-direction: column; gap: 0.75rem; }
.quiz-option {
  padding: 1rem 1.25rem; border: 2px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all 0.15s; font-size: 1rem;
}
.quiz-option:hover { border-color: var(--primary); background: var(--primary-light); }
.quiz-option.selected { border-color: var(--primary); background: var(--primary-light); font-weight: 600; }
.quiz-nav { display: flex; justify-content: space-between; margin-top: 2rem; }

/* Quiz Results */
.quiz-results { display: none; }
.quiz-results.visible { display: block; }
.result-stack { margin-bottom: 2rem; }
.result-stack h3 { margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.result-stack .stack-tools { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.75rem; }
.result-stack .stack-tool {
  padding: 0.5rem 1rem; background: var(--primary-light); border-radius: var(--radius);
  font-weight: 600; color: var(--primary); font-size: 0.9375rem;
}
.result-rationale { color: var(--text-secondary); margin-bottom: 1rem; line-height: 1.7; }
.result-section { margin-bottom: 2.5rem; padding-bottom: 2.5rem; border-bottom: 1px solid var(--border); }
.result-section:last-child { border-bottom: none; }

/* Review */
.review-header { padding: 4rem 0 3rem; background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.review-header h1 { margin-bottom: 0.5rem; }
.review-header .review-tagline { font-size: 1.25rem; color: var(--text-secondary); margin-bottom: 1.5rem; }
.review-meta { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: center; }
.review-body { padding: 3rem 0; }
.review-section { margin-bottom: 3rem; }
.review-section h2 { margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--primary-light); }
.review-sidebar { position: sticky; top: calc(var(--header-height) + 2rem); }
.review-layout { display: grid; grid-template-columns: 1fr 320px; gap: 3rem; }
@media (max-width: 900px) { .review-layout { grid-template-columns: 1fr; } .review-sidebar { position: static; } }
.sidebar-card { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem; }
.sidebar-card h4 { margin-bottom: 1rem; }

/* Comparison */
.comparison-table { width: 100%; border-collapse: collapse; margin: 2rem 0; }
.comparison-table th, .comparison-table td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.comparison-table th { background: var(--bg-alt); font-weight: 600; }
.vs-badge { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--bg-alt); border: 2px solid var(--border); font-weight: 700; color: var(--text-light); font-size: 0.875rem; }

/* Course */
.course-module { margin-bottom: 2rem; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.course-module-header {
  padding: 1rem 1.5rem; background: var(--bg-alt); cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; transition: background 0.15s;
}
.course-module-header:hover { background: var(--border); }
.course-module-content { padding: 1.5rem; display: none; }
.course-module.open .course-module-content { display: block; }
.course-module-header .toggle-icon { transition: transform 0.2s; }
.course-module.open .toggle-icon { transform: rotate(180deg); }

/* Workflow */
.workflow-step { display: flex; gap: 1.5rem; margin-bottom: 1.5rem; }
.step-number {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary); color: white; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 1rem;
}
.step-content h4 { margin-bottom: 0.25rem; }
.step-content p { color: var(--text-secondary); }

/* Pros/Cons */
.pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 1.5rem 0; }
@media (max-width: 640px) { .pros-cons { grid-template-columns: 1fr; } }
.pros h4, .cons h4 { margin-bottom: 0.75rem; }
.pros li, .cons li { padding: 0.375rem 0; padding-left: 1.5rem; position: relative; font-size: 0.9375rem; }
.pros li::before { content: '✓'; position: absolute; left: 0; color: var(--success); font-weight: 700; }
.cons li::before { content: '✗'; position: absolute; left: 0; color: var(--danger); font-weight: 700; }

/* CTA Section */
.cta-section { padding: 4rem 0; text-align: center; background: var(--primary); color: white; }
.cta-section h2 { color: white; margin-bottom: 1rem; }
.cta-section p { color: rgba(255,255,255,0.85); margin-bottom: 2rem; max-width: 560px; margin-left: auto; margin-right: auto; }
.cta-section .btn-primary { background: white; color: var(--primary); }
.cta-section .btn-primary:hover { background: var(--bg-alt); }

/* Newsletter */
.newsletter-form { display: flex; gap: 0.75rem; max-width: 480px; }
.newsletter-form input {
  flex: 1; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 1rem;
}
.newsletter-form input:focus { outline: none; border-color: var(--primary); }
@media (max-width: 480px) { .newsletter-form { flex-direction: column; } }

/* Contact Form */
.contact-form { max-width: 600px; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.375rem; font-weight: 600; font-size: 0.9375rem; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 1rem; font-family: inherit; transition: border-color 0.15s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.form-group textarea { resize: vertical; min-height: 120px; }
.form-message { padding: 1rem; border-radius: var(--radius); margin-top: 1rem; display: none; }
.form-message.success { display: block; background: #ecfdf5; color: var(--success); border: 1px solid #a7f3d0; }
.form-message.error { display: block; background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }

/* Footer */
.site-footer { background: var(--dark); color: #9ca3af; padding: 4rem 0 2rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 3rem; margin-bottom: 3rem; }
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-brand p { margin-top: 0.75rem; font-size: 0.9375rem; line-height: 1.6; }
.footer-col h4 { color: white; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1rem; }
.footer-col a { display: block; color: #9ca3af; font-size: 0.9375rem; padding: 0.25rem 0; transition: color 0.15s; }
.footer-col a:hover { color: white; text-decoration: none; }
.footer-bottom { border-top: 1px solid #374151; padding-top: 2rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; font-size: 0.875rem; }

/* Breadcrumbs */
.breadcrumbs { padding: 0.75rem 0; font-size: 0.875rem; color: var(--text-light); }
.breadcrumbs a { color: var(--text-light); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs span { margin: 0 0.5rem; }

/* Empty State */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-light); }
.empty-state h3 { margin-bottom: 0.5rem; color: var(--text-secondary); }

/* Utility */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* Feature Grid (Home) */
.feature-item { text-align: center; padding: 2rem 1.5rem; }
.feature-icon { width: 56px; height: 56px; border-radius: 12px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; font-size: 1.5rem; font-weight: 700; }
.feature-item h3 { font-size: 1.125rem; margin-bottom: 0.5rem; }
.feature-item p { color: var(--text-secondary); font-size: 0.9375rem; }

/* Stack Example */
.stack-example { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; }
.stack-example h4 { margin-bottom: 0.75rem; }
.stack-flow { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 1rem 0; }
.stack-flow .flow-item { padding: 0.5rem 1rem; background: var(--primary-light); border-radius: var(--radius); font-weight: 600; color: var(--primary); font-size: 0.875rem; }
.stack-flow .flow-arrow { color: var(--text-light); font-weight: 700; }

/* Related Content */
.related-section { margin-top: 3rem; padding-top: 3rem; border-top: 1px solid var(--border); }
.related-section h3 { margin-bottom: 1.5rem; }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--border); }
.faq-question {
  padding: 1.25rem 0; cursor: pointer; display: flex; justify-content: space-between;
  align-items: center; font-weight: 600; font-size: 1.0625rem;
}
.faq-answer { padding-bottom: 1.25rem; display: none; color: var(--text-secondary); line-height: 1.7; }
.faq-item.open .faq-answer { display: block; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease-out; }

/* Print */
@media print {
  .site-header, .site-footer, .mobile-menu, .menu-toggle, .btn { display: none !important; }
  body { font-size: 12pt; }
}
