/* Páginas legais (Termos de Uso e Política de Privacidade).
   Topo, rodapé, cores e fontes vêm de site.css. Aqui só o documento. */

body.legal { background: var(--gray); }

/* Cabeçalho do documento */
.doc-head { background: var(--night); color: var(--white); padding: 64px 0 56px; }
.doc-head__inner { max-width: 1088px; margin: 0 auto; padding: 0 var(--gutter); }
.doc-head h1 {
  margin: 0; font-family: var(--font-display); font-weight: 700;
  font-size: clamp(34px, 5vw, 52px); line-height: 1.08; letter-spacing: -0.03em; text-wrap: balance;
}
.doc-head__updated { margin: 12px 0 0; font-size: 15px; color: var(--on-dark-2); }

/* Grade: sumário à esquerda, texto em coluna de leitura */
.doc {
  max-width: 1088px; margin: 0 auto; padding: 48px var(--gutter) 96px;
  display: grid; grid-template-columns: 240px minmax(0, 720px); gap: 64px; align-items: start;
}
@media (min-width: 961px) {
  .doc-head__inner { padding-left: calc(var(--gutter) + 240px + 64px); }
}

/* Sumário "Nesta página" */
.toc { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; overscroll-behavior: contain; }
.toc__box { margin: 0; }
.toc__label {
  list-style: none; cursor: default;
  font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3);
  padding: 0 12px 10px; display: flex; align-items: center; justify-content: space-between;
}
.toc__label::-webkit-details-marker { display: none; }
.toc__chev { display: none; transition: transform .2s ease; }
.toc__list { list-style: none; margin: 0; padding: 0; counter-reset: toc; border-left: 1px solid var(--line-light-2); }
.toc__list li { counter-increment: toc; }
.toc__list a {
  display: flex; gap: 6px; padding: 7px 12px; margin-left: -1px; border-left: 2px solid transparent;
  font-size: 14.5px; line-height: 1.35; color: var(--ink-2); text-decoration: none;
}
.toc__list a::before { content: counter(toc) "."; color: var(--ink-3); flex: none; min-width: 1.4em; }
.toc__list a:hover { color: var(--ink); background: rgba(1, 12, 40, 0.04); }
.toc__list a[aria-current="true"] { color: var(--ink); font-weight: 600; border-left-color: var(--blue); }

/* Texto */
.doc__body { font-size: 17px; line-height: 1.7; color: var(--ink-2); min-width: 0; }
.doc__body section { scroll-margin-top: 24px; }
.doc__body h2 {
  margin: 56px 0 14px; font-family: var(--font-display); font-weight: 700;
  font-size: 24px; line-height: 1.25; letter-spacing: -0.015em; color: var(--ink);
}
.doc__body section:first-of-type h2 { margin-top: 8px; }
.doc__body p { margin: 0 0 16px; }
.doc__body strong { color: var(--ink); font-weight: 600; }
.doc__body ul, .doc__body ol { margin: 0 0 18px; padding-left: 22px; }
.doc__body li { margin: 0 0 8px; padding-left: 4px; }
.doc__body li::marker { color: var(--blue); }
.doc__body a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; overflow-wrap: anywhere; }
.doc__body a:hover { color: var(--ink); }

.highlight-box {
  margin: 0 0 40px; padding: 18px 22px;
  background: var(--white); border: 1px solid var(--line-light-2); border-left: 4px solid var(--accent); border-radius: 12px;
  color: var(--ink-list);
}

/* Tabela */
.doc__body table {
  width: 100%; margin: 4px 0 20px; border-collapse: separate; border-spacing: 0;
  background: var(--white); border: 1px solid var(--line-light-2); border-radius: 12px; overflow: hidden;
  font-size: 16px; line-height: 1.5;
}
.doc__body th {
  text-align: left; padding: 12px 16px; background: #F4F6FA;
  font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3);
  border-bottom: 1px solid var(--line-light-2);
}
.doc__body td { padding: 12px 16px; vertical-align: top; border-bottom: 1px solid var(--line-light); }
.doc__body tr:last-child td { border-bottom: 0; }

/* Voltar ao topo */
.to-top {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 30;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--white); color: var(--ink); border: 1px solid var(--line-light-2);
  box-shadow: 0 6px 18px rgba(1, 12, 40, 0.12);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { color: var(--blue); }
.no-js .to-top, html:not(.js) .to-top { opacity: 1; transform: none; pointer-events: auto; }

/* Sem a barra fixa da landing: rodapé com respiro normal */
.legal .site-footer__inner { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }

/* Celular e tablet: uma coluna, sumário recolhível no topo do texto */
@media (max-width: 960px) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 24px; padding-bottom: 72px; max-width: 784px; }
  .doc-head__inner { max-width: 784px; }
  .doc-head { padding: 44px 0 40px; }
  .toc { position: static; max-height: none; overflow: visible; }
  .toc__box { background: var(--white); border: 1px solid var(--line-light-2); border-radius: 12px; }
  .toc__label { cursor: pointer; min-height: 52px; padding: 0 16px; }
  .toc__chev { display: block; color: var(--ink-2); }
  .toc__box[open] .toc__chev { transform: rotate(180deg); }
  .toc__list { border-left: 0; border-top: 1px solid var(--line-light); padding: 6px 0; }
  .toc__list a { min-height: 48px; align-items: center; padding: 8px 16px; margin: 0; border-left: 0; font-size: 16px; }
  .toc__list a[aria-current="true"] { border-left: 0; }
}
@media (max-width: 600px) {
  .doc-head { padding: 36px 0 32px; }
  .doc__body h2 { font-size: 22px; margin-top: 44px; }
  .highlight-box { padding: 16px 18px; }
  /* Tabela vira blocos empilhados; o rótulo vem do cabeçalho da coluna */
  .doc__body table, .doc__body tbody, .doc__body tr, .doc__body td { display: block; width: 100%; }
  .doc__body table { border: 0; background: none; border-radius: 0; overflow: visible; font-size: 16px; }
  .doc__body thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .doc__body tr { background: var(--white); border: 1px solid var(--line-light-2); border-radius: 12px; padding: 6px 0; margin-bottom: 12px; }
  .doc__body td { border-bottom: 0; padding: 6px 16px; }
  .doc__body td[data-label]::before {
    content: attr(data-label); display: block;
    font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3);
  }
}
@media (prefers-reduced-motion: reduce) {
  .to-top, .toc__chev { transition: none; }
}

/* Impressão: só o documento */
@media print {
  .skip-link, .site-header, .mobile-nav, .site-footer, .toc, .to-top { display: none !important; }
  body.legal { background: #FFFFFF; }
  .doc-head { background: none; color: #000000; padding: 0 0 12pt; }
  .doc-head__inner { padding: 0 !important; max-width: none; }
  .doc-head__updated { color: #333333; }
  .doc { display: block; padding: 0; max-width: none; }
  .doc__body { font-size: 11pt; line-height: 1.5; color: #000000; }
  .doc__body h2 { color: #000000; font-size: 14pt; margin: 18pt 0 6pt; break-after: avoid; }
  .doc__body a { color: #000000; }
  .highlight-box { border: 1px solid #999999; border-left-width: 3pt; break-inside: avoid; }
  .doc__body table { border: 1px solid #999999; }
  .doc__body tr { break-inside: avoid; }
}
