/* ExpertEditor — site assets (v2) */
/* Tema claro/escuro via [data-theme] no <html> (mesmo mecanismo do editor). */

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: rgba(37, 99, 235, 0.10);
  --bg-1: #eef2ff;
  --bg-2: #f8fafc;
  --surface: #ffffff;
  --surface-card: rgba(255, 255, 255, 0.85);
  --text: #1f2937;
  --muted: #64748b;
  --border: #e5e7eb;
  --border-soft: rgba(15, 23, 42, 0.08);
  --header-bg: rgba(255, 255, 255, 0.75);
  --chip: rgba(148, 163, 184, 0.15);
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 12px 30px rgba(15, 23, 42, 0.08);
  --grid-dot: rgba(37, 99, 235, 0.10);
}

[data-theme='dark'] {
  --brand: #60a5fa;
  --brand-dark: #3b82f6;
  --brand-soft: rgba(59, 130, 246, 0.14);
  --bg-1: #0b1220;
  --bg-2: #0f172a;
  --surface: #1e293b;
  --surface-card: rgba(30, 41, 59, 0.7);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #334155;
  --border-soft: rgba(148, 163, 184, 0.14);
  --header-bg: rgba(15, 23, 42, 0.7);
  --chip: rgba(148, 163, 184, 0.16);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 16px 40px rgba(0, 0, 0, 0.5);
  --grid-dot: rgba(96, 165, 250, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .15s ease, color .15s ease;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }

/* ============ Topbar ============ */
header.site {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-soft);
}
header.site .inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 28px;
}
header.site .brand { display: flex; align-items: center; }
header.site .brand img.logo { height: 38px; width: auto; display: block; }
header.site nav { display: flex; gap: 18px; margin-left: auto; }
header.site nav a { color: var(--muted); font-weight: 500; font-size: 14px; }
header.site nav a.active, header.site nav a:hover { color: var(--brand); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* Toggle de tema */
.theme-switch {
  display: flex; align-items: center; gap: 4px;
  background: var(--chip);
  border: 1px solid var(--border-soft);
  border-radius: 999px; padding: 3px;
}
.theme-switch button {
  border: 0; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 5px 11px; border-radius: 999px; transition: all .15s ease;
  white-space: nowrap;
}
.theme-switch button.active { background: var(--brand); color: #fff; box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35); }

/* ============ Page / layout ============ */
.page {
  position: relative; z-index: 1;
  max-width: 1080px; margin: 0 auto; padding: 0 20px 80px;
}
main { max-width: 1080px; margin: 0 auto; padding: 40px 20px 80px; }

/* Decor (grid pattern) */
.bg-decor {
  position: absolute; inset: 0 0 auto 0; height: 340px; z-index: 0; pointer-events: none;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 80%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 80%);
}

/* ============ Hero ============ */
.hero { text-align: center; padding: 56px 0 32px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--brand); background: var(--brand-soft);
  border: 1px solid var(--border-soft);
  padding: 6px 13px; border-radius: 999px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.hero h1 { font-size: 42px; line-height: 1.1; margin: 18px 0 14px; font-weight: 800; letter-spacing: -0.02em; }
.hero h1 .grad {
  background: linear-gradient(120deg, #2563eb, #7c3aed);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
[data-theme='dark'] .hero h1 .grad { background: linear-gradient(120deg, #60a5fa, #a78bfa); -webkit-background-clip: text; background-clip: text; }
.hero p.lead { font-size: 18px; color: var(--muted); max-width: 700px; margin: 0 auto; }
.cta { display: flex; gap: 12px; margin-top: 26px; justify-content: center; flex-wrap: wrap; }

/* ============ Botões ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 10px; border: 1px solid var(--border-soft);
  background: var(--surface-card); color: var(--text); font-weight: 600; font-size: 15px; cursor: pointer;
  transition: transform .12s, box-shadow .12s, color .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }

/* ============ Cards / grid ============ */
.card {
  background: var(--surface-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 20px; }
.grid .card h3 { margin: 0 0 6px; font-size: 16px; }
.grid .card p { margin: 0; color: var(--muted); font-size: 14px; }
.section h2 { font-size: 26px; margin-top: 44px; letter-spacing: -0.01em; }

code, pre { background: #0f172a; color: #e2e8f0; border-radius: 8px; }
[data-theme='dark'] code, [data-theme='dark'] pre { background: #1e293b; color: #cbd5e1; }
code { padding: 2px 6px; font-size: .9em; }
pre { padding: 16px; overflow-x: auto; }
pre code { background: transparent; padding: 0; }

/* ============ Demos ============ */
.demo-section { margin-top: 28px; }
.demo-caption { text-align: center; margin-bottom: 20px; }
.demo-caption h2 { font-size: 26px; margin: 0 0 6px; }
.demo-caption p { color: var(--muted); margin: 0; }
.demo-card { margin-bottom: 20px; }
.demo-card .card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.demo-card .card-icon {
  width: 42px; height: 42px; border-radius: 11px;
  display: grid; place-items: center; font-size: 18px; font-weight: 800; color: #fff;
}
.demo-card .card-icon.i-blue { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.demo-card .card-icon.i-purple { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.demo-card .card-title { margin: 0; font-size: 18px; font-weight: 700; }
.demo-card .card-desc { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.card-head-right { margin-left: auto; }
.badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
}

/* ============ Toolbar das demos ============ */
.demo-toolbar {
  display: flex; flex-wrap: wrap; gap: 2px;
  padding: 6px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px;
}
.demo-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background .12s, color .12s;
  padding: 0;
}
.demo-btn:hover { background: var(--brand-soft); color: var(--brand); }
.demo-btn.is-active { background: var(--brand-soft); color: var(--brand); border-color: var(--border); }
.demo-btn--text, .demo-btn [class*="demo-btn--text"] { width: auto; }
.demo-btn-text { font-size: 12.5px; font-weight: 700; line-height: 1; }
.demo-ico { width: 18px; height: 18px; }
.demo-sep { width: 1px; align-self: stretch; margin: 4px 3px; background: var(--border); }
.demo-status { margin-top: 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 480px) {
  .demo-btn { width: 30px; height: 30px; }
}

/* ============ Documentação ============ */
.doc-layout { display: grid; grid-template-columns: 240px 1fr; gap: 36px; align-items: start; margin-top: 16px; }
.doc-toc {
  position: sticky; top: 90px;
  background: var(--surface-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 16px;
}
.doc-toc h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.doc-toc a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--text); font-size: 13.5px; font-weight: 500; }
.doc-toc a:hover, .doc-toc a.active { background: var(--brand-soft); color: var(--brand); }
.doc-body article { margin-bottom: 40px; }
.doc-body article > h3 {
  font-size: 26px; margin: 0 0 6px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft); letter-spacing: -0.01em; scroll-margin-top: 90px;
}
.doc-body article > .doc-sub { color: var(--muted); margin: 0 0 16px; }
.doc-body p { margin: 10px 0; }
.doc-body ul, .doc-body ol { padding-left: 22px; }
.doc-body li { margin: 5px 0; }
table.docs { border-collapse: collapse; width: 100%; background: var(--surface-card); border: 1px solid var(--border-soft); margin: 14px 0; font-size: 13.5px; }
table.docs th, table.docs td { border: 1px solid var(--border-soft); padding: 9px 12px; text-align: left; vertical-align: top; }
table.docs th { background: var(--brand-soft); font-weight: 600; }
/* Em telas estreitas, tabelas longas ganham rolagem horizontal em vez de estourar a página. */
.doc-body { min-width: 0; }
.doc-body table.docs { display: block; overflow-x: auto; white-space: nowrap; }
.doc-body table.docs td, .doc-body table.docs th { white-space: normal; }
@media (max-width: 640px) {
  .doc-body table.docs { white-space: nowrap; }
  .doc-body table.docs td, .doc-body table.docs th { white-space: normal; min-width: 0; }
}
.note { background: #eff6ff; border: 1px solid #bfdbfe; border-left: 4px solid var(--brand); border-radius: 8px; padding: 12px 16px; font-size: 14px; }
[data-theme='dark'] .note { background: rgba(37, 99, 235, 0.12); border-color: rgba(59,130,246,.4); color: #bfdbfe; }
.warn { background: #fffbeb; border: 1px solid #fde68a; border-left: 4px solid #f59e0b; border-radius: 8px; padding: 12px 16px; font-size: 14px; }
[data-theme='dark'] .warn { background: rgba(245, 158, 11, 0.12); border-color: rgba(245,158,11,.4); color: #fde68a; }

/* ============ Download ============ */
.dl-list { list-style: none; padding: 0; margin: 0; }
.dl-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 16px; background: var(--surface-card); border: 1px solid var(--border-soft);
  border-radius: 12px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.dl-list .file { font-weight: 700; }
.dl-list .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ============ Footer ============ */
footer.site { border-top: 1px solid var(--border-soft); background: var(--surface-card); color: var(--muted); font-size: 13px; }
footer.site .inner { max-width: 1080px; margin: 0 auto; padding: 22px 20px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
footer.site a { color: var(--muted); }
footer.site a:hover { color: var(--brand); }

/* ============ Responsivo ============ */
@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-toc { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .doc-toc h4 { width: 100%; }
  .doc-toc a { padding: 5px 9px; }
}
@media (max-width: 640px) {
  header.site .inner { flex-wrap: wrap; gap: 10px 18px; }
  header.site nav { margin-left: 0; order: 3; width: 100%; justify-content: space-between; }
  .hero { padding: 40px 0 24px; }
  .hero h1 { font-size: 30px; }
  .hero p.lead { font-size: 16px; }
  .theme-switch button { padding: 5px 8px; font-size: 11.5px; }
}
