/* ============================================================================
   Documentation.

   Moved out of the template. It used to live in a <style> block nested inside
   base.html's own <style>, which closes the outer element at the first
   </style> — so the whole page sheet was being appended to base's, and CSS
   error recovery silently ate the first rule every time. (.gradient-dot was
   the casualty here; nothing looked broken because components.css happened to
   declare it too.)

   As a linked sheet it also loads after ui-system.css, so these rules now win
   the cascade instead of losing to it at equal specificity.
   ========================================================================= */

/* Two-Column Layout — mirrors commands.html */
.commands-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
}

/* Category / TOC Sidebar */
.category-sidebar {
    position: sticky;
    position: -webkit-sticky;
    top: 32px;
    align-self: start;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: transparent;
    border-right: 1px solid var(--border);
    padding-right: 24px;
    scrollbar-width: none;
}
.category-sidebar::-webkit-scrollbar { width: 0; display: none; }

.category-section {
    margin-bottom: 20px;
}

.category-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.01em;
    color: rgba(255, 255, 255, 0.56);
    opacity: 1;
    margin-bottom: 8px;
    padding: 0 12px;
}

.category-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s, opacity 0.15s;
    font-weight: 500;
    font-size: 0.875rem;
    text-align: left;
    margin-bottom: 2px;
    text-decoration: none;
}

.category-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--primary);
}

.category-btn.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--primary);
    font-weight: 600;
}

.category-btn i {
    width: 18px;
    font-size: 0.8125rem;
}

/* Main content column */
.commands-content {
    min-width: 0;
}

/* Crosslink card (to /commands) */
.crosslink-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    margin-bottom: 28px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    text-decoration: none;
    color: #f2f5fa;
    transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s var(--ease-lift);
}

.crosslink-card:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.06));
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.1);
}

.crosslink-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #ffffff, rgba(255, 255, 255, 0.55));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #f2f5fa;
}

.crosslink-card-body { flex: 1; min-width: 0; }

.crosslink-card-title {
    font-size: 0.9375rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.crosslink-card-desc {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
}

.crosslink-card-arrow {
    color: rgba(255, 255, 255, 0.3);
    transition: transform 0.25s var(--ease-lift), color 0.25s;
}

.crosslink-card:hover .crosslink-card-arrow {
    transform: translateX(3px);
    color: #ffffff;
}

/* Docs Sections */
.docs-section {
    margin-bottom: 48px;
    scroll-margin-top: 32px;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.section-heading-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: #f2f5fa;
    flex-shrink: 0;
    background: linear-gradient(135deg, #ffffff, rgba(255, 255, 255, 0.55));
}

.section-heading h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #f2f5fa;
    letter-spacing: -0.025em;
}

.section-intro {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.9375rem;
    margin-bottom: 20px;
    line-height: 1.7;
}

/* Getting-Started step cards */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.step-card {
    padding: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: border-color 0.2s, box-shadow 0.2s var(--ease-lift);
}

.step-card:hover {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.1);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 14px;
    font-variant-numeric: tabular-nums;
}

.step-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #f2f5fa;
    margin-bottom: 6px;
}

.step-card p {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.6;
}

.step-card code {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

/* Command reference card */
.command-card {
    padding: 20px;
    margin-bottom: 14px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: border-color 0.2s, box-shadow 0.2s var(--ease-lift);
}

.command-card:hover {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.1);
}

.command-card h4 {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
}

.command-card p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
    margin-bottom: 12px;
    line-height: 1.6;
}

.command-card p:last-child { margin-bottom: 0; }

.command-card p.note {
    margin-top: 12px;
    margin-bottom: 0;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.8125rem;
}

.command-card p.note code {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    padding: 1px 5px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.usage {
    /* Was rgba(0,0,0,0.3), which composites to almost exactly the page ground
       -- a hole punched through a card. Every nested surface here is a white
       alpha over the ground, never a darker fill. */
    background: var(--surface-2);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 14px 16px;
    margin: 10px 0;
    position: relative;
    overflow-x: auto;
}

.usage code {
    font-family: var(--font-mono);
    /* Was #c9a8dd, a hue no token defines, which split 49 slash commands on
       one page into 41 lilac and 8 grey by which container they sat in. Mono
       already marks these as machine strings; the colour was a second and
       redundant signal. */
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8125rem;
    background: none;
    padding: 0;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
    transition: color 0.2s, background 0.2s, border-color 0.2s, opacity 0.2s;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}
.copy-btn.copied {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.3);
}
.copy-btn.error {
    background: rgba(239, 68, 68, 0.16);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.example {
    background: rgba(255, 255, 255, 0.04);
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 12px;
}

.example strong {
    color: rgba(255, 255, 255, 0.5);
    display: block;
    margin-bottom: 6px;
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0.01em;
}

.example code {
    font-family: var(--font-mono);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8125rem;
    display: block;
    margin-bottom: 4px;
}

/* FAQ cards */
.faq-card {
    padding: 20px;
    margin-bottom: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: border-color 0.2s, box-shadow 0.2s var(--ease-lift);
}

.faq-card:hover {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.1);
}

.faq-card h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #f2f5fa;
    margin-bottom: 8px;
}

.faq-card p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
    line-height: 1.7;
}

.faq-card code {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .commands-layout {
        grid-template-columns: 1fr;
    }
    .category-sidebar {
        position: static;
        border-right: none;
        padding-right: 0;
        padding-bottom: 16px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 20px;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }
    .category-section { margin-bottom: 0; width: 100%; }
    .steps-grid { grid-template-columns: 1fr; }
}
