/**
 * 2network — Documentation Styles
 * Standalone CSS for static doc pages (inherits design tokens inline)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ===== Tokens (inlined for standalone pages) ===== */
:root {
    --brand-blue: #3B82F6;
    --brand-blue-hover: #2563EB;
    --brand-blue-light: #60A5FA;
    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Dark theme (default) */
    --bg-app: #09090B;
    --bg-surface: #1E293B;
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-tertiary: #64748B;
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-medium: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] {
    --bg-app: #F8FAFC;
    --bg-surface: #FFFFFF;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-tertiary: #64748B;
    --border-subtle: rgba(0, 0, 0, 0.05);
    --border-medium: rgba(0, 0, 0, 0.1);
}

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
body { background: var(--bg-app); color: var(--text-primary); line-height: 1.6; }

/* ===== Layout ===== */
.app-container { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-app); position: sticky; top: 0; z-index: 200;
}

.header-left { display: flex; align-items: center; gap: 0.75rem; }

.header-brand {
    display: flex; align-items: center; gap: 0.75rem;
    text-decoration: none; color: inherit;
}

.app-logo {
    width: 36px; height: 36px; background: var(--brand-blue); border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.125rem; color: white;
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.4));
}

.app-name { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.app-name .domain { color: var(--brand-blue); }

.header-right { display: flex; align-items: center; gap: 1rem; }

.doc-nav-link {
    font-size: 0.875rem; font-weight: 500; color: var(--text-secondary);
    text-decoration: none; padding: 0.35rem 0.65rem; border-radius: var(--radius-md);
    transition: color 0.2s, background 0.2s;
}
.doc-nav-link:hover { color: var(--text-primary); background: rgba(59, 130, 246, 0.06); }

.header-icon-btn {
    background: transparent; border: none; cursor: pointer; padding: 0.35rem;
    border-radius: var(--radius-md); color: var(--text-tertiary); display: flex;
    align-items: center; justify-content: center; transition: color 0.2s, background 0.2s;
}
.header-icon-btn:hover { color: var(--brand-blue); background: rgba(59, 130, 246, 0.08); }

/* ===== Doc Main ===== */
.doc-main {
    flex: 1; max-width: 1100px; width: 100%;
    margin: 0 auto; padding: 2rem 1.5rem;
}

.doc-main:has(.doc-article) {
    max-width: 800px;
}

/* ===== Doc Header ===== */
.doc-header { margin-bottom: 2.5rem; }

.doc-back {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.875rem; color: var(--brand-blue); text-decoration: none;
    font-weight: 500; margin-bottom: 1rem;
}
.doc-back:hover { text-decoration: underline; }

.doc-header h1 {
    font-size: 2.25rem; font-weight: 800; letter-spacing: -0.025em;
    margin-bottom: 0.75rem; line-height: 1.2;
}

.doc-description {
    font-size: 1.125rem; color: var(--text-secondary); line-height: 1.7;
    margin-bottom: 1.25rem;
}

.doc-try-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.6rem 1.25rem; background: var(--brand-blue); color: white;
    border-radius: var(--radius-md); font-size: 0.875rem; font-weight: 600;
    text-decoration: none; transition: background 0.2s, transform 0.2s;
}
.doc-try-btn:hover { background: var(--brand-blue-hover); transform: translateY(-1px); }

/* ===== Doc Header Top (back + download) ===== */
.doc-header-top {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1rem;
}

.doc-download-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.45rem 0.85rem; background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3); border-radius: var(--radius-md);
    color: var(--brand-blue-light); font-size: 0.8rem; font-weight: 500;
    font-family: var(--font-sans); cursor: pointer;
    transition: all 0.2s ease;
}
.doc-download-btn:hover {
    background: rgba(59, 130, 246, 0.2); border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
}
[data-theme="light"] .doc-download-btn {
    color: var(--brand-blue); background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.2);
}

/* ===== Doc Search (Hub) ===== */
.doc-search-bar {
    position: relative; max-width: 500px; margin: 0 auto 1.5rem;
}

.doc-search-bar > svg {
    position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
    color: var(--text-tertiary); pointer-events: none;
}

.doc-search-input {
    width: 100%; padding: 0.75rem 2.5rem 0.75rem 2.75rem;
    background: var(--bg-surface); border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl); color: var(--text-primary);
    font-family: var(--font-sans); font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.doc-search-input::placeholder { color: var(--text-tertiary); }
.doc-search-input:focus {
    outline: none; border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.doc-search-clear {
    position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; cursor: pointer; padding: 0.3rem;
    border-radius: 50%; color: var(--text-tertiary); display: flex;
    align-items: center; justify-content: center; transition: color 0.2s, background 0.2s;
}
.doc-search-clear:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.08); }
.hidden { display: none !important; }

.doc-search-count {
    text-align: center; font-size: 0.8rem; color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.doc-no-results {
    text-align: center; padding: 2rem; color: var(--text-tertiary);
    font-size: 0.9rem;
}

/* ===== Doc Sections ===== */
.doc-section {
    margin-bottom: 2rem; padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-subtle);
}
.doc-section:last-child { border-bottom: none; }

.doc-section h2 {
    font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.doc-section p { color: var(--text-secondary); line-height: 1.7; margin-bottom: 0.75rem; }
.doc-section p:last-child { margin-bottom: 0; }

.doc-section ul, .doc-section ol {
    padding-left: 1.5rem; color: var(--text-secondary); line-height: 1.8;
}
.doc-section li { margin-bottom: 0.35rem; }
.doc-section li strong { color: var(--text-primary); }

.doc-steps li { margin-bottom: 0.5rem; }

.doc-section code {
    font-family: var(--font-mono); font-size: 0.85em;
    padding: 0.15rem 0.4rem; background: rgba(59, 130, 246, 0.08);
    border-radius: 4px; color: var(--brand-blue-light);
}

[data-theme="light"] .doc-section code {
    background: rgba(59, 130, 246, 0.06);
    color: var(--brand-blue-hover);
}

/* ===== Related Tools ===== */
.doc-related-links {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem;
}

.doc-related-card {
    display: flex; flex-direction: column; gap: 0.25rem;
    padding: 1rem; background: var(--bg-surface); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); text-decoration: none;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.doc-related-card:hover {
    border-color: var(--border-medium); transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.doc-related-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.doc-related-desc { font-size: 0.8rem; color: var(--text-tertiary); line-height: 1.5; }

/* ===== Docs Hub ===== */
.doc-hub { text-align: center; }
.doc-hub .doc-header h1 { margin-bottom: 0.5rem; }
.doc-hub .doc-description { margin-bottom: 2rem; }

.doc-hub-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 1rem; text-align: left;
}

.doc-hub-card {
    padding: 1.5rem; background: var(--bg-surface); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); text-decoration: none;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.doc-hub-card:hover {
    border-color: var(--brand-blue); transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.doc-hub-card h2 { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.5rem; }
.doc-hub-card p { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 0.75rem; }
.doc-hub-link { font-size: 0.875rem; font-weight: 600; color: var(--brand-blue); }

[data-theme="light"] .doc-hub-card { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); }
[data-theme="light"] .doc-hub-card:hover { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08); }
[data-theme="light"] .doc-related-card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06); }

/* ===== Footer ===== */
.app-footer {
    text-align: center; padding: 1.5rem; border-top: 1px solid var(--border-subtle);
    color: var(--text-tertiary); font-size: 0.75rem;
}
.app-footer p { margin-bottom: 0.35rem; }
.app-footer a { color: var(--brand-blue); text-decoration: none; font-weight: 600; }
.app-footer a:hover { text-decoration: underline; opacity: 0.8; }
.ecosystem-footer { margin-top: 0.5rem; font-size: 0.65rem; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .app-header { padding: 0.75rem 1rem; }
    .doc-main { padding: 1.25rem 1rem; }
    .doc-header h1 { font-size: 1.75rem; }
    .doc-description { font-size: 1rem; }
    .doc-hub-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .doc-hub-grid { grid-template-columns: 1fr; }
    .doc-related-links { grid-template-columns: 1fr; }
}
