/* ═══════════════════════════════════════════════
   Accelerate Git Guide — Shared Styles
   ═══════════════════════════════════════════════ */

:root {
  --bg: #f7f2e6;
  --bg-dark: #efe8d5;
  --text: #211d16;
  --red: #b8231f;
  --red-hover: #8f1815;
  --green: #2e7d43;
  --green-light: #eef5e9;
  --amber: #d99a2b;
  --blue: #1a6fb5;
  --blue-light: #e8f0f8;
  --card: #fffdf6;
  --border: rgba(33,29,22,.25);
  --muted: rgba(33,29,22,.55);
  --serif: 'Newsreader', Georgia, serif;
  --mono: 'IBM Plex Mono', 'Consolas', monospace;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --sidebar-w: 280px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--serif);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ─── */
.page-wrap {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--text);
  color: var(--bg);
  padding: 24px 20px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 24px; text-decoration: none; color: var(--bg);
}
.sidebar-logo img {
  width: 36px; height: 36px; border-radius: 8px;
}
.sidebar-logo span {
  font-size: 18px; font-weight: 700;
}
.sidebar-logo small {
  display: block; font-family: var(--mono); font-size: 8px;
  letter-spacing: .14em; color: rgba(247,242,230,.5); margin-top: 2px;
}

.nav-section {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: .14em; color: rgba(247,242,230,.4);
  margin: 16px 0 8px; text-transform: uppercase;
}
.nav-link {
  display: flex; align-items: baseline; gap: 10px;
  padding: 7px 12px; margin: 2px -8px;
  border-radius: 4px; text-decoration: none;
  color: rgba(247,242,230,.7); font-size: 13.5px;
  transition: all .15s;
}
.nav-link:hover { background: rgba(247,242,230,.1); color: var(--bg); }
.nav-link.active { background: var(--red); color: #fff; font-weight: 600; }
.nav-num {
  font-family: var(--mono); font-size: 10px;
  opacity: .5; width: 18px; text-align: right;
}
.nav-link.active .nav-num { opacity: .8; }

.sidebar-footer {
  margin-top: auto; padding-top: 16px;
  border-top: 1px solid rgba(247,242,230,.15);
  font-size: 11px; color: rgba(247,242,230,.4);
  line-height: 1.5;
}
.sidebar-footer a { color: var(--red); }

/* ─── Main content ─── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 40px 60px 80px;
  max-width: 840px;
}

.chapter-num {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: .16em; color: var(--red);
  text-transform: uppercase; margin-bottom: 4px;
}
.chapter-title {
  font-size: 36px; font-weight: 700; line-height: 1.15;
  margin-bottom: 8px;
}
.chapter-subtitle {
  font-size: 18px; color: var(--muted); font-style: italic;
  margin-bottom: 32px;
}

/* ─── Scene / narrative treatment ─── */
.scene-tag {
  font-family: var(--mono); font-size: 9.5px;
  letter-spacing: .16em; color: var(--red);
  text-transform: uppercase; margin: 36px 0 10px;
  display: flex; align-items: center; gap: 10px;
}
.scene-tag::after {
  content: ''; flex: 1; height: 1px;
  background: rgba(184,35,31,.25);
}
.cold-open {
  font-size: 18px; line-height: 1.85;
  border-left: 3px solid var(--red);
  padding: 4px 0 4px 22px; margin: 0 0 28px;
  color: var(--text);
}
.cold-open p { font-size: 18px; margin-bottom: 14px; }
.cold-open p:last-child { margin-bottom: 0; }
.cold-open em { color: rgba(33,29,22,.8); }
.speak {
  display: block; margin: 14px 0; padding-left: 18px;
  border-left: 2px solid rgba(33,29,22,.2);
  font-style: italic; color: rgba(33,29,22,.85);
}
.speak b { font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--red); display: block; margin-bottom: 2px; letter-spacing: .04em; }
.beat {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  color: var(--muted); text-transform: uppercase;
  margin: 32px 0 6px;
}

h2 {
  font-size: 24px; font-weight: 700; margin: 40px 0 16px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--red);
}
h3 {
  font-size: 18px; font-weight: 700; margin: 28px 0 12px;
}

p { margin-bottom: 16px; font-size: 16px; }
p + p { margin-top: 0; }

strong { font-weight: 700; }
em { font-style: italic; }

a { color: var(--red); }
a:hover { color: var(--red-hover); }

ul, ol {
  margin: 0 0 16px 24px;
  font-size: 16px;
}
li { margin-bottom: 6px; }

/* ─── Terminal mockup ─── */
.terminal {
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: 8px;
  margin: 20px 0;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
}
.terminal-bar {
  background: #333;
  padding: 8px 12px;
  display: flex; align-items: center; gap: 6px;
}
.terminal-dot {
  width: 10px; height: 10px; border-radius: 50%;
}
.terminal-bar-title {
  font-size: 11px; color: #999; margin-left: 8px;
}
.terminal-body { padding: 16px 20px; }
.terminal-line { margin-bottom: 4px; white-space: pre-wrap; word-break: break-all; }
.t-prompt { color: #6aab73; }
.t-cmd { color: #fff; }
.t-flag { color: #ce9178; }
.t-output { color: #999; }
.t-success { color: #6aab73; }
.t-error { color: #f44747; }
.t-file { color: #4fc1ff; }
.t-comment { color: #6a737d; }
.t-highlight { color: #dcdcaa; }

/* ─── Info/warning/tip boxes ─── */
.callout {
  padding: 16px 20px;
  border-radius: 6px;
  margin: 20px 0;
  border-left: 4px solid;
  font-size: 15px;
}
.callout-title {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: .12em; font-weight: 600;
  margin-bottom: 6px; text-transform: uppercase;
}
.callout.tip { background: var(--green-light); border-color: var(--green); }
.callout.tip .callout-title { color: var(--green); }
.callout.warn { background: #fef3e0; border-color: var(--amber); }
.callout.warn .callout-title { color: var(--amber); }
.callout.info { background: var(--blue-light); border-color: var(--blue); }
.callout.info .callout-title { color: var(--blue); }
.callout.danger { background: #fce8e7; border-color: var(--red); }
.callout.danger .callout-title { color: var(--red); }

/* ─── Visual diagrams ─── */
.diagram {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin: 24px 0;
  text-align: center;
  overflow-x: auto;
}
.diagram-label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: .12em; color: var(--muted);
  margin-bottom: 16px; text-transform: uppercase;
}

.flow-row {
  display: flex; align-items: center; justify-content: center;
  gap: 0; flex-wrap: wrap;
}
.flow-box {
  padding: 12px 20px;
  border-radius: 6px;
  font-family: var(--mono); font-size: 12px;
  font-weight: 600; letter-spacing: .05em;
  min-width: 140px; text-align: center;
  border: 2px solid;
}
.flow-box.working { background: #e8f0f8; border-color: var(--blue); color: var(--blue); }
.flow-box.staging { background: #fef3e0; border-color: var(--amber); color: #8a6d0b; }
.flow-box.local { background: var(--green-light); border-color: var(--green); color: var(--green); }
.flow-box.remote { background: #f3e8f5; border-color: #7b1fa2; color: #7b1fa2; }
.flow-box.generic { background: var(--bg-dark); border-color: var(--border); color: var(--text); }

.flow-arrow {
  font-size: 20px; color: var(--muted);
  padding: 0 8px; flex: none;
}
.flow-arrow-label {
  font-family: var(--mono); font-size: 9px;
  color: var(--muted); display: block;
  margin-top: -2px;
}

/* Commit chain */
.commit-chain {
  display: flex; align-items: center;
  justify-content: center; gap: 0;
  padding: 12px 0;
}
.commit-node {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 3px solid var(--green);
  background: var(--green-light);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px;
  color: var(--green); font-weight: 600;
  position: relative;
}
.commit-node.red { border-color: var(--red); background: #fce8e7; color: var(--red); }
.commit-node.blue { border-color: var(--blue); background: var(--blue-light); color: var(--blue); }
.commit-node.active {
  width: 48px; height: 48px;
  border-width: 4px;
  box-shadow: 0 0 0 4px rgba(46,125,67,.2);
}
.commit-link {
  width: 40px; height: 3px;
  background: var(--green);
}
.commit-link.red { background: var(--red); }
.commit-link.blue { background: var(--blue); }
.commit-label {
  position: absolute; top: -22px;
  font-family: var(--mono); font-size: 9px;
  white-space: nowrap; color: var(--muted);
}
.commit-branch-label {
  position: absolute; bottom: -24px;
  font-family: var(--mono); font-size: 10px;
  white-space: nowrap; font-weight: 600;
  padding: 1px 6px; border-radius: 3px;
}

/* ─── Inline code ─── */
code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(33,29,22,.08);
  padding: 2px 6px;
  border-radius: 3px;
}
pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 20px;
  margin: 16px 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
}

/* ─── Quiz ─── */
.quiz {
  background: var(--card);
  border: 2px solid var(--text);
  border-radius: 8px;
  margin: 28px 0;
  overflow: hidden;
}
.quiz-header {
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  font-family: var(--mono); font-size: 11px;
  letter-spacing: .12em;
}
.quiz-body { padding: 20px; }
.quiz-question {
  font-size: 16px; font-weight: 600;
  margin-bottom: 12px;
}
.quiz-option {
  display: block; width: 100%;
  padding: 10px 14px; margin: 6px 0;
  border: 1.5px solid var(--border);
  border-radius: 4px; background: #fff;
  font: 14px/1.4 var(--serif);
  cursor: pointer; text-align: left;
  transition: all .15s;
}
.quiz-option:hover { border-color: var(--text); }
.quiz-option.correct {
  border-color: var(--green); background: var(--green-light);
  cursor: default;
}
.quiz-option.wrong {
  border-color: var(--red); background: #fce8e7;
  cursor: default; opacity: .6;
}
.quiz-explain {
  display: none;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 14px; color: rgba(33,29,22,.75);
}
.quiz-explain.show { display: block; }

/* ─── Step cards ─── */
.steps { counter-reset: step; margin: 24px 0; }
.step {
  display: flex; gap: 16px; margin-bottom: 20px;
  counter-increment: step;
}
.step-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-family: var(--mono); font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex: none; margin-top: 2px;
}
.step-num::before { content: counter(step); }
.step-content { flex: 1; }
.step-content h4 {
  font-size: 16px; font-weight: 700; margin-bottom: 4px;
}
.step-content p { font-size: 15px; margin-bottom: 8px; }

/* ─── Navigation footer ─── */
.chapter-nav {
  display: flex; justify-content: space-between;
  margin-top: 48px; padding-top: 24px;
  border-top: 2px solid var(--text);
}
.chapter-nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border: 1.5px solid var(--text);
  border-radius: 4px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px; font-weight: 600;
  transition: all .15s;
}
.chapter-nav a:hover {
  background: var(--red); color: #fff;
  border-color: var(--red);
}
.chapter-nav .prev::before { content: '\2190\00a0'; }
.chapter-nav .next::after { content: '\00a0\2192'; }

/* ─── Comparison table ─── */
.comparison {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}
.comparison th {
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-family: var(--mono); font-size: 11px;
  letter-spacing: .1em;
}
.comparison td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.comparison tr:nth-child(even) td { background: rgba(33,29,22,.03); }
.comparison code { font-size: 12px; }

/* ─── Progress bar ─── */
.progress-bar {
  position: fixed; top: 0; left: var(--sidebar-w);
  right: 0; height: 3px; z-index: 50;
  background: rgba(33,29,22,.1);
}
.progress-fill {
  height: 100%; background: var(--red);
  transition: width .3s;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: 100%;
    padding: 16px;
  }
  .main {
    margin-left: 0;
    padding: 24px 20px 60px;
  }
  .progress-bar { left: 0; }
  :root { --sidebar-w: 0px; }
  .flow-row { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); }
}

/* ─── Hamburger for mobile ─── */
.menu-toggle {
  display: none;
  position: fixed; top: 12px; left: 12px;
  z-index: 200; width: 40px; height: 40px;
  background: var(--text); color: var(--bg);
  border: none; border-radius: 6px;
  font-size: 20px; cursor: pointer;
}
@media (max-width: 900px) {
  .menu-toggle { display: flex; align-items: center; justify-content: center; }
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: fixed; z-index: 150; }
}
