/* ============================================
   Prime Agent Guide — Styles
   ============================================ */

:root {
    /* Dark theme (default) */
    --bg-primary: #0a0e17;
    --bg-secondary: #0f1521;
    --bg-tertiary: #151c2e;
    --bg-card: #131a2a;
    --bg-card-hover: #1a2238;
    --text-primary: #e8ecf4;
    --text-secondary: #9ba3b4;
    --text-tertiary: #6b7280;
    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --border: #1e293b;
    --border-hover: #334155;
    --gradient-primary: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
    --gradient-secondary: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    --gradient-accent: linear-gradient(135deg, #06b6d4 0%, #10b981 100%);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 40px rgba(6, 182, 212, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-tertiary: #718096;
    --border: #e2e8f0;
    --border-hover: #cbd5e0;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 70px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background 0.4s, color 0.4s;
}

/* Progress Bar */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: var(--gradient-primary);
    z-index: 10000;
    transition: width 0.1s ease;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 14, 23, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.85);
}

.navbar.scrolled {
    box-shadow: var(--shadow-md);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 800;
    font-size: 1.15rem;
}

.logo-icon {
    transition: transform 0.5s;
}

.nav-logo:hover .logo-icon {
    transform: rotate(180deg);
}

.nav-title {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 4px;
    align-items: center;
}

.nav-links a {
    padding: 8px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    white-space: nowrap;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Language Toggle */
.lang-toggle {
    display: flex;
    gap: 2px;
    padding: 3px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
}

.lang-btn {
    padding: 5px 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
    font-family: var(--font-sans);
}

.lang-btn.active {
    background: var(--gradient-primary);
    color: white;
}

/* Mobile Menu Toggle */
.nav-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.nav-menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

.nav-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    z-index: 999;
    flex-direction: column;
    gap: 4px;
    transform: translateY(-100%);
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

.mobile-menu.open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.mobile-menu a {
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.mobile-menu a:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

/* Hero Section */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    padding: 80px 24px 60px;
}

#heroCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.hero-badge {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.version-pill, .license-pill {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.version-pill {
    color: var(--accent-cyan);
    border-color: rgba(6, 182, 212, 0.3);
}

.license-pill {
    color: var(--accent-green);
    border-color: rgba(16, 185, 129, 0.3);
}

.hero-title {
    font-size: clamp(3rem, 8vw, 5.5rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    animation: gradientShift 5s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.hero-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 36px;
    line-height: 1.6;
}

.hero-cta {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 60px;
}

.btn {
    padding: 14px 32px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    font-family: var(--font-sans);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(6, 182, 212, 0.5);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-hover);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
}

.hero-stats {
    display: flex;
    gap: 40px;
    justify-content: center;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-tertiary);
    font-size: 0.8rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

.scroll-arrow {
    width: 2px;
    height: 24px;
    background: linear-gradient(to bottom, var(--accent-cyan), transparent);
}

/* Sections */
.section {
    padding: 100px 24px;
    position: relative;
}

.section-alt {
    background: var(--bg-secondary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-tag {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.section-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.section-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: var(--transition);
    position: relative;
    /* overflow visible so tooltips can extend beyond card */
    overflow: visible;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: scaleX(0);
    transition: transform 0.4s;
    transform-origin: left;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.feature-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 182, 212, 0.1);
    border-radius: var(--radius-md);
    color: var(--accent-cyan);
    margin-bottom: 20px;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

.feature-card code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}

/* Quick Start */
.quickstart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.qs-step {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: var(--transition);
    position: relative;
}

.qs-step:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.qs-number {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    font-size: 1.2rem;
    margin-bottom: 16px;
}

.qs-step h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.qs-step p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Code Blocks */
.code-block {
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    /* overflow visible so tooltips in code-adjacent text aren't clipped.
       The <pre> inside handles its own overflow-x: auto */
    overflow: visible;
    margin: 16px 0;
}

[data-theme="light"] .code-block {
    background: #f6f8fa;
}

.code-block-sm {
    font-size: 0.85rem;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
}

[data-theme="light"] .code-header {
    background: rgba(0, 0, 0, 0.04);
}

.code-dots {
    display: flex;
    gap: 6px;
}

.code-dots i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: block;
}

.code-dots i:nth-child(1) { background: #ff5f56; }
.code-dots i:nth-child(2) { background: #ffbd2e; }
.code-dots i:nth-child(3) { background: #27c93f; }

.code-lang {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: var(--font-mono);
    margin-left: auto;
    margin-right: 12px;
}

.code-copy {
    background: none;
    border: 1px solid var(--border-hover);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: var(--transition);
    font-family: var(--font-sans);
}

.code-copy:hover {
    background: var(--bg-card-hover);
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.code-copy.copied {
    color: var(--accent-green);
    border-color: var(--accent-green);
}

.code-block pre {
    padding: 16px;
    overflow-x: auto;
}

.code-block code {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    color: #e8ecf4;
}

[data-theme="light"] .code-block code {
    color: #1a202c;
}

/* Syntax highlighting */
.syn-keyword { color: #c792ea; }
.syn-string { color: #c3e88d; }
.syn-comment { color: #5c6370; font-style: italic; }
.syn-func { color: #82aaff; }
.syn-number { color: #f78c6c; }

/* Callout */
.callout {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: rgba(6, 182, 212, 0.05);
    border: 1px solid rgba(6, 182, 212, 0.15);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-top: 32px;
}

.callout-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.callout p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.callout code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}

/* Tabs */
.tab-container {
    max-width: 900px;
    margin: 0 auto;
}

.tab-list {
    display: flex;
    gap: 4px;
    padding: 6px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 32px;
    border: 1px solid var(--border);
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    min-width: max-content;
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    font-family: var(--font-sans);
    white-space: nowrap;
}

.tab-btn.active {
    background: var(--gradient-primary);
    color: white;
}

.tab-btn:not(.active):hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-inner {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
}

.tab-inner h3 {
    font-size: 1.4rem;
    margin-bottom: 16px;
}

.tab-inner p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.7;
}

.tab-inner strong {
    color: var(--text-primary);
}

.tab-inner code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}

/* Concept diagrams */
.concept-diagram {
    margin: 24px 0;
    overflow-x: auto;
}

.concept-flow {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.flow-box {
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.flow-box-accent {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.flow-arrow {
    color: var(--accent-cyan);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.flow-box-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.flow-box-small {
    font-size: 0.75rem;
    padding: 6px 12px;
}

.concept-list {
    list-style: none;
    padding: 0;
}

.concept-list li {
    padding: 12px 0 12px 28px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    position: relative;
    line-height: 1.6;
}

.concept-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 14px;
    width: 14px;
    height: 14px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/contain no-repeat;
}

.concept-list li:last-child {
    border-bottom: none;
}

/* Architecture */
.arch-interactive {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.arch-diagram {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
}

.arch-svg {
    width: 100%;
    height: auto;
}

.arch-node {
    cursor: pointer;
    transition: var(--transition);
}

.arch-node-rect {
    transition: var(--transition);
}

.arch-node:hover .arch-node-rect {
    filter: brightness(1.3);
}

.arch-node.active .arch-node-rect {
    filter: brightness(1.5);
    stroke: white;
    stroke-width: 2;
}

.arch-node-client .arch-node-rect { fill: #06b6d4; }
.arch-node-supervisor .arch-node-rect { fill: #8b5cf6; }
.arch-node-catalog .arch-node-rect { fill: #475569; }
.arch-node-worker .arch-node-rect { fill: #10b981; }
.arch-node-providers .arch-node-rect { fill: #f59e0b; }
.arch-node-session .arch-node-rect { fill: #3b82f6; }
.arch-node-kernel .arch-node-rect { fill: #ec4899; }
.arch-node-storage .arch-node-rect { fill: #6366f1; }
.arch-node-children .arch-node-rect { fill: #14b8a6; }

.arch-line {
    stroke: var(--border-hover);
    stroke-dasharray: 4 4;
}

.arch-detail-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    min-height: 300px;
    position: sticky;
    top: 80px;
}

.arch-detail-panel h3 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    color: var(--accent-cyan);
}

.arch-detail-panel p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
}

.arch-detail-panel ul {
    list-style: none;
    padding: 0;
}

.arch-detail-panel li {
    padding: 8px 0 8px 24px;
    color: var(--text-secondary);
    position: relative;
}

.arch-detail-panel li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent-cyan);
}

/* RLM Loop */
.rlm-loop {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 60px auto;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rlm-loop-center {
    position: absolute;
    z-index: 2;
}

.rlm-loop-core {
    width: 120px;
    height: 120px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 0 60px rgba(6, 182, 212, 0.3);
    animation: pulse 3s ease infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 40px rgba(6, 182, 212, 0.2); }
    50% { box-shadow: 0 0 80px rgba(6, 182, 212, 0.4); }
}

.rlm-loop-item {
    position: absolute;
    width: 180px;
    z-index: 2;
}

.rlm-loop-top { top: 0; left: 50%; transform: translateX(-50%); }
.rlm-loop-right { right: -30px; top: 50%; transform: translateY(-50%); }
.rlm-loop-bottom { bottom: 0; left: 50%; transform: translateX(-50%); }
.rlm-loop-left { left: -30px; top: 50%; transform: translateY(-50%); }

.rlm-loop-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
    position: relative;
}

.rlm-loop-num {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.rlm-loop-content strong {
    display: block;
    font-size: 0.85rem;
    margin: 6px 0 4px;
}

.rlm-loop-detail {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.rlm-loop-arrows {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.loop-circle {
    animation: rotateDash 20s linear infinite;
    transform-origin: center;
}

@keyframes rotateDash {
    to { stroke-dashoffset: -100; }
}

/* RLM Bridge */
.rlm-bridge {
    margin-top: 60px;
}

.rlm-bridge h3 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 16px;
}

.rlm-bridge p {
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 32px;
    line-height: 1.7;
    text-align: center;
}

.bridge-diagram {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
    align-items: stretch;
    max-width: 900px;
    margin: 0 auto;
}

.bridge-side {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
}

.bridge-python {
    border-color: rgba(245, 158, 11, 0.3);
}

.bridge-ts {
    border-color: rgba(59, 130, 246, 0.3);
}

.bridge-side h4 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bridge-python h4::before { content: ""; display: inline-block; width: 20px; height: 20px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2'%3E%3Cpath d='M12 2C8 2 6 4 6 8h6c4 0 6 2 6 6v2c0 4-2 6-6 6h-4c-4 0-6-2-6-6'/%3E%3Cpath d='M12 22c4 0 6-2 6-6h-6c-4 0-6-2-6-6V8c0-4 2-6 6-6'/%3E%3Ccircle cx='9' cy='6' r='1' fill='%23f59e0b'/%3E%3Ccircle cx='15' cy='18' r='1' fill='%23f59e0b'/%3E%3C/svg%3E") center/contain no-repeat; }
.bridge-ts h4::before { content: ""; display: inline-block; width: 20px; height: 20px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%233b82f6'%3E%3Cpath d='M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5'/%3E%3C/svg%3E") center/contain no-repeat; }

.bridge-side ul {
    list-style: none;
}

.bridge-side li {
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.bridge-side li:last-child {
    border-bottom: none;
}

.bridge-side code {
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.bridge-bridge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    min-width: 120px;
}

.bridge-line {
    width: 40px;
    height: 2px;
    background: var(--accent-cyan);
}

.bridge-label {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--accent-cyan);
    border-radius: 20px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-cyan);
    margin: 12px 0;
    white-space: nowrap;
}

.bridge-arrow-l, .bridge-arrow-r {
    font-size: 1.5rem;
    color: var(--accent-cyan);
}

/* Delegation Flow */
.delegation-section {
    margin-top: 60px;
}

.delegation-section h3 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 16px;
}

.delegation-section > p {
    color: var(--text-secondary);
    text-align: center;
    max-width: 700px;
    margin: 0 auto 32px;
    line-height: 1.7;
}

.del-flow {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.del-step {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    width: 100%;
    transition: var(--transition);
}

.del-step:hover {
    border-color: var(--accent-cyan);
    transform: translateX(8px);
}

.del-step-num {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.del-step p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.del-step code {
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.del-arrow {
    color: var(--accent-cyan);
    font-size: 1.2rem;
    margin: 4px 0;
}

/* Skills Grid */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}

.skill-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: var(--transition);
}

.skill-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
}

.skill-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.skill-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.skill-badge-md { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.skill-badge-py { background: rgba(245, 158, 11, 0.15); color: var(--accent-orange); }
.skill-badge-ts { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.skill-badge-mcp { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }

.skill-card h3 {
    font-size: 1.15rem;
}

.skill-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 16px;
}

.skill-card a {
    color: var(--accent-cyan);
}

.skill-locations h3 {
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 24px;
}

.loc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.loc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: 0.85rem;
}

.loc-badge {
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.loc-global { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.loc-project { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.loc-package { background: rgba(245, 158, 11, 0.15); color: var(--accent-orange); }
.loc-builtin { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }

.loc-item code {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-cyan);
}

/* Sessions */
.sessions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
}

.session-feature {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
}

.session-feature h3 {
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.session-feature > p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.7;
}

.session-feature code {
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* Tree visualization */
.tree-viz {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.tree-node {
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border);
}

.tree-user {
    background: rgba(6, 182, 212, 0.08);
    border-left-color: var(--accent-cyan);
}

.tree-ai {
    background: rgba(139, 92, 246, 0.08);
    border-left-color: var(--accent-purple);
    margin-left: 16px;
}

.tree-branch-group {
    margin-left: 32px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 4px;
}

.tree-branch {
    padding-top: 4px;
    border-top: 1px dashed var(--border);
}

.tree-branch-active {
    border-top-color: var(--accent-green);
}

.tree-branch-active .tree-user,
.tree-branch-active .tree-ai {
    opacity: 1;
}

.tree-branch:not(.tree-branch-active) {
    opacity: 0.5;
}

/* Compaction visualization */
.compaction-viz {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 16px;
}

.compact-row {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.compact-msg {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.compact-old { background: rgba(107, 114, 128, 0.2); color: var(--text-tertiary); text-decoration: line-through; }
.compact-summary { background: rgba(245, 158, 11, 0.15); color: var(--accent-orange); }
.compact-keep { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.compact-arrow { color: var(--accent-cyan); margin: 0 4px; }

.compact-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}

.legend-old { background: rgba(107, 114, 128, 0.5); }
.legend-summary { background: var(--accent-orange); }
.legend-keep { background: var(--accent-green); }

/* Command list */
.cmd-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cmd-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.cmd-item code {
    background: var(--bg-card);
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--accent-cyan);
    min-width: 80px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.cmd-item span {
    color: var(--text-secondary);
}

/* Long-Running */
.lr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.lr-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-align: center;
    transition: var(--transition);
}

.lr-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
}

.lr-icon {
    font-size: 2rem;
    margin-bottom: 16px;
}

.lr-card h3 {
    font-size: 1.15rem;
    margin-bottom: 12px;
}

.lr-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
}

.lr-card code {
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

/* Providers */
.provider-section {
    max-width: 900px;
    margin: 0 auto;
}

.provider-tabs {
    display: flex;
    gap: 4px;
    padding: 6px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 32px;
    border: 1px solid var(--border);
    max-width: 400px;
    margin: 0 auto 32px;
}

.prov-tab {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    font-family: var(--font-sans);
}

.prov-tab.active {
    background: var(--gradient-primary);
    color: white;
}

.prov-content {
    display: none;
}

.prov-content.active {
    display: block;
}

.prov-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.prov-item {
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.prov-item:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
}

.prov-logo {
    margin-right: 6px;
}

/* CLI Reference */
.cli-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.cli-category {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.cli-category h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.cmd-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.cmd-row:last-child {
    border-bottom: none;
}

.cmd-row code {
    background: var(--bg-tertiary);
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    white-space: nowrap;
}

.cmd-row span {
    color: var(--text-secondary);
}

/* NotebookLM banner */
.notebooklm-banner {
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    transition: var(--transition);
    text-decoration: none;
}

.notebooklm-banner:hover {
    border-color: var(--accent-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.15);
}

.notebooklm-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.notebooklm-text {
    text-align: left;
}

.notebooklm-text strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.notebooklm-text span {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 60px 24px 32px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 60px;
    margin-bottom: 40px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.footer-brand h3 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.footer-brand p {
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.footer-col h4 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.footer-col a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 6px 0;
    transition: var(--transition);
}

.footer-col a:hover {
    color: var(--accent-cyan);
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-bottom p {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    line-height: 1.8;
}

/* Reveal animation */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s, transform 0.6s;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 1024px) {
    .arch-interactive {
        grid-template-columns: 1fr;
    }

    .arch-detail-panel {
        position: static;
    }

    .bridge-diagram {
        grid-template-columns: 1fr;
    }

    .bridge-bridge {
        flex-direction: row;
        padding: 16px 0;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .nav-menu-toggle {
        display: flex;
    }

    .mobile-menu {
        display: flex;
    }

    .mobile-menu:not(.open) {
        display: none;
    }

    .section {
        padding: 60px 16px;
    }

    .hero-cta {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
        margin: 0 auto 40px;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .hero-stats {
        gap: 24px;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .tab-list {
        flex-direction: column;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .footer-links {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .tree-branch-group {
        grid-template-columns: 1fr;
    }

    .rlm-loop-item {
        width: 140px;
    }

    .rlm-loop-right { right: -10px; }
    .rlm-loop-left { left: -10px; }
}

@media (max-width: 480px) {
    .rlm-loop {
        max-width: 340px;
    }

    .rlm-loop-content {
        padding: 8px;
    }

    .rlm-loop-content strong {
        font-size: 0.75rem;
    }

    .rlm-loop-detail {
        font-size: 0.65rem;
    }
}


/* ============================================
   Technical Term Tooltips
   ============================================ */
.term-tooltip {
    position: relative;
    display: inline;
    cursor: help;
    border-bottom: 1px dotted var(--accent-cyan);
    color: var(--accent-cyan);
    transition: color 0.2s;
}

.term-tooltip:hover {
    color: #67e8f9;
    border-bottom-style: solid;
}

.term-tooltip {
    /* Establish stacking context so tooltip floats above all siblings */
    position: relative;
    z-index: 10;
}

.term-tooltip:hover,
.term-tooltip:focus {
    /* When hovered/focused, raise above ALL other tooltips */
    z-index: 99999;
}

.term-tooltip .tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 140%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    width: 340px;
    max-width: 90vw;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-cyan);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-secondary);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(6,182,212,0.1);
    z-index: 1;
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    pointer-events: none;
    text-align: left;
    white-space: normal;
    font-family: var(--font-sans);
}

.term-tooltip .tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--accent-cyan);
}

.term-tooltip:hover .tooltip-content,
.term-tooltip:focus .tooltip-content {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* Tooltip for terms that appear near top of viewport — flip downward */
.term-tooltip.flip-down .tooltip-content {
    bottom: auto;
    top: 140%;
    transform: translateX(-50%) translateY(-8px);
}

.term-tooltip.flip-down:hover .tooltip-content,
.term-tooltip.flip-down:focus .tooltip-content {
    transform: translateX(-50%) translateY(0);
}

.term-tooltip.flip-down .tooltip-content::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--accent-cyan);
}

/* Mobile: make tooltip clickable instead of hover-only */
@media (max-width: 768px) {
    .term-tooltip .tooltip-content {
        width: 280px;
        font-size: 0.78rem;
    }
}

/* Highlight terms inside code blocks differently */
.code-block .term-tooltip {
    color: #67e8f9;
}

/* Tooltips inside tabs need higher stacking than tab content */
.tab-inner {
    position: relative;
    z-index: 1;
}


/* ============================================
   SVG Icon Sizing (replacing emojis)
   ============================================ */
.callout-icon svg {
    color: var(--accent-cyan);
    flex-shrink: 0;
}

.lr-icon svg {
    color: var(--accent-cyan);
}

.feature-icon svg {
    width: 28px;
    height: 28px;
}

.notebooklm-icon svg {
    display: block;
    margin: 0 auto;
}

.notebooklm-banner .notebooklm-icon svg {
    display: inline-block;
    vertical-align: middle;
}

/* Prov logo SVG inline */
.prov-logo svg {
    vertical-align: middle;
}

/* Code copy checkmark SVG */
.code-copy svg {
    vertical-align: middle;
}
