/* Card L3 - shared styles for the legal pages (terms / privacy / refund).
 * These are public static pages (Stripe review and signed-out visitors must open them directly),
 * so they do not pull in the app stylesheet:
 *   - mobile first (reads from 390px), desktop is a single 760px column;
 *   - light / dark follows prefers-color-scheme;
 *   - zero external requests (no web fonts, scripts or images), system fonts only.
 * NOTE: this file must stay free of CJK characters (i18n-ratchet caps new files at 0).
 */

:root {
  --bg: #ffffff;
  --panel: #f4f6fa;
  --line: #e2e6ee;
  --text: #171a21;
  --muted: #5a6373;
  --accent: #1f5fd0;
  --pending: #8a5a00;
  --pending-bg: #fff4d6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --panel: #171a21;
    --line: #2b303b;
    --text: #e8ebf2;
    --muted: #98a1b3;
    --accent: #7aa2ff;
    --pending: #ffcf7a;
    --pending-bg: #3a2c10;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* Top bar: brand + language toggle (one text button, labelled in the other language) */
.legal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.legal-top .brand {
  font-weight: 700;
  letter-spacing: .3px;
  color: inherit;
  text-decoration: none;
  font-size: 16px;
}

.legal-top .beta {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0 7px;
  margin-left: 8px;
  vertical-align: 2px;
}

#langToggle {
  min-height: 44px;
  min-width: 64px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

#langToggle:hover { border-color: var(--accent); color: var(--accent); }

/* Cross links between the three documents */
.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.legal-nav a {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  text-decoration: none;
  color: var(--muted);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.legal-nav a[aria-current="page"] {
  color: var(--text);
  border-color: var(--accent);
  background: var(--panel);
}

main.legal {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  flex: 1;
}

main.legal h1 {
  font-size: 24px;
  line-height: 1.35;
  margin: 8px 0 4px;
}

main.legal .updated {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--muted);
}

main.legal h2 {
  font-size: 18px;
  line-height: 1.4;
  margin: 28px 0 8px;
  padding-top: 4px;
}

main.legal h3 { font-size: 16px; margin: 18px 0 4px; }

main.legal p,
main.legal ul,
main.legal ol { margin: 0 0 12px; }

main.legal ul,
main.legal ol { padding-left: 22px; }

main.legal li { margin: 0 0 6px; }

main.legal .note {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}

main.legal table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 14px;
  font-size: 15px;
}

main.legal th,
main.legal td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

main.legal th { color: var(--muted); font-weight: 600; white-space: nowrap; }

/* Pending items are highlighted so PM / business can spot them; remove the span once confirmed */
.pending {
  display: inline;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--pending-bg);
  color: var(--pending);
  font-size: .93em;
}

.legal-foot {
  border-top: 1px solid var(--line);
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.legal-foot .sep { margin: 0 6px; }

@media (min-width: 720px) {
  main.legal { padding: 28px 24px 56px; }
  main.legal h1 { font-size: 28px; }
  .legal-top,
  .legal-nav { padding-left: 24px; padding-right: 24px; }
}

/* Phones: the two fact tables have three columns and would push the page wider than 390.
   Stack each row into a block instead of scrolling sideways (a sideways scroll on a policy
   page hides the "where is my video processed" answer). */
@media (max-width: 520px) {
  main.legal table,
  main.legal tbody,
  main.legal tr,
  main.legal td { display: block; width: 100%; }
  main.legal thead { display: none; }
  main.legal tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  main.legal td { border: 0; padding: 2px 0; }
  main.legal td:first-child { font-weight: 600; }
  main.legal td:last-child { padding-bottom: 8px; }
}
