/* =================================================================
   EscribaJus — Folha de estilo para páginas legais
   (Termos de Uso, Política de Privacidade, LGPD, Cookies)
   Depende de escribajus-base.css (design tokens + nav + footer).
   ================================================================= */

/* ---------- LAYOUT PRINCIPAL ---------- */
.legal-main {
  background: var(--paper);
  padding: clamp(32px, 6vw, 64px) 0 clamp(48px, 8vw, 96px);
  position: relative;
}

.legal-main::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 280px;
  background: linear-gradient(180deg, var(--paper-2) 0%, var(--paper) 100%);
  z-index: 0;
}

.legal-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: clamp(24px, 4vw, 56px);
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 32px);
}

@media (max-width: 900px) {
  .legal-wrap { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- CABEÇALHO DO DOCUMENTO ---------- */
.legal-doc-header {
  grid-column: 1 / -1;
  margin-bottom: clamp(32px, 5vw, 56px);
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.legal-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--emerald);
  padding: 6px 12px;
  background: var(--moss);
  border-radius: 999px;
  margin-bottom: 20px;
}

.legal-eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--emerald);
}

.legal-doc-header h1 {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 16px;
}

.legal-doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  font-size: 14px;
  color: var(--ink-mute);
}

.legal-doc-meta strong {
  color: var(--ink-soft);
  font-weight: 600;
}

/* ---------- ÍNDICE LATERAL (TOC) ---------- */
.legal-toc {
  position: sticky;
  top: 96px;
  align-self: start;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.legal-toc-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 16px;
}

.legal-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}

.legal-toc li {
  counter-increment: toc;
  margin-bottom: 2px;
}

.legal-toc a {
  display: block;
  padding: 8px 0 8px 28px;
  position: relative;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink-soft);
  transition: color .15s;
  border-left: 2px solid transparent;
  padding-left: 14px;
}

.legal-toc a::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 14px;
  top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
  display: none;
}

.legal-toc a:hover {
  color: var(--emerald);
  border-left-color: var(--emerald);
}

@media (max-width: 900px) {
  .legal-toc {
    position: static;
    order: 2;
    margin-top: 48px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }
}

/* ---------- CORPO DO DOCUMENTO ---------- */
.legal-body {
  max-width: 720px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.68;
  color: var(--ink-soft);
  counter-reset: sec;
}

.legal-body section {
  counter-increment: sec;
  margin-bottom: clamp(32px, 5vw, 56px);
  counter-reset: sub;
}

.legal-body h2 {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 20px;
  padding-top: 8px;
  scroll-margin-top: 96px;
}

.legal-body h2::before {
  content: counter(sec) ". ";
  color: var(--emerald);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.legal-body h3 {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin: 28px 0 10px;
  counter-increment: sub;
  letter-spacing: -0.005em;
}

.legal-body h3::before {
  content: counter(sec) "." counter(sub) " ";
  color: var(--emerald);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.legal-body p {
  margin: 0 0 14px;
}

.legal-body p + p {
  margin-top: 14px;
}

.legal-body strong { color: var(--ink); font-weight: 600; }

.legal-body a {
  color: var(--emerald);
  text-decoration: underline;
  text-decoration-color: rgba(14, 92, 67, .3);
  text-underline-offset: 3px;
  transition: text-decoration-color .15s;
}

.legal-body a:hover { text-decoration-color: var(--emerald); }

.legal-body ul, .legal-body ol {
  margin: 10px 0 18px;
  padding-left: 24px;
}

.legal-body ul li, .legal-body ol li {
  margin-bottom: 6px;
  padding-left: 4px;
}

.legal-body ul li::marker { color: var(--emerald); }
.legal-body ol li::marker { color: var(--emerald); font-weight: 600; }

/* Definições — lista normativa */
.legal-body dl {
  margin: 16px 0 20px;
  padding: 20px 24px;
  background: var(--surface);
  border-left: 3px solid var(--emerald);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.legal-body dt {
  font-weight: 700;
  color: var(--ink);
  margin-top: 10px;
  font-size: 14px;
}

.legal-body dt:first-child { margin-top: 0; }

.legal-body dd {
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* Citação normativa (artigo de lei) */
.legal-body blockquote {
  margin: 20px 0;
  padding: 16px 20px;
  background: var(--moss);
  border-left: 3px solid var(--emerald);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  font-style: italic;
}

.legal-body blockquote cite {
  display: block;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-mute);
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Tabela */
.legal-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.legal-body thead th {
  background: var(--ink);
  color: var(--paper);
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.legal-body tbody td {
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
  vertical-align: top;
}

.legal-body tbody tr:hover td { background: var(--paper-2); }

/* Callout de destaque */
.legal-callout {
  margin: 24px 0;
  padding: 20px 24px;
  background: #FFF8EC;
  border: 1px solid #E8D8A8;
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.6;
}

.legal-callout strong { color: #7A5A1A; }

.legal-callout.danger {
  background: #FFF1EE;
  border-color: #F5C8BE;
}

.legal-callout.danger strong { color: var(--danger); }

.legal-callout.info {
  background: var(--moss);
  border-color: #B9D6C5;
}

.legal-callout.info strong { color: var(--emerald-d); }

/* Rodapé do documento: assinatura + contato */
.legal-signoff {
  margin-top: clamp(40px, 6vw, 72px);
  padding-top: 32px;
  border-top: 2px solid var(--ink);
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.legal-signoff strong { color: var(--ink); }

.legal-signoff .company-block {
  margin-top: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
