/* Dwell User Guide — shared book styles */
:root {
  --brand: #3549FF;
  --brand-dark: #2233D6;
  --brand-light: #EEF0FF;
  --brand-mid: #8B96FF;
  --dwell-yellow: #CCF69F;
  --dwell-green: #429463;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --bg: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-sidebar: #f8fafc;
  --code-bg: #f1f5f9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --sidebar-w: 288px;
  --header-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 24px); }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  background: rgba(255,255,255,0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-logo {
  display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px;
  color: var(--brand); text-decoration: none; letter-spacing: -0.3px;
}
.topbar-logo svg { width: 26px; height: 26px; }
.topbar-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--brand); color: #fff; padding: 3px 8px; border-radius: 100px;
}
.topbar-badge.beta { background: var(--dwell-yellow); color: var(--text); }
.topbar-search { position: relative; width: 300px; }
.topbar-search input {
  width: 100%; height: 38px; padding: 0 14px 0 36px;
  border: 1px solid var(--border); border-radius: 100px;
  background: var(--bg-secondary); font-size: 13px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s; font-family: inherit;
}
.topbar-search input:focus { border-color: var(--brand-mid); box-shadow: 0 0 0 3px rgba(53,73,255,0.08); }
.topbar-search > svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted); pointer-events: none;
}
.search-results {
  position: absolute; top: 46px; left: 0; right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px rgba(15,23,42,0.14); max-height: 380px; overflow-y: auto;
  display: none; z-index: 200;
}
.search-results.open { display: block; }
.search-result {
  display: block; padding: 10px 14px; text-decoration: none; border-bottom: 1px solid var(--border-light);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--brand-light); }
.search-result .sr-title { display: block; font-weight: 600; font-size: 13px; color: var(--text); }
.search-result .sr-page { display: block; font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.search-result mark { background: var(--dwell-yellow); color: inherit; border-radius: 2px; padding: 0 1px; }
.search-empty { padding: 14px; font-size: 13px; color: var(--text-muted); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-link {
  font-size: 13px; color: var(--text-secondary); text-decoration: none; font-weight: 500;
  padding: 6px 10px; border-radius: var(--radius-sm);
}
.topbar-link:hover { background: var(--bg-secondary); color: var(--brand); }
.menu-toggle {
  display: none; background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  width: 38px; height: 38px; cursor: pointer; align-items: center; justify-content: center;
}
.menu-toggle svg { width: 18px; height: 18px; }

/* ---------- Layout ---------- */
.layout { display: flex; padding-top: var(--header-h); min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--bg-sidebar);
  border-right: 1px solid var(--border); position: fixed; top: var(--header-h); bottom: 0;
  overflow-y: auto; padding: 20px 16px 40px;
}
.sidebar-group { margin-bottom: 22px; }
.sidebar-group-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); padding: 0 10px 6px;
}
.sidebar a {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-secondary); text-decoration: none; font-size: 13.5px; font-weight: 500;
  border-left: 2px solid transparent; transition: background 0.15s, color 0.15s;
}
.sidebar a:hover { background: var(--brand-light); color: var(--brand-dark); }
.sidebar a.active { background: var(--brand-light); color: var(--brand-dark); border-left-color: var(--brand); font-weight: 600; }
.sidebar a .ext { margin-left: auto; font-size: 10px; color: var(--text-muted); }

.content { flex: 1; margin-left: var(--sidebar-w); padding: 40px 48px 80px; max-width: 920px; }

/* ---------- Typography ---------- */
.content h1 {
  font-size: 34px; font-weight: 800; letter-spacing: -0.8px; line-height: 1.2; margin-bottom: 12px;
}
.content h1 .fullstop { color: var(--brand); }
.content h2 {
  font-size: 22px; font-weight: 700; letter-spacing: -0.3px; margin: 44px 0 12px;
  padding-top: 8px;
}
.content h3 { font-size: 16.5px; font-weight: 700; margin: 28px 0 8px; }
.content p { margin-bottom: 14px; color: var(--text-secondary); }
.content p strong, .content li strong { color: var(--text); }
.content ul, .content ol { margin: 0 0 16px 22px; color: var(--text-secondary); }
.content li { margin-bottom: 6px; }
.content a { color: var(--brand); text-decoration: none; font-weight: 500; }
.content a:hover { text-decoration: underline; }
.content code {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12.5px;
  background: var(--code-bg); padding: 2px 6px; border-radius: 5px; color: var(--brand-dark);
}
.content hr { border: none; border-top: 1px solid var(--border); margin: 36px 0; }

.page-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--brand); margin-bottom: 8px;
}
.page-lede { font-size: 16.5px; color: var(--text-secondary); margin-bottom: 8px; max-width: 720px; }
.page-updated { font-size: 12px; color: var(--text-muted); margin-bottom: 28px; }

/* ---------- Components ---------- */
.callout {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm);
  margin: 18px 0; font-size: 14px; border: 1px solid;
}
.callout svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.callout p { margin: 0; }
.callout .callout-title { font-weight: 700; display: block; margin-bottom: 2px; color: var(--text); }
.callout.tip { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.callout.important { background: var(--brand-light); border-color: var(--brand-mid); color: #1e2a78; }
.callout.warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }

table { width: 100%; border-collapse: collapse; margin: 18px 0 24px; font-size: 13.5px; }
th {
  text-align: left; font-weight: 700; color: var(--text); padding: 10px 12px;
  border-bottom: 2px solid var(--border); background: var(--bg-secondary);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); vertical-align: top; }
tr:hover td { background: var(--bg-secondary); }

.status-pill, .pill {
  display: inline-block; padding: 2px 10px; border-radius: 100px; font-size: 11.5px; font-weight: 600;
  background: var(--brand-light); color: var(--brand-dark); white-space: nowrap;
}
.pill.green { background: #f0fdf4; color: var(--dwell-green); }
.pill.amber { background: #fffbeb; color: #b45309; }
.pill.red { background: #fef2f2; color: #b91c1c; }
.pill.grey { background: var(--code-bg); color: var(--text-secondary); }

.steps { counter-reset: step; margin: 20px 0; }
.step { display: flex; gap: 14px; margin-bottom: 16px; }
.step-num {
  counter-increment: step; flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.step-num::before { content: counter(step); }
.step-body { flex: 1; }
.step-body p { margin-bottom: 6px; }
.step-body p:first-child { color: var(--text); font-weight: 500; }

.screenshot {
  margin: 22px 0; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 4px 20px rgba(15,23,42,0.07);
}
.screenshot img { width: 100%; display: block; }
.screenshot .caption {
  padding: 10px 16px; font-size: 12.5px; color: var(--text-muted);
  background: var(--bg-secondary); border-top: 1px solid var(--border-light);
}

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin: 22px 0; }
a.card {
  display: block; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: inherit; transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  background: #fff;
}
a.card:hover { border-color: var(--brand-mid); box-shadow: 0 6px 20px rgba(53,73,255,0.1); transform: translateY(-2px); text-decoration: none; }
.card .card-icon { width: 22px; height: 22px; color: var(--brand); margin-bottom: 10px; }
.card .card-title { font-weight: 700; font-size: 14.5px; color: var(--text); margin-bottom: 4px; }
.card .card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.55; }

/* Prev / next */
.pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 56px; }
.pager a {
  flex: 1; max-width: 48%; padding: 14px 18px; border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none; transition: border-color 0.2s, background 0.2s;
}
.pager a:hover { border-color: var(--brand-mid); background: var(--brand-light); text-decoration: none; }
.pager .pager-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.pager .pager-title { display: block; font-size: 14.5px; font-weight: 600; color: var(--text); margin-top: 2px; }
.pager a.next { text-align: right; margin-left: auto; }

/* On-this-page */
.toc-inline {
  background: var(--bg-secondary); border: 1px solid var(--border-light); border-radius: var(--radius);
  padding: 16px 20px; margin: 24px 0; font-size: 13.5px;
}
.toc-inline .toc-title { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 8px; }
.toc-inline ul { margin: 0 0 0 4px; list-style: none; }
.toc-inline li { margin-bottom: 4px; }
.toc-inline a { color: var(--text-secondary); }
.toc-inline a:hover { color: var(--brand); }

/* Footer */
.footer {
  margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; z-index: 90; width: 280px; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(15,23,42,0.25); }
  .content { margin-left: 0; padding: 28px 20px 64px; }
  .menu-toggle { display: flex; }
  .topbar { padding: 0 12px; }
  .topbar-logo { font-size: 16px; }
  .topbar-badge { display: none; }
  .topbar-search { width: 130px; }
  .topbar-link.hide-mobile { display: none; }
}
