/* ============================================
   FRAY DOCS — Dark Theme
   ============================================ */

:root {
    --bg: #0a0a0b;
    --surface: #111113;
    --surface-2: #1a1a1e;
    --border: #2a2a2e;
    --text: #e4e4e7;
    --text-muted: #8b8b94;
    --accent: #6366f1;
    --accent-2: #818cf8;
    --green: #22c55e;
    --cyan: #06b6d4;
    --red: #ef4444;
    --orange: #f97316;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 0.88em;
}

/* ============================================
   TOP BAR
   ============================================ */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 56px;
    background: rgba(10,10,11,0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
}

.topbar-inner {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none !important;
    color: var(--text);
    font-weight: 600;
}

.topbar-logo img { border-radius: 4px; }

.topbar-title { font-size: 0.95rem; }

.topbar-version {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 500;
}

.topbar-search-wrap {
    position: relative;
    width: 220px;
    flex-shrink: 0;
    margin-left: auto;
}

.topbar-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.topbar-search-input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px 6px 30px;
    font-size: 0.82rem;
    color: var(--text);
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.topbar-search-input::placeholder { color: var(--text-muted); opacity: 1; }
.topbar-search-input:focus {
    border-color: var(--accent);
    background: var(--surface);
}
/* remove browser default search cancel button */
.topbar-search-input::-webkit-search-cancel-button { display: none; }

.topbar-nav {
    display: flex;
    gap: 20px;
    font-size: 0.82rem;
}

.topbar-nav a {
    color: var(--text-muted);
    text-decoration: none;
}

.topbar-nav a:hover { color: var(--text); }

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
}

/* ============================================
   LAYOUT
   ============================================ */

.layout {
    display: flex;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    width: 260px;
    min-width: 260px;
    border-right: 1px solid var(--border);
    padding: 24px 0;
    overflow-y: auto;
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    background: var(--bg);
}

.sidebar-section {
    padding: 0 20px;
    margin-bottom: 24px;
}

.sidebar-heading {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-left: 12px;
}

.sidebar-link {
    display: block;
    padding: 6px 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none !important;
    border-radius: 6px;
    transition: all 0.15s;
}

.sidebar-link:hover {
    color: var(--text);
    background: var(--surface);
}

.sidebar-link.active {
    color: var(--accent-2);
    background: rgba(99, 102, 241, 0.1);
    font-weight: 500;
}

/* ============================================
   CONTENT
   ============================================ */

.content {
    flex: 1;
    min-width: 0;
    padding: 40px 48px 80px;
}

.doc-lead {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 36px 0 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.content h2:first-of-type {
    border-top: none;
    padding-top: 0;
}

.content h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 24px 0 8px;
}

.content p {
    margin-bottom: 12px;
    color: var(--text);
    line-height: 1.7;
}

.content ul, .content ol {
    margin: 8px 0 16px 24px;
}

.content li {
    margin-bottom: 6px;
    color: var(--text);
    line-height: 1.6;
}

.content pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    overflow-x: auto;
    margin: 12px 0 20px;
    font-size: 0.85rem;
    line-height: 1.8;
}

.content pre code {
    font-size: 0.85rem;
}

.content code:not(pre code) {
    background: var(--surface-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

.content .c { color: var(--text-muted); }

.content pre.output { border-left: 3px solid var(--accent); }
.content pre.output .g { color: #22c55e; }
.content pre.output .r { color: #ef4444; }
.content pre.output .y { color: #eab308; }
.content pre.output .b { color: #818cf8; }
.content pre.output .cy { color: #06b6d4; }
.content pre.output .dim { color: #555; }
.content pre.output .bold { font-weight: 600; color: #fff; }

.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 20px;
    font-size: 0.9rem;
}

.content th, .content td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.content th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.content td code {
    color: var(--accent-2);
}

.content tr:hover {
    background: var(--surface);
}

.check-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 12px 0 20px;
}

.check-grid div {
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.88rem;
    line-height: 1.5;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 56px;
        z-index: 50;
        width: 280px;
        min-width: 280px;
        transition: left 0.25s ease;
        box-shadow: none;
    }

    .sidebar.open {
        left: 0;
        box-shadow: 4px 0 20px rgba(0,0,0,0.5);
    }

    .sidebar-toggle { display: block; }
    .topbar-nav { display: none; }
    .topbar-search-wrap { display: none; }
    .search-dropdown { left: 0; }

    .content {
        padding: 24px 20px 60px;
    }

    .check-grid { grid-template-columns: 1fr; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .content { padding: 32px 32px 60px; }
}

/* ============================================
   Callout blocks
   ============================================ */

.callout {
    border-left: 3px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 6px 6px 0;
    padding: 14px 18px;
    margin: 20px 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-muted);
}

.callout strong {
    color: var(--text);
    display: block;
    margin-bottom: 4px;
}

.callout a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* New feature banner — blue accent */
.callout-new {
    border-left-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.callout-new strong {
    color: #60a5fa;
}

/* Tip — green accent */
.callout-tip {
    border-left-color: #22c55e;
    background: rgba(34, 197, 94, 0.08);
}

.callout-tip strong {
    color: #4ade80;
}

/* Warning — yellow accent */
.callout-warning {
    border-left-color: #eab308;
    background: rgba(234, 179, 8, 0.08);
}

.callout-warning strong {
    color: #facc15;
}

/* ============================================
   SEARCH (topbar)
   ============================================ */

.search-dropdown {
    display: none;
    position: fixed;
    top: 56px; /* height of topbar */
    left: 260px; /* sidebar width */
    right: 0;
    max-height: calc(100vh - 56px - 40px);
    overflow-y: auto;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    z-index: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.search-dropdown.open { display: block; }

.search-result-item {
    display: block;
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 24px;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
    user-select: none;
}

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover {
    background: rgba(99,102,241,0.08);
    color: var(--text);
}

.search-result-item strong {
    display: block;
    font-size: 0.84rem;
    color: var(--text);
    font-weight: 500;
    margin-bottom: 2px;
}

.search-result-page {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.search-result-body {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 2px;
    opacity: 0.8;
}

.search-result-item mark {
    background: rgba(99,102,241,0.25);
    color: var(--accent-2);
    border-radius: 2px;
    padding: 0 2px;
    font-style: normal;
}

.search-no-results {
    padding: 20px 24px;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 720px;
    margin: 0 auto;
}

/* ============================================
   COPY BUTTON
   ============================================ */

.pre-wrap {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-family: inherit;
    padding: 3px 8px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, border-color 0.15s;
    line-height: 1.6;
}

.pre-wrap:hover .copy-btn { opacity: 1; }

.copy-btn:hover {
    color: var(--text);
    border-color: var(--accent);
}

.copy-btn.copied {
    opacity: 1;
    color: var(--green);
    border-color: var(--green);
}


