/* ── Reset & Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* DevBot navy theme */
  --bg: #0a0d20;
  --bg-subtle: #0e1130;
  --bg-card: #111634;
  --bg-code: #161b3c;
  --border: #252a52;
  --border-subtle: #1c2144;
  --text: #e8e6f0;
  --text-muted: #a09db8;
  --text-dim: #706d88;
  --accent: #6c7bff;
  --accent-bright: #8b96ff;
  --accent-secondary: #ffb454;
  --link: #8b96c9;
  --link-hover: #a8b2e8;
  --code-text: #d4d0e8;
  --hero-gradient-start: #0a0d20;
  --hero-gradient-end: #0e1130;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.5);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color .15s ease;
}
a:hover { color: var(--link-hover); }

img { max-width: 100%; height: auto; }

/* ── Header / Nav ──────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 13, 32, .85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
}
.logo:hover { color: var(--text); }

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
}
.logo-icon img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 6px;
}

.logo-text { letter-spacing: -.02em; }

.nav-links {
  display: flex;
  align-items: center;
  gap: .25rem;
  list-style: none;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .85rem;
  font-size: .875rem;
  font-weight: 450;
  color: var(--text-muted);
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--bg-subtle);
}

.nav-github svg { opacity: .7; transition: opacity .15s; }
.nav-github:hover svg { opacity: 1; }

/* Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  padding: .5rem 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  list-style: none;
  z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: block;
  padding: .5rem 1rem;
  font-size: .85rem;
  border-radius: 0;
}
.nav-dropdown-menu a:hover { background: var(--bg-subtle); }

/* Modules mega-menu — one column per area, opened by click / keyboard (not
   hover), so it stays reachable without a pointer and scales to ~46 entries. */
.nav-megamenu-trigger {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.nav-megamenu-trigger::after {
  content: "▾";
  margin-left: .3rem;
  font-size: .7em;
  opacity: .7;
}
.nav-megamenu-trigger.active { color: var(--text); }
.nav-megamenu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 200;
  width: max-content;
  max-width: calc(100vw - 2rem);
  padding: .75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}
.nav-megamenu[hidden] { display: none; }
.nav-megamenu-all {
  display: block;
  padding: .5rem .5rem .6rem;
  margin-bottom: .5rem;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
  font-weight: 600;
}
.nav-megamenu-all::after {
  content: " →";
  font-weight: 400;
  opacity: .7;
}
.nav-megamenu-cols { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.nav-megamenu-col { min-width: 190px; }
.nav-megamenu-col > summary { cursor: pointer; list-style: none; }
.nav-megamenu-col > summary::-webkit-details-marker { display: none; }
.nav-megamenu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: calc(100vh - 9rem);
  overflow-y: auto;
}
.nav-megamenu-list a {
  display: block;
  padding: .35rem .5rem;
  font-size: .85rem;
  border-radius: 4px;
}
.nav-megamenu-list a:hover { background: var(--bg-subtle); }
.nav-dropdown-heading {
  display: block;
  padding: .25rem .5rem;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .nav-megamenu {
    position: static;
    padding: 0 0 0 .75rem;
    background: transparent;
    border: none;
    box-shadow: none;
  }
  .nav-megamenu-cols { flex-direction: column; gap: 0; }
  .nav-megamenu-list { max-height: none; }
  /* 44px touch targets inside the drawer. */
  .nav-megamenu-all,
  .nav-megamenu-list a,
  .nav-megamenu-col > summary {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: .5rem;
  }
}

/* Mobile toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .5rem;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-muted);
  margin: 4px 0;
  transition: .2s;
}

/* ── Badges ─────────────────────────────────────────────────────────── */
.badge-recommended {
  font-size: .7rem;
  font-weight: 500;
  color: var(--accent);
  background: rgba(108, 123, 255, .15);
  padding: 1px 8px;
  border-radius: 100px;
  vertical-align: middle;
  margin-left: 4px;
}
.badge-power {
  font-size: .7rem;
  font-weight: 500;
  color: var(--accent-secondary);
  background: rgba(255, 180, 84, .15);
  padding: 1px 8px;
  border-radius: 100px;
  vertical-align: middle;
  margin-left: 4px;
}

/* ── Hero ──────────────────────────────────────────────────────────── */
.hero {
  padding: 4rem 0 4rem;
  text-align: center;
  background: linear-gradient(180deg, var(--hero-gradient-start), var(--hero-gradient-end));
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .9rem;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  margin-bottom: 1.75rem;
}

.hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.03em;
  color: var(--text);
  max-width: 780px;
  margin: 0 auto 1.25rem;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}

.hero-install {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: left;
  font-family: var(--font-mono);
  font-size: .9rem;
  color: var(--code-text);
  overflow-x: auto;
}

/* "Why DevBot?" sits inside the hero, just above the install block, so it
   needs its own width and left alignment against the hero's centering. */
.hero-why {
  max-width: 780px;
  margin: 0 auto 2.5rem;
  text-align: left;
}
.hero-why h2 {
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 650;
  letter-spacing: -.01em;
  text-align: center;
  margin-bottom: .5rem;
}
.hero-why-lead {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1.25rem;
}
/* Tighter than the section variant, which has more vertical room to fill. */
.hero-why .highlight-list li { padding: .5rem 0; }
/* The install command must not scroll out of sight on a narrow screen. */
@media (max-width: 640px) {
  .hero-install .hero-install-cmd-text {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

.hero-install .prompt {
  color: var(--text-dim);
  user-select: none;
}

.hero-install .optional {
  opacity: .55;
}

/* The install command line is one click target (copy on click, opencode-style):
   the command text on the left, the copy-status icon at the end of the line. */
.hero-install .hero-install-cmd {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .35rem .5rem;
  margin: -.35rem -.5rem;
  background: none;
  border: none;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}

.hero-install .hero-install-cmd-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
}

.hero-install .hero-install-cmd:hover {
  background: rgba(108, 123, 255, .12);
}

.hero-install .hero-install-cmd:hover .hero-install-cmd-text {
  color: var(--text);
}

.hero-install .hero-install-cmd[data-copied] {
  background: rgba(108, 123, 255, .25);
}

.hero-install-copy-status {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.hero-install-copy-icon {
  color: var(--text-dim);
}

.hero-install-copy-check {
  display: none;
  color: #03b000;
}

.hero-install-cmd[data-copied] .hero-install-copy-icon {
  display: none;
}

.hero-install-cmd[data-copied] .hero-install-copy-check {
  display: block;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.5rem;
  font-size: .9rem;
  font-weight: 550;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-bright);
  color: #fff;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-card);
  border-color: var(--text-dim);
  color: var(--text);
}

/* ── Sections ──────────────────────────────────────────────────────── */
.section {
  padding: 5rem 0;
}

.section-alt {
  background: var(--bg-subtle);
}

.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-header h2 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: .75rem;
}

.section-header p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
}

/* ── Feature Grid ──────────────────────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  transition: border-color .2s, box-shadow .2s;
}
.feature-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(108, 123, 255, .2);
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: .6rem;
  color: var(--text);
}

.feature-card p {
  font-size: .9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.feature-card a {
  color: var(--accent);
}
.feature-card a:hover {
  color: var(--accent-bright);
}

/* ── Highlight List (checkmarks) ───────────────────────────────────── */
.highlight-list {
  list-style: none;
  max-width: 820px;
  margin: 0 auto;
}

.highlight-list li {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .75rem 0;
  font-size: .95rem;
  line-height: 1.55;
  border-bottom: 1px solid var(--border-subtle);
}
.highlight-list li:last-child { border-bottom: none; }

.highlight-list .check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: .7rem;
  color: var(--accent);
  margin-top: .15rem;
}

/* Scenario variant: a neutral marker, not a checkbox — the items are conditions
   the reader recognises, not features the product claims to include. */
.highlight-list-scenarios .check {
  width: auto;
  height: auto;
  background: none;
  border: none;
  border-radius: 0;
  font-size: 1rem;
}

.highlight-list strong {
  color: var(--text);
}

/* ── Install Steps ─────────────────────────────────────────────────── */
.install-steps {
  max-width: 820px;
  margin: 0 auto;
}

.install-step {
  display: flex;
  gap: 1.25rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
}
.install-step:last-child { border-bottom: none; }

.step-number {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 600;
  font-size: .85rem;
  color: var(--accent);
}

.install-step h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: .4rem;
}

.install-step p {
  font-size: .9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.install-step code {
  display: block;
  margin-top: .6rem;
  padding: .6rem .9rem;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--code-text);
  overflow-x: auto;
}

/* ── Prose (doc pages) ─────────────────────────────────────────────── */
.page-content {
  padding: 3.5rem 0 5rem;
}

.page-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: .5rem;
}

.page-description {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

/* Module pages: breadcrumb + capability manifest strip above the prose. */
.page-content--module .page-description { margin-bottom: .75rem; }
.breadcrumb {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { opacity: .55; margin: 0 .35rem; }
.capability-strip {
  display: inline-block;
  padding: .3rem .8rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}
/* Table and list code chips are atomic — `anywhere` split identifiers mid-token. */
.prose table code,
.prose li code { white-space: nowrap; }
/* Below this width a three-column table can't fit; give it a floor width and
   let the prose column scroll horizontally, rather than squeezing every cell
   into a tall stack. */
@media (max-width: 640px) {
  .prose { overflow-x: auto; }
  .prose table { min-width: 40rem; }
}

.prose {
  max-width: 780px;
}

.prose h1 { font-size: 2rem; font-weight: 700; margin: 2.5rem 0 1rem; letter-spacing: -.02em; }
.prose h2 { font-size: 1.5rem; font-weight: 650; margin: 2.5rem 0 .75rem; letter-spacing: -.01em; padding-bottom: .5rem; border-bottom: 1px solid var(--border-subtle); }
.prose h3 { font-size: 1.15rem; font-weight: 600; margin: 2rem 0 .5rem; }
.prose h4 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 .5rem; color: var(--text-muted); }

.prose p { margin-bottom: 1rem; }

.prose ul, .prose ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.prose li { margin-bottom: .35rem; }

.prose code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .15em .35em;
}

.prose pre {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.55;
}
.prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: .85rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: .9rem;
}
.prose th, .prose td {
  text-align: left;
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border-subtle);
}
.prose th {
  font-weight: 600;
  color: var(--text);
  border-bottom-color: var(--border);
}
.prose td { color: var(--text-muted); }
.prose td:first-child { color: var(--text); }

.prose blockquote {
  margin: 1.5rem 0;
  padding: .75rem 1.25rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-card);
  border-radius: 0 6px 6px 0;
  color: var(--text-muted);
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 2.5rem 0;
}

.prose a { text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }

.prose strong { color: var(--text); font-weight: 600; }

/* ── Footer ────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 3.5rem 0 2rem;
  background: var(--bg);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.5fr 3fr;
  gap: 2rem;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.footer-brand .logo-text {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

.footer-tagline {
  margin-top: .6rem;
  font-size: .85rem;
  color: var(--text-dim);
}

.footer-col h4 {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  margin-bottom: .75rem;
}

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: .4rem; }
.footer-col a {
  font-size: .875rem;
  color: var(--text-muted);
}
.footer-col a:hover { color: var(--text); }

.footer-bottom {
  grid-column: 1 / -1;
  padding-top: 2rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  font-size: .8rem;
  color: var(--text-dim);
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-toggle { display: block; }

  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    gap: .25rem;
  }
  .nav-links.open { display: flex; }

  .nav-dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    background: transparent;
    padding-left: 1rem;
  }
  .nav-dropdown:hover .nav-dropdown-menu { display: none; }
  .nav-dropdown.open .nav-dropdown-menu { display: block; }

  .hero { padding: 4rem 0 3rem; }

  /* The install command is wider than a phone viewport. Wrap it so the whole
     command stays visible instead of hiding behind a horizontal scroll. */
  .hero-install .hero-install-cmd-text {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Anchor the copy icon to the first line of the wrapped command instead of
     the vertical middle of the block. */
  .hero-install .hero-install-cmd {
    align-items: flex-start;
  }

  .hero-install-copy-status {
    margin-top: .3rem;
  }

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

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-links {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .hero-actions { flex-direction: column; align-items: center; }
}

/* ── Syntax Highlighting (Rouge — devbot palette) ──────────────────── */
.highlight { margin-bottom: 1.5rem; border-radius: 8px; overflow: hidden; }
.highlight pre { margin: 0; }
.highlight .c, .highlight .cm, .highlight .c1, .highlight .cs { color: #706d88; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt { color: #8b96c9; font-weight: 500; }
.highlight .s, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .s1 { color: #a9b87e; }
.highlight .na { color: #8b96c9; }
.highlight .nb { color: #d4d0e8; }
.highlight .nc, .highlight .no { color: #e8e6f0; }
.highlight .nf, .highlight .ni { color: #d4d0e8; }
.highlight .nn { color: #8b96c9; }
.highlight .o, .highlight .ow { color: #a09db8; }
.highlight .p { color: #d4d0e8; }
.highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo { color: #ffb454; }

/* ── Wide prose (for modules-and-tools, etc.) ──────────────────────── */
.prose-wide {
  max-width: 1120px;
}
