/* Legal pages (/terms, /privacy, /refund): dark hero in the homepage hero colours, then a two-column
   reading layout - sticky table of contents (built from the h2s by js/legal-toc.js) + a readable text column.
   Layout only: the legal wording itself lives in the templates and is never edited here. Prefix: .lg- */

/* ---------- Hero: short, not a full screen ---------- */
.lg-hero { min-height: 0 !important; padding-bottom: 84px; }
.lg-hero::after { height: 180px; opacity: .55; }
.lg-hero h1 { position: relative; z-index: 1; font-size: clamp(36px, 3.6vw, 52px); }
.lg-updated { position: relative; z-index: 1; margin-top: 14px !important; font-size: 15px; font-weight: 500; color: #A9B6CF; }
.lg-switch { position: relative; z-index: 1; display: inline-flex; gap: 4px; margin-top: 28px; padding: 4px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); }
.lg-switch a { display: inline-flex; align-items: center; height: 34px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 600; color: rgba(255,255,255,.7) !important; transition: background-color .2s ease, color .2s ease; }
.lg-switch a:hover { color: #fff !important; background: rgba(255,255,255,.08); }
.lg-switch a[aria-current="page"] { background: #fff; color: var(--ink) !important; }

/* ---------- Two-column reading layout ---------- */
.lg-wrap { display: grid; grid-template-columns: 250px minmax(0, 720px); justify-content: center; gap: 72px; width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 72px 0 112px; }

/* Table of contents */
.lg-toc { position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 120px); overflow-y: auto; padding-right: 4px; }
.lg-toc-h { margin-bottom: 12px !important; font-size: 12.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); }
.lg-toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.lg-toc a { position: relative; display: flex; gap: 10px; padding: 7px 0 7px 16px; font-size: 14px; line-height: 1.4; color: #78716C; transition: color .2s ease; }
.lg-toc a::before { content: ""; position: absolute; left: -1px; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: var(--blue); transform: scaleY(0); transition: transform .25s ease; }
.lg-toc a .n { flex: none; min-width: 18px; font-variant-numeric: tabular-nums; color: #A8A29E; }
.lg-toc a:hover { color: var(--ink); }
.lg-toc a.is-on { color: var(--ink); font-weight: 600; }
.lg-toc a.is-on::before { transform: scaleY(1); }
.lg-toc a.is-on .n { color: var(--blue); }

/* Text column */
.lg-doc { min-width: 0; font-size: 17px; line-height: 1.7; color: #3F3F46; }
.lg-doc section + section { margin-top: 52px; }
.lg-doc h2 { scroll-margin-top: 96px; margin: 0 0 16px; font-size: clamp(22px, 1.8vw, 26px); line-height: 1.3; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.lg-doc h3 { margin: 30px 0 10px; font-size: 18.5px; line-height: 1.4; font-weight: 600; color: var(--ink); }
.lg-doc h2 + h3 { margin-top: 8px; }
.lg-doc p + p, .lg-doc ul + p, .lg-doc table + p, .lg-doc p + ul, .lg-doc p + table { margin-top: 14px; }
.lg-doc strong { font-weight: 600; color: var(--ink); }
.lg-doc a { color: var(--blue); text-decoration: underline; text-decoration-color: rgba(52,97,255,.35); text-underline-offset: 3px; transition: text-decoration-color .2s ease; overflow-wrap: anywhere; }
.lg-doc a:hover { text-decoration-color: currentColor; }
.lg-doc code { padding: 2px 6px; border-radius: 6px; background: var(--grey); font: 500 .86em ui-monospace, 'JetBrains Mono', Menlo, monospace; color: var(--ink); }

/* Lists: small blue dots, nested lists in grey */
.lg-doc ul { display: flex; flex-direction: column; gap: 8px; }
.lg-doc li { position: relative; padding-left: 22px; }
.lg-doc li::before { content: ""; position: absolute; left: 4px; top: .72em; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.lg-doc li ul { margin-top: 8px; }
.lg-doc li li::before { background: #A8A29E; }

/* Tables */
.lg-doc table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; font-size: 15px; line-height: 1.55; }
.lg-doc th { padding: 12px 16px; background: var(--grey); text-align: left; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #78716C; }
.lg-doc td { padding: 13px 16px; vertical-align: top; border-top: 1px solid var(--line); }
.lg-doc td:first-child { font-weight: 500; color: var(--ink); }
.lg-doc th + th, .lg-doc td + td { border-left: 1px solid var(--line); }
.lg-doc h2 + table { margin-top: 4px; }

/* "Questions? Contact us" */
.lg-help { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 64px; padding: 26px 28px; border-radius: 22px; background: #EAF0FF; }
.lg-help div { display: flex; flex-direction: column; gap: 4px; }
.lg-help b { font-size: 19px; font-weight: 600; color: var(--ink); }
.lg-help span { font-size: 15.5px; line-height: 1.5; color: var(--mute); }
.lg-help .pr-btn { flex: none; height: 46px; text-decoration: none; color: #fff !important; }
.lg-help .pr-btn span { color: inherit; }

/* ---------- Narrow screens: contents list above the text ---------- */
@media (max-width: 960px) {
  .lg-wrap { grid-template-columns: minmax(0, 720px); gap: 36px; padding-top: 48px; }
  .lg-toc { position: static; max-height: none; padding: 20px 22px; border-radius: 18px; background: var(--grey); }
  .lg-toc ol { columns: 2; column-gap: 24px; border-left: 0; }
  .lg-toc a { padding-left: 0; break-inside: avoid; }
  .lg-toc a::before { display: none; }
}
@media (max-width: 600px) {
  .lg-hero { padding-bottom: 64px; }
  .lg-toc ol { columns: 1; }
  .lg-doc { font-size: 16.5px; }
  .lg-doc table { display: block; overflow-x: auto; }
  .lg-help { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .lg-toc a::before { transition: none; } }

/* ---------- Phones: the contents list folds into a toggle (built by js/legal-toc.js) ---------- */
.lg-toc-btn { display: none; }
@media (max-width: 600px) {
  .lg-switch a { height: 40px; }
  .lg-toc.has-toggle { padding: 0; }
  .lg-toc.has-toggle .lg-toc-h { display: none; }
  .lg-toc-btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 56px; padding: 0 20px; border: 0; background: none;
    font: 700 12.5px 'Figtree', system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); cursor: pointer; text-align: left; }
  .lg-toc-btn small { margin-left: auto; font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; color: #78716C; }
  .lg-toc-btn svg { flex: none; width: 18px; height: 18px; color: #78716C; transition: transform .25s ease; }
  .lg-toc.is-open .lg-toc-btn svg { transform: rotate(180deg); }
  .lg-toc.has-toggle ol { display: none; padding: 0 20px 14px; }
  .lg-toc.has-toggle.is-open ol { display: block; }
  .lg-toc a { padding-top: 10px; padding-bottom: 10px; font-size: 15px; }
  .lg-doc h2 { scroll-margin-top: 24px; }
  .lg-help .pr-btn { width: 100%; justify-content: center; }
}
@media (max-width: 600px) and (prefers-reduced-motion: reduce) { .lg-toc-btn svg { transition: none; } }
