/* ============================================================
   docs.css — LnVirtualKeyboard documentation layout
   ============================================================ */

html { scroll-behavior: smooth; }
html:has(.docLayout),
body:has(.docLayout) {
    overflow-x: visible;
}
.docBody h2, .docBody h3 { scroll-margin-top: 6rem; }

/* Two-column shell */
.docLayout {
    display: flex;
    align-items: flex-start;
    max-width: 1200px;
    margin: 0 auto;
    padding: calc(70px + 2rem) 1.5rem 4rem;
    gap: 2.5rem;
}

/* ---- Sidebar ---- */
.docSidebar {
    flex: 0 0 220px;
    position: sticky;
    top: calc(70px + 1rem);
    max-height: calc(100vh - 70px - 2rem);
    overflow-y: auto;
    align-self: flex-start;
}

.docSidebarHeader {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.docBackLink {
    font-size: 0.8rem;
    color: #6CBD99;
    text-decoration: none;
    white-space: nowrap;
}
.docBackLink:hover { text-decoration: underline; }

.docSidebarTitle {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
}

.docVersionWrap {
    margin-bottom: 1rem;
}

.docVersionLabel {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 0.35rem;
}

.docVersionSelect {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #374151;
    background: #fff;
    cursor: pointer;
}

.docVersionSelect:focus {
    outline: 2px solid #454D9B;
    outline-offset: 1px;
}

.docNavList {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.docNavItem a {
    display: block;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #374151;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.docNavItem a:hover {
    background: #f3f4f6;
    color: #454D9B;
}
.docNavItem--active a {
    background: #eef2ff;
    color: #454D9B;
    font-weight: 600;
    border-left: 3px solid #454D9B;
}

/* Sub-navigation (in-page TOC) */
.docSubNav {
    list-style: none;
    margin: 0.5rem 0 0.25rem;
    padding: 0.4rem 0 0.4rem 0;
    border-left: 1px solid #e5e7eb;
    margin-left: 0.75rem;
}
.docSubNav__item a {
    display: block;
    padding: 0.25rem 0.5rem 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 400;
    color: #6b7280;
    text-decoration: none;
    background: none;
    border-radius: 0 4px 4px 0;
    transition: color 0.15s, background 0.15s;
}
.docSubNav__item a:hover {
    color: #454D9B;
    background: #f3f4f6;
}
.docSubNav__item--active a {
    color: #454D9B;
    font-weight: 500;
}
.docSubNav__item--h3 a { padding-left: 1.5rem; font-size: 0.75rem; }

/* ---- Main content ---- */
.docContent {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 800px;
}

/* Breadcrumb */
.docBreadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-size: 0.82rem;
    color: #9ca3af;
    margin-bottom: 1.75rem;
}
.docBreadcrumb a {
    color: #6CBD99;
    text-decoration: none;
}
.docBreadcrumb a:hover { text-decoration: underline; }

/* Title */
.docTitle {
    font-size: 2rem;
    font-weight: 700;
    color: #00072d;
    margin: 0 0 2rem;
    line-height: 1.2;
}

/* Body prose */
.docBody h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #00072d;
    margin: 2.5rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #e5e7eb;
}
.docBody h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #454D9B;
    margin: 1.75rem 0 0.5rem;
}
.docBody p {
    font-size: 0.95rem;
    line-height: 1.75;
    color: #374151;
    margin: 0 0 1rem;
}
.docBody ul, .docBody ol {
    padding-left: 1.5rem;
    margin: 0 0 1rem;
}
.docBody li {
    font-size: 0.95rem;
    line-height: 1.75;
    color: #374151;
    margin-bottom: 0.25rem;
}
.docBody code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.85em;
    background: rgba(70, 80, 155, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: #454D9B;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.docBody pre {
    background: #0d1117;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin: 0 0 1.5rem;
    font-size: 0.875rem;
    line-height: 1.6;
}
.docBody pre code {
    background: none;
    padding: 0;
    color: #e6edf3;
    font-size: inherit;
    border-radius: 0;
}

/* Syntax highlight reuse from productSnippet */
.docBody pre .kw   { color: #ff7b72; }
.docBody pre .type { color: #79c0ff; }
.docBody pre .prop { color: #d2a8ff; }
.docBody pre .val  { color: #a5d6ff; }
.docBody pre .cmt  { color: #8b949e; font-style: italic; }
.docBody pre .str  { color: #a5d6ff; }
.docBody pre .fn   { color: #d2a8ff; }

/* Tables */
.docBody .tableWrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 0 1.5rem;
    max-width: 100%;
}
.docBody .tableWrap table {
    margin: 0;
}
.docBody table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.5rem;
    font-size: 0.875rem;
    table-layout: auto;
}
.docBody th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}
.docBody td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    color: #374151;
    vertical-align: top;
    word-break: break-word;
}
.docBody th:first-child,
.docBody td:first-child {
    white-space: nowrap;
    word-break: normal;
    min-width: max-content;
}
.docBody td:first-child code {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}
.docBody tr:nth-child(even) td { background: #f9fafb; }

/* Note/tip callout */
.docNote {
    background: #eff6ff;
    border-left: 3px solid #454D9B;
    border-radius: 0 6px 6px 0;
    padding: 0.75rem 1rem;
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
    color: #374151;
}
.docNote strong { color: #454D9B; }

/* Warning callout */
.docWarning {
    background: #fff7ed;
    border-left: 3px solid #f59e0b;
    border-radius: 0 6px 6px 0;
    padding: 0.75rem 1rem;
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
    color: #374151;
}
.docWarning strong { color: #b45309; }

/* Prev/Next navigation */
.docPrevNext {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}
.docPrevNext__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}
.docPrevNext__item:hover {
    border-color: #454D9B;
    background: #f5f6ff;
}
.docPrevNext__item--next { text-align: right; }
.docPrevNext__item--empty {
    visibility: hidden;
    pointer-events: none;
}
.docPrevNext__label {
    font-size: 0.78rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.docPrevNext__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #454D9B;
}

/* Docs index page */
.docIndexLayout {
    max-width: 900px;
    margin: 0 auto;
    padding: calc(70px + 2rem) 1.5rem 5rem;
}
.docIndexTitle {
    font-size: 2rem;
    font-weight: 700;
    color: #00072d;
    margin: 0 0 0.5rem;
}
.docIndexLead {
    font-size: 1rem;
    color: #6b7280;
    margin: 0 0 2.5rem;
}
.docIndexGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}
.docIndexCard {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.docIndexCard:hover {
    border-color: #6CBD99;
    box-shadow: 0 2px 12px rgba(108, 189, 153, 0.15);
}
.docIndexCard__title {
    font-size: 1rem;
    font-weight: 700;
    color: #00072d;
}
.docIndexCard__excerpt {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
    .docLayout {
        flex-direction: column;
        gap: 1.5rem;
        padding: calc(70px + 1rem) max(1rem, env(safe-area-inset-right)) 3rem max(1rem, env(safe-area-inset-left));
    }
    .docSidebar {
        flex: none;
        width: 100%;
        position: static;
        max-height: none;
    }
    .docContent {
        flex: none;
        width: 100%;
        max-width: none;
    }
    .docIndexLayout {
        padding: calc(70px + 1rem) max(1rem, env(safe-area-inset-right)) 3rem max(1rem, env(safe-area-inset-left));
    }
    .docNavList {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .docNavItem--active a {
        border-left: none;
        border-bottom: 3px solid #454D9B;
    }
    .docTitle { font-size: 1.5rem; }
    .docPrevNext { flex-direction: column; }
    .docPrevNext__item--next { text-align: left; }
    .docSubNav { display: none; }
}
