/* Shared static guide layout */
:root {
  --radius: 0.625rem;
  --background: #ffffff;
  --foreground: #1a1a1a;
  --muted-foreground: #6b7fa3;
  --border: #d4dae3;
  --primary: #254597;
  --primary-fg: #ffffff;
  --sidebar-accent: #ebf0f9;
  font-variant-ligatures: none;
}

html.dark {
  --background: #141820;
  --foreground: #e8eaef;
  --muted-foreground: #9aa8c4;
  --border: #2a3140;
  --sidebar-accent: #1e2840;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  font-size: 16px;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 4rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--background);
}

.top-nav-left { display: flex; align-items: center; gap: 1.5rem; min-width: 0; }
.top-nav img.logo-wordmark { height: 2.5rem; max-width: 12rem; object-fit: contain; }
.top-nav img.logo-mark { height: 2.5rem; object-fit: contain; }
.top-nav .brand-text { font-weight: 700; font-size: 1.1rem; color: var(--primary); text-decoration: none; }
.header-nav { display: flex; align-items: center; gap: 1rem; }
.header-link { font-size: 0.875rem; font-weight: 500; color: var(--muted-foreground); text-decoration: none; }
.header-link:hover, .header-link.active { color: var(--primary); }
.top-nav-right { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; height: 2.25rem;
  padding: 0 0.875rem; font-size: 0.875rem; font-weight: 500; color: var(--primary-fg);
  background: var(--primary); border: none; border-radius: var(--radius); cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.btn-primary:hover { filter: brightness(1.08); }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: transparent;
  color: var(--foreground); cursor: pointer;
}
.theme-toggle .icon-sun { display: inline; }
.theme-toggle .icon-moon { display: none; }
html.dark .theme-toggle .icon-sun { display: none; }
html.dark .theme-toggle .icon-moon { display: inline; }

.page-body { display: flex; flex-direction: column; min-height: calc(100vh - 4rem); }
.docs-layout { display: flex; flex: 1; align-items: flex-start; min-height: 0; }
.sidebar {
  position: sticky; top: 4rem; width: var(--sidebar-width, 24%); min-width: 220px; max-width: 42%;
  max-height: calc(100vh - 4rem); overflow-y: auto; padding: 1rem 0.75rem 2rem;
  border-right: 1px solid var(--border); flex-shrink: 0;
}
.sidebar-resize-handle {
  width: 4px; flex-shrink: 0; cursor: col-resize; align-self: stretch;
  background: transparent; margin: 0 -2px; z-index: 5;
}
.sidebar-resize-handle:hover { background: var(--border); }
.sidebar-search { margin-bottom: 1rem; }
.sidebar-search .search-box { max-width: none; }
.sidebar-search .search-dropdown { max-height: 16rem; }
.header-link--soon { cursor: default; position: relative; }
.header-link--soon:hover, .header-link--soon:focus { color: var(--muted-foreground); }
.header-link--soon .header-tooltip {
  position: absolute; left: 50%; top: calc(100% + 0.35rem); transform: translateX(-50%);
  padding: 0.25rem 0.5rem; font-size: 0.75rem; white-space: nowrap;
  background: var(--foreground); color: var(--background); border-radius: 4px;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
.header-link--soon:hover .header-tooltip,
.header-link--soon:focus .header-tooltip { opacity: 1; }
.hashtag-filter { display: flex; flex-wrap: nowrap; gap: 0.35rem; overflow-x: auto; padding: 0.5rem 0; margin-top: 0.25rem; }
.hashtag-chip {
  flex-shrink: 0; padding: 0.2rem 0.55rem; font-size: 0.75rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--background); color: var(--foreground); cursor: pointer;
}
.hashtag-chip.is-selected { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.hashtag-label { font-size: 0.75rem; color: var(--muted-foreground); margin: 0.25rem 0 0; }
.docs-nav { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; }
.docs-nav a { display: block; color: var(--foreground); text-decoration: none; padding: 0.2rem 0.5rem; border-radius: 0.375rem; }
.docs-nav a:hover { color: var(--primary); background: var(--sidebar-accent); }
.docs-nav a.active { font-weight: 600; color: var(--primary); background: var(--sidebar-accent); }
.nav-group { margin: 0.15rem 0; }
.nav-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 0.2rem 0.25rem; font-weight: 500; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: "▸"; font-size: 0.75rem; color: var(--muted-foreground); transition: transform 0.15s; }
.nav-group[open] > summary::after { transform: rotate(90deg); }
.nav-section-title { font-weight: 600; color: var(--primary); font-size: 0.85rem; }
.nav-children { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.35rem 0 0.5rem; }
.nav-children-indented { padding-left: 0.75rem; border-left: 1px solid var(--border); margin-left: 0.35rem; }
.nav-tag { font-size: 0.7rem; background: #3b82f6; color: #fff; border-radius: 4px; padding: 0.1rem 0.35rem; margin-left: 0.25rem; }
.content-row { display: flex; flex: 1; gap: 2.5rem; min-width: 0; padding: 0 1.5rem 0 0; }
.content { flex: 4.5; min-width: 0; padding: 2.5rem 0 2rem 2rem; max-width: 52rem; }
.content h1 { font-size: 2rem; font-weight: 700; margin: 0 0 0.5rem; color: var(--primary); }
.description { color: var(--muted-foreground); margin: 0 0 1.5rem; font-size: 0.95rem; }
.prose { margin: 0; }
.prose h2 { margin-top: 2rem; padding-bottom: 0.25rem; border-bottom: 1px solid var(--border); color: var(--primary); }
.prose h3, .prose h4 { color: var(--foreground); }
.prose a { color: var(--primary); text-decoration: underline; }
.prose table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; text-align: left; }
.prose code { background: var(--sidebar-accent); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.9em; }
.prose pre { background: var(--sidebar-accent); padding: 1rem; overflow-x: auto; border-radius: 8px; }
.navattic-demo { margin: 1.5rem 0; }
.toc-sidebar { display: none; width: 20rem; flex-shrink: 0; position: sticky; top: 4rem; max-height: calc(100vh - 4rem); overflow-y: auto; padding: 2.25rem 0 2rem 1.5rem; }
.toc-heading { font-size: 0.875rem; font-weight: 600; margin: 0 0 0.75rem; }
.toc-nav { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.875rem; }
.toc-link { color: var(--foreground); text-decoration: none; line-height: 1.4; }
.toc-link:hover { color: var(--primary); }
.toc-link.active { color: var(--primary); font-weight: 600; }
.toc-l2 { padding-left: 0; }
.toc-l3 { padding-left: 1rem; }
.toc-l4 { padding-left: 2rem; }
.pagination { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2.5rem; padding-top: 1.5rem; }
.pagination-btn { display: flex; flex-direction: column; text-decoration: none; color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1rem; transition: border-color 0.15s; }
.pagination-btn:hover { border-color: var(--primary); }
.pagination-prev { align-items: flex-start; }
.pagination-next { align-items: flex-end; text-align: right; }
.pagination-label { font-size: 0.75rem; color: var(--muted-foreground); margin-bottom: 0.35rem; }
.pagination-title { font-size: 0.9rem; font-weight: 500; }
.site-footer { border-top: 1px solid var(--border); height: 4rem; flex-shrink: 0; }
.site-footer-inner { display: flex; align-items: center; justify-content: flex-end; height: 100%; padding: 0 1.5rem; gap: 0.5rem; }
.btn-outline { display: inline-flex; align-items: center; gap: 0.35rem; height: 2rem; padding: 0 0.75rem; font-size: 0.875rem; color: var(--foreground); background: var(--background); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; cursor: pointer; }
.btn-outline:hover { border-color: var(--primary); }
.btn-outline .heart { color: #dc2626; }
@media (min-width: 1280px) { .toc-sidebar { display: block; } }
@media (max-width: 768px) {
  .docs-layout { flex-direction: column; }
  .sidebar { position: static; width: 100%; max-width: none; max-height: none; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar-resize-handle { display: none; }
  .content-row { flex-direction: column; padding: 0; }
  .content { padding: 1.5rem 1rem; }
  .header-nav { display: none; }
}

/* Landing + search pages */
.landing-hero {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: calc(100vh - 8rem); text-align: center; padding: 3rem 1.5rem; flex: 1;
}
.landing-hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.75rem); font-weight: 700; margin: 0 0 1rem;
  color: var(--foreground); line-height: 1.1;
}
.landing-tagline {
  color: var(--muted-foreground); font-size: 1.125rem; max-width: 48rem;
  margin: 0 0 2rem; line-height: 1.5;
}
.search-box { position: relative; width: 100%; max-width: 36rem; }
.search-icon {
  position: absolute; left: 0.875rem; top: 50%; transform: translateY(-50%);
  color: var(--muted-foreground); font-size: 1.1rem; pointer-events: none;
}
.search-input {
  width: 100%; height: 3rem; padding: 0 1rem 0 2.5rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 1rem; background: var(--background); color: var(--foreground);
}
.search-input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.search-dropdown {
  position: absolute; z-index: 30; top: calc(100% + 0.5rem); left: 0; right: 0;
  background: var(--background); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08); max-height: 24rem; overflow-y: auto; padding: 0.5rem;
  text-align: left;
}
.search-result-card {
  display: block; padding: 1rem; border-radius: calc(var(--radius) - 2px);
  text-decoration: none; color: var(--foreground); border: 1px solid transparent;
}
.search-result-card:hover { border-color: var(--primary); background: var(--sidebar-accent); }
.search-result-title { font-size: 1rem; font-weight: 600; margin: 0 0 0.25rem; line-height: 1.3; }
.search-result-desc { font-size: 0.875rem; color: var(--muted-foreground); margin: 0; line-height: 1.4; }
.search-empty { padding: 1rem; text-align: center; color: var(--muted-foreground); font-size: 0.875rem; margin: 0; }
.search-page { flex: 1; max-width: 48rem; margin: 0 auto; padding: 2rem 1.5rem; width: 100%; }
.search-page h1 { font-size: 1.875rem; font-weight: 700; margin: 0 0 1.5rem; color: var(--foreground); }
.search-results { margin-top: 2rem; }
.search-results-count { font-size: 0.875rem; color: var(--muted-foreground); margin: 0 0 1rem; }
.search-results-list { display: flex; flex-direction: column; gap: 0.75rem; }
.search-page-empty { text-align: center; color: var(--muted-foreground); padding: 3rem 1rem; }
.search-page-empty-title { font-size: 1.125rem; font-weight: 500; margin: 0 0 0.5rem; color: var(--foreground); }
.search-page-empty-sub { font-size: 0.875rem; margin: 0; }
.search-page-hint { text-align: center; color: var(--muted-foreground); padding: 3rem 1rem; }
.search-page-hint[hidden] { display: none; }
.search-page:has(.search-results:not(:empty)) .search-page-hint { display: none; }
