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

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #22223a;
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --accent-glow: rgba(124, 58, 237, 0.3);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #2a2a3e;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-width: 800px;
  --max-width-wide: 1200px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-light); text-decoration: none; transition: color 0.2s; }
a:hover { color: #c4b5fd; }

img { max-width: 100%; height: auto; border-radius: 8px; }

/* === Navigation === */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
}

.nav-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-logo .logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent), #ec4899);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.nav-links { display: flex; gap: 0.25rem; align-items: center; }

.nav-links a {
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2rem;
}

/* === Hero Section === */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 1.5rem 4rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(236, 72, 153, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 0%, rgba(59, 130, 246, 0.06) 0%, transparent 50%);
  animation: heroBg 20s ease-in-out infinite alternate;
}

@keyframes heroBg {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-2%, -2%) rotate(3deg); }
}

.hero-content { position: relative; z-index: 1; max-width: 700px; }

.hero-badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--accent-light);
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #fff 0%, var(--accent-light) 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto 2.5rem;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  background: linear-gradient(135deg, var(--accent), #9333ea);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 10px;
  transition: all 0.3s;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
  color: #fff;
}

/* === Chapter Grid (Home) === */
.chapters-section {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: var(--text-secondary);
  margin-bottom: 3rem;
  font-size: 1.05rem;
}

.chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.chapter-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  transition: all 0.3s;
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.chapter-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  color: var(--text-primary);
}

.chapter-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.chapter-card-body h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.chapter-card-body p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.chapter-number {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

/* === Chapter Page === */
.chapter-page { padding-top: 80px; }

.chapter-hero {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 3rem 1.5rem 0;
}

.chapter-hero-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 3rem;
  display: flex;
  gap: 2rem;
  align-items: center;
}

.chapter-hero-icon {
  width: 80px;
  height: 80px;
  min-width: 80px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.chapter-hero-text .chapter-label {
  font-size: 0.85rem;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.chapter-hero-text h1 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.chapter-hero-text .chapter-desc {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* === Chapter Content === */
.chapter-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.chapter-content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 3rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.chapter-content h2:first-child { border-top: none; margin-top: 0; padding-top: 0; }

.chapter-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  color: var(--accent-light);
}

.chapter-content p { margin-bottom: 1.1rem; color: var(--text-secondary); }
.chapter-content p strong { color: var(--text-primary); }

.chapter-content ul, .chapter-content ol {
  margin: 0.75rem 0 1.25rem 1.5rem;
  color: var(--text-secondary);
}

.chapter-content li { margin-bottom: 0.4rem; }
.chapter-content li strong { color: var(--text-primary); }

/* Callout / ciekawostka */
.callout {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(236, 72, 153, 0.05));
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.callout-label {
  font-weight: 600;
  color: var(--accent-light);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

/* Info box */
.info-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.info-box h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Comparison boxes */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

.compare-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.compare-box h4 {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.compare-box li {
  font-size: 0.9rem;
  padding: 0.25rem 0;
  color: var(--text-secondary);
}

/* Spec bars */
.spec-bar {
  margin: 0.75rem 0;
}

.spec-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  margin-bottom: 0.3rem;
}

.spec-bar-track {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.spec-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #ec4899);
  transition: width 1s ease;
}

/* Table */
.chapter-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.92rem;
}

.chapter-content th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-bottom: 2px solid var(--accent);
  font-weight: 600;
  color: var(--text-primary);
}

.chapter-content td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.chapter-content tr:hover td { background: var(--bg-card); }

/* Timeline */
.timeline { margin: 1.5rem 0; position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), var(--border));
}

.timeline-item { position: relative; margin-bottom: 1.5rem; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 0.4rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
}

.timeline-year {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-text { color: var(--text-secondary); font-size: 0.95rem; }

/* === Chapter Navigation === */
.chapter-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  display: flex;
  gap: 1rem;
}

.chapter-nav a {
  flex: 1;
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  transition: all 0.2s;
}

.chapter-nav a:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.chapter-nav .nav-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.3rem;
}

.chapter-nav .nav-title { font-weight: 600; font-size: 0.95rem; }
.chapter-nav .next { text-align: right; }

/* === Footer === */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* === Responsive === */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem;
  }
  .nav-menu-btn { display: block; }
  .chapters-grid { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: 1fr; }
  .chapter-hero-inner { flex-direction: column; padding: 2rem; }
  .chapter-nav { flex-direction: column; }
}

/* === Animations === */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}

.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.2s; }
.animate-in:nth-child(4) { animation-delay: 0.3s; }
.animate-in:nth-child(5) { animation-delay: 0.4s; }
.animate-in:nth-child(6) { animation-delay: 0.5s; }
.animate-in:nth-child(7) { animation-delay: 0.6s; }
.animate-in:nth-child(8) { animation-delay: 0.7s; }
.animate-in:nth-child(9) { animation-delay: 0.8s; }
.animate-in:nth-child(10) { animation-delay: 0.9s; }
.animate-in:nth-child(11) { animation-delay: 1.0s; }

/* === Images === */
.chapter-img {
  margin: 1.5rem 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.chapter-img img {
  width: 100%;
  display: block;
  border-radius: 0;
}

.chapter-img figcaption {
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-card);
  text-align: center;
}

.img-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.img-row .chapter-img { margin: 0; }

.img-row .chapter-img img {
  aspect-ratio: 4/3;
  object-fit: cover;
}

@media (max-width: 768px) {
  .img-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .img-row { grid-template-columns: 1fr; }
}

/* Icon colors per chapter */
.icon-history { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.icon-cpu { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.icon-gpu { background: linear-gradient(135deg, #10b981, #059669); }
.icon-ram { background: linear-gradient(135deg, #f59e0b, #d97706); }
.icon-disk { background: linear-gradient(135deg, #ef4444, #dc2626); }
.icon-cooling { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.icon-case { background: linear-gradient(135deg, #ec4899, #db2777); }
.icon-monitor { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.icon-peripherals { background: linear-gradient(135deg, #f97316, #ea580c); }
.icon-build { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.icon-future { background: linear-gradient(135deg, #6366f1, #4f46e5); }
