/* ════════════════════════════════════════════════════════════
   Legal Pages (Terms of Service, Privacy Policy)
   Public pages — standalone layout, no sidebar/navbar
   ════════════════════════════════════════════════════════════ */

/* ── Page body ── */
.legal-page {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.legal-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--panel) 95%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.legal-header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.legal-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  transition: color 0.15s ease;
}

.legal-logo:hover {
  color: var(--accent);
  text-decoration: none;
}

.legal-logo-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

.legal-logo-text {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.legal-header-links {
  display: flex;
  gap: 16px;
}

.legal-header-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.legal-header-link:hover {
  color: var(--accent);
}

/* ── Main content ── */
.legal-container {
  flex: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  width: 100%;
  box-sizing: border-box;
}

.legal-content h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-bright, var(--text));
  margin: 0 0 8px;
  line-height: 1.2;
}

.legal-effective {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 36px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.legal-content section {
  margin-bottom: 32px;
}

.legal-content h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-bright, var(--text));
  margin: 0 0 12px;
  padding-top: 8px;
}

.legal-content h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 8px;
}

.legal-content p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 12px;
}

.legal-content ul {
  margin: 0 0 12px;
  padding-left: 24px;
}

.legal-content li {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 4px;
}

.legal-content a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

.legal-content a:hover {
  text-decoration: underline;
}

.legal-content strong {
  color: var(--text-bright, var(--text));
  font-weight: 600;
}

/* ── Footer ── */
.legal-footer {
  border-top: 1px solid var(--border);
  background: var(--panel);
  padding: 20px 24px;
  flex-shrink: 0;
}

.legal-footer-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.legal-footer-copy {
  font-size: 13px;
  color: var(--muted);
}

.legal-footer-links {
  display: flex;
  gap: 20px;
}

.legal-footer-links a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.legal-footer-links a:hover {
  color: var(--accent);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .legal-header-inner {
    padding: 0 16px;
  }

  .legal-container {
    padding: 24px 16px 40px;
  }

  .legal-content h1 {
    font-size: 24px;
  }

  .legal-content h2 {
    font-size: 18px;
  }

  .legal-footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* ════════════════════════════════════════════════════════════
   Light Theme Overrides
   ════════════════════════════════════════════════════════════ */
[data-theme="light"] .legal-header {
  background: rgba(255, 255, 255, 0.95);
  border-bottom-color: var(--border);
}

[data-theme="light"] .legal-logo-text {
  color: #1a1a1a;
}

[data-theme="light"] .legal-content h1,
[data-theme="light"] .legal-content h2 {
  color: #111827;
}

[data-theme="light"] .legal-content h3 {
  color: #1f2937;
}

[data-theme="light"] .legal-content p,
[data-theme="light"] .legal-content li {
  color: #374151;
}

[data-theme="light"] .legal-content strong {
  color: #111827;
}

[data-theme="light"] .legal-footer {
  background: var(--panel);
  border-top-color: var(--border);
}

/* Tables in the legal pages (privacy policy Part II: the controller split and
   the Google scope list). Added when platform-privacy-notice.html was merged
   into privacy-policy.html — that page used .legal-table but nothing ever
   styled it, so the tables rendered as bare browser default.

   These carry dense, load-bearing text (what each Google scope actually grants),
   so they are tuned for READING rather than for compactness: horizontal rules
   only — a full cell grid boxes every line in and is what made them feel
   scrunched — generous row padding, and open line-height. */

/* Wrapper so a wide table scrolls itself instead of forcing the page sideways
   on a phone. The page body must never scroll horizontally. */
.legal-table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0 1.75rem;
  -webkit-overflow-scrolling: touch;
}

.legal-table {
  width: 100%;
  min-width: 33rem;              /* below this the columns collide; scroll instead */
  border-collapse: collapse;
  font-size: 1em;                /* was 0.95em — needlessly small for body copy */
  line-height: 1.55;
}

.legal-table th,
.legal-table td {
  /* Horizontal rules only. Vertical borders on a 3-column table of sentences
     read as a spreadsheet and crowd the text against the lines. */
  border: 0;
  border-bottom: 1px solid var(--border-light, rgba(128, 128, 128, 0.18));
  padding: 0.85rem 1.1rem 0.85rem 0;
  text-align: left;
  vertical-align: top;
}

.legal-table th:last-child,
.legal-table td:last-child { padding-right: 0; }

.legal-table thead th {
  border-bottom: 2px solid var(--border, #d9dee3);
  padding-top: 0;
  font-weight: 600;
  font-size: 0.82em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #6b7280);
  white-space: nowrap;
}

.legal-table tbody tr:last-child th,
.legal-table tbody tr:last-child td { border-bottom: 0; }

/* Column rhythm. The first column is a short label in both tables; without a
   width it takes half the table and wraps the label while the explanation —
   the part people read — is squeezed into what is left.

   Matched on COLUMN COUNT (:nth-last-child) rather than position alone, because
   the two tables differ: a flat `th:nth-child(2) { width: 22% }` would also hit
   the 2-column scope table and crush "What it allows" — the widest text on the
   page — into a fifth of the width. */

/* 3-column: Data | Controlled by | Why */
.legal-table thead th:first-child:nth-last-child(3) { width: 34%; }
.legal-table thead th:first-child:nth-last-child(3) ~ th:nth-child(2) { width: 22%; }

/* 2-column: Permission | What it allows */
.legal-table thead th:first-child:nth-last-child(2) { width: 28%; }

.legal-table thead th:last-child { width: auto; }

.legal-table td:first-child { font-weight: 500; }

@media (max-width: 40rem) {
  .legal-table { font-size: 0.94em; }
  .legal-table th,
  .legal-table td { padding: 0.7rem 0.85rem 0.7rem 0; }
}

/* Part divider in the privacy policy — separates the website half from the
   platform half. Larger than a section <h2> so the two-part structure reads
   at a glance. */
.legal-part {
  margin-top: 3rem;
  padding-top: 1.35rem;
  border-top: 2px solid var(--border, #d9dee3);
  font-size: 1.45em;
}
