/* ══════════════════════════════════════════════════════════════════
   legal.css — Shared styles for terms.html and privacy.html
   Extends style.css token system. No duplicate token definitions.
   ══════════════════════════════════════════════════════════════════ */

/* ── Legal Layout ───────────────────────────────────────────────────── */
.legal-main {
  flex: 1;
  padding: 3rem 1.5rem 5rem;
}

.legal-container {
  max-width: 780px;
  margin: 0 auto;
}

/* ── Legal Header ───────────────────────────────────────────────────── */
.legal-header {
  margin-bottom: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.legal-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green-500);
  margin-bottom: 0.75rem;
}

.legal-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

.legal-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.legal-meta time {
  font-weight: 500;
  color: var(--text-secondary);
}

.legal-intro {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 640px;
}

/* ── Table of Contents ──────────────────────────────────────────────── */
.legal-toc {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--green-500);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  margin-bottom: 3rem;
}

.toc-heading {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
}

.toc-list {
  list-style: none;
  counter-reset: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.25rem 2rem;
  padding: 0;
}

.toc-link {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--t-fast);
  display: block;
  padding: 0.2rem 0;
}

.toc-link:hover {
  color: var(--green-400);
}

/* ── Legal Body ─────────────────────────────────────────────────────── */
.legal-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.legal-body section {
  padding: 2.25rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.legal-body section:last-child {
  border-bottom: none;
}

/* Headings */
.legal-body h2 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 1rem;
  scroll-margin-top: 80px; /* offset for sticky header */
}

.legal-body h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 1.5rem;
  margin-bottom: 0.625rem;
  letter-spacing: -0.01em;
}

/* Paragraphs */
.legal-body p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 1rem;
}

.legal-body p:last-child {
  margin-bottom: 0;
}

/* Lists */
.legal-body ul,
.legal-body ol {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

.legal-body li {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.375rem;
}

.legal-body li:last-child {
  margin-bottom: 0;
}

.legal-body li strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Links inside body */
.legal-body a {
  color: var(--green-400);
  text-decoration: underline;
  text-decoration-color: var(--green-border);
  text-underline-offset: 3px;
  transition: color var(--t-fast), text-decoration-color var(--t-fast);
}

.legal-body a:hover {
  color: var(--green-300);
  text-decoration-color: var(--green-400);
}

/* Address */
.legal-address {
  font-style: normal;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.75;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
  display: inline-block;
}

/* ── Callout Blocks ─────────────────────────────────────────────────── */
.legal-callout {
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  line-height: 1.65;
  margin: 1.25rem 0;
}

.legal-callout strong {
  display: block;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.legal-callout--warning {
  background: rgba(240, 192, 50, 0.08);
  border: 1px solid rgba(240, 192, 50, 0.25);
  color: #d4a820;
}

.legal-callout--warning strong {
  color: #e8bc30;
}

.legal-callout--info {
  background: var(--violet-muted);
  border: 1px solid rgba(84, 29, 185, 0.25);
  color: var(--text-secondary);
}

.legal-callout--info strong {
  color: var(--violet-400);
}

.legal-callout--info a {
  color: var(--violet-400);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Table ──────────────────────────────────────────────────────────── */
.legal-table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.legal-table th {
  background: var(--bg-raised);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.legal-table td {
  padding: 0.875rem 1rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
  line-height: 1.55;
}

.legal-table tr:last-child td {
  border-bottom: none;
}

.legal-table tr:hover td {
  background: var(--bg-raised);
}

/* ── Footer Nav ─────────────────────────────────────────────────────── */
.legal-footer-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.legal-back-btn {
  width: auto;
  font-size: 0.875rem;
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .legal-main { padding: 2rem 1.25rem 4rem; }

  .legal-title { font-size: 1.75rem; }

  .toc-list { grid-template-columns: 1fr; }

  .legal-body h2 { font-size: 1.125rem; }

  .legal-table th,
  .legal-table td { padding: 0.625rem 0.75rem; }

  .legal-footer-nav { flex-direction: column; align-items: stretch; }

  .legal-back-btn { width: 100%; justify-content: center; }
}
