/* SUPERCLAWS Docs — Stylesheet */
/* Bootstrap 5.3.3 + Krona One + Instrument Sans + Alpine.js */

/* ===== DESIGN TOKENS (mirrors superclaws.io) ===== */
:root,
[data-bs-theme="dark"] {
    --sc-bg: #0f0f0f;
    --sc-card: #1a1a1a;
    --sc-card2: #252525;
    --sc-text: #ffffff;
    --sc-muted: #a0a0a0;
    --sc-accent: #808080;
    --sc-accent-hover: #666666;
    --sc-border: #333333;
    --sc-success: #22c55e;
    --sc-sidebar-w: 240px;
    --sc-toc-w: 220px;
    --sc-navbar-h: 57px;
}

[data-bs-theme="light"] {
    --sc-bg: #ffffff;
    --sc-card: #f7f7f7;
    --sc-card2: #efefef;
    --sc-text: #0f0f0f;
    --sc-muted: #666666;
    --sc-accent: #555555;
    --sc-accent-hover: #333333;
    --sc-border: #e0e0e0;
    --sc-success: #16a34a;
}

/* ===== BASE ===== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Instrument Sans', sans-serif;
    background: var(--sc-bg);
    color: var(--sc-text);
    margin: 0;
    padding: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--sc-text); text-decoration: none; }
img { max-width: 100%; }

/* ===== TYPOGRAPHY ===== */
.sc-wordmark {
    font-family: 'Krona One', sans-serif;
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--sc-text);
    text-decoration: none;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.sc-wordmark:hover { color: var(--sc-text); }

.sc-wordmark-badge {
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sc-muted);
    border: 1px solid var(--sc-border);
    padding: 0.15rem 0.5rem;
    margin-left: 0.5rem;
    vertical-align: middle;
    white-space: nowrap;
}

.sc-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sc-muted);
}

.sc-heading {
    font-family: 'Krona One', sans-serif;
    font-weight: 400;
    color: var(--sc-text);
    line-height: 1.2;
}

/* ===== NAVBAR ===== */
.sc-navbar {
    background: var(--sc-bg);
    border-bottom: 1px solid var(--sc-border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--sc-navbar-h);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.sc-navbar .sc-nav-link {
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--sc-muted);
    text-decoration: none;
    transition: color 0.2s;
    padding: 0.25rem 0;
    white-space: nowrap;
}
.sc-navbar .sc-nav-link:hover { color: var(--sc-text); }

/* ===== SEARCH ===== */
.sc-search-wrap {
    position: relative;
    width: 220px;
    flex-shrink: 0;
}

.sc-search-input {
    width: 100%;
    background: var(--sc-card);
    border: 1px solid var(--sc-border);
    border-radius: 0;
    color: var(--sc-text);
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.83rem;
    padding: 0.4rem 2.25rem 0.4rem 0.75rem;
    transition: border-color 0.2s;
    outline: none;
}
.sc-search-input::placeholder { color: var(--sc-muted); }
.sc-search-input:focus { border-color: var(--sc-accent); }

.sc-search-icon {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sc-muted);
    pointer-events: none;
    font-size: 0.875rem;
}

.sc-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--sc-card);
    border: 1px solid var(--sc-border);
    z-index: 2000;
    max-height: 320px;
    overflow-y: auto;
}

.sc-search-result-item {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--sc-border);
    text-decoration: none;
    transition: background 0.15s;
}
.sc-search-result-item:last-child { border-bottom: none; }
.sc-search-result-item:hover { background: var(--sc-card2); }

.sc-search-result-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--sc-text);
    display: block;
    margin-bottom: 0.15rem;
}
.sc-search-result-desc {
    font-size: 0.775rem;
    color: var(--sc-muted);
    line-height: 1.5;
}
.sc-search-empty {
    padding: 0.875rem 1rem;
    font-size: 0.83rem;
    color: var(--sc-muted);
}

/* ===== BUTTONS ===== */
.btn-sc {
    border-radius: 0;
    font-family: 'Instrument Sans', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.625rem 1.5rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1.4;
}
.btn-sc:focus { outline: none; box-shadow: none; }

.docs-content a.btn-sc-primary,
a.btn-sc-primary {
    background: var(--sc-text) !important;
    color: var(--sc-bg) !important;
    border-color: var(--sc-text) !important;
    text-decoration: none !important;
}
.docs-content a.btn-sc-primary:hover,
a.btn-sc-primary:hover {
    background: var(--sc-accent-hover) !important;
    border-color: var(--sc-accent-hover) !important;
    color: #ffffff !important;
}

.btn-sc-ghost {
    background: transparent;
    color: var(--sc-muted);
    border-color: var(--sc-border);
}
.btn-sc-ghost:hover { color: var(--sc-text); border-color: var(--sc-accent); }

/* ===== THEME TOGGLE ===== */
.btn-theme {
    background: transparent;
    border: 1px solid var(--sc-border);
    color: var(--sc-muted);
    border-radius: 0;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    flex-shrink: 0;
    padding: 0;
}
.btn-theme:hover { color: var(--sc-text); border-color: var(--sc-text); }

/* ===== DOCS LAYOUT ===== */
.docs-layout {
    display: flex;
    min-height: calc(100vh - var(--sc-navbar-h));
}

/* --- Left Sidebar --- */
.docs-sidebar {
    width: var(--sc-sidebar-w);
    flex-shrink: 0;
    border-right: 1px solid var(--sc-border);
    position: sticky;
    top: var(--sc-navbar-h);
    height: calc(100vh - var(--sc-navbar-h));
    overflow-y: auto;
    padding: 1.5rem 0;
    transition: background-color 0.2s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--sc-border) transparent;
}

.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--sc-border); }

.docs-nav-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sc-muted);
    padding: 1.25rem 1.25rem 0.4rem;
}

.docs-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--sc-muted);
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
    border-left: 2px solid transparent;
    line-height: 1.4;
}
.docs-nav-link:hover { color: var(--sc-text); background: var(--sc-card); }
.docs-nav-link.active {
    color: var(--sc-text);
    border-left-color: var(--sc-text);
    background: var(--sc-card);
    font-weight: 600;
}
.docs-nav-link i { font-size: 0.9rem; flex-shrink: 0; }

/* --- Main Content --- */
.docs-main {
    flex: 1;
    min-width: 0;
    display: flex;
}

.docs-content {
    flex: 1;
    min-width: 0;
    padding: 2.75rem 2.5rem 4rem;
    max-width: 760px;
}

/* --- Right TOC --- */
.docs-toc {
    width: var(--sc-toc-w);
    flex-shrink: 0;
    padding: 2.75rem 1.25rem 2rem 0;
    position: sticky;
    top: var(--sc-navbar-h);
    height: calc(100vh - var(--sc-navbar-h));
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--sc-border) transparent;
}
.docs-toc::-webkit-scrollbar { width: 3px; }
.docs-toc::-webkit-scrollbar-thumb { background: var(--sc-border); }

.docs-toc-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sc-muted);
    margin-bottom: 0.75rem;
    display: block;
}

.docs-toc-link {
    display: block;
    font-size: 0.8rem;
    color: var(--sc-muted);
    text-decoration: none;
    padding: 0.3rem 0 0.3rem 0.75rem;
    border-left: 1px solid var(--sc-border);
    line-height: 1.45;
    transition: color 0.15s, border-color 0.15s;
}
.docs-toc-link:hover { color: var(--sc-text); }
.docs-toc-link.active { color: var(--sc-text); border-left-color: var(--sc-text); font-weight: 600; }
.docs-toc-link.toc-h3 { padding-left: 1.5rem; font-size: 0.77rem; }

/* ===== CONTENT TYPOGRAPHY ===== */
.docs-content h1 {
    font-family: 'Krona One', sans-serif;
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    font-weight: 400;
    color: var(--sc-text);
    line-height: 1.2;
    margin: 0 0 0.875rem;
}

.docs-content .docs-page-meta {
    font-size: 0.83rem;
    color: var(--sc-muted);
    margin-bottom: 2rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--sc-border);
    line-height: 1.65;
}

.docs-content h2 {
    font-family: 'Krona One', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    color: var(--sc-text);
    margin: 2.75rem 0 0.875rem;
    letter-spacing: 0.01em;
    padding-top: 0.5rem;
}

.docs-content h3 {
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--sc-text);
    margin: 1.75rem 0 0.625rem;
}

.docs-content p {
    font-size: 0.925rem;
    color: var(--sc-muted);
    line-height: 1.85;
    margin: 0 0 1rem;
}

.docs-content ul, .docs-content ol {
    padding-left: 1.4rem;
    margin: 0 0 1rem;
}

.docs-content li {
    font-size: 0.925rem;
    color: var(--sc-muted);
    line-height: 1.85;
    margin-bottom: 0.3rem;
}

.docs-content a {
    color: var(--sc-text);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--sc-border);
    transition: text-decoration-color 0.15s;
}
.docs-content a:hover { text-decoration-color: var(--sc-accent); }

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

.docs-content code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.82rem;
    background: var(--sc-card2);
    border: 1px solid var(--sc-border);
    padding: 0.1rem 0.35rem;
    color: var(--sc-text);
}

.docs-content pre {
    background: var(--sc-card);
    border: 1px solid var(--sc-border);
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin: 0 0 1.5rem;
}
.docs-content pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.7;
}

.docs-content blockquote {
    border-left: 3px solid var(--sc-border);
    margin: 0 0 1rem;
    padding: 0.5rem 0 0.5rem 1.25rem;
}
.docs-content blockquote p { margin: 0; font-style: italic; }

/* ===== DOCS COMPONENTS ===== */
.docs-callout {
    border: 1px solid var(--sc-border);
    border-left: 3px solid var(--sc-accent);
    background: var(--sc-card);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    font-size: 0.9rem;
    color: var(--sc-muted);
    line-height: 1.7;
}
.docs-callout.callout-tip { border-left-color: var(--sc-success); }
.docs-callout.callout-info { border-left-color: #3b9ede; }
.docs-callout strong { color: var(--sc-text); display: block; margin-bottom: 0.25rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }

.docs-card {
    background: var(--sc-card);
    border: 1px solid var(--sc-border);
    padding: 1.5rem;
    height: 100%;
    transition: border-color 0.2s;
    text-decoration: none !important;
    display: block;
}
.docs-card:hover { border-color: var(--sc-accent); }
.docs-card-icon { font-size: 1.35rem; color: var(--sc-muted); margin-bottom: 0.875rem; display: block; }
.docs-card-title { font-size: 0.9rem; font-weight: 600; color: var(--sc-text); margin-bottom: 0.4rem; text-decoration: none; }
.docs-card-desc { font-size: 0.83rem; color: var(--sc-muted); line-height: 1.65; margin: 0; }

.docs-step-row {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    padding: 1.5rem;
    border: 1px solid var(--sc-border);
    margin-bottom: 1rem;
    background: var(--sc-card);
    transition: border-color 0.2s;
}
.docs-step-row:hover { border-color: var(--sc-accent); }
.docs-step-num {
    font-family: 'Krona One', sans-serif;
    font-size: 1.5rem;
    color: var(--sc-border);
    line-height: 1;
    flex-shrink: 0;
    width: 2rem;
    text-align: center;
    transition: color 0.2s;
}
.docs-step-row:hover .docs-step-num { color: var(--sc-accent); }
.docs-step-body { flex: 1; }
.docs-step-title { font-size: 0.95rem; font-weight: 600; color: var(--sc-text); margin: 0 0 0.35rem; }
.docs-step-desc { font-size: 0.875rem; color: var(--sc-muted); line-height: 1.7; margin: 0; }

.docs-compare-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.docs-compare-card {
    border: 1px solid var(--sc-border);
    padding: 1.25rem;
    background: var(--sc-card);
}
.docs-compare-card.recommended { border-color: var(--sc-text); }
.docs-compare-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sc-muted);
    margin-bottom: 0.5rem;
    display: block;
}
.docs-compare-label.good { color: var(--sc-success); }
.docs-compare-name { font-family: 'Krona One', sans-serif; font-size: 0.9rem; color: var(--sc-text); margin-bottom: 0.75rem; }
.docs-compare-item {
    display: flex;
    gap: 0.5rem;
    font-size: 0.825rem;
    color: var(--sc-muted);
    margin-bottom: 0.35rem;
    line-height: 1.5;
    align-items: flex-start;
}
.docs-compare-item i { font-size: 0.8rem; flex-shrink: 0; margin-top: 0.15rem; }
.docs-compare-item i.bi-check-circle-fill { color: var(--sc-success); }
.docs-compare-item i.bi-x-circle-fill { color: #e05c5c; }
.docs-compare-item i.bi-dash-circle { color: var(--sc-muted); }

.docs-example-block {
    background: var(--sc-card2);
    border: 1px solid var(--sc-border);
    border-left: 3px solid var(--sc-accent);
    padding: 1.1rem 1.25rem;
    margin: 1rem 0 1.5rem;
    font-size: 0.875rem;
    color: var(--sc-text);
    font-style: italic;
    line-height: 1.7;
}
.docs-example-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sc-muted);
    margin-bottom: 0.4rem;
    display: block;
    font-style: normal;
}

.docs-learn-cta {
    background: var(--sc-card);
    border: 1px solid var(--sc-border);
    padding: 1.5rem;
    display: flex;
    gap: 1.25rem;
    align-items: center;
    margin: 2rem 0;
    transition: border-color 0.2s;
    text-decoration: none;
}
.docs-learn-cta:hover { border-color: var(--sc-accent); }
.docs-learn-cta-icon { font-size: 2rem; color: var(--sc-muted); flex-shrink: 0; }
.docs-learn-cta-title { font-size: 0.95rem; font-weight: 600; color: var(--sc-text); margin: 0 0 0.25rem; }
.docs-learn-cta-desc { font-size: 0.83rem; color: var(--sc-muted); margin: 0; line-height: 1.6; }

/* ===== BREADCRUMB ===== */
.docs-breadcrumb {
    font-size: 0.775rem;
    color: var(--sc-muted);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.docs-breadcrumb a { color: var(--sc-muted); text-decoration: none; transition: color 0.15s; }
.docs-breadcrumb a:hover { color: var(--sc-text); }
.docs-breadcrumb i { font-size: 0.65rem; }

/* ===== MOBILE SIDEBAR TOGGLE ===== */
.docs-sidebar-toggle {
    display: none;
    background: var(--sc-bg);
    border: none;
    border-bottom: 1px solid var(--sc-border);
    width: 100%;
    padding: 0.75rem 1.25rem;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--sc-muted);
    cursor: pointer;
    text-align: left;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}
.docs-sidebar-toggle:hover { color: var(--sc-text); }

.docs-sidebar-mobile {
    display: none;
    border-bottom: 1px solid var(--sc-border);
    background: var(--sc-bg);
    padding: 0.5rem 0 1rem;
}
.docs-sidebar-mobile.open { display: block; }

/* ===== FOOTER ===== */
.sc-footer {
    border-top: 1px solid var(--sc-border);
    padding: 2rem 0;
}
.sc-footer-link {
    font-size: 0.83rem;
    color: var(--sc-muted);
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}
.sc-footer-link:hover { color: var(--sc-text); }
.sc-footer-copy { font-size: 0.78rem; color: var(--sc-muted); }

/* ===== INDEX PAGE CARDS ===== */
.docs-index-hero {
    padding: 3rem 0 2.5rem;
    border-bottom: 1px solid var(--sc-border);
    margin-bottom: 2.5rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1199.98px) {
    .docs-toc { width: 190px; }
    :root { --sc-toc-w: 190px; }
}

@media (max-width: 991.98px) {
    .docs-toc { display: none; }
    .docs-content { max-width: 100%; padding: 2rem 1.75rem 3.5rem; }
    :root { --sc-sidebar-w: 200px; }
}

@media (max-width: 767.98px) {
    .docs-sidebar { display: none; }
    .docs-sidebar-toggle { display: flex; }
    .docs-content { padding: 1.5rem 1.25rem 3rem; }
    .sc-search-wrap { width: 160px; }
    .docs-compare-row { grid-template-columns: 1fr; }
    .docs-layout { flex-direction: column; }
    .docs-main { flex-direction: column; }
}

@media (max-width: 575.98px) {
    .sc-search-wrap { display: none; }
    .docs-content { padding: 1.25rem 1rem 2.5rem; }
}
