/* Rebo: páginas legais (Termos de uso e Política de privacidade, em pt-BR, en e es).
   Usa os tokens, o cabeçalho, o seletor de idioma e o rodapé de styles.css; aqui só o que é da leitura longa:
   faixa de título na noite, texto no dia, sumário fixo no computador e impressão limpa. Sem JavaScript.
   Cláusulas que limitam direitos ficam em destaque (.legal-key), como pede o CDC (art. 54, § 4º). */

.legal-page { background: var(--day-0); }

/* Cabeçalho: sempre com fundo (não há main.js para marcar a rolagem) e preso no topo durante a leitura */
.legal-page .site-header { position: sticky; }
.legal-page .site-header::before { opacity: 1; background: rgba(3, 19, 14, 0.94); box-shadow: 0 1px 0 var(--night-line); }
.legal-home {
  display: none; margin-left: auto; padding: 0.5rem 0.85rem; border-radius: 10px;
  font-size: 0.9375rem; font-weight: 600; text-decoration: none; opacity: 0.8;
  transition-property: opacity, background-color; transition-duration: 0.18s;
}
.legal-home:hover { opacity: 1; background: rgba(167, 243, 208, 0.1); }
@media (min-width: 640px) {
  .legal-home { display: inline-flex; }
  .legal-page .lang { margin-left: 0.25rem; }
}

/* ───────── Faixa do título ───────── */
.legal-hero { padding: clamp(2.25rem, 1.5rem + 3vw, 4rem) 0 clamp(2rem, 1.25rem + 2.5vw, 3.25rem); }
.legal-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.legal-tabs a {
  padding: 0.45rem 0.9rem; border-radius: 999px; font-size: 0.875rem; font-weight: 600; text-decoration: none;
  color: var(--night-muted); box-shadow: inset 0 0 0 1px var(--night-line);
  transition-property: color, background-color, box-shadow; transition-duration: 0.18s;
}
.legal-tabs a:hover { color: var(--night-ink); box-shadow: inset 0 0 0 1px rgba(167, 243, 208, 0.4); }
.legal-tabs a[aria-current='page'] { color: var(--night-0); background: var(--mint); box-shadow: none; }
.legal-hero h1 {
  max-width: 22ch; font-family: var(--font-display); font-weight: 800; letter-spacing: -0.035em;
  font-size: clamp(2.1rem, 1.4rem + 3vw, 3.5rem); line-height: 1.05;
}
.legal-meta { margin-top: 1rem; font-size: 0.9375rem; color: var(--night-muted); }
.legal-lede { max-width: 46rem; margin-top: 1rem; font-size: 1.0625rem; color: var(--night-ink); opacity: 0.92; }

/* ───────── Corpo ───────── */
.legal-body { padding: clamp(2rem, 1rem + 3vw, 3.5rem) 0 clamp(3rem, 2rem + 4vw, 6rem); }
.legal-grid { display: grid; gap: 2rem; }
@media (min-width: 1024px) {
  .legal-grid { grid-template-columns: 15.5rem minmax(0, 46rem); gap: 3.5rem; justify-content: center; }
}

/* Sumário: recolhível no celular, fixo ao lado do texto no computador */
.legal-toc { font-size: 0.9375rem; }
.legal-toc details {
  border: 1px solid var(--line); border-radius: 14px; background: var(--day-1); box-shadow: var(--shadow-sm);
}
.legal-toc summary {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem 1rem; font-weight: 700; color: var(--ink); cursor: pointer; list-style: none;
}
.legal-toc summary::-webkit-details-marker { display: none; }
.legal-toc summary::after {
  content: ''; width: 0.55rem; height: 0.55rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px); transition: transform 0.18s;
}
.legal-toc details[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.legal-toc ol { margin: 0; padding: 0 1rem 1rem; list-style: none; display: grid; gap: 0.15rem; }
.legal-toc a {
  display: block; padding: 0.3rem 0.5rem; border-radius: 8px; color: var(--muted); text-decoration: none; line-height: 1.35;
}
.legal-toc a:hover { color: var(--emerald-800); background: var(--emerald-50); }
@media (min-width: 1024px) {
  .legal-toc {
    position: sticky; top: calc(var(--header-h) + 1.5rem); align-self: start;
    max-height: calc(100vh - var(--header-h) - 2.5rem); overflow: auto; scrollbar-width: thin; font-size: 0.875rem;
  }
  .legal-toc details { border: 0; background: none; box-shadow: none; }
  .legal-toc summary { padding: 0 0.5rem 0.6rem; cursor: default; pointer-events: none; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
  .legal-toc summary::after { display: none; }
  .legal-toc ol { padding: 0; gap: 0; }
  .legal-toc a { padding: 0.22rem 0.5rem; line-height: 1.3; }
}

/* ───────── Texto ───────── */
.legal-doc { min-width: 0; color: var(--ink); font-size: 1.0625rem; line-height: 1.7; }
.legal-doc > section { scroll-margin-top: calc(var(--header-h) + 1rem); }
.legal-doc > section + section { margin-top: 2.75rem; padding-top: 2.25rem; border-top: 1px solid var(--line); }
.legal-doc h2 {
  font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em;
  font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.75rem); line-height: 1.2; margin-bottom: 1rem;
}
.legal-doc h3 { font-size: 1.125rem; font-weight: 700; line-height: 1.35; margin: 1.75rem 0 0.6rem; }
.legal-doc p, .legal-doc ul, .legal-doc ol, .legal-doc .legal-table-wrap { margin: 0 0 1rem; }
.legal-doc ul, .legal-doc ol { padding-left: 1.35rem; }
.legal-doc li { margin-bottom: 0.4rem; }
.legal-doc li::marker { color: var(--emerald-600); }
.legal-doc a { color: var(--emerald-800); text-decoration-thickness: 1px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.legal-doc a:hover { color: var(--emerald-600); }
.legal-doc strong { font-weight: 700; }
/* Número da cláusula no começo do parágrafo (1.1, 1.2...) */
.legal-doc .n { font-weight: 700; color: var(--emerald-700); font-variant-numeric: tabular-nums; margin-right: 0.35rem; }

/* Resumo no topo */
.legal-summary {
  padding: 1.25rem 1.25rem 0.5rem; border-radius: 18px; background: var(--emerald-50);
  box-shadow: inset 0 0 0 1px var(--emerald-100);
}
.legal-summary h2 { font-size: 1.25rem; margin-bottom: 0.35rem; }
.legal-summary .legal-note { font-size: 0.9375rem; color: var(--muted); }
.legal-summary ul { padding-left: 1.2rem; }
.legal-doc > section.legal-summary + section { border-top: 0; }

/* Cláusula que limita direitos: destacada (CDC art. 54, § 4º) */
.legal-key {
  padding: 0.85rem 1rem; border-radius: 12px; background: var(--amber-bg); box-shadow: inset 4px 0 0 var(--amber);
}
.legal-key strong:first-of-type { color: var(--amber-ink); }

/* Tabelas: rolam dentro da própria caixa no celular (a página nunca rola de lado) */
.legal-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--day-1); }
.legal-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; line-height: 1.5; }
.legal-table th, .legal-table td { padding: 0.7rem 0.85rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.legal-table th { font-weight: 700; color: var(--emerald-900); background: var(--surface-2); white-space: nowrap; }
.legal-table tr:last-child td { border-bottom: 0; }
.legal-table td:first-child { font-weight: 600; min-width: 9rem; }
@media (max-width: 639px) {
  .legal-table { font-size: 0.875rem; }
  .legal-table th, .legal-table td { padding: 0.6rem 0.65rem; }
  .legal-table th { white-space: normal; }
  .legal-table td:first-child { min-width: 6.5rem; }
}
.legal-table code, .legal-doc code {
  font: 600 0.85em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 0.1em 0.35em; border-radius: 6px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap;
}

.legal-end { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); font-size: 0.9375rem; color: var(--muted); }

/* ───────── Impressão / PDF ───────── */
@media print {
  .site-header, .legal-toc, .legal-tabs, .site-footer, .skip-link { display: none !important; }
  body::after { display: none; }
  .legal-page, .legal-hero, .legal-body { background: #ffffff !important; color: #000000 !important; }
  .legal-hero { padding: 0 0 1rem; }
  .legal-hero h1, .legal-meta, .legal-lede { color: #000000 !important; }
  .legal-grid { display: block; }
  .legal-doc { font-size: 11pt; line-height: 1.5; }
  .legal-doc a { color: #000000; text-decoration: underline; }
  .legal-doc > section { break-inside: auto; }
  .legal-doc h2, .legal-doc h3 { break-after: avoid; }
  .legal-summary, .legal-key, .legal-table-wrap { box-shadow: none; border: 1px solid #999999; background: #ffffff; }
  mark.todo { background: none; border: 1px dashed #000000; }
}
