/* ===== ROOT & VARIABLES ===== */
:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #666666;
  --border: #eaeaea;
  --accent: #0070f3;
  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-width: 260px;
  --sidebar-width-tablet: 210px;
  --nav-h: 86px;
  --transition: 0.3s ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.5;
  letter-spacing: -0.01em;
  overflow-x: clip;
}

/* Smooth slow fade between pages (Chrome/Edge cross-document transitions) */
@view-transition { navigation: auto; }
@keyframes vt-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes vt-fade-out { from { opacity: 1; } to { opacity: 0; } }
::view-transition-old(root) { animation: vt-fade-out 0.8s ease both; }
::view-transition-new(root) { animation: vt-fade-in 0.8s ease both; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.01ms; }
}

/* Shared intersection dots at the frame's line crossings */
.corner-dot {
  position: absolute;
  width: 6px; height: 6px;
  background: var(--border);
  border-radius: 50%;
  z-index: 60;
  pointer-events: none;
}
.cd-tl { left: 0; top: 0; transform: translate(-50%, -50%); }
.cd-tr { right: 0; top: 0; transform: translate(50%, -50%); }
.cd-bl { left: 0; bottom: 0; transform: translate(-50%, 50%); }
.cd-br { right: 0; bottom: 0; transform: translate(50%, 50%); }

/* ===== HEADER / NAV (matches main site) ===== */
.docs-header { position: sticky; top: 0; z-index: 50; }

.docs-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.5rem clamp(2rem, 4vw, 4rem);
  max-width: 1440px;
  margin: 0 auto;
  position: relative;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: transparent;
}
/* Full-viewport-width frosted backdrop spanning the entire sticky strip */
.docs-nav-bar::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0;
  bottom: 0;
  width: 100vw;
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  z-index: -1;
  pointer-events: none;
}
/* Full-bleed line under the sticky nav */
.docs-nav-bar::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -1px;
  width: 100vw;
  height: 1px;
  background: var(--border);
  pointer-events: none;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}
.logo img { width: 24px; height: 24px; display: block; }

.nav-links { display: flex; gap: 2rem; }
.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--fg); }
.nav-links a.active { color: var(--fg); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary:hover { background: #333; }
.nav-cta { padding: 0.5rem 1rem; font-size: 0.8125rem; }

.docs-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.docs-menu-toggle span {
  width: 24px;
  height: 2px;
  background: var(--fg);
  transition: all var(--transition);
}

/* ===== MAIN CONTAINER (1440 frame) ===== */
.docs-container {
  display: flex;
  max-width: 1440px;
  margin: 0 auto;
  position: relative;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* ===== SIDEBAR ===== */
.docs-sidebar {
  position: sticky;
  top: var(--nav-h);
  width: var(--sidebar-width);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  flex-shrink: 0;
}

.docs-sidebar-nav {
  display: flex;
  flex-direction: column;
}

.nav-section {
  border-bottom: 1px solid var(--border);
}
.nav-section:last-child {
  border-bottom: none;
}

.nav-category {
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color 0.15s ease;
  text-align: left;
}
.nav-category:hover { color: var(--fg); }
.nav-category.active { color: var(--fg); }

.chevron {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  margin-right: 2px;
  border: solid var(--muted);
  border-width: 0 1.5px 1.5px 0;
  border-radius: 0 0 1px 0;
  transform: rotate(45deg);          /* expanded → points down */
  transition: transform var(--transition), border-color 0.15s ease;
  flex-shrink: 0;
}
.nav-category:hover .chevron { border-color: var(--fg); }
.nav-category.collapsed .chevron { transform: rotate(-45deg); }  /* collapsed → points right */

.nav-items {
  list-style: none;
  overflow: hidden;
  transition: max-height var(--transition);
  padding-bottom: 0.5rem;
}

.nav-link {
  display: block;
  padding: 0.5rem 1.5rem 0.5rem 2.5rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1.4;
  border-left: 2px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.nav-link:hover {
  color: var(--fg);
  background: rgba(0, 0, 0, 0.02);
}
.nav-link.active {
  color: var(--accent);
  font-weight: 500;
  background: rgba(0, 112, 243, 0.05);
  border-left-color: var(--accent);
}

/* ===== MAIN CONTENT ===== */
.docs-main {
  flex: 1;
  min-width: 0;
  padding: clamp(2rem, 4vw, 3.5rem) clamp(2rem, 4vw, 4rem);
  min-height: calc(100vh - var(--nav-h));
}

.docs-breadcrumb {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 2.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.docs-content { max-width: 820px; }

.doc-section {
  margin-bottom: 4rem;
  scroll-margin-top: calc(var(--nav-h) + 1rem);
}

.doc-section h2 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 1rem;
  color: var(--fg);
}

.doc-section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2.25rem 0 0.75rem;
  color: var(--fg);
}

.doc-section p {
  margin-bottom: 1rem;
  color: #333;
  line-height: 1.7;
  max-width: 70ch;
}

.doc-section ul,
.doc-section ol {
  margin: 0 0 1.25rem 1.35rem;
  color: #333;
  line-height: 1.7;
}
.doc-section li {
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
  max-width: 68ch;
}
.doc-section li > ul,
.doc-section li > ol {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.doc-section strong { color: var(--fg); font-weight: 600; }

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

/* ===== INLINE CODE ===== */
.doc-section code {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--fg);
  background: #f4f4f5;
  border: 1px solid var(--border);
  padding: 0.12em 0.4em;
  border-radius: 6px;
  white-space: nowrap;
}

/* ===== TABLES (matches main site comparison table) ===== */
.doc-section table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.875rem;
}

.doc-section th {
  text-align: left;
  padding: 0.85rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg);
  background: #fafafa;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.doc-section td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  vertical-align: top;
  line-height: 1.5;
}

.doc-section th:not(:last-child),
.doc-section td:not(:last-child) {
  border-right: 1px solid var(--border);
}

.doc-section tbody tr:nth-child(even) td { background: #fcfcfc; }
.doc-section tbody tr:hover td { background: #f6f9ff; }
.doc-section tbody tr:last-child td { border-bottom: none; }
.doc-section td code { white-space: nowrap; }

/* ===== CALLOUT BOXES (color-coded, refined) ===== */
.doc-note,
.doc-tip,
.doc-warning {
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 10px;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: #333;
  max-width: 820px;
}

.doc-note {
  border-left-color: var(--accent);
  background: rgba(0, 112, 243, 0.04);
}
.doc-tip {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}
.doc-warning {
  border-left-color: #e5484d;
  background: rgba(229, 72, 77, 0.05);
}

.doc-note strong,
.doc-tip strong,
.doc-warning strong { color: var(--fg); }
.doc-note code,
.doc-tip code,
.doc-warning code { background: rgba(255, 255, 255, 0.6); }

/* ===== FOOTER (matches main site) ===== */
.docs-footer {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
  border: 1px solid var(--border);
  padding: 3rem clamp(2rem, 4vw, 4rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.8125rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.docs-footer::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -1px;
  width: 100vw;
  height: 1px;
  background: var(--border);
  pointer-events: none;
}
.docs-footer a { color: inherit; text-decoration: none; }
.docs-footer a:hover { color: var(--fg); }
.footer-links { display: flex; gap: 2rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .docs-sidebar { width: var(--sidebar-width-tablet); }
}

@media (max-width: 768px) {
  .docs-menu-toggle { display: flex; }
  .nav-links { display: none; }
  .nav-cta { display: none; }

  .docs-container { flex-direction: column; }

  .docs-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: calc(100vh - var(--nav-h));
    padding: 1rem 0;
    position: fixed;
    left: 0;
    top: var(--nav-h);
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 49;
    transform: translateX(-100%);
    transition: transform var(--transition);
    overflow-y: auto;
  }
  .docs-sidebar.show { transform: translateX(0); }

  .docs-main { padding: 2rem 1.5rem; flex: 1; }
}

@media (max-width: 480px) {
  .docs-nav-bar { padding: 1rem 1.25rem; }
  .docs-main { padding: 1.5rem 1.25rem; }
  .doc-section { margin-bottom: 3rem; }
  .doc-section ul,
  .doc-section ol { margin-left: 1.25rem; }
}

/* Sidebar scrollbar styling */
.docs-sidebar::-webkit-scrollbar { width: 6px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.docs-sidebar::-webkit-scrollbar-thumb:hover { background: var(--muted); }
