@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=Geist+Mono:wght@300;400;500&display=swap');

/* ── Root Variables ─────────────────────────── */
:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface2: #1a1a1a;
  --border: #262626;
  --border2: #333333;
  --red: #e5484d;
  --red-lt: #ff6b6f;
  --red-dk: #c0282d;
  --red-deep: #7d1a1d;
  --red-dim: rgba(229, 72, 77, 0.10);
  --red-glow: rgba(229, 72, 77, 0.32);
  --green: #3dd68c;
  --text: #ededed;
  --muted: #888888;
  --dim: #555555;
  --mono: 'Geist Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
  --display: 'Syne', sans-serif;

  /* Layout tokens */
  --nav-h: 64px;
  --sidebar-w: 300px;
  --radius: 6px;
  --radius-lg: 10px;
}

/* Light mode overrides */
[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f6f6f6;
  --surface2: #efefef;
  --border: #e3e3e3;
  --border2: #d0d0d0;
  --text: #111111;
  --muted: #666666;
  --dim: #999999;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--display);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  transition: background .25s, color .25s;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

/* ── Top Nav ────────────────────────────────── */
.top-nav {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 200;
  display: flex;
  align-items: center;
  backdrop-filter: blur(12px);
}

.nav-container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 0;
}

/* Brand */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.logo-icon {
  width: 50px;
  height: 50px;
}

/* Center nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: 40px;
  flex: 1;
}

.nav-links a {
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  transition: color .15s;
}

.nav-links a:hover {
  color: var(--text);
}

.version-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.version-current {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--red-dim);
  border: 1px solid var(--red-dk);
  color: var(--red-lt);
  padding: 3px 10px;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 600;
  font-family: var(--mono);
}

.version-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 140px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all .2s cubic-bezier(.16, 1, .3, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  overflow: hidden;
  z-index: 300;
}

.version-badge:hover .version-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.version-dropdown a {
  display: block;
  padding: 8px 14px;
  font-size: .8rem;
  font-family: var(--mono);
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  transition: background .15s, color .15s;
}

.version-dropdown a:last-child {
  border-bottom: none;
}

.version-dropdown a:hover {
  background: var(--surface2);
  color: var(--text);
}

.version-dropdown a.active {
  color: var(--red-lt);
  background: var(--red-dim);
  font-weight: 600;
}

/* Nav actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Search */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 11px;
  color: var(--muted);
  pointer-events: none;
}

#doc-search {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 50px 7px 32px;
  color: var(--text);
  font-family: var(--display);
  font-size: .8rem;
  width: 220px;
  transition: width .2s, border-color .15s;
}

#doc-search::placeholder {
  color: var(--muted);
}

#doc-search:focus {
  outline: none;
  border-color: var(--red);
  width: 260px;
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--red-dim);
}

.search-kbd {
  position: absolute;
  right: 9px;
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--dim);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  pointer-events: none;
}

#search-results {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .5);
  z-index: 300;
}

.search-result-item {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.search-result-item:hover {
  background: var(--surface2);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-title {
  font-weight: 600;
  color: var(--red-lt);
  margin-bottom: 3px;
  font-size: .85rem;
}

.search-result-excerpt {
  font-size: .78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Theme toggle */
#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  padding: 7px;
  display: flex;
  align-items: center;
  transition: color .15s, border-color .15s, background .15s;
}

#theme-toggle:hover {
  color: var(--text);
  border-color: var(--border2);
  background: var(--surface);
}

/* GitHub icon */
.nav-github {
  color: var(--muted);
  display: flex;
  align-items: center;
  transition: color .15s;
}

.nav-github:hover {
  color: var(--text);
}

/* ── Landing Page ────────────────────────────── */
body.landing-page {
  padding-top: var(--nav-h);
}

.landing-page .container {
  max-width: 1900px;
  margin: 0 auto;
  padding: 0 40px;
}

/* Hero — split layout like Node.js */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  padding: 80px 40px 80px;
  max-width: 1940px;
  margin: 0 auto;
}


.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--red-dim);
  border: 1px solid rgba(229, 72, 77, 0.25);
  color: var(--red-lt);
  padding: 5px 14px;
  border-radius: 50px;
  font-size: .78rem;
  font-weight: 600;
  font-family: var(--mono);
  margin-bottom: 28px;
}

.hero-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
  flex-shrink: 0;
}

.hero h1 {
  font-size: clamp(2.8rem, 5vw, 4.2rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin-bottom: 22px;
  color: var(--text);
}

.hero h1 em {
  font-style: normal;
  color: var(--red);
}

.hero .subtitle {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 36px;
  max-width: 440px;
}

.cta-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 26px;
  border-radius: var(--radius);
  font-family: var(--display);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-main {
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 0 0 var(--red-glow);
}

.btn-main:hover {
  background: var(--red-lt);
  box-shadow: 0 0 20px var(--red-glow);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border-color: var(--border2);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--red);
  color: var(--red-lt);
  background: var(--red-dim);
}

/* Code demo panel (right side of hero) */
.hero-right {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.code-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  padding: 0 4px;
  overflow-x: auto;
}

.code-tab {
  padding: 12px 16px;
  font-size: .8rem;
  font-family: var(--display);
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.code-tab:hover {
  color: var(--text);
}

.code-tab.active {
  color: var(--red-lt);
  border-bottom-color: var(--red);
}

.code-panel {
  display: none;
}

.code-panel.active {
  display: block;
}

.code-panel pre {
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  background: var(--surface) !important;
  padding: 24px !important;
  font-family: var(--mono) !important;
  font-size: .82rem !important;
  line-height: 1.7 !important;
  min-height: 280px;
}

.code-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}

.code-lang {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
}

.copy-panel-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--display);
  font-size: .75rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 12px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.copy-panel-btn:hover {
  color: var(--text);
  border-color: var(--border2);
}

.copy-panel-btn svg {
  flex-shrink: 0;
}

/* Sponsors row */
.sponsors-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sponsors-label {
  font-size: .78rem;
  color: var(--dim);
}

.sponsor-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sponsor-badge {
  width: 34px;
  height: 34px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  transition: border-color .15s;
  cursor: pointer;
}

.sponsor-badge:hover {
  border-color: var(--red);
}

/* Divider */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  max-width: 1200px;
  margin: 0 auto;
}

/* Features section */
.features-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 40px;
}

.features-section h2 {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.features-section .section-desc {
  color: var(--muted);
  margin-bottom: 48px;
  font-size: .95rem;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 28px;
  border-radius: var(--radius-lg);
  transition: border-color .2s, transform .2s;
}

.card:hover {
  border-color: var(--red);
  transform: translateY(-3px);
}

.card-icon {
  width: 38px;
  height: 38px;
  background: var(--red-dim);
  border: 1px solid rgba(229, 72, 77, .2);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--red);
}

.card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.card p {
  font-size: .875rem;
  color: var(--muted);
  line-height: 1.65;
}

/* Landing footer */
.landing-footer {
  border-top: 1px solid var(--border);
  padding: 32px 40px;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--dim);
  font-size: .82rem;
}

.landing-footer a {
  color: var(--muted);
  transition: color .15s;
}

.landing-footer a:hover {
  color: var(--red-lt);
}

/* ── Docs Layout ──────────────────────────────── */
.docs-layout {
  display: flex;
  padding-top: var(--nav-h);
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  position: fixed;
  top: var(--nav-h);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 32px 24px;
  border-right: 1px solid var(--border);
  background: var(--bg);
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 2px;
}

.nav-group {
  margin-bottom: 32px;
}

.nav-header {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--dim);
  margin-bottom: 10px;
  padding-left: 10px;
}

.nav-link {
  display: block;
  padding: 7px 10px;
  font-size: .87rem;
  color: var(--muted);
  border-radius: var(--radius);
  transition: color .13s, background .13s;
  font-weight: 400;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface);
}

.nav-link.active {
  color: var(--red-lt);
  background: var(--red-dim);
  font-weight: 600;
  border-left: 2px solid var(--red);
  padding-left: 8px;
}

/* Docs content area */
.docs-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 56px 72px;
  width: 100%;
  max-width: 1250px;
}

/* ── Markdown Body ────────────────────────────── */
.markdown-body h1 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 20px;
  color: var(--text);
}

.markdown-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 52px;
  margin-bottom: 16px;
  color: var(--text);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.markdown-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--text);
}

.markdown-body p {
  font-size: .95rem;
  line-height: 1.8;
  color: var(--muted);
  margin-bottom: 20px;
}

.markdown-body a {
  color: var(--red-lt);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.markdown-body a:hover {
  color: var(--red);
}

.markdown-body code {
  font-family: var(--mono);
  font-size: .85em;
  background: var(--red-dim);
  color: var(--red-lt);
  padding: .15em .45em;
  border-radius: 4px;
  border: 1px solid rgba(229, 72, 77, .18);
}

.markdown-body pre {
  background: var(--surface) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.markdown-body pre code {
  background: none;
  color: inherit;
  border: none;
  padding: 0;
  font-size: .85rem;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.4em;
  margin-bottom: 20px;
}

.markdown-body li {
  font-size: .95rem;
  color: var(--muted);
  margin-bottom: 6px;
  line-height: 1.7;
}

.markdown-body blockquote {
  border-left: 3px solid var(--red);
  padding: 12px 20px;
  background: var(--red-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 20px;
}

.markdown-body blockquote p {
  margin: 0;
  color: var(--text);
  opacity: .85;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 28px;
  font-size: .88rem;
}

.markdown-body th {
  text-align: left;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-weight: 600;
  color: var(--text);
}

.markdown-body td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.markdown-body tr:hover td {
  background: var(--surface);
}

/* ── 404 Page ──────────────────────────────────── */
.page-404 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--nav-h));
  text-align: center;
  padding: 40px;
}

.page-404 .err-code {
  font-size: clamp(5rem, 15vw, 10rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
  color: var(--red);
  opacity: .15;
  margin-bottom: 0;
}

.page-404 h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 12px;
  margin-top: -20px;
}

.page-404 .subtitle {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 36px;
}

/* ── Responsive ───────────────────────────────── */
@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-right {
    display: none;
  }

  .docs-content {
    padding: 40px 32px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .docs-content {
    margin-left: 0;
    padding: 32px 20px;
  }

  .nav-links {
    display: none;
  }

  .hero {
    padding: 60px 20px;
  }

  .features-section {
    padding: 60px 20px;
  }

  .landing-footer {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

/* ── Code Blocks (gerados pelo MarkdownParser) ──────────────────────────────── */

.code-block {
  margin-bottom: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  /* NUNCA position: absolute — senão sobrepõe o code block */
}

.code-header .code-lang {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  /* Override do .code-lang genérico do hero, se existir */
  background: none;
  padding: 0;
  border: none;
}

.code-copy {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--muted);
  padding: 3px 12px;
  border-radius: var(--radius);
  font-size: .75rem;
  font-family: var(--display);
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  line-height: 1.6;
}

.code-copy:hover {
  color: var(--text);
  border-color: var(--border2);
  background: var(--surface);
}

.code-block pre {
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: var(--surface) !important;
  padding: 20px 24px !important;
  overflow-x: auto;
}

.code-block pre code {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  font-family: var(--mono) !important;
  font-size: .84rem !important;
  line-height: 1.65 !important;
  color: inherit;
}

/* table-wrapper para tabelas do parser */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.table-wrapper table {
  margin-bottom: 0;
  border: none;
}

/* heading anchors */
.heading-anchor {
  margin-right: 8px;
  color: var(--red) !important;
  text-decoration: none !important;
  font-weight: 400;
  font-size: .85em;
  transition: opacity .15s;
}


/* ── Adicionar ao final do style.css ──────────────────────────────────────────
   Responsividade do Top Nav — hamburger menu mobile
   ────────────────────────────────────────────────────────────────────────── */

/* Hamburger button (hidden on desktop) */
.nav-hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  padding: 7px;
  align-items: center;
  justify-content: center;
  transition: color .15s, border-color .15s;
  margin-left: auto;
}

.nav-hamburger:hover {
  color: var(--text);
  border-color: var(--border2);
}

.nav-hamburger .hb-close {
  display: none;
}

.nav-hamburger.open .hb-open {
  display: none;
}

.nav-hamburger.open .hb-close {
  display: block;
}

/* Mobile drawer */
.nav-mobile-drawer {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px 20px;
  z-index: 190;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}

.nav-mobile-drawer.open {
  display: flex;
}

.nav-mobile-link {
  display: block;
  padding: 10px 12px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: var(--radius);
  transition: color .13s, background .13s;
  text-decoration: none;
}

.nav-mobile-link:hover {
  color: var(--text);
  background: var(--surface);
}

.nav-mobile-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* Hide desktop nav-links & search on mobile, show hamburger */
@media (max-width: 768px) {
  .nav-links {
    display: none !important;
  }

  .nav-hamburger {
    display: flex;
  }

  /* Keep search hidden on mobile too, or show a compact icon version */
  .search-container {
    display: none;
  }

  .nav-actions {
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .nav-container {
    padding: 0 16px;
  }
}