:root {
    --primary: #06b6d4;
    --primary-dark: #0891b2;
    --bg-dark: #07090e;
    --bg-card: rgba(22, 27, 34, 0.4);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --accent: #22d3ee;
    --gradient: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-main: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    overflow-x: hidden;
    line-height: 1.6;
}

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

.accent {
    color: var(--accent);
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(34, 211, 238, 0.3);
}

/* Typography */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    font-weight: 800;
}

h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 3rem;
    line-height: 1.2;
    margin-bottom: 2rem;
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* Buttons */
.btn-primary {
    background: var(--gradient);
    color: #000 !important;
    /* Force high contrast black text on cyan */
    padding: 12px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    display: inline-block;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(6, 182, 212, 0.4);
    filter: brightness(1.1);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main) !important;
    padding: 12px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    display: inline-block;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    color: var(--primary) !important;
}

.btn-lg {
    padding: 16px 36px;
    font-size: 1.1rem;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 20px 0;
    transition: background 0.3s, padding 0.3s, backdrop-filter 0.3s;
}

.navbar.scrolled {
    background: rgba(7, 9, 14, 0.7);
    backdrop-filter: blur(16px);
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
}

.logo-text > span:first-child {
    color: var(--primary);
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 30px;
}

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

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

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding-top: 80px;
}

.parallax-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120%;
    background-image: linear-gradient(rgba(10, 10, 10, 0.7), rgba(10, 10, 10, 0.7)), url('https://images.unsplash.com/photo-1541888946425-d81bb19240f5?auto=format&fit=crop&q=80&w=2000');
    background-size: cover;
    background-position: center;
    z-index: -1;
    transform: translateY(0);
}

.hero-content {
    max-width: 800px;
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

.hero-actions {
    display: flex;
    gap: 20px;
}

/* Scroll Story Section */
.scroll-story {
    background-color: var(--bg-dark);
    position: relative;
    height: 400vh; /* Adjust height based on number of steps */
}

.story-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    height: 100%; /* Fix sticky: allow child to travel the full 400vh */
}

.story-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 60px;
    box-sizing: border-box;
    padding-bottom: 58px;
}

/* Texto móvil: oculto en escritorio */
.story-mobile-text-wrap {
    display: none;
}

/* Barra de progreso + camión (toda la sección story; posición absoluta en escritorio) */
.story-progress {
    --story-progress: 0;
    --story-complete-blend: 0;
    --story-truck-w: 44px;
    position: absolute;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    width: min(560px, calc(100% - 48px));
    z-index: 12;
    pointer-events: none;
}

.story-progress-truck-lane {
    position: relative;
    height: 36px;
    margin-bottom: 8px;
    width: 100%;
}

.story-progress-icon-stack {
    position: relative;
    width: 100%;
    height: 36px;
}

.story-progress-truck {
    position: absolute;
    top: 0;
    /* left % es del carril; translateX(100%) sería del ancho del camión (~44px) y casi no se nota */
    left: max(0px, calc(100% * var(--story-progress, 0) - var(--story-truck-w)));
    width: var(--story-truck-w);
    height: 34px;
    color: var(--accent);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
    opacity: calc(1 - var(--story-complete-blend, 0));
    transform: scale(calc(1 - 0.12 * var(--story-complete-blend, 0)));
    transform-origin: 50% 50%;
}

.story-progress-truck svg {
    width: 100%;
    height: 100%;
    display: block;
}

.story-progress-success {
    position: absolute;
    top: 0;
    right: 0;
    width: var(--story-truck-w);
    height: 34px;
    color: var(--accent);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
    opacity: var(--story-complete-blend, 0);
    transform: scale(calc(0.86 + 0.14 * var(--story-complete-blend, 0)));
    transform-origin: 50% 50%;
    pointer-events: none;
}

.story-progress-success svg {
    width: 100%;
    height: 100%;
    display: block;
}

.story-progress-track {
    height: 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.story-progress-fill {
    height: 100%;
    width: 100%;
    border-radius: 999px;
    background: var(--gradient);
    transform: scaleX(0);
    transform-origin: left center;
}

.building-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.svg-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: auto;
    /* Trazo más luminoso que --primary para leer bien sobre fondo oscuro */
    color: var(--accent);
    filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.55))
        drop-shadow(0 0 28px rgba(6, 182, 212, 0.35));
}

/* Edificio “dibujado”: menos hueco en el guionado + brillo en el trazo */
#building-svg .building-marching {
    stroke-linecap: round;
    stroke-linejoin: round;
}

#building-svg .building-marching > path {
    paint-order: stroke fill;
}

.build-path {
    opacity: 0.8;
    filter: drop-shadow(0 0 2px var(--primary));
    transition: filter 0.3s ease;
}

.build-path:hover {
    filter: drop-shadow(0 0 8px var(--primary));
}

.build-path.skeleton {
    stroke-width: 1.5;
}

.build-path.detail {
    stroke-width: 1;
    opacity: 0.5;
}


.story-content {
    flex: 1;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px; /* Space between the cards */
}

.story-step {
    position: relative;
    width: 100%;
    opacity: 0.1; /* Start slightly visible or completely hidden */
    transform: translateY(20px);
    transition: all 0.6s ease;
    pointer-events: none;
}

.story-step.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 15px 20px; /* Reduced for vertical fit */
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2; /* keep above the line */
}

/* Dynamic Tree SVG */
#dynamic-tree {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#dynamic-tree path {
    stroke: var(--primary);
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.marching-ants {
    /* Más trazo continuo que 6+6 para que no se lea “fantasma” */
    stroke-dasharray: 14 7;
    animation: marching-ants 1s linear infinite;
}

@keyframes marching-ants {
    to {
        stroke-dashoffset: -21;
    }
}

.glass-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glass-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

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

.section-header {
    text-align: center;
    margin-bottom: 60px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

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

.feature-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s, border-color 0.3s;
}

.feature-card:hover {
    transform: translateY(-10px);
    border-color: rgba(6, 182, 212, 0.3);
}

.feature-card i {
    width: 48px;
    height: 48px;
    color: var(--primary);
    margin-bottom: 20px;
}

.feature-card h3 {
    margin-bottom: 15px;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Video Section */
.video-section {
    padding: 100px 0;
    background: #0f0f0f;
}

.video-container {
    margin-top: 40px;
    border-radius: 24px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.video-placeholder {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
}

.video-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.6);
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: var(--gradient);
    border: none;
    border-radius: 50%;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.play-button:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

/* Demo Section */
.demo-section {
    padding: 120px 0;
}

.demo-card {
    background: var(--bg-card);
    padding: 80px 40px;
    border-radius: 32px;
    text-align: center;
    color: var(--text-main);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.demo-card h2 {
    color: var(--text-main);
    margin-bottom: 20px;
}

.demo-card .accent {
    color: var(--primary);
    background: none;
    -webkit-text-fill-color: initial;
    text-decoration: underline;
}

.demo-card p {
    max-width: 600px;
    margin: 0 auto 40px;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.demo-form {
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    display: flex;
    gap: 15px;
    background: white;
    padding: 10px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.form-group input {
    flex: 1;
    border: none;
    padding: 12px 15px;
    outline: none;
    font-family: var(--font-main);
    font-size: 1rem;
    border-right: 1px solid #eee;
}

.form-group input:last-of-type {
    border-right: none;
}

.form-group button {
    white-space: nowrap;
    min-width: 150px;
}

/* Footer */
.footer {
    padding: 60px 0 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.footer-info {
    text-align: center;
}

.footer-info p {
    color: var(--text-muted);
    margin-top: 10px;
}

.powered-by {
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--text-muted);
    margin-left: 8px;
    letter-spacing: normal;
    text-transform: none;
    vertical-align: middle;
}

.powered-by a {
    color: inherit;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.powered-by a:hover {
    color: #fff;
    text-decoration: underline;
}

.footer-bottom {
    font-size: 0.9rem;
    color: #444;
}

/* Animations */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s forwards;
}

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

[data-reveal] {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.2, 1, 0.3, 1);
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Scroll story: móvil — texto arriba, edificio centro, barra de progreso abajo */
@media (max-width: 900px) {
    .scroll-story {
        height: 320vh;
    }

    .story-container {
        padding: 0 16px;
    }

    .story-sticky {
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        gap: 14px;
        padding: 72px 0 max(16px, env(safe-area-inset-bottom, 0px));
    }

    .story-mobile-text-wrap {
        display: block;
        width: 100%;
        flex: 0 0 auto;
        text-align: center;
        padding: 0 8px;
        max-height: min(40vh, 280px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        /* Aísla el texto de repintes del SVG / barra durante scroll */
        contain: layout style;
        isolation: isolate;
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    .story-mobile-heading {
        font-family: var(--font-heading);
        font-size: clamp(1.28rem, 4.8vw, 1.55rem);
        font-weight: 800;
        line-height: 1.22;
        margin: 0 0 0.55rem;
        /* Color sólido: el gradiente recortado suele “temblar” en subpíxeles al hacer scroll */
        color: var(--accent);
        -webkit-text-fill-color: var(--accent);
        transform: translateZ(0);
        -webkit-font-smoothing: antialiased;
    }

    .story-mobile-desc {
        margin: 0;
        font-size: clamp(0.98rem, 3.6vw, 1.06rem);
        line-height: 1.58;
        letter-spacing: 0.01em;
        color: var(--text-muted);
        transform: translateZ(0);
        -webkit-font-smoothing: antialiased;
    }

    .story-progress {
        position: relative;
        left: auto;
        bottom: auto;
        transform: none;
        width: 100%;
        max-width: none;
        flex: 0 0 auto;
        padding: 0 2px;
    }

    .building-visual {
        flex: 1 1 auto;
        width: 100%;
        /* Más zona vertical para el edificio sin tocar texto ni barra */
        min-height: clamp(200px, 34vh, 440px);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .svg-wrapper {
        width: min(100%, 86vw, 320px);
        max-width: min(320px, 86vw);
        margin: 0 auto;
        filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.65))
            drop-shadow(0 0 36px rgba(6, 182, 212, 0.4));
    }

    .svg-wrapper #building-svg {
        width: 100%;
        height: auto;
        display: block;
    }

    #building-svg .building-marching > path:not(.marching-detail) {
        stroke-width: 2.25;
    }

    #building-svg .building-marching > path.marching-detail {
        stroke-width: 1.15;
        opacity: 0.95;
    }

    /* Tarjetas originales: solo para lectores de pantalla y fuente de texto móvil */
    .story-content {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
        flex: none;
        pointer-events: none;
    }

    #dynamic-tree {
        display: none !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    .nav-links {
        display: none;
    }

    .hero-actions {
        flex-direction: column;
    }

    .form-group {
        flex-direction: column;
        background: transparent;
        padding: 0;
        box-shadow: none;
    }

    .form-group input {
        background: white;
        border-radius: 8px;
        padding: 15px;
        margin-bottom: 10px;
        border-right: none;
    }

    .form-group button {
        width: 100%;
    }
}