:root {
  --octc-sidebar-width: 260px;
  --octc-header-height: 60px;
  --octc-max-content-width: 960px;
  --octc-font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --octc-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --octc-color-bg: #ffffff;
  --octc-color-bg-alt: #f8f9fa;
  --octc-color-text: #1a1a1a;
  --octc-color-text-muted: #666666;
  --octc-color-border: #e5e7eb;
  --octc-color-primary: #e04d0a;
  --octc-color-primary-hover: #f5602a;
  --octc-color-code-bg: #1e293b;
  --octc-color-code-text: #e2e8f0;
}
[data-theme="dark"] {
  --octc-color-bg: #141414;
  --octc-color-bg-alt: #141414;
  --octc-color-text: #e5e5e5;
  --octc-color-text-muted: #a3a3a3;
  --octc-color-border: #2a2a2a;
  --octc-color-primary: #f5714a;
  --octc-color-primary-hover: #ff8a66;
  --octc-color-code-bg: #1a1a1a;
  --octc-color-code-text: #e5e5e5;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --octc-color-bg: #141414;
    --octc-color-bg-alt: #141414;
    --octc-color-text: #e5e5e5;
    --octc-color-text-muted: #a3a3a3;
    --octc-color-border: #2a2a2a;
    --octc-color-primary: #f5714a;
    --octc-color-primary-hover: #ff8a66;
    --octc-color-code-bg: #1a1a1a;
    --octc-color-code-text: #e5e5e5;
  }
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Global noise texture */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

[data-theme="dark"] body::after {
  opacity: 0.04;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body::after {
    opacity: 0.04;
  }
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--octc-header-height) + 1rem);
}
body {
  font-family: var(--octc-font-sans);
  line-height: 1.7;
  color: var(--octc-color-text);
  background: var(--octc-color-bg);
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
  overflow-x: hidden;
}
a {
  color: var(--octc-color-primary);
  text-decoration: none;
}
a:hover {
  color: var(--octc-color-primary-hover);
  text-decoration: underline;
}
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--octc-header-height);
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: none;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 100;
  transition: background-color 0.3s ease;
}

[data-theme="dark"] .header {
  background: rgba(20, 20, 20, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .header {
    background: rgba(20, 20, 20, 0.5);
  }
}
.header-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--octc-color-text);
}
.header-title:hover {
  text-decoration: none;
}
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  margin-right: 0.75rem;
}
.menu-toggle svg {
  display: block;
}
.menu-toggle path {
  stroke: var(--octc-color-text);
}
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 6px;
  color: var(--octc-color-text-muted);
  transition:
    background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.social-link:hover {
  background: var(--octc-color-bg-alt);
  color: var(--octc-color-text);
  text-decoration: none;
}
.social-link svg {
  display: block;
}
.search-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--octc-color-bg-alt);
  border: 1px solid var(--octc-color-border);
  border-radius: 6px;
  color: var(--octc-color-text-muted);
  cursor: pointer;
  font-size: 0.875rem;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.search-button:hover {
  border-color: var(--octc-color-primary);
  color: var(--octc-color-text);
}
.search-button svg {
  width: 16px;
  height: 16px;
}
.search-button kbd {
  padding: 0.125rem 0.375rem;
  background: var(--octc-color-bg);
  border: 1px solid var(--octc-color-border);
  border-radius: 4px;
  font-family: var(--octc-font-mono);
  font-size: 0.75rem;
}
@media (max-width: 640px) {
  .search-button span,
  .search-button kbd {
    display: none;
  }
  .search-button {
    padding: 0.5rem;
  }
}
.search-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  justify-content: center;
  padding-top: 10vh;
}
.search-modal-overlay.open {
  display: flex;
}
.search-modal {
  width: 100%;
  max-width: 560px;
  margin: 0 1rem;
  background: var(--octc-color-bg);
  border: 1px solid var(--octc-color-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}
.search-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--octc-color-border);
}
.search-header svg {
  flex-shrink: 0;
  color: var(--octc-color-text-muted);
}
.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--octc-color-text);
}
.search-input::placeholder {
  color: var(--octc-color-text-muted);
}
.search-close {
  padding: 0.25rem 0.5rem;
  background: var(--octc-color-bg-alt);
  border: 1px solid var(--octc-color-border);
  border-radius: 4px;
  color: var(--octc-color-text-muted);
  font-family: var(--octc-font-mono);
  font-size: 0.75rem;
  cursor: pointer;
}
.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}
.search-result {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: var(--octc-color-text);
  text-decoration: none;
}
.search-result:hover,
.search-result.selected {
  background: var(--octc-color-bg-alt);
  text-decoration: none;
}
.search-result-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}
.search-result-snippet {
  font-size: 0.8125rem;
  color: var(--octc-color-text-muted);
}
.search-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--octc-color-text-muted);
}
.search-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--octc-color-border);
  background: var(--octc-color-bg-alt);
  font-size: 0.75rem;
  color: var(--octc-color-text-muted);
}
.search-footer kbd {
  padding: 0.125rem 0.375rem;
  background: var(--octc-color-bg);
  border: 1px solid var(--octc-color-border);
  border-radius: 4px;
  font-family: var(--octc-font-mono);
}
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  color: var(--octc-color-text-muted);
  transition:
    background 0.15s,
    color 0.15s,
    transform 0.2s ease;
}
.theme-toggle:hover {
  background: var(--octc-color-bg-alt);
  color: var(--octc-color-text);
}
.theme-toggle:active {
  transform: scale(0.9);
}
.theme-toggle svg {
  display: block;
  width: 20px;
  height: 20px;
  transition:
    transform 0.3s ease,
    opacity 0.2s ease;
}
.theme-toggle .icon-sun {
  display: none;
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}
.theme-toggle .icon-moon {
  display: block;
  opacity: 1;
  transform: rotate(0deg) scale(1);
}
[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
  opacity: 1;
  transform: rotate(0deg) scale(1);
}
[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}
/* Mobile footer theme icons */
.mobile-footer-btn .icon-sun {
  display: none;
}
.mobile-footer-btn .icon-moon {
  display: block;
}
[data-theme="dark"] .mobile-footer-btn .icon-sun {
  display: block;
}
[data-theme="dark"] .mobile-footer-btn .icon-moon {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mobile-footer-btn .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .mobile-footer-btn .icon-moon {
    display: none;
  }
}
.layout {
  display: flex;
  padding-top: var(--octc-header-height);
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  top: calc(var(--octc-header-height) + 1rem);
  left: 1rem;
  bottom: 1rem;
  width: calc(var(--octc-sidebar-width) - 1rem);
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 1rem;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.25rem 0.75rem;
  transition: background-color 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--octc-color-border) transparent;
}

[data-theme="dark"] .sidebar {
  background: rgba(30, 30, 30, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.4),
    0 1px 2px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sidebar {
    background: rgba(30, 30, 30, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
      0 4px 24px rgba(0, 0, 0, 0.4),
      0 1px 2px rgba(0, 0, 0, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
}
.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--octc-color-border);
  border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--octc-color-text-muted);
}
.nav-section {
  margin-bottom: 1.5rem;
}
.nav-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--octc-color-text-muted);
  margin-bottom: 0.5rem;
  padding: 0 0.75rem;
}
.nav-list {
  list-style: none;
}
.nav-item {
  margin: 0.125rem 0;
}
.nav-link {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  color: var(--octc-color-text);
  font-size: 0.875rem;
  transition:
    background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-link:hover {
  background: rgba(0, 0, 0, 0.04);
  text-decoration: none;
}
[data-theme="dark"] .nav-link:not(.active):hover {
  background: rgba(255, 255, 255, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav-link:not(.active):hover {
    background: rgba(255, 255, 255, 0.06);
  }
}
.nav-link.active {
  background: var(--octc-color-primary);
  color: white;
}
.nav-link.active:hover {
  background: var(--octc-color-primary-hover);
  color: white;
}
.main {
  flex: 1;
  margin-left: var(--octc-sidebar-width);
  padding: 2rem;
  min-width: 0;
  overflow-x: hidden;
}
.content {
  max-width: var(--octc-max-content-width);
  margin: 0 auto;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}
.content h1 {
  font-size: 2.25rem;
  margin-bottom: 1rem;
  line-height: 1.2;
}
.content h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--octc-color-border);
}
.content h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}
.content h4 {
  font-size: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.content p {
  margin-bottom: 1rem;
}
.content ul,
.content ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}
.content li {
  margin: 0.375rem 0;
}
.content blockquote {
  border-left: 4px solid var(--octc-color-primary);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  background: var(--octc-color-bg-alt);
  border-radius: 0 6px 6px 0;
}
.content code {
  font-family: var(--octc-font-mono);
  font-size: 0.875em;
  background: var(--octc-color-bg-alt);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  word-break: break-all;
}
.content pre {
  background: var(--octc-color-code-bg);
  color: var(--octc-color-code-text);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
  line-height: 1.5;
  transition: background-color 0.3s ease;
}
.content pre code {
  background: transparent;
  padding: 0;
  font-size: 0.8125rem;
}
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.875rem;
}
.content th,
.content td {
  border: 1px solid var(--octc-color-border);
  padding: 0.75rem 1rem;
  text-align: left;
}
.content th {
  background: var(--octc-color-bg-alt);
  font-weight: 600;
}
.content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}
.content img[alt*="Logo"] {
  max-width: 180px;
}
.content hr {
  border: none;
  border-top: 1px solid var(--octc-color-border);
  margin: 2rem 0;
}
/* Mobile Footer Bar */
.mobile-footer {
  display: none;
}
@media (max-width: 768px) {
  .header-actions {
    display: none;
  }
  .mobile-footer {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--octc-color-bg);
    border-top: 1px solid var(--octc-color-border);
    justify-content: space-around;
    align-items: center;
    padding: 0 1rem;
    z-index: 100;
    transition: background-color 0.3s ease;
  }
  .mobile-footer-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    color: var(--octc-color-text-muted);
    text-decoration: none;
    transition:
      background 0.2s,
      color 0.2s;
    min-width: 48px;
  }
  .mobile-footer-btn:hover {
    background: var(--octc-color-bg-alt);
    color: var(--octc-color-text);
    text-decoration: none;
  }
  .mobile-footer-btn svg {
    width: 22px;
    height: 22px;
  }
  .mobile-footer-label {
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }
  .menu-toggle {
    display: none;
  }
  .sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 70vh;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99;
    border-radius: 1.5rem 1.5rem 0 0;
    padding: 1.5rem 1rem 2rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    box-shadow:
      0 -8px 32px rgba(0, 0, 0, 0.12),
      0 -2px 8px rgba(0, 0, 0, 0.06);
  }
  [data-theme="dark"] .sidebar {
    background: rgba(20, 20, 20, 0.95);
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .sidebar {
      background: rgba(20, 20, 20, 0.95);
    }
  }
  .sidebar::before {
    content: "";
    position: absolute;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--octc-color-border);
    border-radius: 2px;
  }
  .sidebar.open {
    transform: translateY(0);
  }
  .main {
    margin-left: 0;
    padding: 1rem 0.75rem;
    padding-bottom: calc(56px + 1rem);
  }
  .content {
    padding: 0 0.25rem;
  }
  .content h1 {
    font-size: 1.5rem;
  }
  .content h2 {
    font-size: 1.2rem;
  }
  .content pre {
    padding: 0.75rem;
    font-size: 0.75rem;
    margin: 1rem -0.75rem;
    border-radius: 0;
  }
  .header {
    padding: 0 1rem;
  }
  .header-title {
    font-size: 1rem;
  }
  .overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
  }
  .overlay.open {
    display: block;
  }
}
.site-footer {
  margin-top: 3rem;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--octc-color-border);
  text-align: center;
  color: var(--octc-color-text-muted);
  font-size: 0.875rem;
}
.site-footer p {
  margin: 0.25rem 0;
}
.site-footer a {
  color: var(--octc-color-primary);
}
.site-footer a:hover {
  color: var(--octc-color-primary-hover);
}