@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap');

:root {
  --font-body: 'Open Sans', Helvetica, Arial, sans-serif;
  --font-code: 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  --bg: #1a1919;
  --bg2: #201f1f;
  --bg3: #312f2f;
  --border: #2e2e2e;
  --text: #d0d0d0;
  --muted: #999;
  --accent: #e67e22;
  --accent2: #f0a050;
  --green: #5d9e5d;
  --yellow: #d4850f;
  --red: #c0392b;
  --purple: #b87d2f;
  --orange: #e67e22;
  --pink: #d4850f;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Hamburger ── */
#hamburger {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  width: 38px;
  height: 38px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
}

#hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: all .3s;
}

#hamburger.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

#hamburger.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

#hamburger.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Overlay ── */
#sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}

/* ── Sidebar ── */
#sidebar {
  width: 250px;
  min-width: 250px;
  background: #141414;
  border-right: 1px solid var(--border);
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: width .3s ease, min-width .3s ease;
  z-index: 100;
}

body.sidebar-closed #sidebar {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-right-color: transparent;
}

.sidebar-header {
  padding: 58px 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  white-space: nowrap;
}

.sidebar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}

.sidebar-subtitle {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.nav-group {
  margin-bottom: 4px;
  padding: 0 8px;
}

.nav-group-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  padding: 12px 12px 4px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.nav-item {
  display: block;
  padding: 7px 12px;
  font-size: 12.5px;
  color: #999;
  cursor: pointer;
  border-left: 3px solid transparent;
  border-radius: 0 6px 6px 0;
  transition: all .15s;
}

.nav-item:hover,
.nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(230, 126, 34, .08);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 11px;
  color: var(--muted);
}

.sidebar-footer code {
  color: var(--accent);
  font-size: 11px;
  font-family: var(--font-code);
}

/* ── Main ── */
#main {
  flex: 1;
  padding: 32px 40px;
  padding-top: 64px;
  max-width: 960px;
  overflow-y: auto;
}

/* ── Section ── */
.section {
  margin-bottom: 60px;
  scroll-margin-top: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section-badge {
  background: var(--accent);
  color: #111;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  flex-shrink: 0;
}

.section-header h1 {
  font-size: 22px;
  font-weight: 600;
  color: #e8e0d0;
}

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}

.card-header {
  padding: 10px 16px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.card-body {
  padding: 16px;
}

/* ── Concept text ── */
.concept-text {
  font-size: 14px;
  line-height: 1.7;
  color: #bbb;
}

.concept-text strong {
  color: #e8e0d0;
  font-weight: 600;
}

/* ── Interview box ── */
.interview-box {
  background: #1a1508;
  border: 1px solid #3a2a10;
  border-radius: 8px;
  padding: 16px;
  margin-top: 8px;
}

.interview-box p {
  font-size: 13px;
  line-height: 1.8;
  color: #c8a070;
  font-style: italic;
}

/* ── Code ── */
pre {
  background: #2b2a2a;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  font-family: var(--font-code);
  color: #c8a86c;
}

code.inline {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  font-family: var(--font-code);
  color: var(--accent);
}

/* ── Imperative commands ── */
.imp-box {
  background: #1a1508;
  border: 1px solid #3a2a10;
  border-radius: 8px;
  padding: 14px;
  margin-top: 8px;
}

.imp-box p {
  font-size: 11px;
  color: #a08050;
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.imp-cmd {
  font-size: 12px;
  font-family: var(--font-code);
  color: #f0a050;
  line-height: 2;
  display: block;
}

.imp-comment {
  color: #705830;
}

/* ── Tags ── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  margin-right: 6px;
  margin-bottom: 4px;
}

.tag-blue {
  background: rgba(230, 126, 34, .1);
  color: #e0a050;
  border: 1px solid rgba(230, 126, 34, .25);
}

.tag-green {
  background: rgba(93, 158, 93, .1);
  color: #7dba7d;
  border: 1px solid rgba(93, 158, 93, .25);
}

.tag-yellow {
  background: rgba(212, 133, 15, .1);
  color: #f0a050;
  border: 1px solid rgba(212, 133, 15, .25);
}

.tag-red {
  background: rgba(192, 57, 43, .1);
  color: #d46040;
  border: 1px solid rgba(192, 57, 43, .25);
}

.tag-purple {
  background: rgba(184, 125, 47, .1);
  color: #e0a050;
  border: 1px solid rgba(184, 125, 47, .25);
}

.tag-cyan {
  background: rgba(230, 126, 34, .1);
  color: #f0a050;
  border: 1px solid rgba(230, 126, 34, .25);
}

/* ── Flow diagram ── */
.flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  margin: 12px 0;
}

.flow-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.flow-arrow {
  color: var(--muted);
  padding: 0 6px;
  font-size: 16px;
}

/* ── Table ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0;
}

th {
  background: var(--bg3);
  color: var(--muted);
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(46, 46, 46, .5);
  color: #bbb;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(230, 126, 34, .03);
}

/* ── Grid ── */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Tip box ── */
.tip {
  background: #1a1508;
  border: 1px solid #3a2a10;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 8px 0;
  font-size: 12px;
  color: #d4850f;
  display: flex;
  gap: 10px;
}

.tip-icon {
  flex-shrink: 0;
}

/* ── Bar chart ── */
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.bar-label {
  font-size: 12px;
  color: var(--muted);
  width: 120px;
  flex-shrink: 0;
  text-align: right;
}

.bar {
  height: 20px;
  border-radius: 4px;
  font-size: 11px;
  display: flex;
  align-items: center;
  padding-left: 8px;
  color: #fff;
  font-weight: 500;
}

/* ── Scrollbar ── */
#sidebar::-webkit-scrollbar,
#main::-webkit-scrollbar {
  width: 4px;
}

#sidebar::-webkit-scrollbar-track,
#main::-webkit-scrollbar-track {
  background: transparent;
}

#sidebar::-webkit-scrollbar-thumb,
#main::-webkit-scrollbar-thumb {
  background: #3a3a3a;
  border-radius: 2px;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    min-width: 280px;
    transform: translateX(-100%);
    transition: transform .3s ease;
  }

  body.sidebar-open #sidebar {
    transform: translateX(0);
  }

  body.sidebar-open #sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-closed #sidebar {
    width: 280px;
    min-width: 280px;
    overflow: visible;
    border-right-color: var(--border);
    transform: translateX(-100%);
  }

  body.sidebar-open.sidebar-closed #sidebar {
    transform: translateX(0);
  }

  #main {
    padding: 20px;
    padding-top: 64px;
  }
}
