/* ========================================
   XIAOW.AI - Documentation Layout
   ======================================== */

:root {
    /* Mist iris platinum public palette */
    --color-bg: #fbfbfc;
    --color-surface: #ffffff;
    --color-text: #15151b;
    --color-text-secondary: #575866;
    --color-text-muted: #9d9caf;
    --color-border: rgba(21, 21, 27, 0.08);
    --color-accent: #6768b6;
    --color-accent-secondary: #8e8f9d;

    /* Typography - System fonts for better performance */
    --font-header: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace;
    --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "PingFang SC", "Microsoft YaHei", sans-serif;

    /* Spacing */
    --container-max: 1100px;
    --section-padding: 7rem 0;
    --radius: 12px;
}

/* === Reset === */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}
a {
    color: var(--color-accent);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}
a:hover {
    color: var(--color-accent-secondary);
}

/* === Documentation Layout === */
.doc-layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 2rem;
    gap: 3rem;
}

/* === Sidebar Navigation === */
.sidebar-nav {
    position: sticky;
    top: 80px;
    height: fit-content;
    width: 280px;
    flex-shrink: 0;
}
.sidebar-title {
    font-family: var(--font-header);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--color-text);
}
.sidebar-section {
    margin-bottom: 2.5rem;
}
.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}
.sidebar-list {
    list-style: none;
}
.sidebar-list li {
    margin-bottom: 0.5rem;
}
.sidebar-list a {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    border-radius: 6px;
    transition: all 0.2s ease;
}
.sidebar-list a:hover {
    color: var(--color-text);
    background: var(--color-surface);
}
.sidebar-list a.active {
    color: var(--color-accent);
    background: rgba(15, 15, 15, 0.05);
    font-weight: 500;
}
.sidebar-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--color-accent);
    color: white;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 8px;
}

/* === Main Content === */
.main-content {
    flex: 1;
    min-width: 0;
    max-width: 850px;
}
.doc-header {
    margin-bottom: 3rem;
}
.doc-title {
    font-family: var(--font-header);
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.15;
    margin-bottom: 1.5rem;
    color: var(--color-text);
}
.doc-desc {
    font-size: 1.25rem;
    color: var(--color-text-secondary);
    line-height: 1.8;
}

/* === Content Sections === */
.doc-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--color-text-secondary);
}
.doc-content p {
    margin-bottom: 1.5rem;
    color: var(--color-text-secondary);
}
.doc-content strong {
    color: var(--color-text);
    font-weight: 600;
}
.doc-content a {
    font-weight: 600;
}
.doc-content a:hover {
    text-decoration: underline;
}

/* Headings */
.doc-content h2 {
    font-family: var(--font-header);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 4rem 0 1.75rem;
    color: var(--color-text);
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-border);
}
.doc-content h3 {
    font-size: 1.625rem;
    font-weight: 600;
    margin: 3rem 0 1.25rem;
    color: var(--color-text);
}
.doc-content h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 2rem 0 1rem;
    color: var(--color-text);
}

/* Lists */
.doc-content ul,
.doc-content ol {
    margin: 1.25rem 0 1.75rem 2rem;
}
.doc-content li {
    margin-bottom: 0.75rem;
    color: var(--color-text-secondary);
}

/* Code Blocks */
.code-block {
    background: #0d0d0d;
    border-radius: 12px;
    overflow: hidden;
    margin: 1.5rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
}
.code-language {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: #8b949e;
}
.code-lang-openai { color: #8e8f9d; }
.code-lang-anthropic { color: #9ca3af; }
.code-lang-gemini { color: #555555; }
.code-copy-btn {
    background: #2a2a2a;
    border: 1px solid #3d3d3d;
    color: #9ca3af;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}
.code-copy-btn:hover {
    background: #3d3d3d;
    color: white;
    border-color: #525252;
}
.code-content {
    padding: 1rem;
    overflow-x: auto;
}
.code-content pre {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
}
.code-comment { color: #6b7280; }
.code-string { color: #a5d6ff; }
.code-keyword { color: #f87171; }
.code-function { color: #b58a4a; }
.code-number { color: #fbbf24; }
.code-variable { color: #34d399; }
.code-tag { color: #fca5a5; }
.code-attribute { color: #fcd34d; }

/* Callout Boxes */
.callout {
    padding: 1.25rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}
.callout-info {
    background: #eff6ff;
    border-left: 4px solid #555555;
}
.callout-warning {
    background: #fffbeb;
    border-left: 4px solid #555555;
}
.callout-note {
    background: #f3f4f6;
    border-left: 4px solid #9ca3af;
}
.callout h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
}
.callout p {
    margin: 0;
    color: var(--color-text-secondary);
}

/* API Table */
.api-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--color-border);
}
.api-table th {
    background: var(--color-surface);
    text-align: left;
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.api-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9375rem;
}
.api-table tr:last-child td {
    border-bottom: none;
}
.api-table tr:hover td {
    background: var(--color-surface);
}
.api-table .endpoint {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--color-accent);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-openai { background: #10a37f; color: white; }
.badge-anthropic { background: #111111; color: white; }
.badge-gemini { background: #555555; color: white; }

/* Right Sidebar - On This Page */
.right-sidebar {
    position: sticky;
    top: 80px;
    height: fit-content;
    width: 200px;
    flex-shrink: 0;
}
.right-sidebar-content {
    padding-left: 1rem;
    border-left: 2px solid var(--color-border);
}
.right-sidebar-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1rem;
}
.right-sidebar-list {
    list-style: none;
}
.right-sidebar-list li {
    margin-bottom: 0.5rem;
}
.right-sidebar-list a {
    display: block;
    padding: 0.375rem 0;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    transition: color 0.2s ease;
}
.right-sidebar-list a:hover {
    color: var(--color-accent);
}
.right-sidebar-list a.active {
    color: var(--color-accent);
    font-weight: 500;
}

/* === Footer === */
.doc-footer {
    border-top: 1px solid var(--color-border);
    padding: 2rem 0;
    margin-top: 4rem;
    background: white;
}
.footer-nav {
    display: flex;
    justify-content: space-between;
}
.footer-nav-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.footer-nav-item h4 {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-text);
}
.footer-nav-item a {
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
}
.footer-nav-item a:hover {
    color: var(--color-accent);
}

/* === Responsive === */
@media (max-width: 968px) {
    .doc-layout {
        flex-direction: column;
        padding: 2rem 1rem;
    }
    .sidebar-nav {
        width: 100%;
        position: relative;
        top: 0;
    }
    .right-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .doc-title { font-size: 1.25rem; }
    .sidebar-list a { font-size: 1rem; }
    .code-content pre { font-size: 0.8rem; }
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: #e8e5dc;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: #dcd9d0; }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* API Info Box */
.api-info {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem;
    margin: 1.5rem 0;
}
.api-info-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}
.api-info-row:last-child {
    border-bottom: none;
}
.api-info-row .label {
    font-weight: 600;
    color: var(--color-text);
    min-width: 80px;
}
.api-info-row .value {
    color: var(--color-text-secondary);
}

/* Feature Grid */
.feature-grid {
    display: grid;
    gap: 1.5rem;
    margin: 2rem 0;
}
.feature-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
}
.feature-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}
.feature-desc {
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
}

/* === Mist iris platinum public refresh === */
:root {
    --color-bg: #fbfbfc;
    --color-surface: #ffffff;
    --color-surface-muted: #f0f0f7;
    --color-text: #15151b;
    --color-text-secondary: #575866;
    --color-text-muted: #9d9caf;
    --color-border: rgba(21, 21, 27, 0.07);
    --color-border-light: rgba(21, 21, 27, 0.04);
    --color-border-dark: rgba(21, 21, 27, 0.12);
    --color-accent: #6768b6;
    --color-accent-secondary: #8e8f9d;
    --color-accent-dark: #4f518f;
    --color-accent-subtle: rgba(103, 104, 182, 0.12);
    --color-success: #16a34a;
    --gradient-hero: linear-gradient(135deg, #6768b6 0%, #8e8f9d 100%);
    --container-max: 1140px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --font-header: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
    background-color: var(--color-bg);
    background-image:
        linear-gradient(180deg, rgba(21, 21, 27, 0.032), rgba(251, 251, 252, 0) 300px),
        linear-gradient(rgba(21, 21, 27, 0.026) 1px, transparent 1px),
        linear-gradient(90deg, rgba(21, 21, 27, 0.026) 1px, transparent 1px);
    background-size: auto, 44px 44px, 44px 44px;
    color: var(--color-text);
    overflow-x: hidden;
}

.container {
    width: min(var(--container-max), calc(100% - 48px));
    margin: 0 auto;
}

.doc-layout {
    max-width: var(--container-max);
    padding: 42px 24px 88px;
    gap: 40px;
    align-items: flex-start;
}

.sidebar-nav {
    top: 92px;
    width: 224px;
    max-height: calc(100vh - 116px);
    overflow-y: auto;
    padding: 16px 10px 16px 0;
    scrollbar-width: thin;
}

.sidebar-title {
    font-size: 1.05rem;
    margin-bottom: 1.25rem;
}

.sidebar-section {
    margin-bottom: 1.75rem;
}

.sidebar-section-title {
    letter-spacing: 0.08em;
}

.sidebar-list a {
    font-size: 0.9rem;
    border-radius: 8px;
}

.sidebar-list a:hover {
    background: var(--color-surface-muted);
}

.sidebar-list a.active {
    background: var(--color-accent-subtle);
    box-shadow: inset 3px 0 0 var(--color-accent);
}

.main-content {
    max-width: 820px;
}

.doc-header {
    margin-bottom: 2.5rem;
}

.doc-title {
    font-size: clamp(1.5rem, 3.65vw, 2.65rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: 0.01em;
}

.doc-desc {
    font-size: clamp(1rem, 1.8vw, 1.18rem);
    line-height: 1.75;
}

.doc-content {
    font-size: 1rem;
}

.doc-content h2 {
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    margin-top: 3.5rem;
    border-bottom-width: 1px;
}

.code-block {
    background: #171824;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.code-header {
    background: #202132;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.code-lang-openai { color: #8e8f9d; }
.code-lang-anthropic { color: #9ca3af; }
.code-lang-gemini { color: #8e8f9d; }

.callout {
    border-radius: 12px;
}

.callout-info {
    background: transparent;
    border-left-color: var(--color-accent);
}

.api-table,
.api-info,
.doc-tool-card,
.feature-card,
.protocol-card,
.model-category,
.architecture-diagram,
.arch-box {
    background: var(--color-surface);
    border-color: var(--color-border);
    box-shadow: 0 16px 40px rgba(24, 24, 27, 0.04);
}

.doc-content :not(pre) > code {
    background: transparent;
    color: var(--color-accent);
    padding: 0;
    border: 0;
    border-radius: 0;
}

.right-sidebar,
.doc-layout > .right-sidebar-list {
    display: none !important;
}

@media (max-width: 968px) {
    .doc-layout {
        padding: 32px 20px 72px;
    }

    .sidebar-nav {
        width: 100%;
        max-height: none;
        padding-right: 0;
    }
}
