/* xity.dev — Generative Developer Portal
   Palette: Circuit Diagram
   - Paper White:   #FAFBFC
   - Code Block:    #F0F3F8
   - Carbon Black:  #1A1A1A
   - Graphite:      #3A3A3A
   - Canvas Dark:   #0E1117
   - Signal Blue:   #3B82F6
   - Trace Green:   #10B981
   - Warning Amber: #F59E0B
   - Canvas Label:  #8A9BB0
   - Grid Faint:    #E2E8F0
*/

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

html, body {
    width: 100%;
    background: #FAFBFC;
    color: #3A3A3A;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
}

/* ============== Layout ============== */
.layout {
    display: grid;
    grid-template-columns: 55% 45%;
    width: 100%;
    min-height: 100vh;
    position: relative;
}

/* ============== Documentation Panel (left 55%) ============== */
.doc-panel {
    background: #FAFBFC;
    padding: 56px 40px 80px 80px;
    border-right: 1px solid #E2E8F0;
    position: relative;
}

.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 96px;
    padding-bottom: 24px;
    border-bottom: 1px solid #E2E8F0;
}

.brand-line {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-mark {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: #1A1A1A;
    letter-spacing: -0.02em;
}

.brand-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #8A9BB0;
    letter-spacing: 0.01em;
}

.kbd-hint {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kbd {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #1A1A1A;
    background: #F0F3F8;
    border: 1px solid #E2E8F0;
    border-radius: 4px;
    padding: 3px 8px;
}

.kbd-label {
    font-family: 'Overpass Mono', 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 300;
    color: #8A9BB0;
}

/* ============== Sections ============== */
.doc-article {
    max-width: 640px;
}

.doc-section {
    padding: 64px 0 48px;
    position: relative;
    min-height: 80vh;
}

.doc-section:first-of-type {
    padding-top: 0;
}

.section-tag {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.section-index {
    color: #8A9BB0;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.section-algo {
    color: #3B82F6;
    background: #F0F3F8;
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid #E2E8F0;
}

.section-title {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 700;
    color: #1A1A1A;
    letter-spacing: -0.025em;
    line-height: 1.12;
    margin-bottom: 28px;
}

#section-1 .section-title {
    font-size: 56px;
}

.doc-section h2.section-title {
    font-size: 40px;
}

.doc-section .lead {
    font-size: 18px;
    line-height: 1.7;
    color: #1A1A1A;
    margin-bottom: 22px;
    font-weight: 400;
}

.doc-section p {
    font-size: 16px;
    line-height: 1.75;
    color: #3A3A3A;
    margin-bottom: 22px;
}

/* ============== Code styles ============== */
code.inline {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: #1A1A1A;
    background: #F0F3F8;
    border-radius: 4px;
    padding: 2px 6px;
    border: 1px solid #E2E8F0;
}

.code-block {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.65;
    color: #1A1A1A;
    background: #F0F3F8;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: 16px 18px;
    margin: 22px 0 28px;
    overflow-x: auto;
    position: relative;
}

.code-block::before {
    content: "// snippet";
    position: absolute;
    top: -10px;
    left: 14px;
    font-size: 10px;
    color: #8A9BB0;
    background: #FAFBFC;
    padding: 0 6px;
    font-family: 'Overpass Mono', 'JetBrains Mono', monospace;
    font-weight: 300;
    letter-spacing: 0.05em;
}

.code-block code {
    font-family: inherit;
    color: inherit;
    background: none;
    padding: 0;
    border: none;
    white-space: pre;
}

/* ============== Generative HR (Cellular Automaton strip) ============== */
canvas.rule-hr {
    display: block;
    width: 100%;
    height: 8px;
    margin: 40px 0 16px;
    background: transparent;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ============== Footer ============== */
.doc-footer {
    margin-top: 96px;
    padding-top: 48px;
    border-top: 1px solid #E2E8F0;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 32px;
    margin-bottom: 32px;
}

.footer-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-label {
    font-family: 'Overpass Mono', 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 300;
    color: #8A9BB0;
    letter-spacing: 0.05em;
}

.footer-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: #1A1A1A;
}

.footer-note {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #8A9BB0;
    font-style: italic;
}

/* ============== Canvas Panel (right 45%) ============== */
.canvas-panel {
    background: #0E1117;
    position: sticky;
    top: 0;
    height: 100vh;
    align-self: start;
    overflow: hidden;
}

.generative-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #0E1117;
}

/* HUD Overlays */
.canvas-hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hud-row {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}

.hud-bottom {
    justify-content: flex-start;
}

.hud-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 60px;
}

.hud-label {
    font-family: 'Overpass Mono', 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 300;
    color: #8A9BB0;
    text-transform: lowercase;
    letter-spacing: 0.08em;
}

.hud-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    color: #E2E8F0;
    letter-spacing: 0.01em;
    transition: color 0.6s ease;
}

#hudAlgo {
    color: #3B82F6;
}

/* HUD corner brackets */
.hud-corner {
    position: absolute;
    width: 14px;
    height: 14px;
    border-color: #8A9BB0;
    opacity: 0.6;
}

.hud-tl {
    top: 14px;
    left: 14px;
    border-top: 1px solid;
    border-left: 1px solid;
}

.hud-tr {
    top: 14px;
    right: 14px;
    border-top: 1px solid;
    border-right: 1px solid;
}

.hud-bl {
    bottom: 14px;
    left: 14px;
    border-bottom: 1px solid;
    border-left: 1px solid;
}

.hud-br {
    bottom: 14px;
    right: 14px;
    border-bottom: 1px solid;
    border-right: 1px solid;
}

/* Section nav dots — vertical, right side */
.section-nav {
    position: absolute;
    top: 50%;
    right: 28px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 18px;
    pointer-events: auto;
}

.nav-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #8A9BB0;
    background: transparent;
    text-decoration: none;
    position: relative;
    transition: background 0.35s ease, border-color 0.35s ease, transform 0.35s ease;
}

.nav-dot:hover {
    border-color: #3B82F6;
    transform: scale(1.18);
}

.nav-dot.active {
    background: #3B82F6;
    border-color: #3B82F6;
}

.nav-dot-num {
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Overpass Mono', 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 300;
    color: #8A9BB0;
    opacity: 0;
    transition: opacity 0.3s ease, color 0.3s ease;
    white-space: nowrap;
}

.nav-dot:hover .nav-dot-num,
.nav-dot.active .nav-dot-num {
    opacity: 1;
}

.nav-dot.active .nav-dot-num {
    color: #3B82F6;
}

/* ============== Selection / scrollbar ============== */
::selection {
    background: #3B82F6;
    color: #FAFBFC;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #FAFBFC;
}

::-webkit-scrollbar-thumb {
    background: #E2E8F0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8A9BB0;
}

/* ============== Responsive — mobile collapses to single column, canvas hidden ============== */
@media (max-width: 768px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .doc-panel {
        padding: 32px 24px 64px;
        border-right: none;
    }

    .doc-header {
        flex-direction: column;
        gap: 16px;
        margin-bottom: 56px;
    }

    .canvas-panel {
        display: none;
    }

    #section-1 .section-title {
        font-size: 38px;
    }

    .doc-section h2.section-title {
        font-size: 28px;
    }

    .doc-section .lead {
        font-size: 17px;
    }

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

@media (max-width: 1100px) and (min-width: 769px) {
    .doc-panel {
        padding: 40px 32px 64px 56px;
    }

    #section-1 .section-title {
        font-size: 44px;
    }

    .doc-section h2.section-title {
        font-size: 32px;
    }
}
