:root {
  --bg: #070b15;
  --bg-2: #0d1424;
  --surface: #121a2d;
  --surface-2: #182339;
  --text: #edf2ff;
  --text-muted: #b2bfd8;
  --border: #2a3552;
  --teal: #1b356d;
  --teal-strong: #112650;
  --teal-soft: rgba(27, 53, 109, 0.22);
  --gold: #c8a34d;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow: 0 22px 50px rgba(2, 6, 17, 0.55);
  --font-heading: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  --font-body: "Source Sans 3", "Avenir", "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, monospace;
  --max-width: 1160px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(27, 53, 109, 0.44), transparent 36%),
    radial-gradient(circle at 88% 15%, rgba(200, 163, 77, 0.24), transparent 30%),
    linear-gradient(180deg, #0a1120 0%, var(--bg) 100%);
}

.topbar {
  position: sticky;
  top: 0.8rem;
  z-index: 20;
  width: min(var(--max-width), calc(100% - 2.5rem));
  margin: 0.8rem auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.72rem 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(9, 14, 27, 0.9);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-family: var(--font-heading);
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(200, 163, 77, 0.36);
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.top-link,
.sidebar-toggle {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.54rem 0.78rem;
  background: rgba(18, 26, 45, 0.92);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.top-actions .top-link:last-of-type {
  background: linear-gradient(135deg, var(--gold), #a87c2b);
  color: #0b111f;
  border-color: #be9238;
  box-shadow: 0 10px 24px rgba(200, 163, 77, 0.25);
}

.top-link:hover,
.sidebar-toggle:hover {
  border-color: #495779;
  transform: translateY(-1px);
}

.top-actions .top-link:last-of-type:hover {
  border-color: #d7b264;
  box-shadow: 0 14px 28px rgba(200, 163, 77, 0.32);
}

.sidebar-toggle {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 1.1rem;
  width: min(var(--max-width), calc(100% - 2.5rem));
  margin: 1rem auto 1.5rem;
}

.layout > * {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 5.4rem;
  align-self: start;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(13, 20, 36, 0.92);
  box-shadow: var(--shadow);
  max-height: calc(100vh - 6rem);
  overflow: auto;
}

.sidebar-search {
  padding: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-search label {
  display: block;
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-weight: 700;
}

.sidebar-search input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0.55rem 0.65rem;
  background: rgba(18, 26, 45, 0.9);
  color: var(--text);
  font-family: var(--font-body);
}

.sidebar-search input:focus {
  outline: 2px solid rgba(200, 163, 77, 0.2);
  border-color: var(--teal);
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem;
}

.sidebar nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 10px;
  padding: 0.52rem 0.6rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar nav a:hover {
  background: var(--teal-soft);
  color: var(--text);
}

.sidebar nav a.active {
  background: var(--gold);
  color: #0b111f;
  font-weight: 700;
  box-shadow: inset 3px 0 0 #ffe19c;
}

.content {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(14, 22, 39, 0.93);
  box-shadow: var(--shadow);
  padding: 1.5rem clamp(1rem, 2.4vw, 2rem);
}

.content section {
  scroll-margin-top: 6.1rem;
  padding-top: 0.2rem;
  margin-bottom: 2.1rem;
}

.content h1,
.content h2,
.content h3 {
  margin: 0;
  line-height: 1.15;
  font-family: var(--font-heading);
}

.content h1 {
  margin-top: 0.42rem;
  font-size: clamp(2rem, 4vw, 2.85rem);
}

.content h2 {
  margin-bottom: 0.6rem;
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  color: var(--text);
}

.content h3 {
  margin: 1rem 0 0.42rem;
  font-size: 1.12rem;
}

.content p,
.content li {
  color: var(--text-muted);
  font-size: 1.01rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  font-family: var(--font-body);
}

.content ul,
.content ol {
  margin: 0.52rem 0 0;
  padding-left: 1.2rem;
}

.content code {
  font-family: var(--font-mono);
  color: #f5cc76;
  font-size: 0.9em;
}

pre {
  margin: 0.6rem 0 0;
  background: #091120;
  border-radius: var(--radius-md);
  border: 1px solid rgba(200, 163, 77, 0.4);
  padding: 0.9rem;
  overflow-x: auto;
}

pre code {
  border: 0;
  background: transparent;
  color: #dce6ff;
  padding: 0;
  font-size: 0.87rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-family: var(--font-heading);
}

.intro-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.intro-grid article {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 0.9rem;
}

.intro-grid h2 {
  font-size: 1.06rem;
  margin-bottom: 0.3rem;
}

.callout {
  margin-top: 0.8rem;
  border: 1px solid rgba(200, 163, 77, 0.4);
  border-radius: var(--radius-md);
  background: rgba(200, 163, 77, 0.08);
  padding: 0.8rem;
}

.callout p {
  margin: 0;
  color: var(--text);
}

.content a {
  color: #efc872;
}

.content a:hover {
  color: #f7d995;
}

.docs-footer {
  margin-top: 2rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 1040px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
    position: fixed;
    left: 1rem;
    right: 1rem;
    top: 5.4rem;
    max-height: calc(100vh - 5.3rem);
    z-index: 25;
    transform: translateY(-16px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
  }

  .sidebar.open {
    display: block;
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .intro-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0.75rem;
    top: 0.45rem;
    width: calc(100% - 1rem);
  }

  .layout {
    width: calc(100% - 1rem);
    margin-top: 0.7rem;
  }

  .content {
    padding: 1rem;
  }

  .top-actions {
    justify-content: flex-start;
    gap: 0.35rem;
    margin-left: auto;
  }

  .top-link {
    display: none;
  }

  .top-link:last-of-type {
    display: inline-flex;
  }

  .top-link,
  .sidebar-toggle {
    padding: 0.42rem 0.62rem;
    font-size: 0.76rem;
  }
}
