/* The user guide (plan D31): a documentation page in the landing page's look, built on site.css's
   tokens. Tree on the left, article in the middle, "On this page" on the right; the page scrolls
   and both side columns stay in place. The tree's rows, selection and hover follow Kata Shell's
   own tree, as Kata Porthole draws it. No script. */

.topnav a.here {
    color: var(--ink);
    font-weight: 600;
}

.guide {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr) 220px;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 16px;
    background: var(--panel);
    border-top: 1px solid var(--line);
}

.guide-side,
.guide-toc {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow-y: auto;
    padding: 20px 0 32px;
}

.guide-side {
    border-right: 1px solid var(--line);
}

.guide-main {
    padding: 28px 48px 64px;
    min-width: 0;
}

/* ---- the tree ---- */

.gtree {
    font-size: 13.5px;
    line-height: 1;
}

.gtree a {
    color: var(--ink);
}

.gtree a:hover {
    text-decoration: none;
}

/* Unlike the app's tree, long titles wrap: a reader needs the whole title to choose. */
.gtree-root,
.gtree summary,
.gtree li a {
    display: flex;
    align-items: flex-start;
    min-height: 24px;
    padding: 4px 10px 4px 6px;
    line-height: 16px;
    cursor: pointer;
}

.gtree .gicon,
.gtree .gchev {
    margin-top: 1px;
}

.gtree-root {
    font-weight: 600;
    margin-bottom: 2px;
    padding-left: 22px;
}

.gtree summary {
    list-style: none;
    font-weight: 600;
    user-select: none;
}

.gtree summary::-webkit-details-marker {
    display: none;
}

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

.gtree li a {
    padding-left: 30px;
}

.gtree-root:hover,
.gtree summary:hover,
.gtree li a:hover {
    background: #e8e8e8;
}

.gtree a.current {
    background: #cce4f7;
}

.gicon {
    width: 14px;
    height: 14px;
    flex: none;
    margin-right: 6px;
}

.gchev {
    width: 10px;
    height: 10px;
    flex: none;
    margin-right: 6px;
    color: #6b7078;
    transition: transform 0.12s;
}

.gtree details[open] > summary .gchev {
    transform: rotate(90deg);
}

/* ---- the article ---- */

.guide-crumb {
    font: 12.5px var(--mono);
    color: var(--muted);
    margin-bottom: 6px;
}

.guide-crumb a {
    color: var(--muted);
}

.guide-main h1 {
    font-family: var(--display);
    font-weight: 700;
    font-size: clamp(28px, 4vw, 36px);
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin-bottom: 18px;
}

.guide-article {
    max-width: 760px;
    font-size: 16.5px;
    line-height: 1.68;
}

.guide-article h2 {
    font-family: var(--display);
    font-weight: 650;
    font-size: 22px;
    line-height: 1.3;
    margin: 34px 0 10px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    scroll-margin-top: 16px;
}

.guide-article h3 {
    font-family: var(--display);
    font-weight: 650;
    font-size: 18px;
    margin: 24px 0 8px;
    scroll-margin-top: 16px;
}

.guide-article p,
.guide-article ul,
.guide-article ol,
.guide-article table,
.guide-article blockquote {
    margin: 0 0 14px;
}

.guide-article ul,
.guide-article ol {
    padding-left: 24px;
}

.guide-article li {
    margin: 3px 0;
}

.guide-article code {
    font: 0.9em var(--mono);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0 4px;
}

.guide-article blockquote {
    border-left: 3px solid var(--line);
    padding: 2px 0 2px 14px;
    color: var(--muted);
}

.guide-article img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.guide-article table {
    border-collapse: collapse;
    font-size: 15px;
    display: block;
    overflow-x: auto;
}

.guide-article th,
.guide-article td {
    border: 1px solid var(--line);
    padding: 6px 10px;
    text-align: left;
    vertical-align: top;
}

.guide-article th {
    background: var(--paper);
}

.guide-article hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 28px 0;
}

/* A section heading draws its own rule; a Markdown rule right above it would double it. */
.guide-article hr:has(+ h2) {
    display: none;
}

.guide-version {
    margin-top: 40px;
    font: 12.5px var(--mono);
    color: var(--muted);
}

/* ---- on this page ---- */

.guide-toc {
    padding-left: 18px;
    font-size: 13px;
}

.guide-toc p {
    font-weight: 600;
    margin-bottom: 8px;
}

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

.guide-toc a {
    display: block;
    color: var(--muted);
    padding: 3px 0 3px 10px;
    border-left: 2px solid var(--line);
    line-height: 1.35;
}

.guide-toc a:hover {
    color: var(--ink);
    text-decoration: none;
}

/* ---- "Contents", shown instead of the tree when there is no room for it ---- */

.guide-contents {
    display: none;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.guide-contents > summary {
    cursor: pointer;
    padding: 8px 12px;
    font-weight: 600;
}

.guide-contents .gtree {
    padding: 0 0 8px;
}

@media (max-width: 1100px) {
    .guide {
        grid-template-columns: 250px minmax(0, 1fr);
    }

    .guide-toc {
        display: none;
    }
}

@media (max-width: 760px) {
    .guide {
        display: block;
        padding: 0;
    }

    .guide-side {
        display: none;
    }

    .guide-main {
        padding: 20px 16px 48px;
    }

    .guide-contents {
        display: block;
    }
}
