/* CADENCE — User Manual styling (role-aware-user-manual-01KZBJFT, WP03).
   Design-token based; light theme only (the app has no dark mechanism). */

/* The manual is mounted into a `.overlay-host`, which is `overflow: hidden`
   with `display:flex; flex-direction:column; flex:1; min-height:0` — see the
   comment at index.html:693. That host deliberately gives its child a BOUNDED
   height and expects the child to be the scroll surface (every sibling screen
   does this with its own `__body { flex:1; overflow:auto }`).

   `.man-root` did not, so the manual was clipped at the fold with no
   scrollbar — and because nothing could scroll, the table-of-contents links
   (which end in `scrollIntoView()`) appeared to do nothing at all. One cause,
   both reported symptoms. */
.man-root {
    flex: 1;
    min-height: 0;
    overflow-y: auto;

    max-width: 1120px;
    margin: 0 auto;
    padding: 24px 28px 48px;
    color: var(--color-text, #0f172a);
}

.man-header h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 14px;
}

.man-role-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--color-text-soft, #475569);
}

.man-role-control select {
    font: inherit;
    color: var(--color-text, #0f172a);
    background: var(--color-surface, #ffffff);
    border: 1px solid var(--color-border-strong, #cbd5e1);
    border-radius: 8px;
    padding: 7px 10px;
}

.man-role-control select:focus-visible,
.man-toc a:focus-visible,
.man-role-notice button:focus-visible {
    outline: 2px solid var(--color-primary-dark, #4338ca);
    outline-offset: 2px;
}

.man-role-notice {
    margin-top: 12px;
    padding: 10px 14px;
    border: 1px solid var(--color-border, #e2e8f0);
    border-left: 3px solid var(--color-primary, #6366f1);
    border-radius: 8px;
    background: var(--color-surface-2, #f1f5f9);
    font-size: 14px;
}

.man-role-notice button {
    margin-left: 8px;
    font: inherit;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 7px;
    border: 1px solid var(--color-border-strong, #cbd5e1);
    background: var(--color-surface, #ffffff);
    color: var(--color-text, #0f172a);
    cursor: pointer;
}

.man-role-notice button:hover {
    border-color: var(--color-primary-dark, #4338ca);
}

/* Layout: sticky TOC beside content on wide viewports. */
.man-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 36px;
    margin-top: 26px;
}

@media (max-width: 900px) {
    .man-layout { grid-template-columns: 1fr; }
    .man-toc { position: static; max-height: none; }
}

.man-toc {
    position: sticky;
    top: 16px;
    align-self: start;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    font-size: 13.5px;
    padding-right: 6px;
}

.man-toc-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted, #64748b);
    margin: 0 0 8px;
}

.man-toc-group {
    font-weight: 600;
    color: var(--color-text-soft, #475569);
    margin: 14px 0 4px;
}

.man-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.man-toc li { margin: 2px 0; }

.man-toc a {
    display: block;
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--color-text-soft, #475569);
    text-decoration: none;
}

.man-toc a:hover {
    background: var(--color-surface-2, #f1f5f9);
    color: var(--color-text, #0f172a);
}

/* Content column: readable measure. */
.man-content {
    max-width: 76ch;
    font-size: 15px;
    line-height: 1.65;
}

.man-content h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 34px 0 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
}

.man-content section:first-of-type h2 { margin-top: 0; }

.man-topic h3 {
    font-size: 16.5px;
    font-weight: 650;
    margin: 26px 0 6px;
}

.man-topic h3:focus { outline: none; }
.man-topic h3:focus-visible {
    outline: 2px solid var(--color-primary-dark, #4338ca);
    outline-offset: 3px;
}

.man-topic p, .man-topic ul { margin: 8px 0; }
.man-topic ul { padding-left: 22px; }
.man-topic li { margin: 4px 0; }

.man-topic code {
    background: var(--color-surface-2, #f1f5f9);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 5px;
    padding: 1px 5px;
    font-size: 0.9em;
}

.man-topic svg { margin: 14px 0; }

.man-figure {
    margin: 14px 0 20px;
}

.man-figure img {
    max-width: 100%;
    height: auto;
    display: block;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.man-figure figcaption {
    margin-top: 6px;
    font-size: 13px;
    color: var(--color-text-soft, #475569);
}

.man-footer {
    margin-top: 40px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border, #e2e8f0);
    font-size: 12.5px;
    color: var(--color-text-muted, #64748b);
}
