/* Deciduous Tutorial Styles */
/* Inspired by mdBook and jujutsu tutorial */

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

/* AI Generated Warning Banner */
.ai-warning-banner {
    background: linear-gradient(135deg, #ff6b6b 0%, #ffa500 100%);
    color: white;
    padding: 12px 20px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.ai-warning-banner a {
    color: white;
    text-decoration: underline;
}
body {
    padding-top: 48px; /* Make room for fixed banner */
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-code: #24292f;
    --text-primary: #24292f;
    --text-secondary: #57606a;
    --text-muted: #6e7781;
    --border-color: #d0d7de;
    --accent-green: #2da44e;
    --accent-blue: #0969da;
    --accent-cyan: #00d9ff;
    --sidebar-width: 280px;
    --content-max-width: 800px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header .logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.sidebar-header .subtitle {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Table of Contents */
.toc-section {
    margin-bottom: 20px;
}

.toc-title {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 4px;
    margin-bottom: 4px;
    transition: background 0.15s;
}

.toc-title:hover {
    background: var(--bg-primary);
}

.toc-title.active {
    background: var(--accent-green);
    color: white;
}

.toc-section ul {
    list-style: none;
    padding-left: 10px;
}

.toc-section li {
    margin: 2px 0;
}

.toc-section li a {
    display: block;
    padding: 4px 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: all 0.15s;
}

.toc-section li a:hover {
    color: var(--accent-blue);
    background: var(--bg-primary);
}

.toc-section li a.active {
    color: var(--accent-green);
    font-weight: 500;
}

/* Main Content */
.content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 40px;
    max-width: calc(var(--content-max-width) + 80px + var(--sidebar-width));
}

article {
    max-width: var(--content-max-width);
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -1px;
    color: var(--text-primary);
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 40px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 30px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

p {
    margin-bottom: 16px;
    color: var(--text-primary);
}

.lead {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

ul, ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

li {
    margin-bottom: 8px;
}

strong {
    font-weight: 600;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Hero Box */
.hero-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 25px 30px;
    margin: 30px 0;
}

.hero-box p {
    margin-bottom: 12px;
}

.hero-box p:last-child {
    margin-bottom: 0;
}

/* Code Blocks */
pre {
    background: var(--bg-code);
    color: #f6f8fa;
    padding: 20px 24px;
    border-radius: 8px;
    margin: 20px 0;
    overflow-x: auto;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

code {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.9em;
}

p code, li code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-primary);
}

pre code {
    background: none;
    padding: 0;
}

/* Syntax highlighting in code blocks */
.cmd { color: #7ee787; }
.comment { color: #8b949e; }
.output { color: #8b949e; }
.prompt { color: #79c0ff; }
.string { color: #a5d6ff; }

/* Terminal Session Box */
.terminal-session {
    background: #1a1a2e;
    border-radius: 10px;
    margin: 25px 0;
    overflow: hidden;
}

.terminal-header {
    background: #16213e;
    padding: 10px 15px;
    border-bottom: 1px solid #2a2a4e;
    font-size: 0.85rem;
    color: #888;
}

.terminal-body {
    padding: 20px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #f6f8fa;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.terminal-body .user-input {
    color: #00d9ff;
}

.terminal-body .claude-response {
    color: #c9d1d9;
}

.terminal-body .command {
    color: #7ee787;
}

.terminal-body .command::before {
    content: "$ ";
    color: #6e7681;
}

.terminal-body .output {
    color: #8b949e;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.95rem;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

tr:hover {
    background: var(--bg-secondary);
}

/* Screenshot Placeholder */
.screenshot-placeholder {
    background: linear-gradient(135deg, #f0f0f0 25%, #e8e8e8 25%, #e8e8e8 50%, #f0f0f0 50%, #f0f0f0 75%, #e8e8e8 75%);
    background-size: 20px 20px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 60px 30px;
    text-align: center;
    margin: 25px 0;
}

.screenshot-placeholder .label {
    background: white;
    padding: 10px 20px;
    border-radius: 6px;
    display: inline-block;
    font-weight: 600;
    color: var(--text-secondary);
}

.screenshot-placeholder .caption {
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Info/Warning Boxes */
.info-box {
    background: #ddf4ff;
    border: 1px solid #54aeff;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 20px 0;
}

.info-box.warning {
    background: #fff8c5;
    border-color: #d4a72c;
}

.info-box.tip {
    background: #d1f7d6;
    border-color: #2da44e;
}

.info-box strong {
    display: block;
    margin-bottom: 4px;
}

/* Navigation */
.page-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.page-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.15s;
}

.page-nav a:hover {
    background: var(--bg-primary);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.page-nav .prev::before {
    content: "\2190";
}

.page-nav .next::after {
    content: "\2192";
}

.page-nav .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
}

.page-nav .title {
    font-weight: 600;
}

/* Next Section CTA */
.next-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 30px;
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.next-section span {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--accent-green);
    color: white;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s;
}

.btn:hover {
    background: #238636;
    text-decoration: none;
}

/* Key Binding Display */
kbd {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.85em;
    box-shadow: 0 1px 0 var(--border-color);
}

/* Node Type Colors */
.node-goal { color: #d29922; }
.node-decision { color: #0969da; }
.node-option { color: #8250df; }
.node-action { color: #2da44e; }
.node-outcome { color: #1f6feb; }
.node-observation { color: #bf3989; }
.node-revisit { color: #f97316; }

/* ========================================
   ANIMATED TERMINAL DEMOS
   ======================================== */

.session-demo {
    background: #1e1e1e;
    border-radius: 12px;
    overflow: hidden;
    margin: 30px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    position: relative;
}

.session-header {
    background: #2d2d2d;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.session-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.session-dot.red { background: #ff5f56; }
.session-dot.yellow { background: #ffbd2e; }
.session-dot.green { background: #27c93f; }

.session-title {
    color: #888;
    font-size: 0.85rem;
    margin-left: 8px;
}

.session-controls {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.session-btn {
    background: #374151;
    color: #9ca3af;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.session-btn:hover {
    background: #4b5563;
    color: #e5e7eb;
}
.session-btn.active {
    background: #ef4444;
    color: white;
}

.session-content {
    padding: 20px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    max-height: 450px;
    overflow-y: auto;
    scroll-behavior: smooth;
    position: relative;
}

.session-content::-webkit-scrollbar {
    width: 8px;
}
.session-content::-webkit-scrollbar-track {
    background: #2d2d2d;
}
.session-content::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}
.session-content::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Pause Overlay */
.pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.pause-overlay.visible {
    opacity: 1;
    visibility: visible;
}
.pause-overlay .pause-icon {
    font-size: 48px;
    margin-bottom: 16px;
}
.pause-overlay .pause-text {
    color: #9ca3af;
    font-size: 0.9rem;
    margin-bottom: 20px;
}
.pause-overlay .resume-btn {
    background: #2da44e;
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.pause-overlay .resume-btn:hover {
    background: #238636;
}

/* Animation Steps */
.session-step {
    opacity: 0;
    transform: translateY(10px);
    margin-bottom: 16px;
}
.session-step:last-child { margin-bottom: 0; }

.session-step.animate {
    animation: fadeInStep 0.5s ease forwards;
    /* Note: --delay is used by JS to schedule when .animate is added.
       Don't add animation-delay here or it will double-delay. */
}

.session-demo.paused .session-step {
    animation-play-state: paused;
}

@keyframes fadeInStep {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Step Labels */
.step-label {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.step-label.user {
    background: #3b82f6;
    color: #fff;
}
.step-label.claude {
    background: #d97706;
    color: #fff;
}
.step-label.system {
    background: #6b7280;
    color: #fff;
}

/* Step Content Styles */
.step-content {
    color: #e5e5e5;
    padding-left: 4px;
}
.step-content.code {
    color: #7ee787;
}
.step-output {
    color: #8b949e;
    font-size: 0.85rem;
    margin-top: 4px;
    padding-left: 4px;
}
.step-success {
    color: #7ee787;
    font-size: 0.85rem;
    margin-top: 4px;
    padding-left: 4px;
}
.step-files {
    color: #f97583;
    font-size: 0.85rem;
    margin-top: 4px;
    padding-left: 4px;
}
.step-thinking {
    color: #a78bfa;
    font-style: italic;
    font-size: 0.85rem;
    margin-top: 4px;
    padding-left: 4px;
}

/* Recovery Output Box */
.step-recovery-output {
    background: #1a3a1a;
    border: 1px solid #22543d;
    border-radius: 6px;
    padding: 12px;
    margin-top: 8px;
    color: #86efac;
    font-size: 0.85rem;
}
.step-recovery-output strong {
    color: #4ade80;
}

/* Session Divider */
.session-divider {
    text-align: center;
    padding: 20px 0;
    opacity: 0;
}
.session-divider.animate {
    animation: fadeInStep 0.5s ease forwards;
    animation-delay: var(--delay);
}
.session-divider span {
    background: #374151;
    color: #9ca3af;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* Tree Display in Recovery */
.tree-line {
    color: #a5d6ff;
    display: block;
    line-height: 1.5;
}
.tree-line.goal { color: #fbbf24; }
.tree-line.decision { color: #60a5fa; }
.tree-line.option { color: #c084fc; }
.tree-line.action { color: #34d399; }
.tree-line.outcome { color: #38bdf8; }
.tree-line.observation { color: #f472b6; }

/* Command inline in session */
.cmd-inline {
    color: #7ee787;
    font-size: 0.85rem;
    padding: 4px 0;
}

/* Graph visualization in terminal */
.ascii-graph {
    color: #a5d6ff;
    font-size: 0.8rem;
    line-height: 1.4;
    padding: 12px;
    background: #1a1a2e;
    border-radius: 6px;
    margin-top: 8px;
}

/* Cycling Demo Container */
.demo-carousel {
    position: relative;
}

.demo-carousel .demo-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: #2d2d2d;
    border-top: 1px solid #404040;
}

.demo-carousel .indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #555;
    cursor: pointer;
    transition: background 0.15s;
}
.demo-carousel .indicator-dot.active {
    background: #2da44e;
}
.demo-carousel .indicator-dot:hover {
    background: #777;
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .content {
        margin-left: 0;
        padding: 20px;
    }

    body {
        flex-direction: column;
    }

    .page-nav {
        flex-direction: column;
        gap: 10px;
    }

    .page-nav a {
        width: 100%;
        justify-content: center;
    }
}
