/* ── User manual (/help) ──────────────────────────────────────────────
 *
 * Loaded after style.css, and only on the manual pages. It reuses the
 * app's theme variables (--surface, --accent, --text-muted …) so the
 * manual follows whichever theme the reader picked in the app, and adds
 * the one thing the app has no use for: long-form reading measures.
 *
 * The app's own rules assume the SPA shell (.screen is display:none
 * until made active, #app is a full-height flex column). The manual has
 * neither, so everything here is scoped under .manual-body.
 */

.manual-body {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg, #14142a);
}

/* ── Top bar ──────────────────────────────────────────────────────── */
.manual-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.manual-brand {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    text-decoration: none;
    background: linear-gradient(135deg, var(--accent), #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.manual-top-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.manual-top-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.92rem;
}
.manual-top-nav a:hover {
    color: var(--text);
}
.manual-cta {
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff !important;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Layout ───────────────────────────────────────────────────────── */
.manual-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 2.5rem;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

.manual-main {
    min-width: 0;
    /* ~70 characters per line: the measure long text is comfortable at. */
    max-width: 44rem;
}
.manual-main-wide {
    max-width: 62rem;
    margin: 0 auto;
    padding: 2.5rem 1.25rem 3rem;
    width: 100%;
}

/* ── Sidebar contents ─────────────────────────────────────────────── */
.manual-side {
    font-size: 0.92rem;
}
.manual-side nav {
    position: sticky;
    top: 5rem;
}
.manual-side-title {
    margin: 1.25rem 0 0.4rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.manual-side-title:first-child {
    margin-top: 0;
}
.manual-side ul {
    list-style: none;
    margin: 0 0 0.25rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.manual-side a {
    display: block;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
}
.manual-side a:hover {
    color: var(--text);
    background: var(--surface2);
}
.manual-side a.current {
    color: var(--text);
    border-left-color: var(--accent);
    background: var(--surface2);
    font-weight: 600;
}

/* ── Breadcrumbs, headings, body copy ─────────────────────────────── */
.manual-crumbs {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}
.manual-crumbs a {
    color: var(--text-muted);
    text-decoration: none;
}
.manual-crumbs a:hover {
    color: var(--accent);
}

.manual-hero {
    margin-bottom: 2.5rem;
}

.manual-article h1,
.manual-hero h1 {
    font-size: clamp(1.7rem, 1.2rem + 2vw, 2.4rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 0 0 0.6rem;
}
.manual-h1-icon {
    margin-right: 0.35rem;
}

.manual-lead {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 0 0 2rem;
}

.manual-article h2 {
    font-size: 1.3rem;
    margin: 2.2rem 0 0.75rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
    letter-spacing: -0.01em;
}
.manual-article h3 {
    font-size: 1.05rem;
    margin: 1.6rem 0 0.5rem;
}
.manual-article p,
.manual-article li {
    line-height: 1.65;
}
.manual-article p {
    margin: 0 0 1rem;
}
.manual-article ul,
.manual-article ol {
    margin: 0 0 1.1rem;
    padding-left: 1.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.manual-article a {
    color: var(--accent);
}
.manual-article code {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.05em 0.35em;
    font-size: 0.9em;
}
.manual-article strong {
    color: var(--text);
}

/* ── Index cards ──────────────────────────────────────────────────── */
.manual-section {
    margin-bottom: 2.5rem;
}
.manual-section h2 {
    font-size: 1.2rem;
    margin: 0 0 0.25rem;
}
.manual-section-blurb {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin: 0 0 1rem;
}
.manual-cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
}
.manual-card a {
    display: flex;
    gap: 0.75rem;
    height: 100%;
    padding: 0.9rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, transform 0.15s;
}
.manual-card a:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}
.manual-card-icon {
    font-size: 1.4rem;
    line-height: 1.2;
}
.manual-card-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.manual-card-text span {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

/* ── Previous / next ──────────────────────────────────────────────── */
.manual-prevnext {
    display: flex;
    gap: 0.75rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.manual-prevnext a {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.8rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
}
.manual-prevnext a:hover {
    border-color: var(--accent);
}
.manual-prevnext span {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.manual-next {
    text-align: right;
}

/* ── Footer ───────────────────────────────────────────────────────── */
.manual-foot {
    border-top: 1px solid var(--border);
    padding: 1.25rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.manual-foot a {
    color: var(--text-muted);
}

/* ── Narrow screens ───────────────────────────────────────────────── */
@media (max-width: 900px) {
    .manual-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.25rem 1rem 2rem;
    }
    /* The contents move below the article: on a phone, the page you asked
     * for should start at the top of the screen, not after a menu. */
    .manual-side {
        order: 2;
        border-top: 1px solid var(--border);
        padding-top: 1.25rem;
    }
    .manual-side nav {
        position: static;
    }
    .manual-main {
        order: 1;
        max-width: none;
    }
    .manual-prevnext {
        flex-direction: column;
    }
    .manual-next {
        text-align: left;
    }
}
