/* ===== Pipeline Demo Page ===== */

/* --- Intro / Prompt Terminal --- */
.pipeline-demo {
    background: var(--bg);
}

.demo-intro {
    padding: 80px 0 60px;
    text-align: center;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(79, 140, 255, 0.08), transparent 60%),
        var(--bg);
}

.demo-breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 32px;
}

.demo-breadcrumb a {
    color: var(--accent);
    transition: color 0.2s;
}

.demo-breadcrumb a:hover {
    color: var(--accent-hover);
}

.demo-breadcrumb-sep {
    color: var(--border);
}

.demo-breadcrumb-current {
    color: var(--text);
}

.demo-title {
    font-size: clamp(36px, 6vw, 64px);
    font-weight: 800;
    letter-spacing: -2px;
    margin-bottom: 16px;
}

.glow-text {
    color: var(--accent);
    text-shadow:
        0 0 20px rgba(79, 140, 255, 0.4),
        0 0 40px rgba(79, 140, 255, 0.2);
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { text-shadow: 0 0 20px rgba(79, 140, 255, 0.4), 0 0 40px rgba(79, 140, 255, 0.2); }
    50% { text-shadow: 0 0 30px rgba(79, 140, 255, 0.6), 0 0 60px rgba(79, 140, 255, 0.3); }
}

.demo-subtitle {
    color: var(--text-dim);
    font-size: 20px;
    max-width: 600px;
    margin: 0 auto 48px;
}

/* Terminal */
.prompt-terminal {
    max-width: 720px;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    text-align: left;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(79, 140, 255, 0.05);
    transition: box-shadow 0.4s;
}

.prompt-terminal.active {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(79, 140, 255, 0.2), 0 0 40px rgba(79, 140, 255, 0.1);
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #1a1a1a;
    border-bottom: 1px solid var(--border);
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-dot-red { background: #ff5f57; }
.terminal-dot-yellow { background: #febc2e; }
.terminal-dot-green { background: #28c840; }

.terminal-title {
    margin-left: 8px;
    font-size: 13px;
    color: var(--text-dim);
    font-family: 'SF Mono', 'Consolas', monospace;
}

.terminal-body {
    padding: 20px;
    background: #0d0d0d;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.8;
}

.terminal-line {
    color: #a0a0a0;
}

.terminal-indent {
    padding-left: 20px;
}

.terminal-prompt {
    color: var(--accent);
    font-weight: 700;
}

.terminal-key {
    color: #79c0ff;
}

.terminal-value {
    color: #a5d6ff;
}

.terminal-num {
    color: #f0883e;
}

.terminal-cursor .cursor-blink {
    color: var(--accent);
    animation: blink 1s step-end infinite;
}

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

/* Launch button */
.demo-launch {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.btn-launch {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 18px 48px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(79, 140, 255, 0.3);
}

.btn-launch:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(79, 140, 255, 0.4);
}

.btn-launch:active {
    transform: scale(0.98);
}

.btn-launch:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-launch-icon {
    font-size: 16px;
}

.btn-launch-icon img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    border-radius: 3px;
    vertical-align: middle;
}

.demo-launch-hint {
    color: var(--text-dim);
    font-size: 14px;
}

/* --- Pipeline Visualization --- */
.pipeline-viz {
    padding: 80px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(ellipse at 50% 50%, rgba(79, 140, 255, 0.03), transparent 70%),
        var(--bg-card);
}

.viz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 48px;
}

.viz-header h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.viz-status {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 14px;
}

.status-indicator {
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-dim);
    transition: all 0.3s;
}

.status-indicator.running {
    color: #28c840;
    border-color: #28c840;
    background: rgba(40, 200, 64, 0.1);
}

.status-indicator.completed {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(79, 140, 255, 0.1);
}

.status-timer {
    color: var(--text-dim);
}

/* Node flow */
.node-flow {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    padding: 20px 0 0;
    margin-bottom: 40px;
}

.node-track {
    position: absolute;
    top: 44px;
    left: 5%;
    right: 5%;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.node-progress {
    position: absolute;
    top: 44px;
    left: 5%;
    height: 2px;
    width: 0;
    background: linear-gradient(90deg, var(--accent), #28c840);
    box-shadow: 0 0 8px rgba(79, 140, 255, 0.5);
    z-index: 1;
    transition: width 0.5s ease;
}

.node-item {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    text-align: center;
}

.node-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.4s;
    margin-bottom: 12px;
}

.node-icon img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    border-radius: 4px;
}

.node-item.running .node-circle {
    border-color: var(--accent);
    background: rgba(79, 140, 255, 0.1);
    box-shadow: 0 0 16px rgba(79, 140, 255, 0.4);
    animation: nodePulse 1.5s ease-in-out infinite;
}

.node-item.completed .node-circle {
    border-color: #28c840;
    background: rgba(40, 200, 64, 0.1);
    box-shadow: 0 0 12px rgba(40, 200, 64, 0.3);
}

@keyframes nodePulse {
    0%, 100% { box-shadow: 0 0 16px rgba(79, 140, 255, 0.4); }
    50% { box-shadow: 0 0 28px rgba(79, 140, 255, 0.6); }
}

.node-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    max-width: 80px;
    line-height: 1.3;
    transition: color 0.3s;
}

.node-item.running .node-label,
.node-item.completed .node-label {
    color: var(--text);
}

.node-detail {
    font-size: 10px;
    color: var(--text-dim);
    font-family: 'SF Mono', 'Consolas', monospace;
    margin-top: 4px;
    min-height: 14px;
}

.node-item.running .node-detail {
    color: var(--accent);
}

.node-item.completed .node-detail {
    color: #28c840;
}

/* Diffusion bar */
.diffusion-bar-wrap {
    max-width: 600px;
    margin: 0 auto 40px;
    opacity: 0;
    transition: opacity 0.3s;
}

.diffusion-bar-wrap.visible {
    opacity: 1;
}

.diffusion-bar-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 8px;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.diffusion-bar {
    height: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.diffusion-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent, #4f8cff), #00d4ff);
    border-radius: 3px;
    transition: width 0.4s ease;
    box-shadow: 0 0 8px rgba(79, 140, 255, 0.4);
}

/* Console log */
.console-log {
    max-width: 720px;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    text-align: left;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #1a1a1a;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-dim);
    font-family: 'SF Mono', 'Consolas', monospace;
}

.console-live {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.3s;
}

.console-live.live {
    background: #28c840;
    box-shadow: 0 0 6px rgba(40, 200, 64, 0.5);
    animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.console-body {
    padding: 16px;
    background: #0d0d0d;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.7;
    max-height: 240px;
    overflow-y: auto;
}

.console-line {
    color: #a0a0a0;
    animation: fadeInLine 0.3s ease;
}

@keyframes fadeInLine {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

.console-line.console-info { color: #79c0ff; }
.console-line.console-success { color: #28c840; }
.console-line.console-warn { color: #febc2e; }
.console-line.console-muted { color: #555; font-style: italic; }

.console-time {
    color: #555;
    margin-right: 8px;
}

/* --- Result Reveal --- */
.result-reveal {
    padding: 100px 0;
    text-align: center;
}

.reveal-container {
    position: relative;
    max-width: 900px;
    margin: 48px auto 0;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.reveal-before {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.reveal-placeholder {
    text-align: center;
    color: var(--text-dim);
}

.reveal-placeholder-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.reveal-placeholder-icon img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 8px;
}

.reveal-placeholder p {
    font-size: 15px;
}

.reveal-after {
    position: absolute;
    inset: 0;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.reveal-after.visible {
    opacity: 1;
}

.reveal-after img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.reveal-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 24px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.5s ease 0.3s;
}

.reveal-after.visible .reveal-overlay {
    opacity: 1;
}

.reveal-badge {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--accent);
    background: rgba(79, 140, 255, 0.15);
    border: 1px solid var(--accent);
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
}

.reveal-meta {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 12px;
    color: var(--text-dim);
    text-align: right;
}

/* Curtain reveal effect */
.reveal-curtain {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: linear-gradient(90deg, var(--bg-card) 50%, transparent 50%);
    background-size: 200% 100%;
    background-position: 0% 0%;
    transition: background-position 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.reveal-curtain.open {
    background-position: -100% 0%;
}

/* --- Metadata Panel --- */
.metadata-panel {
    padding: 100px 0;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 48px;
}

.meta-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: border-color 0.2s, background 0.2s;
}

.meta-card:hover {
    border-color: #2a2a2a;
    background: var(--bg-card-hover);
}

.meta-card-icon {
    font-size: 24px;
    margin-bottom: 12px;
}

.meta-card-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 4px;
}

.meta-card h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.meta-value {
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
    word-break: break-word;
}

.meta-value.mono {
    font-family: 'SF Mono', 'Consolas', monospace;
}

.meta-value.small {
    font-size: 12px;
    color: var(--text-dim);
}

/* Execution history */
.exec-history {
    margin-bottom: 48px;
}

.exec-history h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}

.exec-timeline {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
}

.exec-event {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-family: 'SF Mono', 'Consolas', monospace;
    animation: fadeInLine 0.3s ease;
}

.exec-event:last-child {
    border-bottom: none;
}

.exec-event.exec-muted {
    color: #555;
    font-style: italic;
    font-family: inherit;
    justify-content: center;
}

.exec-event .exec-time {
    color: var(--text-dim);
    flex-shrink: 0;
    min-width: 100px;
}

.exec-event .exec-type {
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
    min-width: 160px;
}

.exec-event .exec-type.exec-created { color: #febc2e; }
.exec-event .exec-type.exec-started { color: #79c0ff; }
.exec-event .exec-type.exec-node { color: var(--accent); }
.exec-event .exec-type.exec-completed { color: #28c840; }

.exec-event .exec-desc {
    color: var(--text);
}

/* Artifacts */
.artifacts-section h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}

.artifact-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.artifact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s;
}

.artifact-item:hover {
    border-color: #2a2a2a;
}

.artifact-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.artifact-icon {
    font-size: 24px;
}

.artifact-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 4px;
    vertical-align: middle;
}

.artifact-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    font-family: 'SF Mono', 'Consolas', monospace;
}

.artifact-desc {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
}

.artifact-download {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    transition: all 0.2s;
}

.artifact-download:hover {
    border-color: var(--accent);
    background: rgba(79, 140, 255, 0.1);
}

/* --- Variation Controls --- */
.variation-controls {
    padding: 100px 0;
    border-top: 1px solid var(--border);
}

.variation-lineage {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.lineage-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    transition: all 0.3s;
    cursor: default;
}

.lineage-item.active {
    border-color: var(--accent);
    background: rgba(79, 140, 255, 0.08);
    box-shadow: 0 0 12px rgba(79, 140, 255, 0.15);
}

.lineage-seed {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
}

.lineage-label {
    font-size: 12px;
    color: var(--text-dim);
}

.variation-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.btn-variation {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 14px 32px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(79, 140, 255, 0.25);
}

.btn-variation:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-variation:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-variation-icon img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    border-radius: 3px;
}

.btn-reset {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset:hover {
    color: var(--text);
    border-color: var(--text-dim);
}

.variation-context {
    text-align: center;
    font-size: 14px;
    color: var(--text-dim);
}

.variation-context-label {
    color: var(--text);
    font-weight: 600;
    margin-right: 8px;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .meta-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .node-flow {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 16px;
    }

    .node-track,
    .node-progress {
        display: none;
    }

    .node-item {
        flex: 1 1 25%;
    }

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

    .viz-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .demo-title {
        font-size: 32px;
    }
}
