/* =================================================================
   THE HELP DIALOG (docs/claude/USER-GUIDES.md) - the "?" button and the page guide it opens. Every class here is
   help-* (or .wf-help-btn) and is owned by this file alone; every colour is a --wf-* / --theme-* token, so the dialog
   follows the tenant's theme and dark mode with no rule of its own. The box is the house wf-modal (wf.css: the float
   surface, radius xl, elevation 3, the --wf-scrim backdrop with its blur); this file only makes it WIDE (about
   960px), gives it a reading measure, and on a phone makes it the whole screen with its own scroll.
   ================================================================= */
/* @tokens-only */

/* The "?" in its four hosts takes the host's icon-button look (wf-shell-iconbtn / conv-icon-btn); while its guide is
   open it reads as pressed. */
.wf-help-btn.is-on { background: var(--wf-primary-soft); color: var(--wf-primary-ink); }

.help-backdrop { padding: 2.5rem 1rem; }

.help-dialog {
    max-width: 960px;
    max-height: calc(100vh - 5rem);
    overflow: hidden;
}

.help-dialog:focus { outline: none; }

/* The head: the page's title on the left, Print / Open in User Guides / Close on the right. Not the old slab - the
   same hairline-and-sheet look as the page header. */
.help-head {
    display: flex;
    flex: none;
    align-items: center;
    gap: var(--wf-space-3);
    padding: var(--wf-space-4) var(--wf-space-5);
    border-bottom: 1px solid var(--wf-line);
    background: var(--theme-background-float);
    border-radius: var(--wf-radius-xl) var(--wf-radius-xl) 0 0;
}

.help-head-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--wf-radius-tile);
    background: var(--wf-primary-soft);
    color: var(--wf-primary-ink);
    font-size: 20px;
}

.help-head-text { flex: 1; min-width: 0; }

.help-kicker {
    margin: 0;
    color: var(--theme-text-muted);
    font-size: var(--wf-text-xs);
    font-weight: 600;
}

.help-title {
    margin: 0;
    overflow: hidden;
    color: var(--theme-text-emphasis);
    font-size: var(--wf-text-h2);
    font-weight: 650;
    line-height: 1.25;
    letter-spacing: -0.012em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.help-head-actions { display: flex; flex: none; align-items: center; gap: var(--wf-space-2); }

.help-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: var(--wf-space-5) var(--wf-space-6) var(--wf-space-7);
    background: var(--theme-background-float);
    border-radius: 0 0 var(--wf-radius-xl) var(--wf-radius-xl);
}

.help-status { margin: var(--wf-space-5) 0; color: var(--theme-text-muted); }

/* A guide still being written (or missing): one calm line, never an error. */
.help-empty { padding: var(--wf-space-7) var(--wf-space-4); text-align: center; color: var(--theme-text-secondary); }
.help-empty .bi { display: block; margin-bottom: var(--wf-space-3); color: var(--theme-text-muted); font-size: 32px; }
.help-empty-title { margin: 0 0 var(--wf-space-2); color: var(--theme-text-emphasis); font-size: var(--wf-text-h3); font-weight: 600; }
.help-empty-text { max-width: 52ch; margin: 0 auto; }

/* THE GUIDE - a reading measure, generous rhythm, numbered steps that read as steps, pictures that fit. */
.help-guide {
    max-width: 76ch;
    color: var(--theme-text);
    font-size: 15px;
    line-height: 1.65;
}

.help-guide > :first-child { margin-top: 0; }

.help-guide h1,
.help-guide h2 {
    margin: var(--wf-space-6) 0 var(--wf-space-2);
    color: var(--theme-text-emphasis);
    font-size: var(--wf-text-h3);
    font-weight: 650;
    line-height: 1.3;
}

.help-guide h3 {
    margin: var(--wf-space-5) 0 var(--wf-space-2);
    color: var(--theme-text-emphasis);
    font-size: 15.5px;
    font-weight: 650;
}

.help-guide h4 { margin: var(--wf-space-4) 0 var(--wf-space-1); color: var(--theme-text-emphasis); font-size: 15px; font-weight: 600; }

.help-guide p { margin: 0 0 var(--wf-space-3); }

.help-guide ul,
.help-guide ol { margin: 0 0 var(--wf-space-4); padding-left: 1.4rem; }

.help-guide li { margin: var(--wf-space-1) 0; }
.help-guide li > p { margin-bottom: var(--wf-space-1); }
.help-guide ol > li::marker { color: var(--wf-primary-ink); font-weight: 650; }

.help-guide strong { color: var(--theme-text-emphasis); font-weight: 650; }

.help-guide a { color: var(--wf-primary-ink); text-decoration: underline; text-underline-offset: 3px; }

.help-guide img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: var(--wf-space-3) 0 var(--wf-space-4);
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-md);
    box-shadow: var(--wf-elev-1);
}

/* A "Tip" or "Good to know" callout is a blockquote in the guide. */
.help-guide blockquote {
    margin: var(--wf-space-3) 0 var(--wf-space-4);
    padding: var(--wf-space-3) var(--wf-space-4);
    border-left: 3px solid var(--wf-primary-ink);
    border-radius: 0 var(--wf-radius-sm) var(--wf-radius-sm) 0;
    background: var(--wf-primary-soft);
    color: var(--theme-text);
}

.help-guide blockquote > :last-child { margin-bottom: 0; }

.help-guide table {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 0 var(--wf-space-4);
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 14px;
}

.help-guide th,
.help-guide td { padding: var(--wf-space-2) var(--wf-space-3); border: 1px solid var(--wf-line); text-align: left; vertical-align: top; }
.help-guide th { background: var(--wf-neutral-soft); color: var(--theme-text-emphasis); font-weight: 600; }

.help-guide code {
    padding: 0 .3em;
    border-radius: var(--wf-radius-xs);
    background: var(--wf-neutral-soft);
    font-size: .92em;
}

.help-guide hr { margin: var(--wf-space-5) 0; border: 0; border-top: 1px solid var(--wf-line); }

/* A REFERENCE's code blocks (the design cookbook's recipes, the embed's snippets - USER-GUIDES.md section 12); a guide
   written to the template has none. Scrolls sideways rather than widening the page. */
.help-guide pre {
    margin: 0 0 var(--wf-space-4);
    padding: var(--wf-space-3) var(--wf-space-4);
    overflow-x: auto;
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-md);
    background: var(--wf-neutral-soft);
    font-size: 13px;
    line-height: 1.5;
}

.help-guide pre code { padding: 0; background: none; font-size: inherit; }

/* Wave 2 - the guide's ON THIS PAGE contents above it (a guide with more than three sections): one folding card, two
   columns on a wide dialog, the tasks indented under their section. A line is a quiet text button that scrolls the
   dialog's own body (helpdialog.js scrollToHeading). */
.help-toc {
    margin: 0 0 var(--wf-space-5);
    padding: var(--wf-space-3) var(--wf-space-4);
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-md);
    background: var(--wf-neutral-soft);
}

.help-toc > summary { cursor: pointer; list-style: none; }
.help-toc > summary::-webkit-details-marker { display: none; }
.help-toc > summary::after { content: "\F282"; margin-left: var(--wf-space-1); font-family: "bootstrap-icons"; font-size: .8em; }
.help-toc[open] > summary::after { content: "\F286"; }

.help-toc-title {
    margin: 0;
    color: var(--theme-text-muted);
    font-size: var(--wf-text-xs);
    font-weight: 650;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.help-toc-list {
    margin: var(--wf-space-2) 0 0;
    padding: 0;
    list-style: none;
    columns: 2 18rem;
    column-gap: var(--wf-space-6);
}

.help-toc-item { break-inside: avoid; }
.help-toc-item.is-sub { padding-left: var(--wf-space-4); }

.help-toc-link {
    display: block;
    width: 100%;
    padding: 2px 0;
    border: 0;
    background: none;
    color: var(--theme-text-secondary);
    font-size: var(--wf-text-sm);
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
}

.help-toc-item:not(.is-sub) .help-toc-link { color: var(--theme-text-emphasis); font-weight: 600; }
.help-toc-link:hover,
.help-toc-link:focus-visible { color: var(--wf-primary-ink); text-decoration: underline; text-underline-offset: 3px; }

/* Wave 2 - the guide's FOOT: the other guides of its chapter and the topic index. */
.help-foot {
    max-width: 72ch;
    margin: var(--wf-space-6) 0 0;
    padding-top: var(--wf-space-4);
    border-top: 1px solid var(--wf-line);
}

.help-foot-title {
    margin: 0 0 var(--wf-space-2);
    color: var(--theme-text-muted);
    font-size: var(--wf-text-xs);
    font-weight: 650;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.help-foot-list { display: flex; flex-wrap: wrap; gap: var(--wf-space-2); margin: 0 0 var(--wf-space-3); padding: 0; list-style: none; }

.help-foot-link {
    display: inline-block;
    padding: 2px var(--wf-space-3);
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-pill);
    color: var(--theme-text-secondary);
    font-size: var(--wf-text-sm);
    text-decoration: none;
}

.help-foot-link:hover,
.help-foot-link:focus-visible { border-color: var(--wf-primary-ink); color: var(--wf-primary-ink); }

.help-foot-index { display: inline-flex; align-items: center; gap: var(--wf-space-1); color: var(--wf-primary-ink); font-size: var(--wf-text-sm); }

/* Tablet: the actions keep their icons; their words stay for screen readers only (never display: none - the words
   are the buttons' names). */
@media (max-width: 900px) {
    .help-head-actions .btn span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
    .help-body { padding: var(--wf-space-4) var(--wf-space-5) var(--wf-space-6); }
}

/* Phone: the whole screen, its own scroll, the title wrapping. */
@media (max-width: 767.98px) {
    .help-backdrop { padding: 0; }
    .help-dialog {
        width: 100%;
        max-width: none;
        height: 100%;
        max-height: none;
        border: 0;
        border-radius: 0;
    }
    .help-head { padding: var(--wf-space-3) var(--wf-space-4); border-radius: 0; }
    .help-head-icon { display: none; }
    .help-title { font-size: var(--wf-text-h3); white-space: normal; }
    .help-body { padding: var(--wf-space-4) var(--wf-space-4) var(--wf-space-7); border-radius: 0; }
    .help-guide { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .help-dialog { animation: none !important; transition: none !important; }
}

/* @end-tokens-only */
