/* Pluggedspace Docs — portal chrome.
   Content styling comes from github-markdown.min.css; this file only styles
   the header, sidebar, search, and layout shell, in GitHub's palette.
   Auto dark mode follows prefers-color-scheme like github-markdown.min.css. */

:root {
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, "Liberation Mono", monospace;

  /* light (GitHub light defaults) */
  --canvas: #ffffff;
  --canvas-subtle: #f6f8fa;
  --border: #d0d7de;
  --fg: #1f2328;
  --fg-muted: #656d76;
  --accent: #0969da;
  --header-bg: #f6f8fa;
  --shadow: 0 8px 24px rgba(140, 149, 159, 0.2);
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0d1117;
    --canvas-subtle: #161b22;
    --border: #30363d;
    --fg: #e6edf3;
    --fg-muted: #848d97;
    --accent: #2f81f7;
    --header-bg: #161b22;
    --shadow: 0 8px 24px rgba(1, 4, 9, 0.8);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg);
  background-color: var(--canvas);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  font-size: 16px;
}
.site-brand:hover { text-decoration: none; }

.site-logo {
  height: 32px;
  width: auto;
  border-radius: 6px;
}

.site-name strong { font-weight: 600; }

/* ---------- Search ---------- */

.site-search {
  position: relative;
  flex: 0 1 320px;
}

.site-search input {
  width: 100%;
  padding: 6px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  background-color: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
}
.site-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.3);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 420px;
  overflow-y: auto;
  background-color: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 4px;
}

.search-result {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--fg);
}
.search-result:hover, .search-result.active {
  background-color: var(--canvas-subtle);
  text-decoration: none;
}
.search-result .sr-title {
  font-weight: 600;
  font-size: 14px;
  display: block;
}
.search-result .sr-snippet {
  font-size: 12px;
  color: var(--fg-muted);
  display: block;
  margin-top: 2px;
}
.search-empty, .search-hint {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--fg-muted);
}

/* ---------- Layout ---------- */

.site-layout {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 0;
}

/* ---------- Sidebar ---------- */

.sidebar {
  flex: 0 0 260px;
  position: sticky;
  top: 57px; /* header height */
  max-height: calc(100vh - 57px);
  overflow-y: auto;
  padding: 24px 16px 32px;
  border-right: 1px solid var(--border);
  font-size: 14px;
}

.nav-section { margin-bottom: 20px; }

.nav-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--fg-muted);
  margin: 0 0 6px;
  padding: 0 8px;
}

.nav-link {
  display: block;
  padding: 4px 8px;
  margin: 1px 0;
  border-radius: 6px;
  color: var(--fg);
  line-height: 1.4;
}
.nav-link:hover {
  background-color: var(--canvas-subtle);
  text-decoration: none;
}
.nav-link.active {
  background-color: var(--canvas-subtle);
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Content ---------- */

.content {
  flex: 1;
  min-width: 0;
  padding: 32px 40px 64px;
}

.content .markdown-body {
  max-width: 860px;
  margin: 0 auto;
  background-color: transparent; /* let the page canvas show through */
  font-size: 16px;
}

/* github-markdown.min.css sets an anchor icon on hover for headings; keep it subtle */
.content .markdown-body h1:first-child { margin-top: 0; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px;
  font-size: 12px;
  color: var(--fg-muted);
  text-align: center;
}
.site-footer p { margin: 0; }

/* ---------- Responsive ---------- */

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  padding: 4px 10px;
  cursor: pointer;
}

@media (max-width: 880px) {
  .menu-toggle { display: inline-block; }

  .site-header-inner { flex-wrap: wrap; }
  .site-search { flex: 1 1 100%; order: 3; }

  .site-layout { flex-direction: column; }

  .sidebar {
    position: static;
    flex: none;
    width: 100%;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: none;
    padding: 16px;
  }
  .sidebar.open { display: block; }

  .content { padding: 24px 16px 48px; }
}
