/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* --- purple2 (active) --- */
    --primary: #5856d6;
    --primary-dark: #3a2e8c;
    --primary-light: #7371fc;
    --bg-dark: #0a0a0f;
    --bg-card: #141419;
    --bg-card-hover: #1a1a20;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7a;
    --border: #2a2a35;
    --gradient-1: linear-gradient(135deg, #7371fc 0%, #1339a3 100%);
    --gradient-2: linear-gradient(
        135deg,
        rgba(115, 113, 252, 0.1) 0%,
        rgba(19, 57, 163, 0.1) 100%
    );
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica',
        'Arial', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

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

.hero > .container {
    max-width: 1400px;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    padding: 16px 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

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

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

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

/* Language Switcher — disabled for now */
.lang-switcher {
    display: none;
    gap: 4px;
}

.lang-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.lang-btn:hover {
    color: var(--text-primary);
}

.lang-btn.active {
    color: var(--text-primary);
}

/* Mobile-only contact button */
.nav-contact-mobile.btn-primary {
    display: none;
}

/* Hamburger Toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    position: relative;
    z-index: 1002;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.nav-toggle.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

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

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

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 8px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-block;
    cursor: pointer;
    border: none;
    font-size: 14px;
}

.btn-primary {
    background: rgba(88, 86, 214, 0.2);
    color: white;
    border: 1px solid var(--primary);
}

.btn-primary:hover {
    background: rgba(88, 86, 214, 0.35);
}

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

.btn-secondary:hover {
    border-color: var(--primary);
    background: rgba(115, 113, 252, 0.08);
}

.btn-large {
    padding: 10px 28px;
    font-size: 16px;
}

.btn-full {
    width: 100%;
    text-align: center;
}

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

/* Dynamic glow — position driven by JS */
.hero-glow {
    position: absolute;
    width: 800px;
    height: 800px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(88, 86, 214, 0.18) 0%,
        rgba(19, 57, 163, 0.08) 40%,
        transparent 70%
    );
    pointer-events: none;
    filter: blur(60px);
    z-index: 0;
    transition: opacity 0.4s ease;
    will-change: transform;
}

/* Stage: wrapper */
.hero-stage {
    position: relative;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    will-change: transform;
}

/* Chart: centered hero element, top gap */
.hero-chart {
    position: relative;
    width: 100%;
    margin-top: 9rem;
    border-radius: 12px;
    overflow: visible;
    border: 1px solid var(--border);
    z-index: 2;
}

/* Block chart interaction until panel dismissed */
.hero-chart::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 5;
    cursor: default;
    transition: opacity 0.5s ease;
}

.hero-chart.is-interactive::after {
    opacity: 0;
    pointer-events: none;
}

.hero-chart.is-interactive .hero-dismiss {
    display: none;
}

/* Replay button */
.hero-replay {
    position: absolute;
    top: -2.3rem;
    right: 12px;
    z-index: 7;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(10, 10, 15, 0.6);
    backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.hero-replay.is-visible {
    opacity: 0.6;
    pointer-events: auto;
}

.hero-replay:hover {
    opacity: 1;
    color: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(88, 86, 214, 0.2);
    box-shadow: 0 0 16px rgba(88, 86, 214, 0.3);
}

.hero-chart #chart {
    width: 100%;
    height: 480px;
    background: #06060c;
    overflow: hidden;
    box-sizing: border-box;
    border-radius: 12px;
}

.hero-chart #chart > * {
    width: 100% !important;
    max-width: 100% !important;
}

/* Hero text — no background, rises from behind chart to above it */
.hero-content {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, 160px);
    z-index: 1; /* behind chart initially */
    width: 88%;
    max-width: 540px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 36px;
    will-change: transform, opacity;
    opacity: 0;
    transition:
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 1.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-content.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
    /* z-index stays 1 during rise — text emerges from behind chart */
}

.hero-content.is-above {
    z-index: 3; /* above chart after rise completes */
}

/* Dismiss button */
.hero-dismiss {
    position: absolute;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    padding: 5px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background: rgba(10, 10, 15, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

/* Show dismiss button only after demo ends */
.hero-dismiss.is-visible {
    opacity: 0.6;
    pointer-events: auto;
}

/* Prominent on hover */
.hero-dismiss.is-visible:hover {
    opacity: 1;
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(10, 10, 15, 0.85);
    box-shadow: 0 0 20px rgba(88, 86, 214, 0.3);
}

.hero-dismiss:hover {
    color: var(--text-primary);
    border-color: var(--primary);
    background: rgba(88, 86, 214, 0.2);
    box-shadow: 0 0 24px rgba(88, 86, 214, 0.4);
    opacity: 1;
}

.badge {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(115, 113, 252, 0.1);
    border: 1px solid rgba(115, 113, 252, 0.3);
    border-radius: 20px;
    color: var(--primary-light);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 24px;
}

/* Hero brand — typewriter morph from "ProChart" to full title */
.hero-brand {
    font-size: 36px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 10px;
    transition: font-size 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-brand.is-typing {
    font-size: 26px;
}

.hero-brand.is-typing::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 0.85em;
    background: var(--primary-light);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 0.5s step-end infinite;
}

.hero-title {
    display: none;
}

.gradient-text {
    color: var(--primary-light);
}

.hero-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 0 18px;
    line-height: 1.65;
    max-width: 460px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-subtitle.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-cta {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin: 20px auto 0;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-cta.is-visible {
    opacity: 1;
}

/* Section Styles */
section {
    padding: 120px 0;
}

section.hero {
    padding: 80px 24px 40px;
}

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

.section-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 16px;
}

.section-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
}

/* Layers Section */
.layers-section {
    background: var(--bg-dark);
    border-top: 1px solid var(--border);
    overflow: hidden;
}

.layers-split {
    display: flex;
    align-items: center;
    gap: 64px;
}

.layers-content {
    flex: 0 0 380px;
    max-width: 380px;
}

.layers-description {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 28px;
}

.layers-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Isometric scene */
.layers-visual {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.iso-scene {
    perspective: 1100px;
    width: 100%;
    max-width: 600px;
    padding: 60px 0;
}

.iso-stack {
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(55deg) rotateZ(-30deg);
    width: 360px;
    height: 200px;
    margin: 100px auto;
}

.iso-layer {
    position: absolute;
    inset: 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: visible;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
    /* JS drives transform via inline style */
    will-change: transform, opacity;
}

.iso-layer svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Layer backgrounds & sizing */
.iso-layer-grid {
    background: #0a0a0f;
}
.iso-layer-candles {
    background: transparent;
    top: 0;
    bottom: auto;
    height: 70%;
}
.iso-layer-rsi {
    background: transparent;
    top: auto;
    bottom: 0;
    height: 30%;
}
.iso-layer-ui {
    background: transparent;
    pointer-events: auto;
}

/* Layer labels */
.layer-label {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.35);
    font-family: -apple-system, sans-serif;
    z-index: 1;
    pointer-events: none;
}

/* Crosshair - hidden by default, purple & thicker */
#ch-v,
#ch-h {
    opacity: 0;
    transition: opacity 0.25s ease;
}

.iso-layer-ui:hover ~ .iso-crosshair-visible,
.iso-layer-ui.ch-active #ch-v,
.iso-layer-ui.ch-active #ch-h {
    opacity: 1;
}

#ch-tooltip {
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* Integration Section */
.integration {
    background: var(--bg-dark);
    border-top: 1px solid var(--border);
}

.integration-split {
    display: flex;
    align-items: center;
    gap: 64px;
}

.code-window {
    flex: 1;
    min-width: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #0d0d14;
}

.code-window-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #161620;
    border-bottom: 1px solid var(--border);
}

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

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

.dot-red {
    background: #ff5f57;
}

.dot-yellow {
    background: #febc2e;
}

.dot-green {
    background: #28c840;
}

.code-window-title {
    font-size: 13px;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.code-window-body {
    padding: 24px;
    margin: 0;
    overflow-x: auto;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.8;
    color: #c9d1d9;
}

.code-window-body code {
    font-family: inherit;
}

.code-comment {
    color: #6b7280;
    font-style: italic;
}

.code-tag {
    color: #7ee787;
}

.code-attr {
    color: #79c0ff;
}

.code-string {
    color: #a5d6ff;
}

.code-keyword {
    color: #ff7b72;
}

.code-func {
    color: #d2a8ff;
}

.integration-content {
    flex: 0 0 400px;
    max-width: 400px;
}

.integration-description {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 28px;
}

.integration-highlights {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.integration-highlights li {
    color: var(--text-secondary);
    font-size: 15px;
    padding-left: 24px;
    position: relative;
}

.integration-highlights li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 7px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
}

/* Features Section */
.features {
    background: var(--bg-dark);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 32px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    transition: all 0.3s;
}

.feature-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    transform: translateY(-4px);
}

.feature-icon {
    width: 48px;
    height: 48px;
    background: rgba(115, 113, 252, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.feature-icon svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.feature-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
}

.feature-description {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* CTA / Contact Section */
.cta {
    background: var(--gradient-2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.cta-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.cta-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 16px;
}

.cta-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.cta-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 20px;
}

.contact-email {
    font-size: 15px;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    letter-spacing: 0.5px;
}

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

.footer-content {
    margin-bottom: 32px;
}

.footer-brand .nav-brand {
    margin-bottom: 16px;
}

.footer-tagline {
    color: var(--text-secondary);
    max-width: 300px;
}

.footer-bottom {
    padding-top: 32px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 1024px) {
    .layers-split {
        flex-direction: column;
        gap: 48px;
    }

    .layers-content {
        flex: none;
        max-width: 100%;
        text-align: center;
    }

    .layers-content .section-title {
        text-align: center !important;
    }

    .layers-legend {
        justify-content: center;
    }

    .integration-split {
        flex-direction: column;
        gap: 48px;
    }

    .integration-content {
        flex: none;
        max-width: 100%;
        text-align: center;
    }

    .integration-content .section-title {
        text-align: center !important;
    }

    .integration-highlights {
        align-items: center;
    }
}

@media (max-width: 768px) {
    /* Hamburger menu — hidden on mobile, replaced by contact button */
    .nav-toggle {
        display: none;
    }

    .nav-contact-mobile {
        display: inline-block;
        font-size: 11px;
        padding: 6px 12px;
        margin-left: auto;
    }

    .nav-links {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(10, 10, 15, 0.97);
        backdrop-filter: blur(16px);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 32px;
        z-index: 1001;
        font-size: 20px;
    }

    .nav-links.is-open {
        display: flex;
    }

    /* Lang switcher in mobile menu */
    .lang-switcher {
        margin-top: 8px;
    }

    /* Section padding */
    section {
        padding: 60px 0;
    }

    .section-header {
        margin-bottom: 48px;
    }

    /* Hero */
    .hero {
        padding: 0 12px 16px;
    }

    .hero-chart #chart {
        height: 380px;
    }

    .hero-brand {
        font-size: 24px;
    }

    .hero-brand.is-typing {
        font-size: 18px;
    }

    .hero-title {
        font-size: 22px;
    }

    .hero-subtitle {
        font-size: 12px;
    }

    .hero-cta {
        flex-direction: row;
        justify-content: center;
        gap: 8px;
    }

    .hero-cta .btn-primary,
    .hero-cta .btn-secondary {
        font-size: 12px;
        padding: 8px 14px;
    }

    .hero-content {
        padding: 0 12px;
        max-width: 94%;
    }

    .hero-chart {
        margin-top: 11rem;
    }

    .priceInfoBar {
        display: none !important;
    }

    .hero-glow {
        width: 400px;
        height: 400px;
    }

    /* Font sizes */
    .section-title {
        font-size: 28px;
    }

    .section-subtitle {
        font-size: 16px;
    }

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

    .cta-subtitle {
        font-size: 16px;
    }

    /* Features grid */
    .features-grid {
        grid-template-columns: 1fr;
    }

    /* Card padding */
    .feature-card {
        padding: 24px;
    }

    /* Isometric layers */
    .iso-stack {
        transform: rotateX(55deg) rotateZ(-30deg) scale(0.7);
        margin: 40px auto;
        width: 320px;
        height: 180px;
    }

    .iso-scene {
        padding: 30px 0;
        overflow: hidden;
    }

    /* Code window */
    .code-window-body {
        font-size: 12px;
        padding: 16px;
        word-break: break-all;
    }

    /* Footer */
    .footer {
        padding: 48px 0 32px;
    }

    /* CTA */
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .features-grid {
        grid-template-columns: 1fr;
    }

    .iso-stack {
        width: 280px;
        height: 160px;
    }

    .container {
        padding: 0 16px;
    }
}

/* ==========================================
   Scroll Reveal Animation System
   ========================================== */

/* Base hidden state for all revealable elements */
.reveal {
    opacity: 0;
    transition:
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.reveal-up {
    transform: translateY(40px);
}

.reveal.reveal-left {
    transform: translateX(-40px);
}

.reveal.reveal-right {
    transform: translateX(40px);
}

.reveal.reveal-scale {
    transform: scale(0.95);
}

/* Visible state */
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
}

/* Stagger delays for children */
.stagger-children .reveal:nth-child(1) {
    transition-delay: 0ms;
}
.stagger-children .reveal:nth-child(2) {
    transition-delay: 120ms;
}
.stagger-children .reveal:nth-child(3) {
    transition-delay: 240ms;
}
.stagger-children .reveal:nth-child(4) {
    transition-delay: 360ms;
}
.stagger-children .reveal:nth-child(5) {
    transition-delay: 480ms;
}
.stagger-children .reveal:nth-child(6) {
    transition-delay: 600ms;
}

/* ==========================================
   Hero entrance animation
   ========================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Children controlled individually via JS — no auto-stagger */

/* ==========================================
   Code window typewriter effect
   ========================================== */
.code-line {
    opacity: 0;
    transform: translateX(-8px);
    transition:
        opacity 0.4s ease-out,
        transform 0.4s ease-out;
    display: block;
    min-height: 1.8em;
}

.code-line.is-typed {
    opacity: 1;
    transform: translateX(0);
}

/* Blinking cursor on the last typed line */
.code-line.is-typing::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--primary-light);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 0.6s step-end infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* Code window entrance */
.code-window {
    opacity: 0;
    transform: translateY(30px);
    transition:
        opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.code-window.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   Section header animations
   ========================================== */
.section-header .section-title,
.section-header .section-subtitle {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.section-header.is-visible .section-title {
    opacity: 1;
    transform: translateY(0);
}

.section-header.is-visible .section-subtitle {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.15s;
}

/* ==========================================
   CTA section animation
   ========================================== */
.cta-content > * {
    opacity: 0;
    transform: translateY(25px);
    transition:
        opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.cta-content.is-visible > *:nth-child(1) {
    opacity: 1;
    transform: translateY(0);
}
.cta-content.is-visible > *:nth-child(2) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.15s;
}
.cta-content.is-visible > *:nth-child(3) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.3s;
}
.cta-content.is-visible > *:nth-child(4) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.45s;
}

/* ==========================================
   Demo Cursor
   ========================================== */
.demo-cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2147483647;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px; /* center on position */
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    will-change: transform;
    /* Open hand SVG */
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 11V6a2 2 0 00-4 0v1M14 7V4a2 2 0 00-4 0v7M10 6V5a2 2 0 00-4 0v9c0 5 3.5 8 8 8 4 0 8-3 8-8v-4a2 2 0 00-4 0v2'/%3E%3C/svg%3E")
        no-repeat center center;
    background-size: 28px 28px;
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.5));
}

.demo-cursor.is-visible {
    opacity: 1;
    animation: cursorFloat 2s ease-in-out infinite;
}

@keyframes cursorFloat {
    0%,
    100% {
        scale: 1;
    }
    50% {
        scale: 1.12;
    }
}

.demo-cursor.is-dragging {
    /* Closed grab hand */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 14V8a2 2 0 014 0v4m0-2a2 2 0 014 0v4m0-2a2 2 0 014 0v2c0 5-3.5 8-8 8-4 0-8-3-8-8v-1a2 2 0 014 0v3'/%3E%3C/svg%3E");
    animation: none;
    scale: 0.95;
}

/* Ripple ring on interaction */
.demo-cursor-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border-radius: 50%;
    border: 2px solid rgba(88, 86, 214, 0.7);
    pointer-events: none;
    opacity: 0;
}

@keyframes cursorRipple {
    0% {
        transform: scale(0.4);
        opacity: 1;
    }
    100% {
        transform: scale(2.8);
        opacity: 0;
    }
}

.demo-cursor-ripple.is-active {
    animation: cursorRipple 0.6s ease-out forwards;
}

/* Demo narration panel — bottom area of chart for normal steps */
.demo-narration {
    position: absolute;
    z-index: 9998;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 16px;
    background: rgba(10, 10, 15, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    white-space: nowrap;
}

.demo-narration.is-visible {
    opacity: 1;
}

/* Hero clone: centered text overlay for major steps (speed-independent, 1s) */
.demo-narration-hero {
    position: absolute;
    z-index: 10000;
    left: 50%;
    transform: translateX(-50%) translateY(-50%) scale(0.8);
    font-size: 18px;
    font-weight: 600;
    padding: 10px 28px;
    background: rgba(10, 10, 15, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.95);
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition:
        opacity 0.3s ease,
        transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.demo-narration-hero.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(-50%) scale(1);
}

/* Demo pulse highlight */
@keyframes demoPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(88, 86, 214, 0.6);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(88, 86, 214, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(88, 86, 214, 0);
    }
}

.demo-pulse {
    animation: demoPulse 0.8s ease-in-out 3 !important;
}

/* Demo debug overlay */
.demo-debug {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    padding: 8px 20px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid #5856d6;
    border-radius: 8px;
    color: #7371fc;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    pointer-events: none;
    white-space: nowrap;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .reveal,
    .code-line,
    .code-window,
    .hero-content > *,
    .hero-chart,
    .section-header .section-title,
    .section-header .section-subtitle,
    .cta-content > * {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
        transition: none !important;
    }

    .code-line,
    .iso-layer {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
}
