/* NutHouse help centre: the docs shell and article components. Tokens come from site.css. */
:root { --help-side: 250px; --help-toc: 210px; --help-nav-h: 76px; }

.help-shell { display: grid; grid-template-columns: var(--help-side) minmax(0, 1fr); gap: 2.5rem; max-width: 1240px; margin: 0 auto; padding: 1.5rem var(--gutter) 4rem; align-items: start; }
.help-shell.has-toc { grid-template-columns: var(--help-side) minmax(0, 1fr) var(--help-toc); }
.help-shell > * { min-width: 0; }
.help-main { max-width: 78ch; }
.help-main > :first-child { margin-top: 0; }

/* Sidebar */
.help-sidebar { position: sticky; top: calc(var(--help-nav-h) + 1rem); max-height: calc(100vh - var(--help-nav-h) - 2rem); overflow-y: auto; padding-right: 0.5rem; }
.help-sidebar ul { list-style: none; margin: 0.8rem 0 0; padding: 0; display: grid; gap: 0.1rem; }
.help-sidebar a { display: flex; align-items: center; gap: 0.55rem; padding: 0.4rem 0.6rem; border-radius: var(--pill); color: var(--fg); font-weight: 600; font-size: 0.93rem; line-height: 1.25; }
.help-sidebar a .ico { width: 1.4em; text-align: center; flex: none; font-size: 1.05em; }
.help-sidebar a small { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 0.78rem; }
.help-sidebar a:hover { background: var(--accent-soft); text-decoration: none; }
.help-sidebar a.active { background: var(--accent); color: #fff; }
.help-sidebar a.active small { color: rgb(255 255 255 / 0.75); }
.help-topics-toggle { display: none; }

/* Search */
.help-search { position: relative; display: flex; gap: 0.5rem; }
.help-search input { flex: 1; min-width: 0; padding: 0.6rem 0.9rem; border: 1px solid var(--line); border-radius: var(--pill); background: var(--panel); color: var(--fg); font: inherit; font-size: 0.95rem; }
.help-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.help-search.big input { padding: 0.9rem 1.2rem; font-size: 1.05rem; }
.help-search-results { position: absolute; top: calc(100% + 0.4rem); left: 0; right: 0; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); overflow: hidden; }
.help-search-results a { display: grid; padding: 0.55rem 0.9rem; border-top: 1px solid var(--line); color: var(--fg); }
.help-search-results a:first-child { border-top: 0; }
.help-search-results a:hover, .help-search-results a.sel { background: var(--accent-soft); text-decoration: none; }
.help-search-results a b { font-weight: 600; }
.help-search-results a span { font-size: 0.8rem; color: var(--muted); }
.help-search-results p { margin: 0; padding: 0.7rem 0.9rem; font-size: 0.9rem; color: var(--muted); }

/* Home */
.help-hero { position: relative; padding: 2rem 2.2rem; border-radius: var(--radius-xl); background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--panel); border: 1px solid var(--line); overflow: hidden; }
.help-hero h1 { margin: 0.2rem 0 0.4rem; font-size: clamp(2rem, 4.5vw, 3rem); }
.help-hero .lead { max-width: 52ch; }
.help-hero .help-search { max-width: 560px; margin-top: 1.2rem; }
.help-hero-mascot { position: absolute; right: 1rem; bottom: -0.6rem; width: 170px; height: auto; pointer-events: none; }
.start-here { margin: 1.6rem 0; }
.start-here .label { margin: 0 0 0.5rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.start-here .links { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.start-here .links a { padding: 0.4rem 0.8rem; border: 1px solid var(--line); border-radius: var(--pill); background: var(--panel); color: var(--fg); font-weight: 600; font-size: 0.9rem; }
.start-here .links a:hover { border-color: var(--accent); text-decoration: none; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.9rem; }
.cat-card { display: grid; gap: 0.3rem; padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); color: var(--fg); transition: transform 0.15s, box-shadow 0.15s; }
.cat-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-card); border-color: var(--accent); }
.cat-card .ico { font-size: 1.7rem; line-height: 1; }
.cat-card h2 { margin: 0.2rem 0 0; font-size: 1.1rem; }
.cat-card p { margin: 0; font-size: 0.9rem; color: var(--muted); }
.cat-card small { margin-top: 0.3rem; font-size: 0.78rem; font-weight: 600; color: var(--accent); }

/* Category + lists */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0 0 1rem; font-size: 0.88rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs i { font-style: normal; opacity: 0.6; }
.cat-title { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.4rem; }
.cat-title .ico { font-size: 1.2em; }
.lede, .help-article .lede { font-size: 1.15rem; color: var(--muted); max-width: 60ch; margin: 0.3rem 0 1.4rem; }
.article-list { list-style: none; margin: 1.2rem 0; padding: 0; counter-reset: art; }
.article-list li + li { border-top: 1px solid var(--line); }
.article-list a { display: grid; gap: 0.15rem; padding: 0.8rem 0.6rem 0.8rem 0; color: var(--fg); }
.article-list a:hover { text-decoration: none; }
.article-list a:hover b { color: var(--accent); }
.article-list a b { font-size: 1.05rem; }
.article-list a span { font-size: 0.9rem; color: var(--muted); }

/* Article body */
.help-article h1 { margin: 0 0 0.3rem; font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.1; }
.help-article h2 { margin: 2.2rem 0 0.7rem; font-size: 1.45rem; scroll-margin-top: calc(var(--help-nav-h) + 1rem); }
.help-article h3 { margin: 1.5rem 0 0.5rem; font-size: 1.1rem; }
.help-article p, .help-article li { font-size: 1.02rem; line-height: 1.6; }
.help-article ul, .help-article ol:not(.steps) { padding-left: 1.3rem; }
.help-article li + li { margin-top: 0.3rem; }
.help-article b, .help-article strong { font-weight: 700; }
.help-article kbd { display: inline-block; padding: 0.05em 0.45em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--panel); font: 600 0.85em/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.help-article code { padding: 0.1em 0.4em; border-radius: 6px; background: var(--accent-soft); font-size: 0.9em; }
.help-article img.pixel { image-rendering: pixelated; }

.steps { list-style: none; counter-reset: step; margin: 1rem 0; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding: 0.7rem 0 0.7rem 2.9rem; border-bottom: 1px solid var(--line); margin: 0; }
.steps > li:last-child { border-bottom: 0; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0.65rem; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: var(--coin, #ffec27); color: #1b2340; font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; }

.settings { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.95rem; }
.settings th, .settings td { padding: 0.55rem 0.7rem; border-top: 1px solid var(--line); vertical-align: top; text-align: left; }
.settings th { width: 32%; font-weight: 700; white-space: normal; }
.settings tr:first-child th, .settings tr:first-child td { border-top: 0; }
table.ref { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.92rem; }
table.ref th, table.ref td { padding: 0.6rem 0.6rem; border-top: 1px solid var(--line); vertical-align: top; text-align: left; }
table.ref thead th { border-top: 0; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
table.ref td:first-child { width: 28%; }
table.ref td:last-child { width: 30%; color: var(--muted); }
table.ref tr:target { background: var(--accent-soft); }
.trigmark { display: inline-block; margin-left: 0.3rem; padding: 0 0.4em; border-radius: var(--pill); background: var(--trigger, #e53950); color: #fff; font-size: 0.7rem; font-weight: 700; vertical-align: middle; }
.refchip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15em 0.6em; border: 1px solid var(--line); border-radius: var(--pill); background: var(--panel); font-size: 0.9em; font-weight: 600; cursor: help; }
.refchip .dot { width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--play, #1f9d55); }
.refchip.advanced .dot { background: var(--spot, #29adff); }
.refchip.expert .dot { background: var(--leaf-2, #5cb85f); }
.refchip.trig { border-color: var(--trigger, #e53950); }
.chip.missing { background: var(--danger, #c62828); color: #fff; }

.callout { display: flex; gap: 0.8rem; margin: 1.3rem 0; padding: 0.9rem 1rem; border-radius: var(--radius-lg); border: 1px solid var(--line); border-left-width: 4px; background: var(--panel); }
.callout .callout-icon { font-size: 1.3rem; line-height: 1.3; flex: none; }
.callout > div { font-size: 0.98rem; line-height: 1.55; }
.callout .callout-label { margin-right: 0.2em; }
.callout.tip { border-left-color: var(--coin, #ffec27); }
.callout.note { border-left-color: var(--spot, #29adff); }
.callout.try { border-left-color: var(--play, #1f9d55); }
.callout.watch { border-left-color: var(--trigger, #e53950); }
.callout.grownups { border-left-color: var(--bark, #8d6e4d); }

.shot { margin: 1.3rem 0; }
.shot.wide { margin-inline: -1rem; }
.shot .mac-window { box-shadow: var(--shadow-card); }
.shot img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.shot figcaption { margin-top: 0.5rem; font-size: 0.88rem; color: var(--muted); }
.shot-pending { display: grid; place-items: center; gap: 0.3rem; aspect-ratio: 16 / 10; padding: 1rem; text-align: center; background: repeating-linear-gradient(45deg, transparent 0 14px, rgb(0 0 0 / 0.035) 14px 28px), var(--bg); color: var(--muted); }
.shot-pending span { font-weight: 700; }
.shot-pending small { max-width: 40ch; font-size: 0.8rem; }

.help-rule { margin: 1.2rem 0; }
.help-rule .tok.trig { border-color: var(--trigger, #e53950); }

.related { margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.related h2 { margin: 0 0 0.6rem; font-size: 1.1rem; }
.related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.related li { display: grid; gap: 0.1rem; }
.related li a { font-weight: 600; }
.related li span { font-size: 0.85rem; color: var(--muted); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin: 2rem 0 0; }
.pager a { display: grid; gap: 0.15rem; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); color: var(--fg); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager a small { font-size: 0.78rem; color: var(--muted); }
.pager a.next { text-align: right; }

.stuck { display: flex; align-items: center; gap: 1.2rem; margin-top: 2.5rem; padding: 1.2rem 1.4rem; border-radius: var(--radius-xl); background: var(--accent-soft); }
.stuck img { width: 96px; height: 96px; flex: none; }
.stuck h2 { margin: 0 0 0.2rem; font-size: 1.2rem; }
.stuck p { margin: 0; font-size: 0.95rem; }

/* Right-hand TOC */
.help-toc { position: sticky; top: calc(var(--help-nav-h) + 1rem); font-size: 0.86rem; }
.help-toc p { margin: 0 0 0.4rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.72rem; color: var(--muted); }
.help-toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.help-toc a { display: block; padding: 0.25rem 0 0.25rem 0.8rem; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); }
.help-toc a:hover { color: var(--fg); text-decoration: none; }
.help-toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

/* Generated pages */
.sprite-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.6rem; margin: 0.8rem 0 1.4rem; }
.sprite-strip figure { margin: 0; text-align: center; font-size: 0.78rem; }
.sprite-strip .pic { display: grid; place-items: center; height: 64px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.sprite-strip img { max-height: 48px; width: auto; }
.tut-steps { counter-reset: t; list-style: none; padding: 0; }
.tut-steps > li { counter-increment: t; padding: 1rem 0; border-top: 1px solid var(--line); }
.tut-steps h3 { margin: 0 0 0.3rem; }
.tut-steps h3::before { content: counter(t) ". "; color: var(--accent); }
.tut-steps .hint { font-size: 0.92rem; color: var(--muted); }

@media (max-width: 1199px) {
  .help-shell.has-toc { grid-template-columns: var(--help-side) minmax(0, 1fr); }
  .help-toc { display: none; }
}
@media (max-width: 900px) {
  :root { --help-nav-h: 76px; }
  .help-shell, .help-shell.has-toc { grid-template-columns: 1fr; gap: 1rem; }
  .help-topics-toggle { display: inline-block; justify-self: start; padding: 0.45rem 0.9rem; border: 1px solid var(--line); border-radius: var(--pill); background: var(--panel); color: var(--fg); font: inherit; font-weight: 600; cursor: pointer; }
  .help-sidebar { display: none; position: static; max-height: none; padding: 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); }
  .help-sidebar.open { display: block; }
  .help-sidebar ul { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .help-hero { padding: 1.4rem 1.2rem 1.6rem; }
  .help-hero-mascot { display: none; }
  .pager { grid-template-columns: 1fr; }
  .pager a.next { text-align: left; }
  .stuck { flex-direction: column; align-items: flex-start; }
  .settings th { width: 40%; }
  table.ref { display: block; overflow-x: auto; }
  .shot.wide { margin-inline: 0; }
}
