/*
  Shared stylesheet for the four legal pages (terms, privacy, cancellation,
  community). Palette and type scale are tuned to Apple's own legal pages:
  SF-stack typography first, Apple's exact greys (#1d1d1f / #6e6e73), hairlines
  at rgba(0,0,0,0.1), link colour #0066cc. Dark-mode fork added so a user
  flipping the global rb_theme toggle gets the matching dark surface.
*/

* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

:root {
  --bg:          #ffffff;
  --bg-elev:     #fbfbfd;
  --text:        #1d1d1f;
  --text-mute:   #6e6e73;
  --text-dim:    #86868b;
  --link:        #0066cc;
  --link-hover:  #0077ed;
  --hairline:    rgba(0,0,0,0.08);
  --hairline-strong: rgba(0,0,0,0.12);
  --surface-soft:#f5f5f7;
  --caution-bg:  #fff8ee;
  --caution-bd:  rgba(230,160,0,0.25);
  --caution-fg:  #7a5c00;
}

html[data-theme="dark"] {
  --bg:          #000000;
  --bg-elev:     #0b0b0d;
  --text:        #f5f5f7;
  --text-mute:   #a1a1a6;
  --text-dim:    #86868b;
  --link:        #2997ff;
  --link-hover:  #4daaff;
  --hairline:    rgba(255,255,255,0.09);
  --hairline-strong: rgba(255,255,255,0.14);
  --surface-soft:#1c1c1e;
  --caution-bg:  rgba(230,160,0,0.08);
  --caution-bd:  rgba(230,160,0,0.28);
  --caution-fg:  #ffcf6b;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 17px;
  line-height: 1.47059;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* ───── Header ─────
   Apple-style header: generous vertical breathing room, large semibold title
   in the SF Display stack, muted meta line. No serif. */
.legal-header {
  padding: 96px 0 60px;
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
}
.legal-inner {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 40px;
}
.legal-eyebrow {
  display: block;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-mute);
  margin-bottom: 18px;
}
.legal-h1 {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', sans-serif;
  font-size: clamp(40px, 6vw, 56px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.07143;
  color: var(--text);
  margin-bottom: 20px;
}
.legal-meta {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-mute);
}

/* ───── Body ─────
   740px measure, 17px/1.47 for the Apple-adjacent reading rhythm.
   Section headings are weight-based not caps/track; keeps the page quiet. */
.legal-body {
  max-width: 740px;
  margin: 0 auto;
  padding: 56px 40px 120px;
}
.legal-body h2 {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', sans-serif;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.021em;
  color: var(--text);
  margin: 72px 0 20px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
  line-height: 1.14286;
}
.legal-body h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.legal-body h3 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.016em;
  color: var(--text);
  margin: 44px 0 14px;
  line-height: 1.19048;
}
.legal-body h4 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--text);
  margin: 32px 0 10px;
  line-height: 1.47059;
}
.legal-body p {
  font-size: 17px;
  line-height: 1.52941;
  letter-spacing: -0.022em;
  color: var(--text);
  margin-bottom: 18px;
}
.legal-body p strong { color: var(--text); font-weight: 600; }
.legal-body ul, .legal-body ol {
  padding-left: 24px;
  margin: 0 0 20px;
}
.legal-body li {
  font-size: 17px;
  line-height: 1.52941;
  letter-spacing: -0.022em;
  color: var(--text);
  margin-bottom: 8px;
}
.legal-body li:last-child { margin-bottom: 0; }
.legal-body hr {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 56px 0;
}
.legal-body blockquote {
  margin: 24px 0;
  padding: 20px 24px;
  border-left: 2px solid var(--hairline-strong);
  background: var(--bg-elev);
  border-radius: 0 8px 8px 0;
}
.legal-body blockquote p {
  font-size: 15px;
  color: var(--text-mute);
  margin-bottom: 10px;
}
.legal-body blockquote p:last-child { margin-bottom: 0; }

/* ───── Tables ─────
   Apple style: no outer borders, hairlines only between rows, generous padding.
   Horizontal scroll wrapper for mobile. */
.tbl-wrap {
  overflow-x: auto;
  margin: 24px 0;
  -webkit-overflow-scrolling: touch;
}
.legal-body table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
}
.legal-body th, .legal-body td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
  color: var(--text);
}
.legal-body th {
  font-weight: 600;
  color: var(--text);
  background: var(--bg-elev);
  border-bottom: 1px solid var(--hairline-strong);
}
.legal-body tr:last-child td { border-bottom: 0; }

/* ───── Call-out boxes ─────
   Soft rounded surfaces for liability caps / warnings; matches the overall
   quiet aesthetic — nothing shouts unless the content itself is shouting. */
.caps-notice {
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 22px 24px;
  margin: 20px 0 28px;
}
.caps-notice p { font-size: 15px; line-height: 1.6; color: var(--text-mute); margin-bottom: 12px; }
.caps-notice p:last-child { margin-bottom: 0; }

.warning-banner {
  background: var(--caution-bg);
  border: 1px solid var(--caution-bd);
  border-radius: 12px;
  padding: 18px 22px;
  margin: 0 0 40px;
}
.warning-banner p { font-size: 15px; line-height: 1.6; color: var(--caution-fg); margin: 0; }

/* Safety callout — used only on the Community Guidelines page for the
   "contact 911 first" emphasis. Red-tinted but still quiet, matching the
   Apple caution-notice aesthetic rather than a loud warning. */
.safety-callout {
  background: rgba(227, 0, 0, 0.04);
  border: 1px solid rgba(227, 0, 0, 0.14);
  border-radius: 12px;
  padding: 18px 22px;
  margin: 0 0 36px;
}
html[data-theme="dark"] .safety-callout {
  background: rgba(255, 69, 58, 0.08);
  border-color: rgba(255, 69, 58, 0.22);
}
.safety-callout p { font-size: 15px; line-height: 1.6; color: #7a2020; margin: 0; font-weight: 500; }
html[data-theme="dark"] .safety-callout p { color: #ff9b94; }

/* ───── Footer ─────
   Tiny, muted, hairline-separated. Mirrors Apple's legal page footer. */
.legal-foot {
  background: var(--bg-elev);
  border-top: 1px solid var(--hairline);
  padding: 36px 40px;
}
.legal-foot-inner {
  max-width: 740px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.legal-foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
}
.legal-foot-links a {
  font-size: 13px;
  color: var(--text-mute);
  text-decoration: none;
  padding: 2px 0;
  transition: color .15s;
}
.legal-foot-links a:hover { color: var(--text); }
.legal-foot-copy {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ───── Mobile ───── */
@media (max-width: 640px) {
  .legal-header { padding: 60px 0 44px; }
  .legal-inner, .legal-body { padding-left: 22px; padding-right: 22px; }
  .legal-body { padding-top: 44px; padding-bottom: 80px; }
  .legal-body h2 { font-size: 24px; margin-top: 56px; padding-top: 20px; }
  .legal-body h3 { font-size: 19px; margin-top: 36px; }
  .legal-foot { padding: 28px 22px; }
  .legal-foot-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
}
