/* ── Legal & Trust pages (public/terms.html, privacy.html, refund-policy.html,
   ai-providers.html, student-policy.html) ─────────────────────────────────────
   Shared shell: top nav, readable long-form content, table of contents, and the
   "Legal & Trust" footer. Colours come from theme.css — no raw hex here. */

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
}

/* Aurora + circuit-grid background (matches app/auth pages) */
body::before {
  content: '';
  position: fixed; inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(ellipse 50% 45% at 85% 90%, color-mix(in srgb, var(--accent2) 20%, transparent), transparent 60%),
    radial-gradient(ellipse 40% 40% at 8% 30%, color-mix(in srgb, #22d3ee 14%, transparent), transparent 60%);
}

/* ── Top nav ── */
.legal-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 28px;
  background: var(--nav-topbar-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.legal-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}
.legal-nav-brand img { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; display: block; }
.legal-nav-links { display: flex; align-items: center; gap: 6px; }
.legal-nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.legal-nav-links a:hover { color: var(--text); background: var(--sidebar-link-hover-bg); }

/* ── Content layout ── */
.legal-wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 28px 72px;
}
.legal-content { max-width: 720px; }

.legal-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-hover);
  margin-bottom: 14px;
}
.legal-h1 { font-size: 32px; font-weight: 800; line-height: 1.2; margin-bottom: 14px; }
.legal-lead { font-size: 15px; color: var(--text2); margin-bottom: 22px; max-width: 62ch; }

.legal-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}
.legal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: var(--radius-full);
}

/* ── Table of contents ── */
.legal-toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 36px;
}
.legal-toc-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 12px;
}
.legal-toc ol { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.legal-toc a {
  display: flex;
  gap: 10px;
  color: var(--text2);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.legal-toc a:hover { color: var(--text); background: var(--sidebar-link-hover-bg); }
.legal-toc .toc-num { color: var(--accent-hover); font-weight: 700; min-width: 22px; font-variant-numeric: tabular-nums; }

/* ── Long-form typography ── */
.legal-section { margin-bottom: 40px; scroll-margin-top: 84px; }
.legal-section h2 {
  font-size: 21px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.legal-section h3 { font-size: 16px; font-weight: 700; margin: 22px 0 10px; color: var(--text); }
.legal-section p { font-size: 15px; color: var(--text2); margin-bottom: 14px; }
.legal-section ul, .legal-section ol {
  margin: 0 0 16px 4px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.legal-section li { font-size: 15px; color: var(--text2); }
.legal-section li::marker { color: var(--accent-hover); }
.legal-section strong { color: var(--text); font-weight: 600; }
.legal-section a { color: var(--accent-hover); text-decoration: none; }
.legal-section a:hover { text-decoration: underline; }

/* Callout boxes */
.legal-callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin: 18px 0;
  font-size: 14px;
  color: var(--text2);
}
.legal-callout strong { color: var(--text); }
.legal-callout.warn { border-left-color: var(--warning); }
.legal-callout.info { border-left-color: var(--blue); }

.legal-todo {
  background: var(--warning-bg);
  border: 1px dashed color-mix(in srgb, var(--warning) 45%, transparent);
  color: var(--amber);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  display: inline-block;
}

/* ── Provider cards (ai-providers.html) ── */
.provider-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.provider-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.provider-card-name { font-size: 16px; font-weight: 700; color: var(--text); }
.provider-card-site { font-size: 13px; font-weight: 600; color: var(--accent-hover); text-decoration: none; }
.provider-card-site:hover { text-decoration: underline; }
.provider-models { display: flex; flex-wrap: wrap; gap: 8px; }
.model-chip {
  font-family: 'JetBrains Mono', 'Inter', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

/* Flow diagram (ai-providers.html) */
.flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 20px 0 8px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.flow-node {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  text-align: center;
}
.flow-node.gateway { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; }
.flow-arrow { color: var(--muted); font-size: 14px; line-height: 1; }

/* ── Footer ── */
.legal-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 40px 28px 28px;
  margin-top: 24px;
}
.legal-footer-grid {
  max-width: 800px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 28px;
}
.legal-footer-col h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 12px;
}
.legal-footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.legal-footer-col a { color: var(--text2); text-decoration: none; font-size: 14px; transition: color 0.15s; }
.legal-footer-col a:hover { color: var(--text); }
.legal-footer-entity {
  max-width: 800px;
  margin: 32px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}
.legal-footer-entity a { color: var(--accent-hover); text-decoration: none; }
.legal-footer-entity a:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .legal-nav { padding: 12px 16px; }
  .legal-nav-links a:not(:last-child) { display: none; }
  .legal-wrap { padding: 32px 18px 56px; }
  .legal-h1 { font-size: 26px; }
  .legal-footer { padding: 32px 18px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
