/* Katakata documentation pages. Loaded after styles.css, which supplies the tokens,
   header, buttons and footer. */

/* The header is the site's own (styles.css), generated for every page by _docs/build.py. */

/* ---- Two-column shell ---- */
.docLayout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
    padding-top: 2.5rem;
    padding-bottom: 5rem;
}
.docBody h2, .docBody h3 { scroll-margin-top: 88px; }

/* ---- Sidebar ---- */
.docSidebar {
    position: sticky; top: calc(64px + 1.5rem);
    max-height: calc(100vh - 64px - 3rem);
    overflow-y: auto;
}
.docSidebarHeader {
    display: grid; gap: .5rem;
    margin-bottom: 1rem; padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.docSidebarTitle {
    color: var(--heading); text-decoration: none;
    font-size: .95rem; font-weight: 700;
    border-left: 3px solid var(--green-soft); padding-left: .6rem;
}
.docVersionWrap { display: grid; gap: .3rem; margin-top: .35rem; }
.docVersionLabel { font-size: .8rem; color: var(--text-muted); }
.docVersionSelect {
    width: 100%; padding: .4rem .55rem;
    border: 1px solid var(--border); border-radius: 6px;
    font: inherit; font-size: .85rem; color: var(--text); background: var(--surface);
}

.docNavList { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.docNavItem > a {
    display: block; padding: .4rem .7rem; border-radius: 6px;
    font-size: .92rem; color: var(--text); text-decoration: none;
}
.docNavItem > a:hover { background: var(--bg-tint); color: var(--accent-text); }
.docNavItem--active > a { background: var(--us-bg); color: var(--accent-text); font-weight: 700; }

/* In-page table of contents, added under the active page by docs.js */
.docSubNav { list-style: none; margin: .35rem 0 .5rem .7rem; padding: 0; border-left: 1px solid var(--border); }
.docSubNav a {
    display: block; padding: .22rem .5rem .22rem .75rem;
    font-size: .8rem; line-height: 1.4; color: var(--text-muted); text-decoration: none;
}
.docSubNav a:hover { color: var(--accent-text); }
.docSubNav__item--h3 a { padding-left: 1.4rem; font-size: .76rem; }
.docSubNav__item--active a { color: var(--green); font-weight: 500; box-shadow: inset 2px 0 0 var(--green-soft); margin-left: -1px; }

/* ---- Content ---- */
.docContent { max-width: 800px; }
.docBreadcrumb { display: flex; flex-wrap: wrap; gap: .45rem; font-size: .82rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.docBreadcrumb a { color: var(--text-muted); text-decoration: none; }
.docBreadcrumb a:hover { color: var(--accent-text); }
.docBreadcrumb [aria-current] { color: var(--heading); }
/* Language switch: at the far end of the breadcrumb row, so the header stays the same on every page. */
.docBreadcrumb .docLangSwitch {
    margin-left: auto; padding: .1rem .6rem;
    border: 1px solid var(--border); border-radius: 999px;
    color: var(--accent-text); font-weight: 700;
}
.docBreadcrumb .docLangSwitch:hover { border-color: var(--green-soft); color: var(--accent-text); }
.docIndex .docBreadcrumb { margin-bottom: 1.5rem; }
.docTitle {
    margin: 0 0 2rem; color: var(--heading);
    font-size: clamp(1.7rem, 3vw, 2.2rem); line-height: 1.15; font-weight: 700; letter-spacing: -.012em;
    border-left: 4px solid var(--green-soft); padding-left: .85rem;
}

.docBody { font-size: 1rem; }
.docBody h2 {
    margin: 2.75rem 0 .8rem; padding-bottom: .4rem;
    color: var(--heading); font-size: 1.35rem; line-height: 1.25; font-weight: 700;
    border-bottom: 1px solid var(--border);
}
.docBody h3 { margin: 1.9rem 0 .5rem; color: var(--accent-text); font-size: 1.08rem; font-weight: 700; }
.docBody p, .docBody li { line-height: 1.7; color: var(--text); }
.docBody p { margin: 0 0 1rem; }
.docBody ul, .docBody ol { padding-left: 1.4rem; margin: 0 0 1rem; }
.docBody li { margin-bottom: .25rem; }
.docBody a { color: var(--link); font-weight: 500; text-decoration: underline; text-decoration-color: var(--green-pale); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.docBody a:hover { text-decoration-color: var(--green); }

.docBody code {
    font-family: 'Roboto Mono', ui-monospace, Menlo, Consolas, monospace;
    font-size: .86em; padding: 1px 5px; border-radius: 4px;
    background: var(--bg-tint); color: var(--accent-text);
    overflow-wrap: anywhere;
}
.docBody pre {
    margin: 0 0 1.5rem; padding: 1.1rem 1.3rem; overflow-x: auto;
    background: var(--navy); border-radius: 10px;
    font-size: .86rem; line-height: 1.6;
}
.docBody pre code { padding: 0; background: none; color: #e6e9ff; font-size: inherit; overflow-wrap: normal; }
.docBody pre .kw   { color: #ff9e8f; }
.docBody pre .type { color: #8fd0ff; }
.docBody pre .prop { color: #c9b3ff; }
.docBody pre .fn   { color: #7fe3e4; }
.docBody pre .str  { color: #b6eed5; }
.docBody pre .val  { color: #ffd38a; }
.docBody pre .cmt  { color: #8b93b8; font-style: italic; }

/* Tables */
.docBody .tableWrap { overflow-x: auto; margin: 0 0 1.5rem; }
.docBody table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: .88rem; margin: 0 0 1.5rem; }
.docBody .tableWrap table { margin: 0; }
.docBody th, .docBody td { padding: .5rem .75rem; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.docBody th { background: var(--bg-tint); color: var(--heading); font-weight: 700; white-space: nowrap; }
.docBody td { color: var(--text); }
.docBody td:first-child, .docBody td:first-child code { white-space: nowrap; overflow-wrap: normal; }

/* Callouts */
.docNote, .docWarning {
    margin: 0 0 1.25rem; padding: .8rem 1rem;
    border-radius: 0 8px 8px 0; font-size: .93rem;
}
.docNote { background: var(--bg-tint); border-left: 3px solid var(--indigo); }
.docNote strong { color: var(--accent-text); }
.docWarning { background: #fff7ea; border-left: 3px solid #e3a33a; }
.docWarning strong { color: var(--warn); }
.docNote p:last-child, .docWarning p:last-child { margin-bottom: 0; }

/* Previous / next */
.docPrevNext {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
    margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border);
}
.docPrevNext__item {
    display: grid; gap: .2rem; padding: 1rem 1.2rem;
    border: 1px solid var(--border); border-radius: var(--radius);
    text-decoration: none;
}
a.docPrevNext__item:hover { border-color: var(--green-soft); background: var(--bg-tint); }
.docPrevNext__item--next { text-align: right; }
.docPrevNext__label { font-size: .78rem; color: var(--text-muted); }
.docPrevNext__title { font-weight: 700; color: var(--accent-text); }

/* ---- Docs home ---- */
.docIndex { padding-top: 3.5rem; padding-bottom: 5rem; }
.docIndexLead { margin: 0 0 2.5rem; max-width: 46rem; font-size: 1.08rem; color: var(--text-muted); }
.docIndexGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.docIndexCard {
    display: grid; gap: .45rem; align-content: start;
    padding: 1.3rem 1.4rem; border: 1px solid var(--border); border-radius: var(--radius);
    text-decoration: none; background: var(--surface);
}
.docIndexCard:hover { border-color: var(--green-soft); box-shadow: var(--shadow); }
.docIndexCard__title { font-weight: 700; color: var(--heading); font-size: 1.05rem; }
.docIndexCard__excerpt { font-size: .9rem; line-height: 1.55; color: var(--text-muted); }

/* ---- Tablet and phone ---- */
@media (max-width: 900px) {
    .docLayout { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; padding-top: 0; }
    /* The page list becomes a swipeable chip row pinned under the header. */
    .docSidebar {
        position: sticky; top: 64px; z-index: 5; max-height: none; overflow: visible;
        margin: 0 -24px; padding: .6rem 24px;
        background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--border);
    }
    /* Title and version on one compact row above the page chips. */
    .docSidebarHeader {
        display: flex; align-items: center; justify-content: space-between; gap: 1rem;
        margin-bottom: .5rem; padding-bottom: 0; border-bottom: 0;
    }
    .docVersionWrap { display: flex; align-items: center; gap: .5rem; margin-top: 0; }
    /* The value ("1.4.0 (current)") says what the dropdown is; keep the label for screen readers only. */
    .docVersionLabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .docVersionSelect { width: auto; padding: .25rem .45rem; font-size: .8rem; }
    .docNavList {
        display: flex; gap: .4rem; overflow-x: auto; scroll-snap-type: x proximity;
        scrollbar-width: none;
    }
    .docNavList::-webkit-scrollbar { display: none; }
    .docNavItem { flex: none; scroll-snap-align: start; }
    .docNavItem > a { padding: .35rem .8rem; border: 1px solid var(--border); border-radius: 999px; font-size: .86rem; white-space: nowrap; }
    .docNavItem--active > a { border-color: var(--green-soft); }
    .docSubNav { display: none; }
    .docBody h2, .docBody h3 { scroll-margin-top: 130px; }
    .docContent { padding-top: 1rem; }
}
@media (max-width: 640px) {
    .docTitle { margin-bottom: 1.5rem; }
    .docBody pre { margin-left: -24px; margin-right: -24px; border-radius: 0; padding: 1rem 24px; font-size: .8rem; }
    .docPrevNext { grid-template-columns: 1fr; }
    .docPrevNext__item--next { text-align: left; }
    .docPrevNext__item--empty { display: none; }
    .docIndex { padding-top: 2.5rem; }
}
