/* =========================
   Time Rocha — Legal docs CSS
   ========================= */

:root {
  --primary: #259E8B;
  --primary-dark: #1A7567;
  --primary-tint: rgba(37, 158, 139, 0.08);
  --secondary: #172731;
  --background: #F5F7F7;
  --surface: #FFFFFF;
  --text: #172731;
  --text-muted: #5A6B72;
  --text-soft: #8A9AA1;
  --border: #E2E8E9;
  --border-strong: #C7D1D5;

  --c-warn:  #D97706;
  --c-info:  #2563EB;
  --c-crit:  #DC2626;
  --c-tip:   #059669;
  --c-warn-bg:  rgba(217, 119, 6, 0.08);
  --c-info-bg:  rgba(37, 99, 235, 0.08);
  --c-crit-bg:  rgba(220, 38, 38, 0.08);
  --c-tip-bg:   rgba(5, 150, 105, 0.08);

  --shadow-sm: 0 2px 6px rgba(23, 39, 49, 0.04);
  --shadow-md: 0 4px 24px rgba(23, 39, 49, 0.06);
  --shadow-lg: 0 12px 32px rgba(23, 39, 49, 0.08);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0E1A21;
    --surface: #172731;
    --text: #E2E8E9;
    --text-muted: #9AABB3;
    --text-soft: #6E8089;
    --border: #243640;
    --border-strong: #2F4452;
    --primary-tint: rgba(37, 158, 139, 0.14);
    --c-warn-bg:  rgba(217, 119, 6, 0.14);
    --c-info-bg:  rgba(96, 165, 250, 0.16);
    --c-crit-bg:  rgba(248, 113, 113, 0.14);
    --c-tip-bg:   rgba(52, 211, 153, 0.14);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* =====  Skip link (a11y)  ===== */
.skip-link {
  position: absolute;
  left: -9999px;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 1000;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
}

/* =====  Reading progress bar  ===== */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  width: 0;
  z-index: 50;
  transition: width 0.08s linear;
}

/* =====  Topbar  ===== */
.topbar {
  background: var(--secondary);
  color: #FFFFFF;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  backdrop-filter: saturate(180%) blur(6px);
}

.topbar .topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
}

.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.4px;
}
.topbar .brand .brand-mark {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.topbar .brand .brand-name { color: #fff; }
.topbar .brand .brand-tag { color: var(--primary); font-weight: 500; font-size: 13px; opacity: 0.85; }

.topbar nav { display: flex; gap: 6px; }
.topbar nav a {
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.topbar nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.topbar nav a[aria-current="page"] {
  color: var(--primary);
  background: rgba(37, 158, 139, 0.14);
}

/* =====  Layout container  ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 48px 24px 64px; }

/* =====  Hero (index)  ===== */
.hero {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 64px 48px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 60%;
  height: 200%;
  background: radial-gradient(circle, rgba(37, 158, 139, 0.25) 0%, transparent 60%);
  pointer-events: none;
}
.hero .eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 18px;
  position: relative;
}
.hero h1 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.8px;
  margin-bottom: 20px;
  color: #fff;
  max-width: 22ch;
  position: relative;
}
.hero h1 .accent { color: var(--primary); }
.hero .lede {
  font-size: 17px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  max-width: 60ch;
  margin-bottom: 28px;
  position: relative;
}
.hero .badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  position: relative;
}
.hero .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  backdrop-filter: blur(6px);
}
.hero .badge svg { width: 14px; height: 14px; }

/* =====  Doc cards (index)  ===== */
.doc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}
.doc-card {
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.doc-card:hover,
.doc-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
  text-decoration: none;
}
.doc-card .doc-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-tint);
  color: var(--primary);
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.doc-card .doc-icon svg { width: 22px; height: 22px; }
.doc-card h3 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.doc-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
  line-height: 1.55;
}
.doc-card .doc-meta {
  margin-top: auto;
  padding-top: 14px;
  color: var(--text-soft);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.doc-card .doc-meta .arrow {
  margin-left: auto;
  color: var(--primary);
  font-weight: 600;
  transition: transform 0.18s;
}
.doc-card:hover .doc-meta .arrow { transform: translateX(4px); }

/* =====  Generic info row (index)  ===== */
.info-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.info-card .info-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.info-card .info-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.info-card .info-value a { color: var(--primary); }

/* =====  Document layout (termos / privacidade)  ===== */
.doc-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: start;
}
@media (min-width: 1024px) {
  .doc-layout {
    grid-template-columns: 240px 1fr;
    gap: 56px;
  }
}

/* TOC */
.toc {
  position: sticky;
  top: 88px;
  font-size: 13.5px;
  padding-left: 0;
  display: none;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.toc::-webkit-scrollbar { width: 4px; }
.toc::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.toc .toc-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-soft);
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-left: 16px;
}
.toc ol {
  list-style: none;
  border-left: 2px solid var(--border);
  padding-left: 0;
  margin-left: 0;
}
.toc ol li { margin: 0; }
.toc ol a {
  display: block;
  padding: 7px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -2px;
  line-height: 1.4;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.toc ol a:hover {
  color: var(--text);
  background: var(--primary-tint);
}
.toc ol a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
  background: var(--primary-tint);
}
@media (min-width: 1024px) {
  .toc { display: block; }
}

/* Mobile TOC accordion */
.toc-mobile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow: hidden;
}
.toc-mobile summary {
  padding: 14px 18px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--primary);
  transition: transform 0.2s;
}
.toc-mobile[open] summary::after { transform: rotate(180deg); }
.toc-mobile ol {
  list-style: none;
  padding: 0 0 8px;
  margin: 0;
  border-top: 1px solid var(--border);
}
.toc-mobile ol a {
  display: block;
  padding: 10px 18px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
}
.toc-mobile ol a:hover { background: var(--primary-tint); color: var(--primary); }
@media (min-width: 1024px) {
  .toc-mobile { display: none; }
}

/* Card / document */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 48px;
  box-shadow: var(--shadow-md);
  counter-reset: section;
}
@media (max-width: 600px) {
  .card { padding: 28px 22px; border-radius: var(--radius-md); }
}

/* Doc header */
.doc-header {
  padding-bottom: 24px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.doc-header .doc-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 10px;
}
h1 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.6px;
  margin-bottom: 14px;
}
.doc-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
  align-items: center;
}
.doc-meta-bar .meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-tint);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

/* Document body */
.doc-body { padding-top: 12px; }
.doc-body p,
.doc-body ul,
.doc-body ol,
.doc-body .callout,
.doc-body .table-wrap {
  max-width: 68ch;
}

/* Sections with numbering */
.doc-body section {
  padding-top: 36px;
  scroll-margin-top: 88px;
}
.doc-body section + section {
  border-top: 1px solid var(--border);
}

h2 {
  counter-increment: section;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
  margin: 0 0 16px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
h2::before {
  content: counter(section, decimal-leading-zero);
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-tint);
  padding: 5px 10px;
  border-radius: 999px;
  letter-spacing: 1.2px;
  flex-shrink: 0;
  align-self: center;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 22px 0 8px;
  font-family: 'Inter', sans-serif;
}

p { margin-bottom: 14px; color: var(--text); }
strong { color: var(--text); font-weight: 600; }

ul, ol { margin: 6px 0 16px 22px; }
li { margin-bottom: 6px; color: var(--text); }

a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
a:hover { border-bottom-color: var(--primary); }
a:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  border-radius: 3px;
}

/* TL;DR / summary block */
.tldr {
  background: var(--primary-tint);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin: 6px 0 20px;
  font-size: 14.5px;
  color: var(--text);
  border-left: 3px solid var(--primary);
}
.tldr strong {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--primary-dark);
  text-transform: uppercase;
  margin-bottom: 4px;
  font-weight: 700;
}

/* Callouts */
.callout {
  --c: var(--primary);
  --bg: var(--primary-tint);
  background: var(--bg);
  border-left: 4px solid var(--c);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin: 20px 0;
}
.callout.warning  { --c: var(--c-warn); --bg: var(--c-warn-bg); }
.callout.info     { --c: var(--c-info); --bg: var(--c-info-bg); }
.callout.critical { --c: var(--c-crit); --bg: var(--c-crit-bg); }
.callout.tip      { --c: var(--c-tip);  --bg: var(--c-tip-bg); }
.callout[data-label]::before {
  content: attr(data-label);
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--c);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--c); }

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead {
  background: var(--primary-tint);
}
th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
tr:last-child td { border-bottom: none; }
@media (prefers-color-scheme: dark) {
  th { color: var(--primary); }
}

/* Contact block */
.contact {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 28px;
  border-radius: var(--radius-lg);
  margin-top: 48px;
  position: relative;
  overflow: hidden;
}
.contact::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 50%;
  height: 180%;
  background: radial-gradient(circle, rgba(37, 158, 139, 0.3) 0%, transparent 60%);
  pointer-events: none;
}
.contact h3 {
  color: #fff;
  margin: 0 0 6px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 20px;
  font-weight: 700;
  position: relative;
}
.contact p {
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 10px;
  position: relative;
}
.contact a {
  color: #fff;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
}
.contact a:hover { border-bottom-color: #fff; }

/* Back to top */
.to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--secondary);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, background 0.2s;
  box-shadow: var(--shadow-md);
  z-index: 30;
}
.to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.to-top:hover { background: var(--primary-dark); }
.to-top svg { width: 18px; height: 18px; }

/* Footer */
footer {
  background: var(--secondary);
  color: rgba(255, 255, 255, 0.78);
  padding: 48px 24px 24px;
  margin-top: 64px;
}
.footer-grid {
  max-width: 1200px;
  margin: 0 auto 32px;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 32px;
}
.footer-grid h4 {
  color: var(--primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 14px;
}
.footer-grid a,
.footer-grid p {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 14px;
  padding: 4px 0;
  margin: 0;
  border-bottom: none;
}
.footer-grid a:hover { color: var(--primary); }
.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: space-between;
}
@media (max-width: 600px) {
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* =====  Responsive trim  ===== */
@media (max-width: 768px) {
  .hero { padding: 44px 28px; }
  .doc-grid { grid-template-columns: 1fr; }
  .info-row { grid-template-columns: 1fr; }
  .topbar nav a { padding: 8px 10px; }
  .container { padding: 28px 16px 48px; }
}

/* =====  Print  ===== */
@media print {
  .topbar, .toc, .toc-mobile, .to-top, .progress-bar, footer, .contact { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; line-height: 1.45; }
  .container { padding: 0; }
  .card { box-shadow: none; padding: 0; border: 0; }
  .doc-layout { display: block; }
  h2 { page-break-after: avoid; }
  p, li { orphans: 3; widows: 3; }
  a { color: #000; border-bottom: none; }
  a::after { content: " (" attr(href) ")"; font-size: 9pt; color: #666; }
  .doc-body p, .doc-body ul, .doc-body ol { max-width: 100%; }
}

/* =====  Reduced motion  ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
