/* ===========================================================================
   wispa · Help center - layout on top of styles.css tokens + tools.css chrome.
   Ink & Wisp: serif (Fraunces) for headings = the human voice; sans (Inter) for
   prose = the finished text; mono (JetBrains) for labels/keys; violet accent for
   links + active state. Dark default, light via [data-theme="light"] tokens.
   =========================================================================== */

/* ----------------------------------------------------------------- hero --- */
.help-hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(40px, 6.5vw, 84px) clamp(40px, 6vw, 76px);
  border-bottom: 1px solid var(--hairline);
}
.help-hero-inner {
  position: relative;
  max-width: 760px;
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 44px);
  text-align: center;
}
.help-h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 4.4vw, 3rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 10px 0 0;
  color: var(--ink);
}
.help-sub {
  margin: 16px auto 0;
  max-width: 620px;
  color: var(--body-c);
  font-size: 1.02rem;
  line-height: 1.6;
}

/* --------------------------------------------------------------- search --- */
.help-search {
  position: relative;
  max-width: 560px;
  margin: 28px auto 0;
  text-align: left;
}
.help-search-ic {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.help-search-input {
  width: 100%;
  height: 52px;
  padding: 0 18px 0 46px;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s, box-shadow 0.18s;
  -webkit-appearance: none;
  appearance: none;
}
.help-search-input::placeholder { color: var(--muted); }
.help-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.help-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* results dropdown */
.help-results {
  position: absolute;
  z-index: 60;
  left: 0; right: 0; top: calc(100% + 8px);
  max-height: min(64vh, 460px);
  overflow-y: auto;
  padding: 6px;
  background: var(--elev);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-pop);
}
.help-res {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "title cat" "sum sum";
  gap: 2px 12px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  text-decoration: none;
  cursor: pointer;
}
.help-res:hover, .help-res.is-active { background: var(--accent-soft); }
.help-res-title {
  grid-area: title;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.94rem;
  color: var(--ink);
}
.help-res-cat {
  grid-area: cat;
  align-self: center;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-text);
}
.help-res-sum {
  grid-area: sum;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.help-res-empty {
  padding: 18px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ----------------------------------------------------------- hub body ----- */
.help-body { padding-block: clamp(40px, 6vw, 76px); }
.help-cat { margin-top: clamp(40px, 5vw, 64px); }
.help-cat:first-child { margin-top: 0; }
.help-cat-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--hairline);
}
.help-cat-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.help-cat-txt h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 2px 0 0;
}
.help-cat-txt p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.help-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 14px;
}
.help-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 20px 20px 18px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  text-decoration: none;
  transition: border-color 0.18s, transform 0.18s, background 0.18s;
}
.help-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
}
.help-card h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  margin: 0;
}
.help-card p {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}
.help-card-read {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--muted-soft);
}

/* --------------------------------------------------------- article page --- */
.help-subhead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--nav-bg-strong);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.help-subhead { top: 53px; } /* sits just under the sticky brand nav */
.help-subhead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 11px;
}
.help-subhead .breadcrumb {
  justify-content: flex-start;
  margin: 0;
  min-width: 0;
  overflow: hidden;
}
.help-subhead .bc-current {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.help-search-sm {
  margin: 0;
  flex: none;
  width: min(280px, 42vw);
}
.help-search-sm .help-search-input {
  height: 38px;
  font-size: 0.9rem;
  padding-left: 40px;
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.help-search-sm .help-search-ic { left: 13px; }

.help-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  padding-block: clamp(36px, 5vw, 60px);
  align-items: start;
}

/* sticky table of contents */
.help-toc {
  position: sticky;
  top: 108px;
  align-self: start;
}
.help-toc-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--muted-soft);
  margin: 0 0 12px;
}
.help-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 1px solid var(--hairline);
}
.help-toc-list a {
  display: block;
  padding: 5px 0 5px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}
.help-toc-list a:hover { color: var(--body-c); }
.help-toc-list a.is-active {
  color: var(--accent-text);
  border-left-color: var(--accent);
}
.help-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
  transition: color 0.15s;
}
.help-back:hover { color: var(--accent-text); }

/* article header */
.help-article { max-width: 760px; min-width: 0; }
.help-art-head { padding-bottom: 26px; margin-bottom: 30px; border-bottom: 1px solid var(--hairline); }
.ha-cat {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent-text);
  text-decoration: none;
}
.ha-cat:hover { text-decoration: underline; text-underline-offset: 3px; }
.ha-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 12px 0 0;
}
.ha-summary {
  margin: 14px 0 0;
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--body-c);
}
.ha-read { margin: 16px 0 0; font-size: 0.72rem; letter-spacing: 0.05em; color: var(--muted-soft); }

/* ------------------------------------------------------------- prose ------ */
.ha-body { font-size: 1rem; line-height: 1.72; color: var(--body-c); }
.ha-body > * { margin: 0; }
.ha-body > * + * { margin-top: 20px; }
.ha-body p { max-width: 68ch; }
.ha-h {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.42rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-top: 40px !important;
  scroll-margin-top: 120px;
}
.ha-body strong { color: var(--ink); font-weight: 650; }
.ha-body a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s;
}
.ha-body a:hover { text-decoration-color: var(--accent); }
.ha-body code {
  font-family: var(--mono);
  font-size: 0.86em;
  padding: 0.12em 0.4em;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--hairline);
}
.ha-body kbd {
  font-family: var(--mono);
  font-size: 0.8em;
  padding: 0.15em 0.5em;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--hairline-strong);
  box-shadow: 0 1px 0 var(--hairline-strong);
  white-space: nowrap;
}
.ha-body ul.ha-list, .ha-body ol.ha-steps { padding-left: 0; max-width: 68ch; list-style: none; }
.ha-body ul.ha-list > li, .ha-body ol.ha-steps > li { position: relative; padding-left: 30px; }
.ha-body ul.ha-list > li + li, .ha-body ol.ha-steps > li + li { margin-top: 11px; }
.ha-body ul.ha-list > li::before {
  content: "";
  position: absolute; left: 8px; top: 0.72em;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
.ha-body ol.ha-steps { counter-reset: step; }
.ha-body ol.ha-steps > li { counter-increment: step; padding-left: 40px; min-height: 26px; }
.ha-body ol.ha-steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0.05em;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 0.8rem; font-weight: 600;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 50%;
}

/* callout */
.ha-note {
  padding: 15px 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}
.ha-note p { margin: 0 !important; max-width: none; font-size: 0.94rem; color: var(--body-c); }
.ha-note-warn {
  border-left-color: var(--voice);
  background: var(--voice-soft);
}

/* table */
.ha-tablewrap { overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--r-lg); }
.ha-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ha-table th, .ha-table td {
  padding: 11px 15px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--hairline);
}
.ha-table thead th {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  white-space: nowrap;
}
.ha-table tbody tr:last-child td { border-bottom: none; }
.ha-table td:first-child { color: var(--ink); font-weight: 550; }

/* code block */
.ha-code {
  overflow-x: auto;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
}
.ha-code code { font-family: var(--mono); font-size: 0.84rem; line-height: 1.6; color: var(--ink); }

/* ------------------------------------------------------- faq + related --- */
.ha-faq, .ha-related { margin-top: clamp(44px, 6vw, 68px); }
.ha-faq h2, .ha-related h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 6px 0 20px;
}
.ha-faq-item { padding: 18px 0; border-top: 1px solid var(--hairline); }
.ha-faq-item:last-child { border-bottom: 1px solid var(--hairline); }
.ha-faq-q { font-family: var(--serif); font-weight: 500; font-size: 1.06rem; color: var(--ink); margin: 0 0 7px; }
.ha-faq-a { margin: 0; color: var(--body-c); font-size: 0.96rem; line-height: 1.6; }
.ha-faq-a a { color: var(--accent-text); text-underline-offset: 2px; }

.help-rels { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.help-rel {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
  text-decoration: none;
  transition: border-color 0.18s, background 0.18s;
}
.help-rel:hover { border-color: var(--accent); background: color-mix(in srgb, var(--surface) 74%, transparent); }
.help-rel h3 { font-family: var(--sans); font-weight: 600; font-size: 0.95rem; color: var(--ink); margin: 0; }
.help-rel p { margin: 5px 0 0; color: var(--muted); font-size: 0.84rem; line-height: 1.45; }

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 900px) {
  .help-layout { grid-template-columns: 1fr; gap: 0; }
  .help-toc {
    position: static;
    order: 2;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--hairline);
  }
  .help-toc-list { border-left: none; }
  .help-toc-list a { border-left: none; padding-left: 0; }
  .help-toc-list a.is-active { border-left: none; }
  .help-back { margin-top: 16px; }
  .help-article { order: 1; max-width: none; }
}
@media (max-width: 600px) {
  .help-subhead-inner { flex-direction: column; align-items: stretch; gap: 9px; }
  .help-search-sm { width: 100%; }
  .help-subhead { top: 0; position: static; }
}

@media (prefers-reduced-motion: no-preference) {
  .help-card, .help-rel { will-change: transform; }
}
