/*
  Help page (/hilfe, /help): page-specific styles only. Loaded after styles.css and motion.css on this page only
  (scripts/build.mjs › SUBPAGES). Shared subpage building blocks (page-hero variants, .card, .chip,
  .badge, .pill-status, .callout, .window, .side-layout, .side-nav …) live in styles.css; reuse them.
  Rules: the two literal breakpoints (max-width: 960px / 640px); every hidden start state scoped to
  html.motion (".motion .x") or a JS-only state attribute; animate transform/opacity only.

  Structure (scripts/pages/help.mjs): centred hero with search · four topic cards · side-layout with the
  sticky topic nav and the sections (glance figure + accordion) · empty state · contact card.
*/

/* Hero search. 56px pill, 16px text (no iOS zoom on focus), icon left, clear button right. */
.help-search { position: relative; width: 100%; max-width: 560px; margin-top: var(--space-6); }
.help-search > .icon { position: absolute; left: 20px; top: 50%; margin-top: -10px; color: var(--ink-2); pointer-events: none; }
.help-search input { display: block; width: 100%; height: 56px; margin: 0; padding: 0 56px 0 52px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); font: 400 var(--fs-body)/1.4 var(--font); -webkit-appearance: none; appearance: none; transition: border-color var(--dur-ui, 240ms) var(--ease-standard, ease); }
/* No clear button yet: the placeholder may use the right padding too. */
.help-search:has(.help-search-clear[hidden]) input { padding-right: 20px; }
.help-search input::placeholder { color: var(--muted); opacity: 1; }
.help-search input { text-overflow: ellipsis; }
.help-search input:hover { border-color: #ffffff52; }
.help-search input:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.help-search input::-webkit-search-cancel-button, .help-search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.help-search-clear { position: absolute; right: 6px; top: 6px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); }
.help-search-clear:hover { color: var(--ink); background: var(--surface-hover); }
.help-search-clear:focus-visible { outline-offset: 0; }
/* The result line keeps its height, so typing never moves the page. */
.page-hero .help-count { min-height: 20px; margin-top: var(--space-3); font-size: var(--fs-meta); line-height: 20px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* No scripting: no search (the page lists every question). Decided at first paint. */
@media (scripting: none) {
  .help-search { display: none; }
  .page-hero .help-count { margin-top: var(--space-5); }
}

/* Topic cards: icon, title, one line, count + arrow. Equal heights; the count sits on the bottom edge. */
.help-topics { padding-top: 0; }
.help-topic-grid { list-style: none; margin: 0; padding: 0; }
.help-topic { display: flex; flex-direction: column; align-items: flex-start; padding: var(--space-5); }
.help-topic .icon-tile { margin-bottom: var(--space-5); }
.help-topic h3 a { color: var(--ink); }
.help-topic .help-topic-text { margin-top: var(--space-2); font-size: var(--fs-ui); line-height: var(--lh-ui); color: var(--ink-2); }
.help-topic-meta { display: flex; align-items: center; justify-content: space-between; align-self: stretch; margin-top: auto; padding-top: var(--space-5); font-size: var(--fs-meta); line-height: 1.4; color: var(--muted); font-variant-numeric: tabular-nums; }
.help-topic:hover .icon-tile { color: var(--ink); }
.help-topic .icon-tile { transition: color var(--dur-ui, 240ms) var(--ease-standard, ease); }
/* While searching: topics without a match step back (still links). */
.help-topic[data-empty] { border-color: var(--line); }
.help-topic[data-empty] :is(.icon-tile, h3, .help-topic-text) { opacity: .45; }
.help-topic :is(.icon-tile, h3, .help-topic-text) { transition: opacity var(--dur-ui, 240ms) var(--ease-standard, ease); }

/* While searching the cards shrink to title + count, so the results start right under the search
   (user-initiated layout change; the page is static otherwise). */
main[data-help-searching] .help-topic { padding-block: var(--space-4); }
main[data-help-searching] .help-topic :is(.icon-tile, .help-topic-text) { display: none; }
main[data-help-searching] .help-topic-meta { padding-top: var(--space-1); }
main[data-help-searching] .help-body { padding-top: var(--space-6); }

/* Body: sticky topic nav | sections. */
.help-body > .side-layout { align-items: start; column-gap: clamp(56px, 12vw - 76px, 96px); }
.help-nav { padding-top: 6px; }
.help-nav a[data-empty] { opacity: .45; }
.help-nav-contact { display: grid; margin-top: var(--space-5); padding: var(--space-4) 0 0 var(--space-4); border-top: 1px solid var(--line); font-size: var(--fs-meta); line-height: 1.5; color: var(--muted); }
.help-nav-contact a { display: inline-flex; align-items: center; min-height: var(--touch); padding: 0; color: var(--ink-2); font-size: var(--fs-meta); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.help-nav-contact a::before { display: none; }
.help-nav-contact a:hover { color: var(--ink); }

.help-section + .help-section { margin-top: var(--space-8); }
.help-section > h2 { margin-bottom: var(--space-5); font-size: var(--fs-h3); }
.help-link { margin-top: var(--space-3); }

/* Accordion on this page (spec §4.5): 56px rows, a hover wash that bleeds 12px without moving text. */
.help-main summary { position: relative; isolation: isolate; min-height: 56px; padding-block: 18px; transition: color var(--dur-micro, 160ms) var(--ease-out, ease); }
.help-main summary::before { content: ''; position: absolute; z-index: -1; inset: 1px -12px; border-radius: var(--radius-sm); background: var(--surface-hover); opacity: 0; transition: opacity var(--dur-micro, 160ms) var(--ease-out, ease); }
@media (hover: hover) {
  .help-main summary:hover::before { opacity: 1; }
}
.help-main details > p { color: var(--ink-2); padding-bottom: var(--space-5); }
.help-main details > p a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.help-main details:target > summary, .help-main details[data-hit] > summary { color: var(--ink); }

/* "At a glance" figures: one per section, the facts of the answers below as a small picture. */
.help-glance { margin: 0 0 var(--space-5); padding: var(--space-5); }
.help-glance > figcaption { margin-top: var(--space-4); }
/* Credits: label | two credit dots | value. Filled dot = 1 credit per minute. */
/* Sources: chips. */
.help-sources { list-style: none; margin: 0; padding: 0; }
/* Data: two columns, local | service; dashed chip = conditional (homepage data flow). */
.help-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
.help-split-col + .help-split-col { padding-left: var(--space-5); border-left: 1px solid var(--line); }
.help-split-title { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); font-size: var(--fs-ui); line-height: 1.4; font-weight: 500; color: var(--ink); }
.help-split-title .icon { color: var(--ink-2); }
.help-chip-stack { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }
.help-chip-stack .chip { max-width: 100%; white-space: normal; flex-wrap: wrap; row-gap: 0; }
.help-chip-when { margin-left: 2px; font-size: var(--fs-meta); color: var(--muted); }
/* Assistant: assistant — local connection — BashoClip, then the rules. */
.help-flow { display: grid; grid-template-columns: auto minmax(48px, 1fr) auto; align-items: center; column-gap: var(--space-3); }
.help-flow-node > .icon { color: var(--ink-2); }
.help-flow-node img { width: 16px; height: 16px; }
.help-flow-wire { position: relative; display: flex; justify-content: center; min-width: 0; }
.help-flow-wire::before { content: ''; position: absolute; inset-inline: 0; top: 50%; border-top: 1px solid var(--line-strong); }
.help-flow-wire > span { position: relative; padding-inline: var(--space-2); background: var(--surface); font-size: var(--fs-meta); line-height: 1.4; color: var(--ink-2); text-align: center; }
.help-flow-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-5); }
.help-flow-foot .pill-status { flex: none; }

/* While searching the glance figures step aside; only matching questions remain. */
.help-main[data-searching] :is(.help-glance, .help-link) { display: none; }
.help-main[data-searching] .help-section + .help-section:not([hidden]) { margin-top: var(--space-7); }
/* Results swap with a short opacity fade (user-initiated; nothing slides). */
@keyframes help-swap { from { opacity: 0; } }
.motion .help-main[data-swap] { animation: help-swap var(--dur-micro, 160ms) var(--ease-out-soft, ease); }

/* Empty state and contact card. */
.help-empty, .help-contact { display: grid; grid-template-columns: 48px minmax(0, 1fr); column-gap: var(--space-5); align-items: start; }
.help-empty { margin-bottom: var(--space-7); }
.help-empty p { font-size: var(--fs-ui); line-height: var(--lh-ui); }
.help-empty .help-empty-title { margin-bottom: var(--space-1); font-size: var(--fs-body); font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.help-empty a, .help-contact-copy a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.help-contact { margin-top: var(--space-8); grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; }
.help-contact-copy h2 { font-size: var(--fs-title); line-height: var(--lh-title); font-weight: 600; letter-spacing: var(--tracking-title); }
.help-contact-copy p { margin-top: var(--space-1); font-size: var(--fs-ui); line-height: var(--lh-ui); }
.help-contact .card-actions { grid-column: 2 / -1; margin-top: var(--space-4); }
.help-main[data-searching] .help-contact { margin-top: var(--space-7); }

@media (max-width: 960px) {
  /* The topic cards above already jump to each section; the sticky nav is a desktop aid. */
  .help-nav { display: none; }
  .help-contact { grid-template-columns: 48px minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .help-search input { height: 52px; }
  .help-search-clear { top: 4px; }
  /* Topic cards become compact rows: icon, title + count, arrow. */
  .help-topic-grid { gap: var(--space-2); }
  .help-topic { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: var(--space-4); align-items: center; padding: var(--space-3) var(--space-4); }
  .help-topic .icon-tile { grid-row: 1 / 3; width: 32px; height: 32px; margin: 0; border-radius: 8px; }
  .help-topic .icon-tile .icon { width: 18px; height: 18px; }
  .help-topic h3 { font-size: var(--fs-body); line-height: 1.35; }
  .help-topic .help-topic-text { display: none; }
  .help-topic-meta { display: contents; }
  .help-topic-meta > [data-topic-count] { grid-column: 2; grid-row: 2; font-size: var(--fs-meta); color: var(--muted); }
  .help-topic-meta > .card-arrow { grid-column: 3; grid-row: 1 / 3; }
  /* Phones already show compact rows: keep the icon while searching. */
  main[data-help-searching] .help-topic { padding-block: var(--space-3); }
  main[data-help-searching] .help-topic .icon-tile { display: inline-grid; }
  .help-glance { padding: var(--space-4); }
  .help-split { grid-template-columns: minmax(0, 1fr); }
  .help-chip-stack { flex-flow: row wrap; }
  .help-split-col + .help-split-col { padding: var(--space-4) 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .help-flow { grid-template-columns: minmax(0, 1fr); justify-items: start; row-gap: 0; }
  .help-flow-wire { justify-content: flex-start; min-height: 40px; align-items: center; margin-left: 20px; padding-left: var(--space-4); }
  .help-flow-wire::before { inset: 0 auto 0 0; top: 0; border-top: 0; border-left: 1px solid var(--line-strong); }
  .help-flow-wire > span { padding-inline: 0; background: none; text-align: left; }
  .help-flow-foot { flex-direction: column; }
  .help-empty, .help-contact { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-4); }
  .help-contact .card-actions { grid-column: 1; flex-direction: column; align-items: stretch; margin-top: 0; }
  .help-contact .card-actions .button { width: 100%; }
}
@media not all and (max-width: 640px) { .help-rates .rate-chip { min-width: 150px; } }
