/* ═══════════════════════════════════════════════════════════════
   SPC Addon API Wiki — Shared Stylesheet
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg:          #0d1117;
  --bg-card:     #161b22;
  --bg-code:     #1c2129;
  --bg-hover:    rgba(88,166,255,0.06);
  --border:      #30363d;
  --border-light:#3d444d;
  --text:        #c9d1d9;
  --text-bright: #f0f6fc;
  --text-dim:    #8b949e;
  --accent:      #58a6ff;
  --accent-dim:  #1f6feb;
  --green:       #3fb950;
  --orange:      #d29922;
  --red:         #f85149;
  --purple:      #bc8cff;
  --yellow:      #e3b341;
  --sidebar-w:   270px;
  --content-max: 880px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  display: flex;
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════ */
nav.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

/* logo block */
.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo h1 {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.4px;
  margin-bottom: 2px;
}
.sidebar-logo .subtitle {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 600;
}

/* nav links */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0 24px;
}
.sidebar-nav .section-label {
  display: block;
  padding: 14px 20px 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px 7px 24px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13.5px;
  transition: all 0.12s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
  color: var(--text);
  background: var(--bg-hover);
  border-left-color: var(--border-light);
}
.sidebar-nav a.active {
  color: var(--text-bright);
  background: var(--bg-hover);
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar-nav a .icon {
  width: 16px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
  opacity: 0.7;
}
.sidebar-nav a:hover .icon,
.sidebar-nav a.active .icon { opacity: 1; }

/* sidebar footer */
.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.sidebar-footer a { color: var(--accent); text-decoration: none; }
.sidebar-footer a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════ */
main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 48px 56px 120px;
  max-width: calc(var(--content-max) + 112px);
}

/* ── Typography ────────────────────────────────────────────── */
h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-bright);
  margin: 0 0 8px;
  letter-spacing: -0.5px;
}
h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-bright);
  margin: 48px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
h2:first-of-type { margin-top: 0; }
h3 {
  font-size: 18px;
  font-weight: 600;
  color: #e6edf3;
  margin: 32px 0 12px;
}
h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  margin: 20px 0 8px;
}
p   { margin: 0 0 12px; }
ul, ol { margin: 0 0 16px 20px; }
li { margin-bottom: 5px; }
a   { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { color: #e6edf3; }
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* ── Hero / Page header ────────────────────────────────────── */
.page-header {
  margin-bottom: 36px;
}
.page-header h1 {
  margin-bottom: 8px;
}
.page-header .lead {
  font-size: 16px;
  color: var(--text-dim);
  margin: 0 0 16px;
  line-height: 1.6;
}
.page-header .badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-card {
  background: linear-gradient(135deg, rgba(31,111,235,0.10) 0%, rgba(188,140,255,0.06) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px 32px;
  margin-bottom: 40px;
}
.hero-card h1 {
  font-size: 36px;
  margin-bottom: 8px;
}
.hero-card .lead {
  font-size: 17px;
  color: var(--text-dim);
  margin: 0 0 20px;
  max-width: 600px;
}

/* ── Badges / Tags ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}
.badge-blue    { background: var(--accent-dim); color: #fff; }
.badge-green   { background: rgba(63,185,80,0.2); color: var(--green); border: 1px solid rgba(63,185,80,0.3); }
.badge-orange  { background: rgba(210,153,34,0.15); color: var(--orange); border: 1px solid rgba(210,153,34,0.3); }
.badge-purple  { background: rgba(188,140,255,0.15); color: var(--purple); border: 1px solid rgba(188,140,255,0.3); }
.badge-red     { background: rgba(248,81,73,0.15); color: var(--red); border: 1px solid rgba(248,81,73,0.3); }

.step-badge {
  display: inline-block;
  background: var(--accent-dim);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 12px;
  margin-right: 6px;
  vertical-align: middle;
}

/* ── Code ──────────────────────────────────────────────────── */
pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  overflow-x: auto;
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.55;
}
code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  font-size: 13px;
}
:not(pre) > code {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5px 6px;
  font-size: 12.5px;
  white-space: nowrap;
}

/* syntax colors */
.kw  { color: #ff7b72; }       /* keyword */
.ty  { color: #79c0ff; }       /* type */
.str { color: #a5d6ff; }       /* string */
.cm  { color: #8b949e; font-style: italic; }  /* comment */
.fn  { color: #d2a8ff; }       /* function/method */
.num { color: #79c0ff; }       /* number */
.an  { color: #d29922; }       /* annotation */

/* code label */
.code-label {
  display: inline-block;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}
.code-label + pre {
  border-top-left-radius: 0;
}

/* ── Info Boxes ────────────────────────────────────────────── */
.callout {
  border-radius: 8px;
  padding: 14px 18px;
  margin: 16px 0 20px;
  font-size: 14px;
  border-left: 4px solid;
  line-height: 1.6;
}
.callout-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 13.5px;
}
.callout.tip    { background: rgba(63,185,80,0.06);  border-color: var(--green); }
.callout.warn   { background: rgba(210,153,34,0.06); border-color: var(--orange); }
.callout.danger { background: rgba(248,81,73,0.06);  border-color: var(--red); }
.callout.info   { background: rgba(88,166,255,0.06); border-color: var(--accent); }
.callout.tip  .callout-title  { color: var(--green); }
.callout.warn .callout-title  { color: var(--orange); }
.callout.danger .callout-title{ color: var(--red); }
.callout.info .callout-title  { color: var(--accent); }

/* ── Tables ────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 24px;
  font-size: 13.5px;
}
th, td {
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--border);
}
th {
  background: var(--bg-code);
  font-weight: 600;
  color: #e6edf3;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
td code { font-size: 12px; }

/* ── Diagram blocks ────────────────────────────────────────── */
.diagram {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  margin: 16px 0 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre;
  overflow-x: auto;
  color: var(--text-dim);
}
.diagram .hl { color: var(--accent); font-weight: 600; }
.diagram .g  { color: var(--green); }
.diagram .o  { color: var(--orange); }
.diagram .p  { color: var(--purple); }
.diagram .r  { color: var(--red); }

/* ── File tree ─────────────────────────────────────────────── */
.file-tree {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 12px 0 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.8;
}
.file-tree .dir  { color: var(--accent); }
.file-tree .file { color: var(--text-dim); }
.file-tree .note { color: var(--green); font-style: italic; }

/* ── Cards grid ────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 16px 0 28px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
}
.card a { text-decoration: none; }
.card-icon {
  font-size: 24px;
  margin-bottom: 10px;
}
.card h3 {
  font-size: 15px;
  margin: 0 0 6px;
  color: var(--text-bright);
}
.card p {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.5;
}

/* ── Steps list ────────────────────────────────────────────── */
.steps {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  counter-reset: step-counter;
}
.steps li {
  counter-increment: step-counter;
  position: relative;
  padding: 16px 0 16px 56px;
  border-bottom: 1px solid var(--border);
}
.steps li:last-child { border-bottom: none; }
.steps li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0; top: 16px;
  width: 36px; height: 36px;
  background: var(--accent-dim);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}
.steps li strong {
  display: block;
  font-size: 15px;
  color: var(--text-bright);
  margin-bottom: 4px;
}

/* ── Method signature ──────────────────────────────────────── */
.method-sig {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 16px;
  margin: 8px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  overflow-x: auto;
  display: block;
}

/* ── Toc (right-side page toc for long pages) ──────────────── */
.page-toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 0 0 32px;
}
.page-toc h4 {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 10px;
}
.page-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.page-toc li { margin-bottom: 6px; }
.page-toc a {
  font-size: 13px;
  color: var(--text-dim);
}
.page-toc a:hover { color: var(--text); }

/* ── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--border-light); }

/* ── Prev/Next navigation ──────────────────────────────────── */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.page-nav a {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 20px;
  text-decoration: none;
  transition: border-color 0.15s;
  min-width: 180px;
}
.page-nav a:hover { border-color: var(--accent-dim); text-decoration: none; }
.page-nav .nav-label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.page-nav .nav-title {
  font-size: 14px;
  color: var(--text-bright);
  font-weight: 600;
}
.page-nav .next { text-align: right; margin-left: auto; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  nav.sidebar { display: none; }
  main {
    margin-left: 0;
    padding: 24px 20px 80px;
    max-width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════
   BEGINNER-FRIENDLY ADDITIONS
   ═══════════════════════════════════════════════════════════════ */

/* ── Difficulty badges ─────────────────────────────────────── */
.difficulty {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 6px;
}
.difficulty-beginner   { background: rgba(63,185,80,0.18);  color: var(--green);  border: 1px solid rgba(63,185,80,0.3); }
.difficulty-intermediate { background: rgba(210,153,34,0.15); color: var(--orange); border: 1px solid rgba(210,153,34,0.3); }
.difficulty-advanced   { background: rgba(188,140,255,0.15); color: var(--purple); border: 1px solid rgba(188,140,255,0.3); }

/* ── Learning path (numbered route) ────────────────────────── */
.learning-path {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 20px 0 32px;
  position: relative;
}
.learning-path::before {
  content: '';
  position: absolute;
  left: 22px;
  top: 28px;
  bottom: 28px;
  width: 3px;
  background: linear-gradient(to bottom, var(--green), var(--accent), var(--purple));
  border-radius: 2px;
}
.lp-step {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.12s;
}
.lp-step:hover {
  border-color: var(--accent-dim);
  transform: translateX(4px);
  text-decoration: none;
}
.lp-num {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  flex-shrink: 0;
}
.lp-num-green  { background: rgba(63,185,80,0.15); color: var(--green); border: 2px solid var(--green); }
.lp-num-blue   { background: rgba(88,166,255,0.12); color: var(--accent); border: 2px solid var(--accent); }
.lp-num-purple { background: rgba(188,140,255,0.12); color: var(--purple); border: 2px solid var(--purple); }
.lp-body { flex: 1; }
.lp-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 2px;
}
.lp-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
}
.lp-time {
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.7;
  white-space: nowrap;
}

/* ── Section divider for card groups ───────────────────────── */
.card-section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 36px 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.card-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── "Do I need this?" box ─────────────────────────────────── */
.need-this {
  background: linear-gradient(135deg, rgba(88,166,255,0.05) 0%, rgba(63,185,80,0.03) 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  margin: 0 0 32px;
}
.need-this h3 {
  font-size: 15px;
  color: var(--accent);
  margin: 0 0 10px;
}
.need-this ul {
  margin: 0 0 0 18px;
  padding: 0;
}
.need-this li {
  font-size: 13.5px;
  margin-bottom: 4px;
  color: var(--text);
}
.need-this .skip-note {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
}

/* ── TL;DR summary box ─────────────────────────────────────── */
.tldr {
  background: rgba(63,185,80,0.05);
  border: 1px solid rgba(63,185,80,0.2);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 0 0 28px;
}
.tldr-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 6px;
}
.tldr p {
  font-size: 14px;
  color: var(--text);
  margin: 0;
  line-height: 1.55;
}
