/* rust.quest - Rust Language Quest */
/* Colors: #1E1E22, #3E3E42, #D4D4D8, #FF6B35, #569CD6, #6A9955, #4EC9B0, #DCDCAA */

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

body {
    background-color: #1E1E22;
    color: #D4D4D8;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    line-height: 1.7;
    overflow-x: hidden;
}

/* Layout: Split Screen */
#layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

/* Sidebar Terminal */
#sidebar {
    background-color: #1E1E22;
    border-right: 1px solid #3E3E42;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: transform 0.3s ease;
}

#sidebar.collapsed {
    transform: translateX(-240px);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #3E3E42;
    background: #1E1E22;
}

.terminal-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #6A9955;
}

.toggle-btn {
    background: none;
    border: 1px solid #3E3E42;
    color: #D4D4D8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.toggle-btn:hover {
    border-color: #FF6B35;
}

.terminal-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.8;
}

.term-line {
    white-space: nowrap;
}

.indent1 { padding-left: 1.5rem; }
.indent2 { padding-left: 3rem; }
.term-line.blank { height: 1.4rem; }

.term-keyword { color: #569CD6; }
.term-fn { color: #DCDCAA; }
.term-string { color: #6A9955; }
.term-type { color: #4EC9B0; }
.term-comment { color: #6A9955; font-style: italic; }
.term-macro { color: #DCDCAA; }
.term-output { color: #D4D4D8; opacity: 0.7; }
.term-success { color: #6A9955; opacity: 1; }

/* Main Content */
#content {
    grid-column: 2;
}

.content-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 4rem 5rem;
}

.section-inner {
    max-width: 800px;
    width: 100%;
}

/* Hero */
.hero-badge {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    color: #DCDCAA;
    background: rgba(220, 220, 170, 0.1);
    padding: 0.3rem 1rem;
    border: 1px solid rgba(220, 220, 170, 0.3);
    margin-bottom: 2rem;
}

.hero-title {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    color: #D4D4D8;
    letter-spacing: -0.01em;
    line-height: 1.1;
}

.hero-dot {
    color: #FF6B35;
}

.hero-desc {
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    color: #D4D4D8;
    max-width: 550px;
    margin-top: 1.5rem;
    opacity: 0.8;
}

.compile-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.compile-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6A9955;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.compile-text {
    color: #6A9955;
}

/* Chapter Badges */
.chapter-badge {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #FF6B35;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.section-title {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    color: #FF6B35;
    letter-spacing: -0.01em;
    margin-bottom: 1rem;
}

.section-desc {
    font-size: 1.05rem;
    color: #D4D4D8;
    max-width: 600px;
    margin-bottom: 2.5rem;
    opacity: 0.85;
}

/* Borrow Checker Diagrams */
.borrow-diagram {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.borrow-box {
    padding: 1rem 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    position: relative;
    min-width: 100px;
    text-align: center;
}

.borrow-box.owned {
    border: 2px solid #FF6B35;
    color: #FF6B35;
}

.borrow-box.moved {
    border: 2px solid #FF6B35;
    color: #FF6B35;
    opacity: 0.6;
}

.borrow-box.ref {
    border: 2px dashed #569CD6;
    color: #569CD6;
}

.borrow-box[data-label]::before {
    content: attr(data-label);
    position: absolute;
    top: -1.5rem;
    left: 0;
    font-size: 0.7rem;
    color: #D4D4D8;
    opacity: 0.6;
}

.borrow-arrow {
    width: 120px;
    height: 40px;
    flex-shrink: 0;
}

/* Code Blocks */
.code-block {
    background: #3E3E42;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.code-header {
    background: rgba(62, 62, 66, 0.8);
    padding: 0.5rem 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #D4D4D8;
    opacity: 0.6;
    border-bottom: 1px solid rgba(212, 212, 216, 0.1);
}

.code-block pre {
    padding: 1.25rem;
    overflow-x: auto;
}

.code-block code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.8;
    color: #D4D4D8;
}

.ck { color: #569CD6; }
.ct { color: #4EC9B0; }
.cs { color: #6A9955; }
.cc { color: #6A9955; font-style: italic; opacity: 0.7; }
.cf { color: #DCDCAA; }
.cm { color: #DCDCAA; }

/* Lifetime Visualization */
.lifetime-viz {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background: rgba(62, 62, 66, 0.3);
    border-left: 3px solid #FF6B35;
}

.lifetime-bar {
    height: 30px;
    background: rgba(255, 107, 53, 0.2);
    border: 1px solid #FF6B35;
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    position: relative;
}

.lifetime-bar.lt-inner {
    background: rgba(86, 156, 214, 0.2);
    border-color: #569CD6;
}

.lifetime-bar.lt-ref {
    background: rgba(78, 201, 176, 0.2);
    border-color: #4EC9B0;
}

.lt-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #D4D4D8;
}

/* Victory Section */
.victory-title {
    color: #6A9955;
}

.victory-output {
    background: #3E3E42;
    padding: 1.5rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    margin-bottom: 2rem;
}

.vo-line {
    padding: 0.2rem 0;
    color: #D4D4D8;
}

.vo-green {
    color: #6A9955;
    font-weight: 500;
}

.vo-result {
    color: #FF6B35;
    margin-top: 0.5rem;
    font-weight: 500;
}

.crab-ascii {
    text-align: center;
    margin-top: 2rem;
}

.crab-ascii pre {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    color: #FF6B35;
    line-height: 1.4;
    display: inline-block;
    text-align: left;
}

/* Responsive */
@media (max-width: 900px) {
    #layout {
        grid-template-columns: 1fr;
    }

    #sidebar {
        position: relative;
        width: 100%;
        height: auto;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid #3E3E42;
    }

    #sidebar.collapsed {
        transform: translateX(0);
        max-height: 48px;
        overflow: hidden;
    }

    #content {
        grid-column: 1;
    }

    .content-section {
        padding: 3rem 2rem;
    }
}

@media (max-width: 480px) {
    .borrow-diagram {
        flex-direction: column;
    }

    .borrow-arrow {
        transform: rotate(90deg);
    }
}
