/* =================================================================
   THE GUIDES LIBRARY (docs/claude/USER-GUIDES.md section 7) - /guides (every guide by chapter, one search) and
   /guides/{key} (one guide, its contents, its related guides, Print and Ask Help). Every class here is guides-* and is
   owned by this file alone; the guide's own reading typography is help.css's help-guide (the "?" dialog's - one look
   for a guide wherever it is read). Every colour is a --wf-* / --theme-* token.
   ================================================================= */
/* @tokens-only */

/* ── The library ────────────────────────────────────────────────── */

.guides-search {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 0 var(--wf-space-6);
}

.guides-search-icon {
    position: absolute;
    left: var(--wf-space-4);
    color: var(--theme-text-muted);
    font-size: 18px;
    pointer-events: none;
}

.guides-search-input {
    width: 100%;
    height: 52px;
    padding: 0 var(--wf-space-4) 0 calc(var(--wf-space-4) + 28px);
    border: 1px solid var(--wf-line-strong);
    border-radius: var(--wf-radius-lg);
    background: var(--wf-card);
    box-shadow: var(--wf-elev-1);
    color: var(--theme-text);
    font: inherit;
    font-size: 16px;
}

.guides-search-input:focus { border-color: var(--wf-primary-ink); outline: none; box-shadow: 0 0 0 3px var(--wf-primary-soft), var(--wf-elev-1); }

.guides-search-busy {
    position: absolute;
    right: var(--wf-space-4);
    color: var(--theme-text-muted);
    font-size: var(--wf-text-sm);
}

.guides-chapter { margin: 0 0 var(--wf-space-6); }

.guides-chapter-head {
    display: flex;
    align-items: center;
    gap: var(--wf-space-3);
    margin: 0 0 var(--wf-space-3);
}

.guides-chapter-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: var(--wf-radius-tile);
    background: var(--wf-neutral-soft);
    color: var(--theme-text-secondary);
    font-size: 16px;
}

.guides-chapter-title {
    margin: 0;
    color: var(--theme-text-emphasis);
    font-size: var(--wf-text-h3);
    font-weight: 650;
}

.guides-chapter-count { color: var(--theme-text-muted); font-size: var(--wf-text-sm); }

.guides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--wf-space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.guides-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--wf-space-1);
    height: 100%;
    padding: var(--wf-space-4) calc(var(--wf-space-4) + 20px) var(--wf-space-4) var(--wf-space-4);
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-md);
    background: var(--wf-card);
    box-shadow: var(--wf-elev-1);
    color: var(--theme-text);
    text-decoration: none;
    transition: border-color var(--wf-motion), box-shadow var(--wf-motion), transform var(--wf-motion);
}

.guides-card:hover { border-color: var(--wf-line-strong); box-shadow: var(--wf-elev-2); transform: translateY(-1px); }
.guides-card:focus-visible { outline: 2px solid var(--wf-primary-ink); outline-offset: 2px; }

.guides-card-title { color: var(--theme-text-emphasis); font-weight: 650; line-height: 1.3; }

.guides-card-purpose {
    display: -webkit-box;
    overflow: hidden;
    color: var(--theme-text-secondary);
    font-size: var(--wf-text-sm);
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.guides-card-go {
    position: absolute;
    top: var(--wf-space-4);
    right: var(--wf-space-4);
    color: var(--theme-text-muted);
    transition: color var(--wf-motion), transform var(--wf-motion);
}

.guides-card:hover .guides-card-go { color: var(--wf-primary-ink); transform: translateX(2px); }

/* Search results. */
.guides-results { margin: 0 0 var(--wf-space-6); }

.guides-results-count { margin: 0 0 var(--wf-space-3); color: var(--theme-text-muted); font-size: var(--wf-text-sm); }

.guides-hits { display: flex; flex-direction: column; gap: var(--wf-space-2); margin: 0 0 var(--wf-space-4); padding: 0; list-style: none; }

.guides-hit {
    padding: var(--wf-space-3) var(--wf-space-4);
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-md);
    background: var(--wf-card);
}

.guides-hit-title { margin-right: var(--wf-space-2); color: var(--theme-text-emphasis); font-weight: 650; text-decoration: none; }
.guides-hit-title:hover { color: var(--wf-primary-ink); text-decoration: underline; text-underline-offset: 3px; }

.guides-chip {
    display: inline-block;
    padding: 1px var(--wf-space-2);
    border-radius: var(--wf-radius-pill);
    background: var(--wf-neutral-soft);
    color: var(--theme-text-secondary);
    font-size: var(--wf-text-xs);
    font-weight: 600;
    vertical-align: 1px;
}

.guides-hit-snippet { margin: var(--wf-space-1) 0 0; color: var(--theme-text-secondary); font-size: var(--wf-text-sm); line-height: 1.5; }

.guides-hit-section {
    display: inline-flex;
    align-items: center;
    gap: var(--wf-space-1);
    margin-top: var(--wf-space-1);
    color: var(--wf-primary-ink);
    font-size: var(--wf-text-sm);
    font-weight: 600;
    text-decoration: none;
}

.guides-hit-section:hover { text-decoration: underline; text-underline-offset: 3px; }

.guides-note { margin: 0 0 var(--wf-space-3); color: var(--theme-text-muted); }

/* Ask Help about the words - always the last line of a search. */
.guides-askhelp {
    display: flex;
    align-items: center;
    gap: var(--wf-space-3);
    width: 100%;
    padding: var(--wf-space-3) var(--wf-space-4);
    border: 1px dashed var(--wf-line-strong);
    border-radius: var(--wf-radius-md);
    background: var(--wf-brand-wash), var(--wf-card);
    color: var(--theme-text);
    text-align: left;
    cursor: pointer;
}

.guides-askhelp:hover { border-style: solid; }
.guides-askhelp:focus-visible { outline: 2px solid var(--wf-primary-ink); outline-offset: 2px; }

.guides-askhelp-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: var(--wf-radius-tile);
    background: var(--wf-primary-soft);
    color: var(--wf-primary-ink);
}

.guides-askhelp-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.guides-askhelp-text b { overflow: hidden; color: var(--theme-text-emphasis); font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.guides-askhelp-text small { color: var(--theme-text-muted); font-size: var(--wf-text-xs); }

.guides-foot {
    display: flex;
    align-items: center;
    gap: var(--wf-space-2);
    margin: var(--wf-space-6) 0 0;
    color: var(--theme-text-muted);
    font-size: var(--wf-text-sm);
}

.guides-foot a { color: var(--theme-text-secondary); }

/* ── One guide ──────────────────────────────────────────────────── */

.guides-reader-head { max-width: 76ch; margin: 0 0 var(--wf-space-5); }

.guides-back {
    display: inline-flex;
    align-items: center;
    gap: var(--wf-space-1);
    margin: 0 0 var(--wf-space-3);
    color: var(--theme-text-muted);
    font-size: var(--wf-text-sm);
    font-weight: 600;
    text-decoration: none;
}

.guides-back:hover { color: var(--wf-primary-ink); }

.guides-reader-kicker {
    display: flex;
    align-items: center;
    gap: var(--wf-space-2);
    margin: 0 0 var(--wf-space-1);
    color: var(--theme-text-muted);
    font-size: var(--wf-text-xs);
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.guides-reader-title {
    margin: 0 0 var(--wf-space-2);
    color: var(--theme-text-emphasis);
    font-size: var(--wf-text-h1);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.015em;
}

.guides-reader-lead { margin: 0 0 var(--wf-space-4); color: var(--theme-text-secondary); font-size: 16px; line-height: 1.55; }

.guides-reader-actions { display: flex; flex-wrap: wrap; gap: var(--wf-space-2); }

.guides-reader-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    grid-template-areas: "article aside";
    align-items: start;
    gap: var(--wf-space-6);
}

.guides-article { grid-area: article; min-width: 0; padding: var(--wf-space-5) var(--wf-space-6) var(--wf-space-7); }

.guides-guide { margin: 0 auto 0 0; }

/* A cited heading gets the reader's eye for a moment. */
.guides-guide :is(h2, h3):focus { outline: none; }
.guides-guide :is(h2, h3):target,
.guides-guide :is(h2, h3):focus-visible { color: var(--wf-primary-ink); }

.guides-aside {
    position: sticky;
    top: calc(var(--wf-sticky-top, 0px) + var(--wf-space-4));
    grid-area: aside;
    display: flex;
    flex-direction: column;
    gap: var(--wf-space-5);
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.guides-aside-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;
}

.guides-toc > summary { cursor: pointer; list-style: none; }
.guides-toc > summary::-webkit-details-marker { display: none; }

.guides-toc-list,
.guides-related-list { margin: 0; padding: 0; list-style: none; }

.guides-toc-item a,
.guides-related-list a {
    display: block;
    padding: 4px var(--wf-space-2);
    border-left: 2px solid var(--wf-line);
    color: var(--theme-text-secondary);
    font-size: var(--wf-text-sm);
    line-height: 1.35;
    text-decoration: none;
}

.guides-toc-item.is-sub a { padding-left: var(--wf-space-5); font-size: var(--wf-text-xs); }

.guides-toc-item a:hover,
.guides-related-list a:hover { border-left-color: var(--wf-primary-ink); color: var(--wf-primary-ink); }

/* Wave 2 - the reader's link to the library's topic index, under the chapter's other guides. */
.guides-index-link {
    display: inline-flex;
    align-items: center;
    gap: var(--wf-space-1);
    color: var(--wf-primary-ink);
    font-size: var(--wf-text-sm);
    text-decoration: none;
}

.guides-index-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.guides-missing { max-width: 640px; margin: var(--wf-space-6) auto; }

/* Tablet and phone: the contents above the guide, folded away by the reader. */
@media (max-width: 1023.98px) {
    .guides-reader-body {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "aside" "article";
        gap: var(--wf-space-4);
    }
    .guides-aside {
        position: static;
        max-height: none;
        padding: var(--wf-space-3) var(--wf-space-4);
        border: 1px solid var(--wf-line);
        border-radius: var(--wf-radius-md);
        background: var(--wf-card);
    }
    .guides-related { display: none; }
    .guides-toc > summary::after { content: "\F282"; margin-left: var(--wf-space-1); font-family: "bootstrap-icons"; }
}

@media (max-width: 767.98px) {
    .guides-search { margin-bottom: var(--wf-space-4); }
    .guides-grid { grid-template-columns: minmax(0, 1fr); }
    .guides-article { padding: var(--wf-space-4); }
    .guides-reader-title { font-size: var(--wf-text-h2); }
}

@media (prefers-reduced-motion: reduce) {
    .guides-card,
    .guides-card-go { transition: none; }
    .guides-card:hover { transform: none; }
}

/* @end-tokens-only */
