/* --- Root Variables & Design Tokens --- */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Fira Code', monospace;
  
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-light: #f8fafc;
  --bg-alt: #f1f5f9;
  
  --text-primary: #0f172a;
  --text-muted: #64748b;
  --text-light: #f8fafc;
  
  --accent: #10b981; /* Terminal/Linux Green */
  --accent-hover: #059669;
  --brand-blue: #3b82f6;
  
  --border-color: #e2e8f0;
  --radius: 12px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: #ffffff;
  line-height: 1.6;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Buttons & Typography --- */
h1, h2, h3 {
  line-height: 1.2;
  font-weight: 800;
}

a {
  text-decoration: none;
  color: inherit;
}

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

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

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-alt);
}

.btn-outline {
  border: 1px solid var(--border-color);
  background: transparent;
}

.btn-large {
  padding: 16px 32px;
  font-size: 1.125rem;
}

.btn-block {
  width: 100%;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  background-color: #e0e7ff;
  color: #4338ca;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 999px;
  margin-bottom: 16px;
}

/* --- Navbar --- */
.navbar {
  border-bottom: 1px solid var(--border-color);
  padding: 20px 0;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  z-index: 100;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-weight: 800;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.terminal-prompt {
  color: var(--accent);
  font-family: var(--font-mono);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* --- Hero Section --- */
.hero {
  padding: 64px 0 48px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 55%, #eef4ff 100%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 44px;
  align-items: center;
}

.hero-content h1 {
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
  max-width: 620px;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  max-width: 580px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.hero-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-highlights span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.1);
  color: #1d4ed8;
  font-size: 0.85rem;
  font-weight: 600;
}

/* --- Custom Book Cover Card --- */
.book-card {
  display: flex;
  justify-content: center;
}

.book-cover {
  width: 300px;
  height: 410px;
  background: linear-gradient(145deg, #111827 0%, #0f172a 100%);
  color: var(--text-light);
  border-radius: 18px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.14);
  position: relative;
}

.book-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 2px;
}

.book-cover h2 {
  font-size: 2.25rem;
  letter-spacing: 1px;
}

.book-sub {
  font-size: 0.875rem;
  color: #94a3b8;
}

.book-terminal {
  background: #020617;
  padding: 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  border-left: 3px solid var(--accent);
}

/* --- Stats Bar --- */
.stats-bar {
  background-color: var(--bg-dark);
  color: var(--text-light);
  padding: 40px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
}

.stat-item h3 {
  font-size: 2.5rem;
  color: var(--accent);
  font-family: var(--font-mono);
}

.stat-item p {
  color: #94a3b8;
  font-size: 0.9rem;
}

/* --- Section Layouts --- */
.section {
  padding: 72px 0;
}

.bg-alt {
  background-color: var(--bg-alt);
}

.section-title {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 36px auto;
}

.section-title h2 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.section-title p {
  color: var(--text-muted);
}

/* --- Feature Cards --- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}

.feature-card {
  padding: 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: #ffffff;
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.feature-card h3 {
  margin-bottom: 12px;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* --- Table of Contents Grid --- */
.toc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.toc-part {
  background: #ffffff;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  min-height: 220px;
}

.toc-part.featured {
  background: linear-gradient(145deg, #ffffff 0%, #eff6ff 100%);
  border-color: #bfdbfe;
}

.part-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--brand-blue);
  font-weight: 600;
  text-transform: uppercase;
}

.toc-part h3 {
  margin: 10px 0 12px;
  font-size: 1.15rem;
}

.toc-part p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* --- Pricing Card --- */
.pricing-card {
  max-width: 500px;
  margin: 0 auto;
  border: 2px solid var(--accent);
  border-radius: 20px;
  padding: 40px;
  background: #ffffff;
  box-shadow: var(--shadow);
  text-align: center;
}

.price {
  font-size: 3.5rem;
  font-weight: 800;
  margin: 20px 0;
}

.price span {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

.pricing-features {
  list-style: none;
  text-align: left;
  margin-bottom: 32px;
}

.pricing-features li {
  padding: 10px 0;
  color: var(--text-muted);
  border-bottom: 1px solid var(--bg-alt);
}

.secure-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 16px;
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border-color);
  padding: 40px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* --- Modal Styles --- */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
}

.modal-container {
  position: relative;
  background: #ffffff;
  width: 90%;
  max-width: 900px;
  height: 85vh;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  z-index: 1001;
  overflow: hidden;
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  flex: 1;
  background: var(--bg-alt);
  padding: 24px;
  overflow-y: auto;
}

.preview-loading,
.preview-error {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 220px;
  text-align: center;
  color: var(--text-muted);
  font-weight: 600;
}

.preview-page-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(15, 23, 42, 0.05);
}

.preview-page-label {
  text-align: center;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.preview-canvas {
  display: block;
  width: 100%;
  max-width: 680px;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.12);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
  .hero-grid, .features-grid, .toc-grid, .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 48px;
  }

  .hero-content h1 {
    font-size: 2.1rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-footer {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}
