/* Reset and base */
* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.7;
  margin: 0;
  padding: 0;
  color: #333;
  background: #fff;
}

/* Offset anchor links for sticky header */
h1, h2, h3, h4, h5, h6 {
  scroll-margin-top: 5rem;
}

/* Site Navigation */
.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  background: #fff;
}

.site-nav-wrapper {
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: #111;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: #4b5563;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.nav-links a:hover {
  color: #4f46e5;
}

/* Layout */
.layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  min-height: calc(100vh - 150px);
}

.layout:has(.home-page) {
  max-width: none;
  justify-content: center;
}

/* Sidebar */
.sidebar {
  width: 260px;
  padding: 2rem 1.5rem;
  border-right: 1px solid #e5e7eb;
  background: #fafafa;
  flex-shrink: 0;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin: 0 0 0.75rem 0;
  font-weight: 600;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li {
  margin: 0.25rem 0;
}

.sidebar ul ul {
  margin-left: 1rem;
  margin-top: 0.25rem;
}

.sidebar a {
  color: #374151;
  text-decoration: none;
  font-size: 0.9rem;
  display: block;
  padding: 0.25rem 0;
  transition: color 0.15s;
}

.sidebar a:hover {
  color: #4f46e5;
}

/* Main content */
main {
  flex: 1;
  padding: 2rem 3rem;
  max-width: 800px;
}

main.with-sidebar {
  max-width: none;
}

main.home-page {
  max-width: none;
  padding: 0;
  margin: 0 auto;
}

/* Typography */
h1, h2, h3, h4 {
  color: #111;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.25rem;
  margin-top: 0;
  line-height: 1.2;
}

h2 {
  font-size: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.1rem;
}

p {
  margin: 1rem 0;
}

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

li {
  margin: 0.5rem 0;
}

/* Links */
main a {
  color: #4f46e5;
  text-decoration: none;
}

main a:hover {
  text-decoration: underline;
}

/* Visualization container */
.visualization {
  margin: 2rem 0;
  padding: 1.5rem;
  background: #fafafa;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

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

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

th {
  font-weight: 600;
  background: #f9fafb;
  color: #374151;
}

tr:hover {
  background: #f9fafb;
}

/* Page navigation */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
}

.page-nav a {
  padding: 0.75rem 1rem;
  background: #f3f4f6;
  border-radius: 8px;
  font-weight: 500;
  transition: background 0.15s;
}

.page-nav a:hover {
  background: #e5e7eb;
  text-decoration: none;
}

.next-link {
  margin-left: auto;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 2rem;
  color: #6b7280;
  font-size: 0.875rem;
  border-top: 1px solid #e5e7eb;
}

/* Helper text */
.hint {
  font-size: 0.875rem;
  color: #6b7280;
  font-style: italic;
}

/* Callout boxes */
.callout {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin: 1.5rem 0;
}

.callout-info {
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
}

.callout-tip {
  background: #ecfdf5;
  border-left: 4px solid #10b981;
}

.callout-warning {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
}

/* Budget example box */
.budget-example {
  background: #f9fafb;
  padding: 1.5rem;
  border-radius: 8px;
  margin: 1.5rem 0;
}

.budget-example h4 {
  margin-top: 0;
  color: #374151;
}

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

.hero h1,
.hero-headline {
  font-size: 2.75rem;
  margin-bottom: 1.25rem;
  line-height: 1.2;
}

.hero-headline {
  font-size: 3rem;
  margin-top: 0;
}

.hero-accent {
  color: #4f46e5;
  font-size: 2.25rem;
  font-weight: 600;
}

.hero p {
  font-size: 1.1rem;
  color: #4b5563;
  max-width: 600px;
  margin: 3.5rem auto 3.5rem auto;
  line-height: 1.5;
}

/* Home page sections */
.home-section {
  padding: 3rem 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.home-section.tight-top {
  padding-top: 0.5rem;
}

.home-section.tight-top h2 {
  margin-top: 0;
  margin-bottom: 0;
}

.home-section.alt-bg {
  background: #f9fafb;
  max-width: none;
  padding: 4rem 3rem;
}

.home-section.alt-bg > * {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.home-section h2 {
  text-align: center;
  border-bottom: none;
  margin-bottom: 1.5rem;
}

/* Problem cards */
.problem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.problem-card {
  padding: 1.25rem;
  background: #fef2f2;
  border-radius: 8px;
  border-left: 4px solid #ef4444;
}

.problem-card strong {
  color: #991b1b;
}

.problem-card p {
  margin: 0.75rem 0 0 0;
  line-height: 1.5;
}

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

.feature-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.feature-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.feature-text {
  font-size: 0.95rem;
  color: #374151;
}

/* Learning path */
.path-container {
  margin-top: 2rem;
}

.path-step {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 1.5rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.path-step:last-child {
  border-bottom: none;
}

.path-number {
  width: 40px;
  height: 40px;
  background: #4f46e5;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.path-content h4 {
  margin: 0 0 0.5rem 0;
  color: #111;
}

.path-content p {
  margin: 0 0 0.5rem 0;
  color: #4b5563;
}

.path-content a {
  font-weight: 500;
}

/* Tool cards */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.tool-card {
  display: block;
  padding: 1.25rem;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.tool-card:hover {
  border-color: #4f46e5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
  transform: translateY(-2px);
  text-decoration: none;
}

.tool-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.tool-name {
  font-weight: 600;
  color: #111;
  margin-bottom: 0.5rem;
}

.tool-desc {
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.4;
}

/* CTA section */
.cta-section {
  text-align: center;
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.cta-section h2 {
  margin-bottom: 1rem;
}

.cta-section p {
  max-width: 600px;
  margin: 0 auto 2rem auto;
  color: #4b5563;
}

.cta-subtext {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.75rem !important;
  margin-bottom: 0 !important;
}

.cta-button {
  display: inline-block;
  background: #4f46e5;
  color: white !important;
  padding: 0.875rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.15s;
}

.cta-button:hover {
  background: #4338ca;
  text-decoration: none !important;
}

/* Topic cards on home page */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.topic-card {
  padding: 1.5rem;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.topic-card:hover {
  border-color: #4f46e5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.topic-card h3 {
  margin-top: 0;
  color: #111;
}

.topic-card p {
  color: #4b5563;
  margin-bottom: 0;
}

/* Responsive */
@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem;
  }

  .sidebar-section {
    display: inline-block;
    margin-right: 2rem;
    margin-bottom: 1rem;
  }

  main {
    padding: 1.5rem;
  }
}

@media (max-width: 600px) {
  .site-nav {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .nav-links {
    gap: 1rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  .hero h1,
  .hero-headline {
    font-size: 2rem;
  }

  .hero-accent {
    font-size: 1.5rem;
  }

  .hero {
    padding: 2rem 1.5rem 1rem 1.5rem;
  }

  .home-section {
    padding: 2.5rem 1.5rem;
  }

  .home-section.alt-bg {
    padding: 2.5rem 1.5rem;
  }

  .feature-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .feature-item {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .path-step {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

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

  .tool-card {
    padding: 1rem;
    text-align: center;
  }

  .tool-icon {
    font-size: 1.5rem;
  }

  .tool-desc {
    font-size: 0.8rem;
  }
}
