/* ==========================================================================
   FaxLock — Shared styles for legal pages (Terms, Privacy)
   Depends on index.css for CSS variables and base theme
   ========================================================================== */

.legal-main {
  flex: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: 60px 24px 80px;
  position: relative;
  z-index: 10;
}

.legal-header {
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.legal-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 120px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  box-shadow: 0 0 12px var(--primary-glow);
}
.legal-header h1 {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1.5px;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.15;
  text-shadow: 0 0 60px var(--primary-glow);
}
.legal-header .subtitle {
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.legal-header .subtitle::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--primary);
}

/* ── Table of contents ── */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 48px;
}
.toc h2 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
  display: block;
}
.toc h2::before { display: none; }
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 4px;
}
.toc li a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s;
}
.toc li a:hover {
  background: var(--surface-hover);
  color: var(--primary);
}
.toc li a::before {
  content: attr(data-num);
  color: var(--primary);
  font-weight: 700;
  margin-right: 8px;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

/* ── Sections ── */
.legal-main section {
  margin-bottom: 40px;
  scroll-margin-top: 96px;
}
.legal-main h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  line-height: 1.3;
}
.legal-main h2 .num {
  color: var(--primary);
  font-size: 26px;
  font-weight: 800;
  opacity: 0.55;
  line-height: 1;
  flex-shrink: 0;
}
.legal-main p {
  margin-bottom: 14px;
  color: var(--text-muted);
  font-size: 15.5px;
  line-height: 1.75;
}
.legal-main p:last-child { margin-bottom: 0; }
.legal-main strong { color: var(--text); font-weight: 600; }
.legal-main ul, .legal-main ol {
  margin: 0 0 16px 22px;
  padding-left: 8px;
}
.legal-main li {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 15.5px;
  line-height: 1.7;
}
.legal-main ul li::marker { color: var(--primary); }
.legal-main a { color: var(--primary); text-decoration: none; }
.legal-main a:hover { color: #5EEAD4; text-decoration: underline; }

/* ── Highlight box ── */
.highlight {
  background: var(--surface);
  border-left: 3px solid var(--primary);
  padding: 16px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 16px;
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.7;
}
.highlight strong { color: var(--text); }

/* ── Back button ── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 48px;
  padding: 14px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s;
  text-decoration: none;
}
.back-btn:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  text-decoration: none;
}
.back-btn svg { width: 16px; height: 16px; }

/* ── Light-theme tweaks ── */
[data-theme="light"] .legal-header h1 { text-shadow: none; }
[data-theme="light"] .legal-header::after { box-shadow: none; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .legal-main { padding: 40px 20px 60px; }
  .legal-header h1 { font-size: 30px; }
  .legal-main h2 { font-size: 18px; }
  .legal-main h2 .num { font-size: 22px; }
  .toc ul { grid-template-columns: 1fr; }
}

/* ── Print ── */
@media print {
  #mainHeader, footer, .toc, .back-btn, .grid-bg, .orb, .shard { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .legal-main { max-width: 100%; padding: 0; }
  .legal-header h1 { color: #000 !important; text-shadow: none !important; font-size: 24pt; }
  .legal-main h2 { color: #000 !important; font-size: 14pt; margin-top: 18pt; }
  .legal-main p, .legal-main li { color: #000 !important; font-size: 11pt; }
  .legal-main a { color: #000 !important; text-decoration: underline; }
  section { break-inside: avoid; margin-bottom: 18pt; }
}
