/* ═══════════════════════════════════════════════════
   FONTS & RESET
═══════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&family=Sora:wght@300;400;600;700;800&display=swap');

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

/* ═══════════════════════════════════════════════════
   TOKENS
═══════════════════════════════════════════════════ */
:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface2:  #1c2230;
  --border:    #30363d;
  --border2:   #21262d;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --green:     #3fb950;
  --green-dim: #238636;
  --teal:      #39d0c8;
  --teal-dim:  #1a7a74;
  --blue:      #58a6ff;
  --blue-dim:  #1f4b8e;
  --yellow:    #d29922;
  --orange:    #f0883e;
  --red:       #ff7b72;
  --font-body: 'Sora', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --sidebar-w: 260px;
  --radius:    8px;
  --radius-lg: 14px;
}

/* ═══════════════════════════════════════════════════
   BASE
═══════════════════════════════════════════════════ */
html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
}

::selection { background: var(--teal-dim); color: var(--text); }

/* ═══════════════════════════════════════════════════
   HERO
═══════════════════════════════════════════════════ */
.hero {
  position: relative;
  overflow: hidden;
  padding: 80px 40px 60px;
  border-bottom: 1px solid var(--border);
}

.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border2) 1px, transparent 1px),
    linear-gradient(90deg, var(--border2) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 100%);
  opacity: 0.4;
}

.hero-glow {
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(57,208,200,0.08) 0%, transparent 70%);
  top: -200px; left: 50%; transform: translateX(-50%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--teal);
  letter-spacing: 0.04em;
  margin-bottom: 24px;
}

.hero-badge::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--green);
}

.hero h1 {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--teal) 0%, var(--blue) 60%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 580px;
  margin-bottom: 32px;
  font-weight: 300;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* PDF Button */
.btn-pdf {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--teal-dim), var(--blue-dim));
  border: 1px solid var(--teal);
  color: var(--teal);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}

.btn-pdf:hover {
  background: linear-gradient(135deg, rgba(57,208,200,0.2), rgba(88,166,255,0.2));
  box-shadow: 0 0 20px rgba(57,208,200,0.2), 0 0 0 1px var(--teal);
  transform: translateY(-1px);
}

.btn-pdf svg { flex-shrink: 0; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 12px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-secondary:hover { border-color: var(--blue); color: var(--blue); }

/* Skills pills */
.hero-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--border2);
}

.skill-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

.skill-pill svg { color: var(--green); }

/* ═══════════════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════════════ */
.layout {
  display: flex;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px;
  gap: 40px;
  align-items: flex-start;
}

/* ═══════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 24px;
}

.sidebar-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.sidebar-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border2);
}

.nav-list { list-style: none; padding: 8px 0; }

.nav-list li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  font-size: 0.83rem;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}

.nav-list li a:hover { color: var(--text); background: var(--surface2); }
.nav-list li a.active { color: var(--teal); border-left-color: var(--teal); background: rgba(57,208,200,0.05); }

.nav-num {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--border);
  width: 18px;
  flex-shrink: 0;
  transition: color 0.15s;
}

.nav-list li a.active .nav-num,
.nav-list li a:hover .nav-num { color: var(--teal); }

/* Progress bar */
.progress-wrap {
  padding: 14px 18px;
  border-top: 1px solid var(--border2);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.progress-bar {
  height: 3px;
  background: var(--border2);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--blue));
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════════════════ */
.content { flex: 1; min-width: 0; }

/* MODULE SECTION */
.module {
  margin-bottom: 64px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.module.visible { opacity: 1; transform: none; }

.module-header {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border2);
}

.module-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--teal);
  background: rgba(57,208,200,0.08);
  border: 1px solid rgba(57,208,200,0.2);
  border-radius: 6px;
  padding: 6px 10px;
  white-space: nowrap;
  margin-top: 4px;
  letter-spacing: 0.04em;
}

.module-title-wrap h2 {
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 6px;
}

.module-title-wrap p {
  font-size: 0.88rem;
  color: var(--muted);
}

/* SECTION HEADINGS */
.content h3 {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  margin: 32px 0 12px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.content h3::before {
  content: '';
  display: inline-block;
  width: 3px; height: 18px;
  background: var(--teal);
  border-radius: 2px;
  flex-shrink: 0;
}

.content h4 {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
  margin: 24px 0 10px;
  font-size: 0.78rem;
}

/* PARAGRAPHS */
.content p {
  font-size: 0.95rem;
  color: #c9d1d9;
  line-height: 1.8;
  margin-bottom: 14px;
}

/* LISTS */
.content ul, .content ol {
  margin: 8px 0 20px 0;
  padding-left: 0;
  list-style: none;
}

.content ul li, .content ol li {
  position: relative;
  padding: 5px 0 5px 26px;
  font-size: 0.93rem;
  color: #c9d1d9;
  line-height: 1.7;
}

.content ul li::before {
  content: '▸';
  position: absolute; left: 0;
  color: var(--teal);
  font-size: 0.75rem;
  top: 8px;
}

.content ol { counter-reset: item; }
.content ol li { counter-increment: item; }
.content ol li::before {
  content: counter(item) '.';
  position: absolute; left: 0;
  color: var(--teal);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  top: 7px;
}

/* CODE BLOCKS */
.code-block {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 16px 0 24px;
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.code-dots { display: flex; gap: 6px; }
.code-dots span {
  width: 10px; height: 10px; border-radius: 50%;
}
.code-dots span:nth-child(1) { background: #ff5f57; }
.code-dots span:nth-child(2) { background: #febc2e; }
.code-dots span:nth-child(3) { background: #28c840; }

.code-lang {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.code-copy {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.code-copy:hover { border-color: var(--teal); color: var(--teal); }

.code-block pre {
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.8;
  color: #e6edf3;
}

.code-block pre .comment { color: var(--muted); font-style: italic; }
.code-block pre .cmd { color: var(--teal); }
.code-block pre .flag { color: var(--orange); }
.code-block pre .str { color: var(--green); }
.code-block pre .path { color: var(--yellow); }
.code-block pre .conflict-mine { color: var(--red); }
.code-block pre .conflict-sep { color: var(--muted); }
.code-block pre .conflict-theirs { color: var(--green); }

/* INLINE CODE */
code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: rgba(57,208,200,0.08);
  color: var(--teal);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(57,208,200,0.15);
}

/* INFO BOXES */
.info-box {
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 20px 0;
  border-left: 3px solid;
}

.info-box.tip {
  background: rgba(57,208,200,0.06);
  border-color: var(--teal);
}

.info-box.warning {
  background: rgba(210,153,34,0.07);
  border-color: var(--yellow);
}

.info-box.rule {
  background: rgba(88,166,255,0.06);
  border-color: var(--blue);
}

.info-box-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.info-box.tip .info-box-title { color: var(--teal); }
.info-box.warning .info-box-title { color: var(--yellow); }
.info-box.rule .info-box-title { color: var(--blue); }

.info-box p { font-size: 0.88rem; margin-bottom: 6px; color: #c9d1d9; }
.info-box p:last-child { margin-bottom: 0; }

/* TABLES */
.table-wrap { overflow-x: auto; margin: 16px 0 28px; border-radius: var(--radius); border: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }

thead tr { background: var(--surface2); }

thead th {
  padding: 12px 16px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border2); transition: background 0.15s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

tbody td { padding: 11px 16px; color: #c9d1d9; vertical-align: top; }
tbody td:first-child { font-family: var(--font-mono); font-size: 0.8rem; color: var(--teal); white-space: nowrap; }

/* FOLDER STRUCTURE */
.folder-tree {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 2;
  margin: 16px 0;
}

.folder-tree .dir { color: var(--blue); }
.folder-tree .file { color: #c9d1d9; }
.folder-tree .comment-f { color: var(--muted); font-style: italic; }
.folder-tree .ignored { color: var(--muted); text-decoration: line-through; }
.folder-tree .important { color: var(--green); }

/* CHECKLIST */
.checklist { list-style: none; padding: 0; margin: 12px 0; }
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.9rem;
  color: #c9d1d9;
}

.checklist li::before { display: none; }

.check-icon {
  width: 18px; height: 18px;
  background: rgba(63,185,80,0.1);
  border: 1px solid var(--green-dim);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  font-size: 11px;
}

/* DIVIDER */
.divider {
  border: none;
  border-top: 1px solid var(--border2);
  margin: 56px 0;
}

/* TAGS inside content */
.tag {
  display: inline-block;
  background: rgba(63,185,80,0.1);
  color: var(--green);
  border: 1px solid rgba(63,185,80,0.2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 12px;
}

.tag.blue { background: rgba(88,166,255,0.1); color: var(--blue); border-color: rgba(88,166,255,0.2); }
.tag.orange { background: rgba(240,136,62,0.1); color: var(--orange); border-color: rgba(240,136,62,0.2); }

/* ═══════════════════════════════════════════════════
   MODULE OVERVIEW CARDS (intro section)
═══════════════════════════════════════════════════ */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 24px 0 40px;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  transition: all 0.2s;
  display: block;
}

.module-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.mc-num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--teal);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.mc-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 6px;
}

.mc-desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════ */
footer {
  border-top: 1px solid var(--border2);
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.83rem;
  font-family: var(--font-mono);
}

footer a { color: var(--teal); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════
   SCROLL TO TOP
═══════════════════════════════════════════════════ */
#scrollTop {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 40px; height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  color: var(--muted);
  z-index: 100;
}

#scrollTop.show { opacity: 1; transform: none; }
#scrollTop:hover { border-color: var(--teal); color: var(--teal); }

/* ═══════════════════════════════════════════════════
   PRINT / PDF STYLES
═══════════════════════════════════════════════════ */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  body { background: #fff !important; color: #1a1a2e !important; font-size: 11pt; }

  .hero { background: #f5f7fa !important; padding: 30px !important; border-bottom: 2px solid #1f5c8b !important; }
  .hero-grid, .hero-glow { display: none; }
  .hero h1 { color: #1f5c8b !important; -webkit-text-fill-color: #1f5c8b !important; font-size: 22pt !important; }
  .hero-desc { color: #555 !important; }
  .hero-actions, .hero-skills, .btn-pdf, .btn-secondary { display: none !important; }

  .layout { display: block !important; padding: 0 !important; }
  .sidebar { display: none !important; }
  .content { width: 100% !important; }

  .module { opacity: 1 !important; transform: none !important; break-inside: avoid; margin-bottom: 30px; }
  .module-header { border-bottom: 1px solid #ccc !important; }
  .module-num { background: #e8f4fb !important; color: #1f5c8b !important; border-color: #1f5c8b !important; }
  .module-title-wrap h2 { color: #1a1a2e !important; font-size: 15pt; }

  .content h3 { color: #1a1a2e !important; font-size: 11pt; }
  .content h3::before { background: #1f5c8b !important; }
  .content p, .content li { color: #333 !important; }

  .code-block { background: #f8f8f8 !important; border-color: #ccc !important; break-inside: avoid; }
  .code-header { background: #efefef !important; border-color: #ccc !important; }
  .code-block pre { color: #1a1a2e !important; font-size: 9pt; }
  .code-block pre .cmd { color: #1a7a74 !important; }
  .code-block pre .comment { color: #888 !important; }
  .code-block pre .str { color: #238636 !important; }
  .code-dots, .code-copy { display: none !important; }

  .info-box.tip { background: #e8f8f8 !important; }
  .info-box.warning { background: #fef9ec !important; }
  .info-box.rule { background: #e8f0fb !important; }
  .info-box p, .info-box-title { color: #1a1a2e !important; }

  table { border: 1px solid #ccc !important; }
  thead tr { background: #e8f4fb !important; }
  thead th { color: #555 !important; }
  tbody td { color: #333 !important; }
  tbody td:first-child { color: #1a7a74 !important; }

  .folder-tree { background: #f8f8f8 !important; color: #1a1a2e !important; }
  .folder-tree .dir { color: #1f5c8b !important; }
  .folder-tree .comment-f { color: #888 !important; }

  .divider { border-color: #ddd !important; }
  code { background: #f0f0f0 !important; color: #1a7a74 !important; border-color: #ccc !important; }

  #scrollTop, footer { display: none !important; }

  @page {
    margin: 2cm;
    size: A4;
  }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .layout { flex-direction: column; gap: 24px; }
  .sidebar { width: 100%; position: static; }
  .nav-list { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
  .nav-list li a { padding: 6px 10px; border-left: none; border-radius: 6px; font-size: 0.78rem; }
  .nav-list li a.active { background: rgba(57,208,200,0.1); }
  .hero { padding: 50px 20px 40px; }
  .layout { padding: 24px 16px; }
  .progress-wrap { display: none; }
}
