/* ==========================================================================
   PhobGCC Documentation Theme
   Native Dark/Light CSS — Zero Upstream Markdown Modifications Required
   ========================================================================== */

:root {
  --bg: #0d1117;
  --bg-elevated: #161b22;
  --bg-hover: #21262d;
  --bg-code: #161b22;
  --border: #30363d;
  --border-subtle: #21262d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-heading: #f0f6fc;
  --accent: #8b7cf6;
  --accent-hover: #a78bfa;
  --accent-soft: rgba(139, 124, 246, 0.14);
  --header-bg: rgba(13, 17, 23, 0.86);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --header-height: 58px;
  --sidebar-width: 265px;
  --toc-width: 225px;
  --radius: 8px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-elevated: #f6f8fa;
  --bg-hover: #eaeef2;
  --bg-code: #f6f8fa;
  --border: #d0d7de;
  --border-subtle: #e5e9ee;
  --text: #1f2328;
  --text-muted: #656d76;
  --text-heading: #111827;
  --accent: #5b46e8;
  --accent-hover: #4834d4;
  --accent-soft: rgba(91, 70, 232, 0.1);
  --header-bg: rgba(255, 255, 255, 0.88);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.68;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Top Navbar
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.menu-toggle:hover {
  background: var(--bg-hover);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text-heading);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.site-brand img {
  width: 22px;
  height: 22px;
  image-rendering: pixelated;
}

.brand-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 7px;
  border-radius: 999px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.search-trigger:hover {
  border-color: var(--accent);
  color: var(--text);
}

.search-trigger kbd {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-muted);
}

.header-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.header-link:hover {
  background: var(--bg-hover);
  color: var(--text-heading);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-heading);
  border-color: var(--accent);
}

.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ==========================================================================
   3-Column Shell Layout
   ========================================================================== */

.docs-shell {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--toc-width);
  align-items: start;
}

/* ==========================================================================
   Left Sidebar Navigation
   ========================================================================== */

.sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 20px 14px 36px 20px;
  border-right: 1px solid var(--border-subtle);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

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

.nav-section-title {
  margin: 0 0 6px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: block;
  padding: 6px 10px;
  margin: 2px 0;
  border-radius: 6px;
  font-size: 0.89rem;
  line-height: 1.35;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-heading);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 600;
  border-left-color: var(--accent);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.sidebar-backdrop.open {
  display: block;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */

.docs-main {
  min-width: 0;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 40px 56px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  font-size: 0.83rem;
  color: var(--text-muted);
}

.breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
}

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

.breadcrumbs .sep {
  opacity: 0.5;
}

/* Markdown Typography */

.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4 {
  color: var(--text-heading);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
  position: relative;
}

.doc-content h1 {
  font-size: 2rem;
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.doc-content h2 {
  font-size: 1.45rem;
  margin: 34px 0 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.doc-content h3 {
  font-size: 1.18rem;
  margin: 24px 0 10px;
}

.doc-content h4 {
  font-size: 1rem;
  margin: 18px 0 8px;
}

.heading-anchor {
  margin-left: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.doc-content h1:hover .heading-anchor,
.doc-content h2:hover .heading-anchor,
.doc-content h3:hover .heading-anchor,
.heading-anchor:focus {
  opacity: 1;
}

.heading-anchor:hover {
  color: var(--accent);
}

.doc-content p {
  margin: 0 0 16px;
}

.doc-content a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.doc-content a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.doc-content ul,
.doc-content ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.doc-content li {
  margin: 5px 0;
}

.doc-content li > ul,
.doc-content li > ol {
  margin: 4px 0 6px;
}

.doc-content hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

.doc-content blockquote {
  margin: 16px 0;
  padding: 12px 18px;
  border-left: 4px solid var(--accent);
  background: var(--bg-elevated);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
}

.doc-content blockquote p:last-child {
  margin-bottom: 0;
}

.doc-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
}

.doc-content pre {
  margin: 18px 0;
  padding: 14px 16px;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--bg-code);
  border: 1px solid var(--border);
  line-height: 1.5;
}

.doc-content pre code {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.86rem;
}

.doc-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  display: inline-block;
}

.doc-content img.zoomable {
  cursor: zoom-in;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.doc-content img.zoomable:hover {
  box-shadow: var(--shadow);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 18px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.doc-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.doc-content th,
.doc-content td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.doc-content th {
  background: var(--bg-elevated);
  color: var(--text-heading);
  font-weight: 600;
}

.doc-content tr:last-child td {
  border-bottom: 0;
}

.doc-content tr:nth-child(even) td {
  background: rgba(128, 128, 128, 0.03);
}

/* ==========================================================================
   Right Sidebar: On This Page TOC
   ========================================================================== */

.toc-sidebar {
  position: sticky;
  top: var(--header-height);
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 28px 18px 28px 12px;
  scrollbar-width: thin;
}

.toc-sidebar.empty {
  display: none;
}

.toc-title {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border-subtle);
}

.toc-link {
  display: block;
  padding: 4px 0 4px 12px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 0.83rem;
  line-height: 1.38;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.toc-link:hover {
  color: var(--text-heading);
}

.toc-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

.toc-link.toc-h3 {
  padding-left: 22px;
  font-size: 0.8rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--text-muted);
}

.site-footer p {
  margin: 0 0 8px;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Search Modal
   ========================================================================== */

.search-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  padding: 10vh 16px 16px;
}

.search-modal.open {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.search-dialog {
  width: 100%;
  max-width: 600px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.search-input-wrap svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-heading);
  font-family: inherit;
  font-size: 1rem;
}

.search-results {
  max-height: 55vh;
  overflow-y: auto;
  padding: 8px;
}

.search-result-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.12s ease;
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--accent-soft);
}

.search-result-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-heading);
  margin-bottom: 3px;
}

.search-result-snippet {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.search-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ==========================================================================
   Image Lightbox & Back-to-Top
   ========================================================================== */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(4px);
  padding: 24px;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 94vw;
  max-height: 92vh;
  border-radius: var(--radius);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7);
}

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.15s ease;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1200px) {
  .docs-shell {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }
  .toc-sidebar {
    display: none;
  }
}

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

  .header-links,
  .search-trigger kbd,
  .search-trigger-label {
    display: none;
  }

  .docs-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 150;
    width: 280px;
    max-width: 82vw;
    height: 100vh;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    padding-top: 20px;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

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

  .docs-main {
    padding: 20px 18px 48px;
  }

  .doc-content h1 {
    font-size: 1.65rem;
  }
}
