/* Help pages: menu left, article middle, "On this page" right.
   Builds on landing.css (tokens, header, footer, buttons). */

.help-body {
  --header-h: 68px;
  --side-w: 272px;
  --toc-w: 208px;
  --accent: linear-gradient(180deg, var(--gold-soft), var(--violet-soft) 55%, var(--blue-soft));
  padding-top: var(--header-h);
}
.help-body section { padding: 0; }
/* the header lines up with the wider help layout */
.help-body .site-header .wrap { max-width: 1320px; }
.help-nav-home[aria-current="page"] { color: var(--ink); font-weight: 600; }

.help-layout {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr) var(--toc-w);
  gap: 48px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: calc(100vh - var(--header-h));
}
.help-layout.is-home { grid-template-columns: var(--side-w) minmax(0, 1fr); }

/* ── menu ─────────────────────────────────────────────── */
.help-side {
  position: sticky;
  top: var(--header-h);
  align-self: start;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px 8px 40px 0;
  font-size: 15px;
}
.help-search {
  position: relative;
  display: flex;
  align-items: center;
}
.help-search-icon {
  position: absolute;
  left: 12px;
  color: var(--ink-3);
  pointer-events: none;
}
.help-search input {
  width: 100%;
  height: 40px;
  padding: 0 52px 0 36px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  -webkit-appearance: none;
  appearance: none;
}
.help-search input::-webkit-search-cancel-button { display: none; }
.help-search input::placeholder { color: var(--ink-3); }
.help-search input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(236, 160, 245, 0.28);
}
.help-kbd {
  position: absolute;
  right: 10px;
  font: 600 11px/1 var(--mono);
  color: var(--ink-3);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 4px 6px;
  pointer-events: none;
}
.help-search input:focus ~ .help-kbd { display: none; }

.help-menu { margin-top: 22px; }
.help-menu-sec + .help-menu-sec { margin-top: 4px; }
.help-menu-sec summary {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  cursor: pointer;
  padding: 7px 10px;
  border-radius: 10px;
  font-weight: 700;
  color: var(--ink);
}
.help-menu-sec summary::-webkit-details-marker { display: none; }
.help-menu-sec summary::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(-45deg);
  margin: 0 4px 0 2px;
  transition: transform var(--t-fast) var(--ease-spring);
}
.help-menu-sec[open] summary::before { transform: rotate(45deg); }
.help-menu-sec summary:hover { background: var(--bg-soft); }
.help-menu-sec summary a { flex: 1; }
.help-menu-sec ul {
  list-style: none;
  margin: 2px 0 10px 17px;
  border-left: 1px solid var(--line-strong);
}
.help-menu-sec li a {
  position: relative;
  display: block;
  padding: 6px 12px 6px 16px;
  color: var(--ink-2);
  line-height: 1.4;
  transition: color var(--t-fast);
}
.help-menu-sec li a:hover { color: var(--ink); }
.help-menu a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.help-menu-sec li a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

/* ── search results ───────────────────────────────────── */
.help-results {
  list-style: none;
  margin-top: 10px;
}
.help-results a, .help-results .empty {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  line-height: 1.35;
}
.help-results a b { display: block; font-weight: 650; color: var(--ink); }
.help-results a small {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-3);
}
.help-results a span {
  display: block;
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.help-results mark { background: rgba(255, 201, 143, 0.55); color: inherit; border-radius: 3px; padding: 0 1px; }
.help-results [aria-selected="true"] a, .help-results a:hover { background: var(--bg-soft); }
.help-results [aria-selected="true"] a { box-shadow: inset 3px 0 0 var(--ink); }
.help-results .empty { color: var(--ink-3); font-size: 14px; }
.help-side.searching .help-menu { display: none; }

/* ── article ──────────────────────────────────────────── */
.help-main { padding: 40px 0 72px; min-width: 0; }
.help-crumbs {
  display: flex;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-3);
  margin-bottom: 14px;
}
.help-crumbs a:hover { color: var(--ink); }
.help-main h1 {
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-size: clamp(2rem, 3.6vw, 2.75rem);
  text-wrap: balance;
}
.help-lead {
  margin-top: 14px;
  font-size: 19px;
  color: var(--ink-2);
  max-width: 680px;
}
.help-article { max-width: 720px; }
.help-article h2 {
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 44px 0 12px;
  max-width: none;
}
.help-article h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 30px 0 8px;
}
.help-article h2, .help-article h3 { scroll-margin-top: calc(var(--header-h) + 20px); }
.help-article p, .help-article ul, .help-article ol, .help-article pre,
.help-article table, .help-article blockquote { margin-top: 14px; }
.help-article ul, .help-article ol { padding-left: 1.4em; }
.help-article li + li { margin-top: 6px; }
.help-article li > ul, .help-article li > ol { margin-top: 6px; }
.help-article a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--violet-soft);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--t-fast);
}
.help-article a:hover { text-decoration-color: var(--ink); }
.help-article strong { font-weight: 700; }
.help-article pre {
  background: var(--pill-dark);
  color: #ece8f7;
  border-radius: 14px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
}
.help-article pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.help-article blockquote {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--bg-soft);
  border-left: 3px solid var(--violet-soft);
  color: var(--ink-2);
}
.help-article blockquote > :first-child { margin-top: 0; }
.help-article table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 15px;
}
.help-article th, .help-article td {
  text-align: left;
  vertical-align: top;
  padding: 8px 14px 8px 0;
  border-bottom: 1px solid var(--line);
}
.help-article th { font-weight: 700; border-bottom-color: var(--line-strong); }
.help-article hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }

.help-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 720px;
  margin-top: 56px;
}
.help-pager a {
  display: block;
  padding: 14px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.help-pager a:hover { border-color: var(--ink); box-shadow: var(--shadow-sm); }
.help-pager small { display: block; font-size: 13px; color: var(--ink-3); }
.help-pager span { font-weight: 650; }
.help-pager .next { grid-column: 2; text-align: right; }

/* ── on this page ─────────────────────────────────────── */
.help-toc {
  position: sticky;
  top: var(--header-h);
  align-self: start;
  padding: 44px 0 40px;
  font-size: 14px;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.help-toc p {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.help-toc ul { list-style: none; }
.help-toc li a {
  display: block;
  padding: 4px 0;
  line-height: 1.4;
  color: var(--ink-2);
  transition: color var(--t-fast);
}
.help-toc li.l3 a { padding-left: 14px; font-size: 13.5px; }
.help-toc a:hover, .help-toc a.active { color: var(--ink); }
.help-toc a.active { font-weight: 600; }

/* ── home and section pages ───────────────────────────── */
.help-hero {
  position: relative;
  padding: 56px 40px 44px !important;
  margin-top: 8px;
  border-radius: 28px;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg-soft);
}
.help-hero::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto auto;
  width: 70%;
  aspect-ratio: 1;
  z-index: -1;
  background:
    radial-gradient(closest-side, rgba(255, 201, 143, 0.75), transparent 70%) 0 30% / 60% 60% no-repeat,
    radial-gradient(closest-side, rgba(236, 160, 245, 0.6), transparent 70%) 45% 10% / 60% 60% no-repeat,
    radial-gradient(closest-side, rgba(169, 199, 255, 0.7), transparent 70%) 80% 45% / 60% 60% no-repeat;
  filter: blur(10px);
}
.help-hero p { margin-top: 12px; color: var(--ink-2); max-width: 520px; }
.help-search-lg { margin-top: 26px; max-width: 560px; }
.help-search-lg .help-search-icon { left: 16px; }
.help-search-lg input { height: 54px; padding-left: 46px; font-size: 17px; border-radius: 16px; }
.help-results-lg {
  max-width: 560px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 6px;
  box-shadow: var(--shadow-md);
}

.help-sections {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 32px;
}
.help-sec-card {
  padding: 22px 22px 18px !important;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.help-sec-card h2 { font-size: 1.15rem; letter-spacing: -0.01em; line-height: 1.3; }
.help-sec-card h2 a:hover { text-decoration: underline; text-decoration-color: var(--violet-soft); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.help-sec-card ul { list-style: none; margin-top: 10px; }
.help-sec-card li a {
  display: block;
  padding: 4px 0;
  font-size: 15px;
  color: var(--ink-2);
}
.help-sec-card li a:hover { color: var(--ink); }

.help-cards {
  list-style: none;
  display: grid;
  gap: 12px;
  margin-top: 26px;
  max-width: 720px;
}
.help-cards a {
  display: block;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.help-cards a:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.help-cards b { display: block; font-weight: 700; }
.help-cards span { display: block; margin-top: 4px; color: var(--ink-2); font-size: 15px; }

/* ── narrow screens ───────────────────────────────────── */
.help-mobilebar, .help-scrim { display: none; }

@media (max-width: 1180px) {
  .help-layout { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .help-toc { display: none; }
}

@media (max-width: 860px) {
  .help-layout, .help-layout.is-home { display: block; padding: 0 16px; }
  .help-mobilebar {
    position: sticky;
    top: var(--header-h);
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(253, 252, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    font-size: 15px;
  }
  .help-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    cursor: pointer;
  }
  .help-mobilebar-where {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink-3);
  }
  .help-side {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    width: min(320px, 86vw);
    max-height: none;
    align-self: stretch; /* fixed boxes honour align-self; start would cut the drawer short */
    padding: 20px 16px 40px;
    background: var(--bg);
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    transition: transform var(--t-med) var(--ease-spring);
  }
  .help-body.menu-open .help-side { transform: none; }
  .help-body.menu-open { overflow: hidden; }
  .help-scrim {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(25, 19, 49, 0.32);
  }
  .help-body.menu-open .help-scrim { display: block; }
  .help-kbd { display: none; }
  .help-main { padding-top: 24px; }
  .help-hero { padding: 36px 20px 28px !important; border-radius: 22px; }
  .help-pager { grid-template-columns: 1fr; }
  .help-pager .next { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .help-side, .help-menu-sec summary::before { transition: none; }
}
