/* ============================================================================
   Portal de Documentação — tema único (Notion / GitBook / Vercel Docs)
   Estático, sem dependências. Dark + Light. Neutro (o portal não é o produto:
   é a casca de documentação — a identidade visual do CLIENTE não entra aqui).
   ============================================================================ */

:root {
  --sidebar-w: 288px;
  --content-max: 860px;
  --radius: 10px;
  --radius-sm: 6px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, Menlo, monospace;

  /* Light */
  --bg: #ffffff;
  --bg-subtle: #f7f7f5;
  --bg-inset: #f0f0ee;
  --surface: #ffffff;
  --border: #e6e6e3;
  --border-strong: #d5d5d0;
  --text: #1f2328;
  --text-soft: #4a4f57;
  --text-muted: #838890;
  --accent: #2f6f4f;         /* verde sóbrio, neutro de documentação */
  --accent-soft: #e8f1ec;
  --link: #2563a8;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);

  --ok: #2f855a;  --warn: #b7791f;  --danger: #c0392b;  --info: #2563a8;
}

html[data-theme="dark"] {
  --bg: #0f1115;
  --bg-subtle: #15181e;
  --bg-inset: #1b1f27;
  --surface: #161a20;
  --border: #262b34;
  --border-strong: #333a45;
  --text: #e7eaee;
  --text-soft: #b6bcc6;
  --text-muted: #7d858f;
  --accent: #4ea981;
  --accent-soft: #17251f;
  --link: #6ea8dd;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.35);
  --ok: #57b98a;  --warn: #d9a441;  --danger: #e06b5e;  --info: #6ea8dd;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0; font-family: var(--font-sans); color: var(--text);
  background: var(--bg); line-height: 1.65; font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--bg-subtle); border-right: 1px solid var(--border);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 6px;
}
.sidebar__brand { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px 14px; }
.sidebar__project { font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.sidebar__client { font-size: 12.5px; color: var(--text-muted); }
.sidebar__group-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); padding: 14px 10px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border-radius: var(--radius-sm); color: var(--text-soft); font-size: 14.5px;
}
.nav-item:hover { background: var(--bg-inset); text-decoration: none; color: var(--text); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item__mark { width: 16px; text-align: center; flex: none; font-size: 13px; }
.nav-item--done .nav-item__mark { color: var(--ok); }
.nav-item--todo { color: var(--text-muted); cursor: default; }
.nav-item--todo:hover { background: transparent; color: var(--text-muted); }

/* ---------- Main ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; padding: 12px 32px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--border);
}
.breadcrumb { font-size: 13.5px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb__sep { opacity: .5; }
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.chip {
  font-size: 11.5px; padding: 3px 10px; border-radius: 999px; font-weight: 600;
  border: 1px solid var(--border-strong); color: var(--text-soft); background: var(--surface); white-space: nowrap;
}
.chip--status { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: var(--accent-soft); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-soft); cursor: pointer; font-size: 16px;
}
.icon-btn:hover { background: var(--bg-inset); color: var(--text); }

.page { display: grid; grid-template-columns: 1fr minmax(0,var(--content-max)) 1fr; gap: 0; padding: 0 32px; }
.content { grid-column: 2; padding: 40px 0 96px; min-width: 0; }

/* Header do documento */
.doc-header { margin-bottom: 28px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.doc-eyebrow { font-size: 12.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 700; }
.doc-title { font-size: 34px; line-height: 1.15; margin: 8px 0 10px; letter-spacing: -.02em; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--text-muted); }
.doc-meta b { color: var(--text-soft); font-weight: 600; }

/* Tipografia de conteúdo */
.content h2 { font-size: 24px; margin: 44px 0 12px; letter-spacing: -.01em; scroll-margin-top: 88px; padding-top: 4px; }
.content h3 { font-size: 18.5px; margin: 30px 0 8px; scroll-margin-top: 88px; }
.content h4 { font-size: 15.5px; margin: 22px 0 6px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .04em; }
.content p { margin: 12px 0; color: var(--text-soft); }
.content ul, .content ol { margin: 12px 0; padding-left: 22px; color: var(--text-soft); }
.content li { margin: 5px 0; }
.content strong { color: var(--text); }
.content hr { border: 0; border-top: 1px solid var(--border); margin: 36px 0; }
.content code { font-family: var(--font-mono); font-size: .88em; background: var(--bg-inset); padding: 2px 6px; border-radius: 5px; }
.content pre { background: var(--bg-inset); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; overflow-x: auto; margin: 16px 0; }
.content pre code { background: none; padding: 0; }
.anchor { color: var(--text-muted); opacity: 0; margin-left: 8px; font-weight: 400; text-decoration: none; }
h2:hover .anchor, h3:hover .anchor { opacity: 1; }

/* ---------- Componentes de documentação ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); margin: 14px 0;
}
.card__title { font-weight: 700; margin: 0 0 6px; font-size: 15.5px; }
.grid { display: grid; gap: 14px; margin: 16px 0; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.metric__value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.metric__label { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14.5px; display: block; overflow-x: auto; }
thead th { text-align: left; font-weight: 600; color: var(--text-soft); background: var(--bg-subtle); }
th, td { padding: 10px 14px; border: 1px solid var(--border); vertical-align: top; }
tbody tr:nth-child(even) { background: var(--bg-subtle); }

.callout { display: flex; gap: 12px; border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; background: var(--surface); }
.callout__icon { font-size: 18px; line-height: 1.5; flex: none; }
.callout--info { border-left-color: var(--info); }
.callout--ok { border-left-color: var(--ok); }
.callout--warn { border-left-color: var(--warn); }
.callout--danger { border-left-color: var(--danger); }
.callout p:first-child { margin-top: 0; } .callout p:last-child { margin-bottom: 0; }

.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-soft); }
.badge--alta { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.badge--media { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.badge--baixa { color: var(--text-muted); }
.badge--ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 18px 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 4px 0 18px 22px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }

/* Comparativo (prós/contras) */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.compare__col { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.compare__col h4 { margin-top: 0; }
.compare--pos h4 { color: var(--ok); } .compare--neg h4 { color: var(--danger); }

/* Accordion */
details.accordion { border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 16px; margin: 10px 0; background: var(--surface); }
details.accordion > summary { cursor: pointer; font-weight: 600; padding: 12px 0; list-style: none; }
details.accordion > summary::-webkit-details-marker { display: none; }
details.accordion > summary::before { content: "▸"; margin-right: 10px; color: var(--text-muted); }
details.accordion[open] > summary::before { content: "▾"; }

/* Fluxograma simples (passos horizontais) */
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0; }
.flow__step { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 14px; font-size: 13.5px; font-weight: 600; }
.flow__arrow { color: var(--text-muted); }

/* ---------- Nav entre páginas ---------- */
.pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); }
.pager a { flex: 1; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; background: var(--surface); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager__dir { font-size: 12px; color: var(--text-muted); }
.pager__title { font-weight: 600; color: var(--text); }
.pager__next { text-align: right; }

/* ---------- TOC / scrollspy (coluna direita em telas largas) ---------- */
.toc { grid-column: 3; position: sticky; top: 88px; align-self: start; padding: 40px 0 0 28px; font-size: 13px; max-height: calc(100vh - 100px); overflow-y: auto; }
.toc__label { text-transform: uppercase; font-size: 11px; letter-spacing: .08em; color: var(--text-muted); font-weight: 600; margin-bottom: 10px; }
.toc a { display: block; color: var(--text-muted); padding: 4px 0 4px 12px; border-left: 2px solid var(--border); }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc a.lvl-3 { padding-left: 24px; }

/* ---------- Home do portal (index) ---------- */
.hero { padding: 20px 0 8px; }
.hero h1 { font-size: 40px; letter-spacing: -.03em; margin: 6px 0 12px; }
.hero p { font-size: 18px; color: var(--text-soft); max-width: 640px; }
.stage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 16px; margin: 28px 0; }
.stage-card { display: block; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--surface); box-shadow: var(--shadow); }
.stage-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); transition: .15s; }
.stage-card__n { font-size: 12px; color: var(--text-muted); font-weight: 700; }
.stage-card__title { font-weight: 700; font-size: 16px; margin: 4px 0 6px; color: var(--text); }
.stage-card__desc { font-size: 13.5px; color: var(--text-muted); }

/* ---------- Menu mobile ---------- */
.menu-toggle { display: none; }
@media (max-width: 1200px) { .toc { display: none; } .page { grid-template-columns: 1fr minmax(0,var(--content-max)) 1fr; } }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: 84%; max-width: 320px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.is-open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .page { padding: 0 18px; } .topbar { padding: 12px 18px; }
  .doc-title { font-size: 27px; } .hero h1 { font-size: 30px; }
  .grid--2, .grid--3, .grid--4, .compare { grid-template-columns: 1fr; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; display: none; }
  .scrim.is-open { display: block; }
}
