/* ---- Theme tokens (mirrors the Claude artifact palette the source sheets were written against) ---- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "Cascadia Code", "Consolas", monospace;
  --radius: 8px;

  --bg-page: #f7f6f4;
  --surface-0: #ffffff;
  --surface-1: #f2f0ec;
  --surface-2: #ffffff;
  --border: #e4e1da;
  --border-strong: #d8d4ca;
  --border-accent: #c96442;
  --text-primary: #2b2825;
  --text-secondary: #6b6660;
  --text-muted: #928d85;
  --bg-accent: #f4e6de;
  --text-accent: #b35333;
  --bg-success: #e2ede4;
  --text-success: #3d7a52;
  --bg-warning: #f8ecd4;
  --text-warning: #a3792f;
  --bg-pro: #e8e5f5;
  --text-pro: #6a5cad;
}

:root[data-theme="dark"] {
  --bg-page: #1b1a19;
  --surface-0: #232120;
  --surface-1: #2a2827;
  --surface-2: #2a2827;
  --border: #3a3735;
  --border-strong: #47433f;
  --border-accent: #c96442;
  --text-primary: #ece9e4;
  --text-secondary: #b3aea6;
  --text-muted: #857f76;
  --bg-accent: #3a2a22;
  --text-accent: #e08862;
  --bg-success: #223228;
  --text-success: #7cbf8f;
  --bg-warning: #3a2f1c;
  --text-warning: #d9ac5c;
  --bg-pro: #2b2740;
  --text-pro: #a99bea;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-page: #1b1a19;
    --surface-0: #232120;
    --surface-1: #2a2827;
    --surface-2: #2a2827;
    --border: #3a3735;
    --border-strong: #47433f;
    --border-accent: #c96442;
    --text-primary: #ece9e4;
    --text-secondary: #b3aea6;
    --text-muted: #857f76;
    --bg-accent: #3a2a22;
    --text-accent: #e08862;
    --bg-success: #223228;
    --text-success: #7cbf8f;
    --bg-warning: #3a2f1c;
    --text-warning: #d9ac5c;
    --bg-pro: #2b2740;
    --text-pro: #a99bea;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ---- App shell ---- */
.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  padding: 1rem 0.75rem;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  z-index: 40;
}

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

.app-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0.5rem 0.6rem 1rem;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.9rem 0.6rem 0.4rem;
}

.sidebar-title:first-of-type { padding-top: 0; }

.nav-link {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 2px;
  font-family: var(--font-sans);
}

.nav-link:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-link.active { background: var(--bg-accent); color: var(--text-accent); }

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.scrim.visible { opacity: 1; pointer-events: auto; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.75rem 1rem;
  background: var(--surface-0);
  border-bottom: 1px solid var(--border);
}

.icon-btn {
  background: none;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 16px;
}
.icon-btn:hover { background: var(--surface-2); }

.page-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.search-box {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 0.5px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
}
.search-box:focus { outline: none; border-color: var(--border-accent); }
.search-box::placeholder { color: var(--text-muted); }

.content {
  flex: 1;
  padding: 1rem;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

.empty-state {
  color: var(--text-muted);
  font-size: 14px;
  padding: 2rem 0;
  text-align: center;
}

@media (min-width: 900px) {
  .sidebar { transform: translateX(0); position: sticky; height: 100vh; }
  .scrim { display: none; }
  .main { margin-left: 0; }
  .hamburger { display: none; }
}

/* ---- Shared reference-sheet styles (from the original artifact sheets) ---- */
.container { padding: 0 0 2rem; }
.category-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1.25rem; }
.tab { padding: 6px 14px; border-radius: var(--radius); border: 0.5px solid var(--border-strong); font-size: 13px; font-weight: 500; cursor: pointer; background: var(--surface-2); color: var(--text-secondary); transition: all 0.15s; font-family: var(--font-sans); }
.tab.active { background: var(--bg-accent); color: var(--text-accent); border-color: var(--border-accent); }
.tab:hover:not(.active) { background: var(--surface-1); color: var(--text-primary); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.card { background: var(--surface-2); border: 0.5px solid var(--border); border-radius: 12px; padding: 1rem 1.1rem; }
.card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.operator-name { font-size: 15px; font-weight: 500; color: var(--text-primary); }
.operator-name.mono { font-family: var(--font-mono); }
.badge { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: var(--radius); text-transform: capitalize; }
.badge-search, .badge-sql, .badge-filtering, .badge-transforming, .badge-aggregating, .badge-finding, .badge-ordering, .badge-shaping { background: var(--bg-accent); color: var(--text-accent); }
.badge-sort, .badge-ef { background: var(--bg-success); color: var(--text-success); }
.badge-pattern, .badge-both { background: var(--bg-warning); color: var(--text-warning); }
.badge-structure { background: var(--bg-pro); color: var(--text-pro); }

/* Generic per-section badge coloring (Azure, DevOps, K8s, Docker, C#, System Design, Patterns) */
.badge-azure, .badge-csharp, .badge-sysdesign { background: var(--bg-accent); color: var(--text-accent); }
.badge-devops, .badge-docker { background: var(--bg-success); color: var(--text-success); }
.badge-k8s, .badge-patterns { background: var(--bg-pro); color: var(--text-pro); }
.complexity-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: var(--radius); border: 0.5px solid var(--border); color: var(--text-secondary); font-family: var(--font-mono); background: var(--surface-1); }
.desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; line-height: 1.5; }
.use-when { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; font-style: italic; }
.code-label { font-size: 11px; font-weight: 500; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.code-section { margin-bottom: 8px; }
.code-section:last-child { margin-bottom: 0; }
.code-block { background: var(--surface-0); border-radius: var(--radius); border: 0.5px solid var(--border); padding: 10px 12px; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-primary); line-height: 1.7; white-space: pre; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- Q&A accordion (list layout) ---- */
.cards-list { grid-template-columns: 1fr; }
.qa-item { padding: 0; }
.qa-item .qa-question {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 1rem 1.1rem;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}
.qa-item .qa-question::-webkit-details-marker { display: none; }
.qa-item .qa-question::marker { content: ""; }
.qa-item .qa-question:hover { color: var(--text-accent); }
.qa-item .qa-question-text { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge-dsa { background: var(--bg-warning); color: var(--text-warning); flex-shrink: 0; }
.qa-item .chevron { color: var(--text-muted); transition: transform 0.15s ease; flex-shrink: 0; }
.qa-item[open] .chevron { transform: rotate(180deg); }
.qa-item .qa-answer {
  padding: 0 1.1rem 1rem;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
