/* ============================================================
   Prick Docs — docs.css
   Docs layout, sidebar, TOC, search, article typography.
   Uses shared custom properties from style.css.
   ============================================================ */

/* ============================================================
   Layout
   ============================================================ */

.docs-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 64px);
    padding-top: 64px;
}

/* ============================================================
   Sidebar
   ============================================================ */

.docs-sidebar {
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 1.5rem 1rem 2rem;
    border-right: 1px solid var(--surface-border);
    background: var(--surface);
    -webkit-overflow-scrolling: touch;
}

.docs-sidebar::-webkit-scrollbar {
    width: 4px;
}

.docs-sidebar::-webkit-scrollbar-thumb {
    background: var(--surface-border);
    border-radius: 2px;
}

.docs-search {
    position: relative;
    margin-bottom: 1.25rem;
}

.docs-search input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--surface-raised);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: var(--font-stack);
    outline: none;
    transition: border-color 0.2s;
}

.docs-search input:focus {
    border-color: var(--rose-light);
}

.docs-search input::placeholder {
    color: var(--text-muted);
}

.docs-search::before {
    content: "\1F50D";
    position: absolute;
    left: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    pointer-events: none;
}

/* Category sections */
.docs-category-section {
    margin-bottom: 1rem;
}

.docs-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.5rem;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-stack);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    transition: color 0.2s;
}

.docs-category-header:hover {
    color: var(--text-secondary);
}

.docs-category-header .chevron {
    transition: transform 0.2s;
    font-size: 0.6rem;
    line-height: 1;
}

.docs-category-section.collapsed .chevron {
    transform: rotate(-90deg);
}

.docs-category-section.collapsed .docs-category-list {
    display: none;
}

.docs-category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.docs-category-list li {
    margin: 0;
}

.docs-category-list a {
    display: block;
    padding: 0.375rem 0.5rem 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
    line-height: 1.4;
}

.docs-category-list a:hover {
    background: var(--surface-raised);
    color: var(--text-primary);
}

.docs-category-list a.active {
    background: #FFF1F2;
    color: var(--rose);
    font-weight: 600;
}

/* Mobile sidebar toggle */
.docs-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 200;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--surface-border);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    align-items: center;
    justify-content: center;
}

.docs-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 149;
    background: rgba(0, 0, 0, 0.3);
}

/* ============================================================
   Content Area
   ============================================================ */

.docs-content {
    padding: 2rem 2.5rem 4rem;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}

/* Breadcrumbs */
.docs-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.docs-breadcrumbs a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.docs-breadcrumbs a:hover {
    color: var(--rose);
}

.docs-breadcrumbs .sep {
    color: var(--surface-border);
    font-size: 0.75rem;
}

.docs-breadcrumbs .current {
    color: var(--text-secondary);
}

/* Article header */
.docs-content h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.docs-reading-time {
    display: inline-block;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Table of Contents */
.docs-toc {
    background: var(--surface-raised);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
}

.docs-toc-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.docs-toc ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

.docs-toc > ol > li {
    margin-bottom: 0.25rem;
}

.docs-toc ol ol {
    padding-left: 1rem;
    margin-top: 0.25rem;
}

.docs-toc a {
    display: inline-block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.125rem 0;
    transition: color 0.2s;
    line-height: 1.5;
}

.docs-toc a:hover {
    color: var(--rose);
}

.docs-toc a.active {
    color: var(--rose);
    font-weight: 600;
}

/* ============================================================
   Article Body Typography
   ============================================================ */

.docs-body h2 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.docs-body h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.docs-body p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.docs-body ul,
.docs-body ol {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.8;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.docs-body li {
    margin-bottom: 0.35rem;
}

.docs-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

.docs-body code {
    background: var(--surface-raised);
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    padding: 0.15rem 0.35rem;
    font-size: 0.875em;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
}

.docs-body pre {
    background: var(--surface-raised);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.docs-body pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.8125rem;
    line-height: 1.6;
}

.docs-body blockquote {
    border-left: 3px solid var(--rose-light);
    padding: 0.75rem 1rem;
    margin: 0 0 1rem;
    background: #FFF1F2;
    border-radius: 0 8px 8px 0;
}

.docs-body blockquote p {
    margin-bottom: 0;
    color: var(--text-secondary);
}

.docs-body a {
    color: var(--rose);
    text-decoration: underline;
    text-decoration-color: var(--rose-light);
    text-underline-offset: 2px;
    transition: text-decoration-color 0.2s;
}

.docs-body a:hover {
    text-decoration-color: var(--rose);
}

.docs-body details {
    background: var(--surface-raised);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.docs-body details summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.docs-body details[open] summary {
    margin-bottom: 0.5rem;
}

.docs-body details ul,
.docs-body details ol {
    font-size: 0.875rem;
}

.docs-body hr {
    border: none;
    border-top: 1px solid var(--surface-border);
    margin: 2rem 0;
}

/* Screenshot in doc article */
.doc-screenshot {
    margin: 1.5rem auto;
    text-align: center;
}

.doc-screenshot img {
    max-width: 320px;
    width: 100%;
    border-radius: 36px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.10),
        0 6px 20px rgba(0, 0, 0, 0.06);
}

.doc-screenshot figcaption {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

/* ============================================================
   Prev / Next Navigation
   ============================================================ */

.docs-prev-next {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--surface-border);
}

.docs-prev-next a {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    max-width: 48%;
}

.docs-prev-next a:hover {
    border-color: var(--rose-light);
    box-shadow: 0 2px 8px rgba(201, 64, 88, 0.06);
}

.docs-prev-next .nav-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.docs-prev-next .nav-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--rose);
}

.docs-prev-next .next {
    text-align: right;
    margin-left: auto;
}

/* ============================================================
   Docs Index Page
   ============================================================ */

.docs-index {
    padding: 6rem 0 4rem;
    max-width: 960px;
    margin: 0 auto;
}

.docs-index h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.docs-index .docs-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.docs-index .docs-search {
    max-width: 400px;
    margin-bottom: 2.5rem;
}

.docs-index-category {
    margin-bottom: 2.5rem;
}

.docs-index-category h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--surface-border);
}

.docs-index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.docs-index-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: block;
}

.docs-index-card:hover {
    border-color: #FECDD3;
    box-shadow: 0 4px 16px rgba(201, 64, 88, 0.06);
}

.docs-index-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.docs-index-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
}

/* ============================================================
   Responsive — 768px
   ============================================================ */

@media (max-width: 768px) {
    .docs-layout {
        grid-template-columns: 1fr;
    }

    .docs-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 150;
        transition: left 0.3s ease;
        padding-top: 1.5rem;
    }

    .docs-sidebar.open {
        left: 0;
    }

    .docs-sidebar-toggle {
        display: flex;
    }

    .docs-sidebar-overlay.open {
        display: block;
    }

    .docs-content {
        padding: 1.5rem 1.25rem 3rem;
    }

    .docs-content h1 {
        font-size: 1.5rem;
    }

    .docs-toc {
        /* Collapse into details on mobile */
    }

    .docs-prev-next {
        flex-direction: column;
    }

    .docs-prev-next a {
        max-width: 100%;
    }

    .docs-prev-next .next {
        text-align: left;
    }

    .doc-screenshot img {
        max-width: 260px;
    }

    .docs-index {
        padding: 5rem 1.25rem 3rem;
    }

    .docs-index h1 {
        font-size: 1.75rem;
    }

    .docs-index-grid {
        grid-template-columns: 1fr;
    }
}
