/* ==========================================================================
   Kornox Documentation (/docs/) — Resend & Laravel 3-Column Architecture
   ========================================================================== */

body.is-kornox-docs {
    background-color: var(--kx-bg);
}

.docs-mobile-bar {
    display: none;
    position: sticky;
    top: var(--kx-header-h);
    z-index: 150;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--kx-line);
}

.docs-mobile-bar-inner {
    max-width: var(--kx-rail-width);
    margin: 0 auto;
    padding: 8px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.docs-drawer-btn,
.docs-mobile-search-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 12px;
    border-radius: var(--kx-radius-full);
    border: 1px solid var(--kx-line);
    background: var(--kx-surface);
    color: var(--kx-text-2);
    font-size: 0.83rem;
    font-weight: 560;
}

.docs-drawer-btn svg,
.docs-mobile-search-btn svg {
    width: 15px;
    height: 15px;
}

/* 3-Column Shell */
.docs-shell {
    max-width: 1380px;
    margin: 0 auto;
    padding: 20px 24px 56px;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

/* 1. Left Sidebar */
.docs-sidebar-sticky {
    position: sticky;
    top: calc(var(--kx-header-h) + 20px);
    max-height: calc(100dvh - var(--kx-header-h) - 36px);
    overflow-y: auto;
    padding-right: 6px;
    scrollbar-width: thin;
}

.docs-search-trigger {
    width: 100%;
    height: 36px;
    padding: 0 10px 0 12px;
    margin-bottom: 18px;
    border-radius: var(--kx-radius-action);
    border: 1px solid var(--kx-line-strong);
    background: var(--kx-surface);
    color: var(--kx-text-4);
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--kx-shadow-xs);
    transition: border-color 0.14s ease, color 0.14s ease;
}

.docs-search-trigger:hover {
    border-color: rgba(60, 60, 67, 0.28);
    color: var(--kx-text-2);
}

.docs-search-trigger-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.docs-search-trigger svg {
    width: 15px;
    height: 15px;
}

.docs-tree {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.docs-group summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    font-size: 0.78rem;
    font-weight: 640;
    color: var(--kx-text);
    cursor: pointer;
    user-select: none;
}

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

.docs-group summary::after {
    content: "";
    width: 12px;
    height: 12px;
    background-color: var(--kx-text-4);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat center / contain;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat center / contain;
    rotate: -90deg;
    transition: rotate 0.16s ease;
}

.docs-group[open] > summary::after {
    rotate: 0deg;
}

.docs-group-list {
    list-style: none;
    margin: 3px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.docs-group-list a {
    display: block;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.84rem;
    line-height: 1.35;
    color: var(--kx-text-3);
    transition: background-color 0.13s ease, color 0.13s ease;
}

.docs-group-list a:hover {
    background: rgba(60, 60, 67, 0.05);
    color: var(--kx-text);
}

.docs-group-list a[aria-current="page"] {
    background: var(--kx-surface-3);
    color: var(--kx-text);
    font-weight: 590;
}

/* 2. Resend-style Rounded White Article Canvas */
.docs-canvas {
    background: var(--kx-surface);
    border: 1px solid var(--kx-line);
    border-radius: var(--kx-radius);
    padding: 44px 48px 56px;
    display: grid;
    grid-template-columns: minmax(0, 720px) 216px;
    justify-content: space-between;
    gap: 48px;
    min-height: 76vh;
}

.docs-article {
    min-width: 0;
}

.docs-head {
    margin-bottom: 28px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--kx-line);
}

.docs-head-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.docs-crumbs {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--kx-text-3);
}

.docs-crumbs a { color: var(--kx-text-3); }
.docs-crumbs a:hover { color: var(--kx-blue); }

.docs-copy-url {
    height: 30px;
    padding: 0 10px;
    font-size: 0.76rem;
}
.docs-copy-url svg { width: 13px; height: 13px; }

.docs-head h1 {
    font-size: clamp(1.95rem, 3vw, 2.45rem);
    line-height: 1.1;
    letter-spacing: -0.034em;
    margin-bottom: 10px;
}

.docs-lead {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.54;
    color: var(--kx-text-3);
}

/* Headings with copy-anchor button */
.docs-prose {
    max-width: none;
}

.docs-heading {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    scroll-margin-top: calc(var(--kx-header-h) + 28px);
}

.docs-anchor-btn {
    opacity: 0;
    padding: 2px 6px;
    border-radius: 5px;
    font-family: var(--kx-font-mono);
    font-size: 0.82em;
    font-weight: 500;
    color: var(--kx-text-4);
    transition: opacity 0.14s ease, color 0.14s ease, background-color 0.14s ease;
}

.docs-heading:hover .docs-anchor-btn,
.docs-anchor-btn:focus-visible {
    opacity: 1;
}

.docs-anchor-btn:hover {
    color: var(--kx-blue);
    background: var(--kx-bg);
}

.docs-prose .kx-shot {
    margin: 1.5em 0;
}

.docs-hr {
    border: 0;
    border-top: 1px solid var(--kx-line);
    margin: 2em 0;
}

/* Mobile collapsible TOC */
.docs-mobile-toc {
    display: none;
    margin-bottom: 24px;
    border: 1px solid var(--kx-line);
    border-radius: 10px;
    background: var(--kx-bg);
}

.docs-mobile-toc summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--kx-text);
    cursor: pointer;
}
.docs-mobile-toc summary::-webkit-details-marker { display: none; }
.docs-mobile-toc summary svg { width: 15px; height: 15px; color: var(--kx-text-3); }

.docs-mobile-toc ul {
    list-style: none;
    margin: 0;
    padding: 4px 14px 12px;
    border-top: 1px solid var(--kx-line);
}

.docs-mobile-toc li a {
    display: block;
    padding: 5px 0;
    font-size: 0.83rem;
    color: var(--kx-text-2);
}
.docs-mobile-toc li.toc-lv-3 a { padding-left: 14px; color: var(--kx-text-3); }

/* Footer & Prev/Next */
.docs-foot {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--kx-line);
}

.docs-updated {
    font-size: 0.79rem;
    color: var(--kx-text-4);
    margin-bottom: 20px;
}

.docs-pager {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.docs-pager-link {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 14px 16px;
    border-radius: 11px;
    border: 1px solid var(--kx-line);
    background: var(--kx-bg);
    transition: border-color 0.14s ease, background-color 0.14s ease;
}

.docs-pager-link:hover {
    border-color: var(--kx-line-strong);
    background: var(--kx-surface);
}

.docs-pager-link small {
    font-size: 0.74rem;
    color: var(--kx-text-4);
}

.docs-pager-link strong {
    font-size: 0.89rem;
    font-weight: 610;
    color: var(--kx-text);
}

.docs-pager-next {
    text-align: right;
    align-items: flex-end;
}

/* 3. Right Sticky TOC */
.docs-toc-sticky {
    position: sticky;
    top: calc(var(--kx-header-h) + 28px);
}

.docs-toc-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 620;
    color: var(--kx-text);
    margin-bottom: 10px;
}
.docs-toc-head svg { width: 14px; height: 14px; color: var(--kx-text-4); }

.docs-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid var(--kx-line);
}

.docs-toc-list li a {
    position: relative;
    display: block;
    padding: 5px 0 5px 14px;
    font-size: 0.79rem;
    line-height: 1.38;
    color: var(--kx-text-3);
    transition: color 0.14s ease;
}

.docs-toc-list li.toc-lv-3 a {
    padding-left: 25px;
    font-size: 0.76rem;
}

.docs-toc-list li a:hover {
    color: var(--kx-text);
}

.docs-toc-list li a.is-active {
    color: var(--kx-text);
    font-weight: 590;
}

.docs-toc-list li a.is-active::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 4px;
    bottom: 4px;
    border-left: 1.8px solid var(--kx-text);
}

/* Cmd+K Search Dialog */
.docs-search-modal {
    width: min(92vw, 600px);
    max-height: 76dvh;
    margin: 10dvh auto auto;
    padding: 0;
    border: 1px solid var(--kx-line-strong);
    border-radius: var(--kx-radius);
    background: var(--kx-surface);
    box-shadow: var(--kx-shadow-lg);
    overflow: hidden;
}

.docs-search-modal:modal {
    overscroll-behavior: contain;
}

.docs-search-modal::backdrop {
    overflow: hidden;
    overscroll-behavior: contain;
    background: rgba(17, 17, 17, 0.28);
    backdrop-filter: blur(3px);
}

.docs-search-box {
    display: flex;
    flex-direction: column;
    max-height: 76dvh;
}

.docs-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--kx-line);
}

.docs-search-bar svg {
    width: 17px;
    height: 17px;
    color: var(--kx-text-4);
    flex: none;
}

.docs-search-bar input {
    flex: 1;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 0.95rem;
    color: var(--kx-text);
}

.docs-search-results {
    overflow-y: auto;
    padding: 8px;
}

.docs-search-empty {
    padding: 28px 16px;
    text-align: center;
    font-size: 0.86rem;
    color: var(--kx-text-3);
}

.docs-hit {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 9px;
    color: inherit;
    transition: background-color 0.12s ease;
}

.docs-hit:hover,
.docs-hit.is-selected {
    background: var(--kx-bg);
    color: inherit;
}

.docs-hit-sec {
    font-size: 0.72rem;
    color: var(--kx-blue);
    font-weight: 580;
}

.docs-hit-title {
    font-size: 0.9rem;
    font-weight: 610;
    color: var(--kx-text);
}

.docs-hit-desc {
    font-size: 0.8rem;
    color: var(--kx-text-3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Responsive Breakpoints */
@media (max-width: 1140px) {
    .docs-canvas {
        grid-template-columns: minmax(0, 1fr);
        padding: 36px 32px 48px;
    }
    .docs-toc {
        display: none;
    }
    .docs-mobile-toc {
        display: block;
    }
}

@media (max-width: 900px) {
    .docs-mobile-bar {
        display: block;
    }
    .docs-shell {
        grid-template-columns: minmax(0, 1fr);
        padding: 12px 12px 40px;
    }
    .docs-canvas {
        padding: 26px 18px 36px;
    }
    .docs-sidebar {
        position: fixed;
        top: var(--kx-header-h);
        left: 0;
        bottom: 0;
        width: min(84vw, 300px);
        background: var(--kx-surface);
        border-right: 1px solid var(--kx-line);
        z-index: 190;
        padding: 16px;
        overflow-y: auto;
        transform: translateX(-104%);
        transition: transform 0.22s var(--kx-ease);
    }
    .docs-sidebar.is-open {
        transform: translateX(0);
    }
    .docs-sidebar-sticky {
        position: static;
        max-height: none;
    }
    .docs-backdrop:not([hidden]) {
        display: block;
        position: fixed;
        inset: var(--kx-header-h) 0 0 0;
        background: rgba(17, 17, 17, 0.25);
        z-index: 185;
    }
    .docs-pager {
        grid-template-columns: minmax(0, 1fr);
    }
}
