*, *::before, *::after { box-sizing: border-box; }

:root {
  --text: #222;
  --muted: #5f6368;
  --line: #e5e5e5;
  --soft: #f6f7f8;
  --link: #1f5fa8;
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.65;
}

a { color: var(--link); }
a:hover { text-decoration: none; }

h1, h2, .brand, .nav, .btn, .toc, table, .site-footer, .menu-toggle {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: #fff; padding: 6px 10px; z-index: 10; }

/* Cabeçalho */
.site-header { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 16px; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: .9rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--text); }
.menu-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 4px; padding: 6px 12px; font-size: .9rem; cursor: pointer; color: var(--text); }

/* Introdução */
.intro { padding: 48px 0 32px; border-bottom: 1px solid var(--line); }
.intro h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); line-height: 1.25; margin: 0 0 12px; }
.lead { color: var(--muted); margin: 0 0 24px; max-width: 680px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--text);
  border-radius: 4px;
  background: var(--text);
  color: #fff;
  font-size: .95rem;
  text-decoration: none;
}
.btn:hover { background: #444; }
.btn-ghost { background: #fff; color: var(--text); }
.btn-ghost:hover { background: var(--soft); }

/* Conteúdo */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 48px; padding-top: 32px; padding-bottom: 48px; }
.topic { padding: 8px 0 24px; border-bottom: 1px solid var(--line); margin-bottom: 24px; scroll-margin-top: 76px; }
.topic:last-child { border-bottom: 0; }
.topic h2 { font-size: 1.4rem; margin: 0 0 12px; }
.topic ul { padding-left: 1.2em; }
.topic li { margin-bottom: 6px; }
.note { background: var(--soft); border-left: 3px solid var(--line); padding: 10px 14px; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
caption { text-align: left; color: var(--muted); padding-bottom: 8px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--soft); }

.resources li { margin-bottom: 10px; }

/* Barra lateral */
.toc { position: sticky; top: 84px; font-size: .9rem; }
.toc h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 8px; }
.toc ol { margin: 0; padding-left: 1.2em; }
.toc a { color: var(--text); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* Rodapé */
.site-footer { border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding-top: 20px; padding-bottom: 20px; }
.footer-inner p { margin: 0; }

.back-top {
  position: fixed; right: 16px; bottom: 16px;
  width: 40px; height: 40px; line-height: 40px; text-align: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: #fff; color: var(--text); text-decoration: none;
}

/* Responsivo */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .sidebar { display: none; }
}

@media (max-width: 720px) {
  body { font-size: 17px; }
  .menu-toggle { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 60px; background: #fff; border-bottom: 1px solid var(--line); flex-direction: column; padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .nav a { padding: 8px 0; }
  .intro { padding: 32px 0 24px; }
}
