/* legal.css — About / Terms / Privacy pages. Loads after styles.css (reuses its tokens). */

main.doc {
  display: block; /* styles.css makes <main> a two-column grid for the app */
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 56px;
}
.doc h1 { font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; margin: 8px 0 6px; }
.doc .updated { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.doc h2 { font-size: 18px; margin: 32px 0 8px; }
.doc p, .doc li { color: var(--text-2); line-height: 1.6; }
.doc ul { padding-left: 20px; }
.doc li { margin: 4px 0; }
.doc strong { color: var(--text); }
.doc a { color: var(--text); text-underline-offset: 3px; }
.doc .lead { font-size: 17px; color: var(--text); }
.doc .callout {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 20px 0;
}
.doc .callout p { margin: 0; }

.legal-top { justify-content: space-between; }
.legal-top .back { color: var(--text-2); text-decoration: none; font-size: 14px; }
.legal-top .back:hover { color: var(--text); }

.foot-links { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.foot-links a { color: var(--muted); text-decoration: none; }
.foot-links a:hover { color: var(--text); text-decoration: underline; }

/* ---------- /stats (owner-only usage page) ---------- */
main.stats-page { max-width: 900px; }
.stats-page #st-range { margin: 0 0 18px; }
.stats-page .stats { margin-top: 4px; }
.stats-page .stat { cursor: default; text-align: left; }
.st-note { font-size: 13px; color: var(--muted) !important; margin: 4px 0 8px; }
.st-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.st-table th, .st-table td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--border); }
.st-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.st-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- /pricing ---------- */
.plan-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 24px 0 8px; }
.plan-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  display: flex; flex-direction: column;
}
.plan-card-pro { border-color: var(--text-2); }
.doc .plan-card h2 { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.doc .plan-card p { margin: 0 0 10px; }
.doc .plan-price { color: var(--text); font-size: 15px; margin-bottom: 2px !important; }
.plan-price b { font-size: 30px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.doc .plan-sub { color: var(--muted); font-size: 14px; }
.plan-sub b { color: var(--text-2); }
.doc .plan-trial { color: var(--good); font-weight: 600; } /* the free-trial line (plans.js → TRIAL_DAYS) */
.doc .plan-cta { margin: auto 0 0 !important; padding-top: 6px; color: var(--text); font-weight: 600; }
.doc .plan-cta .btn { text-decoration: none; }
.doc .plan-cta .btn-primary { color: var(--accent-ink); }

.plan-table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 8px 0 4px; }
.plan-table th, .plan-table td { padding: 10px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.plan-table thead th { color: var(--muted); font-weight: 600; font-size: 12px; text-align: center; }
.plan-table thead th:first-child { text-align: left; }
.plan-table tbody th { text-align: left; font-weight: 400; color: var(--text-2); line-height: 1.45; }
.plan-table td { text-align: center; width: 76px; white-space: nowrap; font-weight: 600; }
.plan-table td.yes { color: var(--good); }
.plan-table td.no { color: var(--muted); font-weight: 400; }
.plan-table td.soon { color: var(--muted); font-size: 12px; white-space: normal; }

@media (max-width: 560px) {
  .plan-cards { grid-template-columns: 1fr; }
  .plan-table { font-size: 14px; }
  .plan-table td { width: 52px; }
}

/* ---------- /methodology ---------- */
.method h3 { font-size: 15px; margin: 22px 0 6px; color: var(--text); }
.method .callout ul { margin: 0; }
.method .data-credit { font-size: 12px; color: var(--muted); }
.toc { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 20px 0 4px; }
.doc .toc a {
  font-size: 13px; color: var(--text-2); text-decoration: none;
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px;
}
.doc .toc a:hover { color: var(--text); border-color: var(--text-2); }
/* Anchors land below the sticky header instead of under it. */
.method h2, .method .mline { scroll-margin-top: 72px; }

/* The generated list (scripts/methodology.js): one block per line on the chart. */
.mgroup { margin: 28px 0 0; }
.doc .mgroup h3 {
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 4px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.doc .mgroup-note { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.mline { padding: 12px 0; border-bottom: 1px solid var(--border); }
.doc .mline h4 { font-size: 15px; margin: 0 0 2px; color: var(--text); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.doc .mline p { margin: 2px 0 0; font-size: 14px; line-height: 1.5; }
.doc .mline .how { color: var(--muted); font-size: 13px; }
.mline .how b { color: var(--text-2); font-weight: 600; }
.mline code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px;
  color: var(--text-2); overflow-wrap: anywhere; /* XBRL tag names are one long word: let them wrap on phones */
}
.src {
  font-size: 11px; font-weight: 600; line-height: 1.5; white-space: nowrap;
  border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; color: var(--text-2);
}
.src-calc, .src-fill, .src-sheet { border-style: dashed; border-color: var(--text-2); }
.src-market { color: var(--good); border-color: var(--good); }
@media (max-width: 560px) { .src { white-space: normal; } }

/* ---------- /learn (education pages) ---------- */
.learn .crumb { font-size: 13px; color: var(--muted); margin: 0; }
.doc.learn .crumb a { color: var(--muted); text-decoration: none; }
.doc.learn .crumb a:hover { color: var(--text); text-decoration: underline; }
.learn h3 { font-size: 15px; margin: 22px 0 6px; color: var(--text); }
.learn h2 { scroll-margin-top: 72px; }
.learn .sum {
  font-size: 17px; color: var(--text); font-weight: 600; text-align: center;
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius);
  padding: 14px 16px; margin: 16px 0;
}

/* A link into the app: the exact chart the paragraph above is about (settings ride in the URL — public/share.js). */
.doc a.example {
  display: block; text-decoration: none;
  border: 1px solid var(--border); border-left: 3px solid var(--good);
  background: var(--surface); border-radius: var(--radius);
  padding: 12px 16px; margin: 16px 0;
}
.doc a.example:hover { border-color: var(--text-2); border-left-color: var(--good); }
.example span { display: block; }
.example .example-kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.example .example-title { font-weight: 600; color: var(--text); margin: 2px 0; }
.example .example-go { font-size: 14px; color: var(--good); }

/* Diagrams: plain boxes, no pictures and no real figures. Labels carry the meaning, not the colour. */
.learn figure { margin: 20px 0; }
.learn figcaption { font-size: 12px; color: var(--muted); margin-top: 8px; text-align: center; }
.sheet { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; height: 190px; }
.sheet-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sheet-eq { align-self: center; font-size: 22px; color: var(--muted); }
.sheet-box {
  flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font-weight: 600; padding: 6px; line-height: 1.25;
}
.sheet-box small { font-weight: 400; font-size: 12px; color: var(--muted); }
.sheet-liab { flex: 3; border-top: 3px solid var(--s2); }
.sheet-equity { flex: 2; border-top: 3px solid var(--s3); }
.sheet-assets { border-top: 3px solid var(--s1); }

.bars { display: grid; gap: 16px; }
.bars-row { display: grid; grid-template-columns: 1fr; gap: 4px; }
.bars-name { font-size: 13px; font-weight: 600; color: var(--text); }
.bar {
  font-size: 12px; color: var(--text); white-space: nowrap; line-height: 1;
  padding: 7px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface);
}
.bar-cash { border-left: 4px solid var(--s3); }
.bar-debt { border-left: 4px solid var(--s2); }
.w25 { width: 25%; } .w35 { width: 35%; } .w80 { width: 80%; } .w90 { width: 90%; }
.bars-result { font-size: 13px; color: var(--text-2); }
.bars-result b { color: var(--text); }

/* The /learn index and the "read next" list at the foot of an article. */
.learn-list { list-style: none; padding: 0 !important; margin: 20px 0; display: grid; gap: 12px; }
.learn-list li { margin: 0; }
.doc .learn-list a {
  display: block; text-decoration: none;
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 14px 16px;
}
.doc .learn-list a:hover { border-color: var(--text-2); }
.learn-list b { display: block; color: var(--text); font-size: 16px; }
.learn-list span { display: block; color: var(--text-2); font-size: 14px; line-height: 1.5; margin-top: 2px; }
@media (max-width: 560px) {
  .sheet { height: 170px; gap: 6px; }
  .w25 { width: 38%; } .w35 { width: 45%; }
}

/* ---------- /learn: live charts in the article (public/embed.js) ---------- */
/* embed.js swaps each a.example for a figure.embed; if it can't, the link card above stays. */
.learn figure.embed {
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius);
  padding: 14px 14px 10px; margin: 16px 0;
}
.embed-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 0 0 6px; text-align: left; }
.learn figure.embed figcaption { font-size: 15px; color: var(--text); margin: 0 0 6px; text-align: left; }
.embed-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--text-2); margin: 0 0 6px; }
.embed-legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.embed-legend-item i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.embed-legend-item.is-empty { color: var(--muted); }
.embed-legend-item.is-empty i { opacity: 0.4; }
/* Room is held for the chart before its data arrives, so the text below doesn't jump. */
.embed-chart { min-height: 280px; display: grid; align-items: center; }
.doc .embed-status { text-align: center; color: var(--muted); font-size: 13px; margin: 0; }
.doc .embed-key { margin: 6px 0 0; }
.doc .embed-key a { color: inherit; }
.doc .embed-actions { display: flex; align-items: center; gap: 14px; margin: 10px 0 0; font-size: 14px; }
.doc .embed-open, .embed-dialog .embed-open { color: var(--good); text-decoration: none; }
.embed-open:hover { text-decoration: underline; }
.embed-expand, .embed-back { cursor: pointer; }

/* Expanded: the same chart over the article. Whole screen on a phone, a large card on a desktop. */
.embed-dialog {
  width: min(1000px, 100vw - 48px); max-width: none; max-height: none;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text); padding: 16px 20px 18px;
}
.embed-dialog::backdrop { background: rgb(0 0 0 / 0.55); }
.embed-dialog-bar { margin: 0 0 12px; }
.embed-dialog .embed-title { font-size: 18px; margin: 0 0 8px; }
.embed-dialog .embed-chart { min-height: 220px; }
.embed-dialog .embed-key { margin: 6px 0 0; }
.embed-dialog .embed-actions { display: flex; margin: 12px 0 0; font-size: 14px; }
@media (max-width: 600px) {
  .embed-chart { min-height: 220px; }
  .learn figure.embed { padding: 12px 10px 8px; }
  .embed-dialog {
    width: 100vw; height: 100vh; height: 100dvh; margin: 0; border: 0; border-radius: 0;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  }
}

/* ---------- /screens (company lists — public/screens.html, src/screens.js) ---------- */
/* The index reuses .learn-list; a list page reuses the screener's table (.scr-results in styles.css). */
.doc .screen-test { color: var(--text); font-weight: 600; margin: 4px 0 2px; }
.doc.screens .updated { margin: 0 0 12px; }
.doc .screen-note { font-size: 13px; color: var(--muted); }
.doc.screens .scr-results tbody tr { cursor: default; } /* the company link is the click target, not the row */
.doc.screens .scr-results a { color: inherit; text-decoration: none; }
.doc.screens .scr-results a:hover b { text-decoration: underline; text-underline-offset: 3px; }
/* The screener upsell on a list page (src/screens.js → screenerUpsell): closed to one line, like the app's "Data table".
   Inside, the app's Pro preview pieces: .pro-tag, .example-note, the EXAMPLE badge (.example-badge), .scr-results. */
.screener-upsell { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); margin: 12px 0 16px; }
.screener-upsell > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; font-weight: 600; color: var(--text);
}
.screener-upsell > summary::-webkit-details-marker { display: none; }
.screener-upsell > summary::after { content: "▸"; margin-left: auto; color: var(--muted); }
.screener-upsell[open] > summary::after { content: "▾"; }
.upsell-body { padding: 0 16px 16px; }
.doc .upsell-lead { margin: 0 0 10px; color: var(--text-2); }
/* The price preview's EXAMPLE badge (styles.css → .example-chart::after), inline before the example's heading —
   over a table it would sit on the column names. */
.example-badge {
  display: inline-block; margin-right: 6px; font-size: 11px; font-weight: 800; letter-spacing: .12em;
  color: var(--muted); border: 1px dashed var(--muted); border-radius: 6px; padding: 1px 7px; vertical-align: 1px;
}
.doc .upsell-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.doc .upsell-actions .btn { text-decoration: none; }
.doc .upsell-actions .btn-primary { color: var(--accent-ink); }

/* ---------- company topic pages (/AAPL/revenue — public/company-topic.html, src/topics.js) ---------- */
/* The chart is a /learning example (embed.js); the year-by-year table reuses the screener's (.scr-results in
   styles.css); the companies of a similar size reuse .learn-list. */
.doc.topic .scr-results tbody tr { cursor: default; }
.doc.topic .scr-results tbody tr:hover { background: none; }
.doc.topic .scr-results tbody th span { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.doc.topic .scr-results thead a { color: inherit; text-decoration: none; }
.doc.topic .scr-results thead a:hover { text-decoration: underline; text-underline-offset: 3px; }
.doc.topic .scr-results td.none { color: var(--muted); }
.doc.topic .topic-facts { margin-top: 16px; }
.doc .topic-links li { margin: 4px 0; }
.learn-list.topic-near { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.doc .topic-near a { padding: 10px 12px; }
.topic-near b { font-size: 15px; }
.topic-near span { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
