/*
  Help family layout: support, privacy, terms and account deletion.
  Layout only. Colours, type and components come from /assets/grainwork.css.
*/

/* ---------- Support ---------- */

.help-hero { padding-bottom: clamp(32px, 4vw, 48px); }
.help-hero .lede { margin-top: 20px; }

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}
.jump a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-control);
  border-radius: 999px;
  color: var(--ink);
  font-size: var(--text-small);
  font-weight: 500;
  text-decoration: none;
  background: var(--paper-raised);
}
.jump a:hover { border-color: var(--accent); color: var(--accent); }

.help-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 20rem);
  gap: clamp(40px, 6vw, 88px);
  align-items: start;
  padding-bottom: var(--section);
}

.help-section { scroll-margin-top: calc(var(--header-height) + 16px); }
.help-section + .help-section { margin-top: clamp(64px, 8vw, 104px); }
.help-section__head { max-width: var(--max-text); margin-bottom: 20px; }
.help-section__head h2 { font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem); }
.help-section__head p { margin-top: 12px; color: var(--muted); }

.help-group {
  margin: 36px 0 4px;
  font: 600 var(--text-eyebrow)/1.3 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  scroll-margin-top: calc(var(--header-height) + 16px);
}
.help-group + .faq { border-top-color: var(--line-strong); }

.help-main .faq details > div p + p,
.help-main .faq details > div p + ul,
.help-main .faq details > div ul + p { margin-top: 0.9em; }
.help-main .faq details > div ul { padding-left: 1.3em; }
.help-main .faq details > div .actions { margin-top: 16px; }
.help-main .faq details > div .actions + .contact-line { margin-top: 8px; }
.help-main .text-link { min-height: 44px; }
.help-main .faq .note { margin-top: 16px; }

.help-aside {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  scroll-margin-top: calc(var(--header-height) + 16px);
}
.help-aside .card h2 { font-size: clamp(1.5rem, 1.3rem + 0.6vw, 1.75rem); }
.help-aside .card .button { width: 100%; }

@media (max-width: 900px) {
  .help-layout { grid-template-columns: minmax(0, 1fr); }
  .help-aside { position: static; }
}

/* ---------- Legal documents ---------- */

.legal-head {
  padding: clamp(48px, 7vw, 88px) 0 clamp(24px, 3vw, 32px);
}
.legal-head h1 { max-width: 20ch; }
.legal-head .updated { margin-top: 14px; color: var(--faint); font-size: var(--text-small); }

.legal-body {
  display: grid;
  grid-template-columns: minmax(0, 16.5rem) minmax(0, 68ch);
  gap: clamp(40px, 6vw, 80px);
  align-items: start;
  padding-bottom: var(--section);
}
/* Table of contents: a fixed list on wide screens, a closed panel on phones
   (help.js opens or closes it by width; without the script it stays open). */
.legal-toc { margin: 0; padding: 16px 20px; }
.legal-toc summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  list-style: none;
  cursor: pointer;
}
.legal-toc summary::-webkit-details-marker { display: none; }
.legal-toc summary strong { margin: 0; }
.legal-toc__count { font-size: var(--text-caption); color: var(--faint); }
.legal-toc ol { columns: 1; margin-top: 4px; padding: 0; list-style: none; }
.legal-toc li { margin: 0; }
.legal-toc li a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 0;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.35;
}
.legal-toc li a:hover { color: var(--accent); text-decoration: underline; }
.legal-toc li a[aria-current] { color: var(--accent); font-weight: 600; }

@media (min-width: 1001px) {
  .legal-toc summary { cursor: default; }
  .legal-toc__count { display: none; }
  .legal-toc li a { padding: 4px 0; font-size: var(--text-caption); line-height: 1.3; }
}
/* Stay in view while reading only when the whole list fits the window. */
@media (min-width: 1001px) and (min-height: 740px) {
  .legal-toc:not(.legal-toc--long) { position: sticky; top: calc(var(--header-height) + 24px); }
}
@media (min-width: 1001px) and (min-height: 900px) {
  .legal-toc--long { position: sticky; top: calc(var(--header-height) + 24px); }
}

.back-to-top { display: none; }
/* Where the long list cannot stay in view, offer the way back to it instead. */
@media (min-width: 1001px) and (max-height: 899px) {
  .legal-toc--long ~ .prose .back-to-top { display: block; margin-top: 0.75em; font-size: var(--text-small); }
  .legal-toc--long ~ .prose .back-to-top + h2 { margin-top: 1.4em; }
  .legal-toc--long ~ .prose .back-to-top a { display: inline-flex; align-items: center; min-height: 44px; }
}

.legal .prose { max-width: 68ch; }
.legal .prose > :first-child { margin-top: 0; }
.legal .prose h2 { scroll-margin-top: calc(var(--header-height) + 16px); }
.legal .prose p { color: var(--ink); }
.legal .prose p + p,
.legal .prose ul + p,
.legal .prose p + ul { margin-top: 1em; }
.legal .prose .intro { font-size: var(--text-lede); line-height: 1.55; color: var(--muted); }

/* Long runs of bold-lead paragraphs read as a list of labeled items. */
.legal .prose .lead-list > p > strong:first-child {
  display: block;
  margin-bottom: 4px;
  color: var(--heading);
}
.legal .prose .lead-list > p + p {
  margin-top: 0;
  padding-top: 18px;
  margin-bottom: 0;
}
.legal .prose .lead-list > p { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.legal .prose .lead-list > p:last-child { border-bottom: 0; }

@media (max-width: 1000px) {
  .legal-body { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .legal-toc { padding: 4px 20px; }
  .legal-toc details[open] { padding-bottom: 12px; }
  .legal-toc summary::after { content: "+"; margin-left: auto; font: 400 1.5rem/1 var(--sans); color: var(--accent); }
  .legal-toc details[open] summary::after { content: "\2212"; }
  .legal-toc ol { columns: 2 14rem; column-gap: 32px; }
  .legal-toc li { break-inside: avoid; }
  .legal .prose .back-to-top { display: block; margin-top: 0.75em; font-size: var(--text-small); }
  .legal .prose .back-to-top + h2 { margin-top: 1em; }
  .back-to-top a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* Single-column help document (account deletion) */
.legal-doc {
  max-width: calc(68ch + 2 * var(--gutter));
  padding-bottom: var(--section);
}
.legal-doc .prose h2:first-of-type { margin-top: 1.4em; }
.legal-doc .request { margin: 24px 0; }
.legal-doc .request .contact-line { margin-top: 10px; }

/* "Opens your email app" line under every email button */
.contact-line { font-size: var(--text-caption); line-height: 1.5; color: var(--faint); }
.contact-line a { color: var(--accent); }

.help-demo-link { margin-top: 12px; }
