/* ============================================================
   Site-specific layout styles
   Page structure, docs layout, etc.
   ============================================================ */

/* ---- Docs Index Grid ---- */

.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}
.docs-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.2rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-subtle);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.docs-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.docs-card svg {
    width: 32px;
    height: 32px;
    color: var(--accent);
    margin-bottom: 0.5rem;
}
.docs-card-icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}
img.docs-card-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    image-rendering: pixelated;
}
.docs-card strong {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    margin-bottom: 0.3rem;
}
.docs-card span:not(.docs-card-icon) {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ---- Docs Layout ---- */

.docs-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    max-width: 100ch;
    margin: 0 auto;
}
#toc-wrapper {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 0.85rem;
    flex-shrink: 0;
}
#toc-header h1 {
    font-size: 1.1rem;
    margin: 0 0 2px 0;
    text-align: center;
}
#toc-header h1 .header-anchor {
    display: none;
}
#toc-header sub-title {
    display: block;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
    font-family: var(--font-heading);
}
#toc-logo {
    display: block;
    width: 48px;
    height: auto;
    image-rendering: pixelated;
    margin: 0 auto 6px;
}
#docs-nav ul {
    margin: 0;
    padding-left: 1.2em;
}
#docs-nav li {
    margin: 2px 0;
    line-height: 1.4;
}
#docs-nav a {
    text-decoration: none;
    color: var(--text-muted);
}
#docs-nav a:hover {
    color: var(--accent);
}
#docs-nav a.toc-active {
    color: var(--accent);
    font-weight: 600;
}
#docs-content {
    min-width: 0;
    flex: 1;
    max-width: 80ch;
}
#docs-content pre {
    overflow-x: auto;
}
@media (min-width: 100ch) {
    #toc-wrapper {
        position: sticky;
        top: 60px;
        width: 24ch;
        max-height: calc(100vh - 80px);
        display: flex;
        flex-direction: column;
        font-size: 0.8rem;
        overflow: hidden;
    }
    #toc-header {
        flex-shrink: 0;
    }
    #docs-nav {
        overflow-y: auto;
        flex: 1;
        width: 100%;
        margin: 0 -16px;
        padding: 0 16px;
        box-sizing: content-box;
    }
    #docs-nav li {
        margin: 1px 0;
    }
}
@media (max-width: 100ch) {
    .docs-layout {
        flex-direction: column;
        max-width: 100%;
    }
    #toc-wrapper {
        max-height: 40vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        max-width: 100%;
    }
    #docs-nav {
        overflow-y: auto;
        flex: 1;
    }
    #docs-content {
        max-width: 100%;
        overflow-x: auto;
    }
}
#docs-content:target {
    outline: none;
}

/* ---- Docs Page Nav (prev/next) ---- */

.docs-page-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.docs-page-nav a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text);
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: border-color 0.15s;
}
.docs-page-nav a:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.docs-page-nav svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.docs-page-nav .next { margin-left: auto; }
