/* ================================================================
   COMO FUNCIONA — estilos específicos de la página
   Las variables, reset, .container, .btn, header y footer
   vienen de global.css, que se carga antes en todas las páginas.
================================================================ */

/* Scroll Progress Bar */
#scrollProgress {
    position: fixed;
    top: 0; left: 0;
    width: 0%;
    height: 4px;
    background: var(--primary);
    z-index: 9999;
    border-radius: 0 2px 2px 0;
    transition: width 0.1s linear;
}

/* ---- Animaciones de reveal (Intersection Observer) ---- */
.reveal-up {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-up.active { opacity: 1; transform: translateY(0); }

.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-scale.active { opacity: 1; transform: scale(1); }

/* ================================================================
   1. HERO SECTION
================================================================ */
.cf-hero {
    padding: 100px 0 80px;
    background: linear-gradient(180deg, rgba(255,255,255,0.7) 0%, rgba(250,250,250,1) 100%),
                url('../images/hero_how_it_works.png') center/cover no-repeat;
    text-align: center;
}
.hero-pill {
    display: inline-block;
    background: rgba(124, 92, 191, 0.1);
    color: var(--primary-hover);
    padding: 6px 16px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 24px;
}
.cf-hero h1 { font-size: 3.5rem; margin-bottom: 20px; letter-spacing: -1px; }
.cf-hero p  { font-size: 1.25rem; color: var(--text-sec); max-width: 600px; margin: 0 auto 40px; }

.time-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--white);
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
    color: var(--text-sec);
    font-size: 0.95rem;
}
.time-pill span { font-size: 1.2rem; }

/* ================================================================
   2. PASOS (zigzag)
================================================================ */
.steps { padding: 80px 0; background: var(--white); position: relative; }

.step-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 60px;
    margin-bottom: 120px;
    position: relative;
}
.step-row:nth-child(even) { flex-direction: row-reverse; }
.step-row:last-child { margin-bottom: 0; }

.step-content { flex: 1; position: relative; z-index: 2; }
.step-visual   { flex: 1; position: relative; z-index: 1; display: flex; justify-content: center; }

/* Número decorativo de fondo */
.bg-number {
    position: absolute;
    top: -40px; left: -20px;
    font-size: 12rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    color: var(--primary);
    opacity: 0.05;
    z-index: -1;
    line-height: 1;
    user-select: none;
}

/* Conector entre pasos */
.connector {
    position: absolute;
    left: 50%;
    bottom: -90px;
    height: 60px;
    width: 2px;
    border-left: 2px dashed var(--primary);
    opacity: 0.3;
    transform: translateX(-50%);
}
.connector::after {
    content: '↓';
    position: absolute;
    bottom: -15px; left: -8px;
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: bold;
}

/* Pill de número de paso */
.step-pill {
    display: inline-block;
    color: var(--white);
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 16px;
}
.pill-1 { background: var(--primary); }
.pill-2 { background: var(--secondary); }
.pill-3 { background: var(--success); }

.step-title { font-size: 2.2rem; margin-bottom: 16px; }
.step-desc  { font-size: 1.1rem; color: var(--text-sec); margin-bottom: 32px; }

.step-list { margin-bottom: 32px; }
.step-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-weight: 500;
}
.step-list li i { color: var(--primary); font-style: normal; font-size: 1.2rem; }

/* ================================================================
   CSS ART — Tablet (Paso 1)
================================================================ */
.css-tablet {
    width: 400px;
    height: 280px;
    background: #F8F9FA;
    border: 12px solid #E5E5EA;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    position: relative;
    overflow: hidden;
}
.tablet-card {
    border-radius: 8px;
    background: #EEE;
    position: relative;
    overflow: hidden;
    animation: pulse-light 2s infinite alternate;
}
.tablet-card:nth-child(1) { background: linear-gradient(135deg, var(--bg-alt), #FFEBEB); animation-delay: 0s; }
.tablet-card:nth-child(2) { background: linear-gradient(135deg, #E8F5E9, #C8E6C9); animation-delay: 0.5s; }
.tablet-card:nth-child(3) { background: linear-gradient(135deg, #FFF3E0, #FFE0B2); animation-delay: 1s; }
.tablet-card:nth-child(4) { background: linear-gradient(135deg, #E3F2FD, #BBDEFB); animation-delay: 1.5s; }
.tablet-card.selected { border: 3px solid var(--primary); animation: none; }
.tablet-card.selected::after {
    content: '✓';
    position: absolute;
    top: 8px; right: 8px;
    background: var(--primary); color: white;
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: bold;
}
@keyframes pulse-light {
    0%   { opacity: 0.7; }
    100% { opacity: 1; }
}

/* ================================================================
   CSS ART — Smartphone (Paso 2)
================================================================ */
.css-phone {
    width: 260px;
    height: 520px;
    background: #FFF;
    border: 10px solid var(--bg-dark);
    border-radius: 36px;
    box-shadow: var(--shadow-lg);
    padding: 24px 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.phone-notch {
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 100px; height: 20px;
    background: var(--bg-dark);
    border-radius: 0 0 10px 10px;
}
.css-dropzone {
    width: 100%;
    height: 140px;
    border: 2px dashed #CCC;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.css-avatar {
    width: 80px; height: 80px;
    background: var(--secondary);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-family: 'Nunito', sans-serif; font-weight: bold;
    box-shadow: 0 4px 10px rgba(255,107,107,0.3);
    opacity: 0; transform: scale(0);
}
.css-phone.animate .css-avatar {
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    animation-delay: 0.5s;
}
@keyframes popIn { to { opacity: 1; transform: scale(1); } }

.css-input    { width: 100%; height: 40px; background: #F4F6F8; border-radius: 8px; padding: 0 12px; display: flex; align-items: center; font-size: 0.8rem; color: var(--text-main); font-weight: 600; }
.css-textarea { width: 100%; height: 80px; background: #F4F6F8; border-radius: 8px; padding: 12px; font-size: 0.7rem; color: var(--text-sec); }

.css-progress-track { width: 100%; height: 6px; background: #EEE; border-radius: 3px; margin-top: auto; overflow: hidden; }
.css-progress-fill  { width: 0%; height: 100%; background: var(--primary); }
.css-phone.animate .css-progress-fill {
    animation: fillProgress 2s ease-in-out forwards;
    animation-delay: 1.5s;
}
@keyframes fillProgress { to { width: 100%; } }

.css-progress-text { font-size: 0.7rem; color: var(--primary); font-weight: bold; text-align: center; opacity: 0; }
.css-phone.animate .css-progress-text {
    animation: fadeIn 0.3s forwards;
    animation-delay: 3.5s;
}
@keyframes fadeIn { to { opacity: 1; } }

/* Timeline de entrega */
.timeline-delivery {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin-top: 32px;
}
.tl-node {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}
.tl-node::after {
    content: '';
    position: absolute;
    top: 20px; left: 50%; width: 100%; height: 2px;
    background: #E5E5EA; z-index: 1;
}
.tl-node:last-child::after { display: none; }
.tl-circle {
    width: 40px; height: 40px;
    background: var(--bg-alt); color: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    position: relative; z-index: 2;
    margin-bottom: 8px;
}
.tl-node.final .tl-circle { background: var(--accent); color: white; transform: scale(1.2); box-shadow: 0 4px 10px rgba(255,217,61,0.4); }
.tl-text { font-size: 0.75rem; font-weight: 600; color: var(--text-sec); padding: 0 4px; }
.tl-node.final .tl-text { color: var(--text-main); font-weight: 800; margin-top: 4px; }

/* ================================================================
   CSS ART — Caja (Paso 3)
================================================================ */
.css-box-wrapper {
    position: relative;
    width: 300px; height: 300px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.css-box {
    width: 160px; height: 120px;
    background: #D7CCC8;
    position: relative;
    border-radius: 4px;
    perspective: 800px;
    z-index: 2;
}
.css-box-flap {
    position: absolute; top: 0; left: 0; width: 100%; height: 60px;
    background: #BCAAA4;
    transform-origin: top;
    transform: rotateX(0deg);
    z-index: 3;
    border-radius: 4px 4px 0 0;
}
.css-box-wrapper.animate .css-box-flap {
    animation: openBox 4s infinite alternate;
}
.css-book-inside {
    position: absolute;
    top: 20px; left: 50%; transform: translateX(-50%);
    width: 100px; height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 4px;
    z-index: 1;
    opacity: 0;
    box-shadow: 0 0 20px rgba(255,217,61,0.6);
}
.css-box-wrapper.animate .css-book-inside {
    animation: revealBook 4s infinite alternate;
}
@keyframes openBox {
    0%, 20%   { transform: rotateX(0deg); }
    80%, 100% { transform: rotateX(120deg); }
}
@keyframes revealBook {
    0%, 20%   { opacity: 0; transform: translate(-50%, 0); }
    80%, 100% { opacity: 1; transform: translate(-50%, -40px); }
}
.css-truck {
    position: absolute;
    bottom: 40px; left: 0;
    font-size: 2rem;
    animation: driveTruck 6s infinite linear;
}
@keyframes driveTruck {
    0%   { transform: translateX(-50px); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateX(350px); opacity: 0; }
}
.delivery-pill {
    background: #E8F5E9; color: var(--success);
    padding: 8px 16px; border-radius: 20px;
    font-size: 0.85rem; font-weight: bold;
    margin-top: 20px;
}

/* ================================================================
   3. MÉTRICAS
================================================================ */
.metrics {
    padding: 100px 0;
    background-color: #FAFAFA;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-align: center;
}
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}
.metric-item { position: relative; padding: 10px; }
.metric-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0; top: 15%; height: 70%; width: 1px;
    background: var(--line);
}
.metric-icon   { font-size: 1.6rem; margin-bottom: 12px; opacity: 0.8; }
.metric-number {
    font-size: 3.4rem; font-family: 'Nunito', sans-serif;
    font-weight: 800; margin-bottom: 6px; line-height: 1.1;
    color: var(--primary);
}
.metric-label { font-size: 0.9rem; font-weight: 700; color: var(--text-sec); text-transform: uppercase; letter-spacing: 0.5px; }

/* ================================================================
   4. GALERÍA DE EJEMPLOS
================================================================ */
.examples { padding: 100px 0; background: var(--white); }
.examples-header { text-align: center; margin-bottom: 60px; }
.examples-header h2 { font-size: 2.5rem; margin-bottom: 16px; }
.examples-header p  { font-size: 1.1rem; color: var(--text-sec); }

.masonry-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 200px;
    gap: 24px;
}
.ex-card {
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    display: flex; flex-direction: column; justify-content: flex-end;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    color: white;
}
.ex-card:hover { transform: scale(1.02); box-shadow: var(--shadow-md); z-index: 10; }
.ex-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 60%);
    z-index: 1;
}
.ex-content { position: relative; z-index: 2; }
.ex-badge  { display: inline-block; background: rgba(255,255,255,0.2); backdrop-filter: blur(4px); padding: 4px 10px; border-radius: 12px; font-size: 0.7rem; font-weight: bold; margin-bottom: 8px; }
.ex-title  { font-family: 'Nunito', sans-serif; font-size: 1.2rem; font-weight: 800; margin-bottom: 4px; line-height: 1.2; }
.ex-quote  { font-size: 0.85rem; font-style: italic; opacity: 0.9; margin-top: 8px; border-left: 2px solid var(--accent); padding-left: 8px; }
.ex-large  { grid-row: span 2; }

/* Cards de ejemplo */
.card-1 { background: url('../images/cf_card1.png') center/cover no-repeat; }
.card-1 .book-spine { position: absolute; left: 20px; top: -10px; bottom: -10px; width: 15px; background: rgba(0,0,0,0.1); border-left: 2px solid rgba(255,255,255,0.3); }
.card-2 { background: url('../images/cf_card2.png') center/cover no-repeat; }
.card-3 { background: url('../images/cf_card3.png') center/cover no-repeat; }
.card-4 { background: url('../images/cf_card4.png') center/cover no-repeat; }
.card-5 { background: url('../images/book_jungle.png') center/cover no-repeat; color: white; grid-row: span 2; }
.interior-spread { display: flex; gap: 10px; height: 100%; padding-bottom: 60px; position: relative; z-index: 2; opacity: 0.85; }
.page-left  { flex: 1; background: linear-gradient(135deg, rgba(255,205,210,0.8), rgba(248,187,208,0.8)); border-radius: 8px; backdrop-filter: blur(2px); }
.page-right { flex: 1; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.text-line  { height: 8px; background: rgba(255,255,255,0.6); border-radius: 4px; backdrop-filter: blur(2px); }
.text-line:nth-child(1) { width: 80%; }
.text-line:nth-child(2) { width: 100%; }
.text-line:nth-child(3) { width: 90%; }
.text-line:nth-child(4) { width: 60%; }
.card-5 .ex-title  { color: white; }
.card-5 .ex-badge  { background: var(--primary); color: white; }
.card-6 { background: url('../images/cat_madre.png') center/cover no-repeat; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.kid-silhouette { position: absolute; bottom: -20px; width: 100px; height: 120px; background: rgba(0,0,0,0.4); border-radius: 50px 50px 0 0; z-index: 2; }

/* ================================================================
   5. COMPARATIVA
================================================================ */
.comparison { padding: 100px 0; background: var(--bg-alt); }
.comp-header { text-align: center; margin-bottom: 60px; }
.comp-header h2 { font-size: 2.5rem; }

.comp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: center;
}
.comp-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.comp-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.comp-title { font-size: 1.3rem; margin-bottom: 24px; text-align: center; }
.comp-icon  { font-size: 3rem; text-align: center; margin-bottom: 16px; opacity: 0.5; filter: grayscale(1); }

.comp-list li { margin-bottom: 16px; display: flex; gap: 12px; font-size: 0.95rem; align-items: flex-start; }
.comp-list li i { font-style: normal; margin-top: 2px; }
.icon-x { color: #F44336; }
.icon-w { color: #FF9800; }
.icon-v { color: var(--accent); font-weight: bold; }

.comp-card.highlight {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
    border: 2px solid var(--primary-hover);
    position: relative;
}
.comp-card.highlight:hover { transform: scale(1.07); }
.comp-card.highlight .comp-title { color: white; }
.comp-card.highlight .comp-icon { opacity: 1; filter: none; }
.highlight-badge {
    position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
    background: var(--accent); color: var(--text-main);
    padding: 6px 16px; border-radius: var(--radius-pill);
    font-weight: 800; font-size: 0.85rem; box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    white-space: nowrap;
}

/* ================================================================
   6. CTA FINAL
================================================================ */
.final-cta {
    padding: 140px 24px;
    background: linear-gradient(135deg, rgba(124,92,191,0.85), rgba(255,107,107,0.85)),
                url('../images/hero_banner.png') center/cover no-repeat;
    text-align: center;
    color: white;
}
.final-cta h2 { font-size: 3rem; margin-bottom: 16px; color: white; text-shadow: 0 2px 10px rgba(0,0,0,0.3); }
.final-cta p  { font-size: 1.2rem; color: rgba(255,255,255,0.9); margin-bottom: 40px; text-shadow: 0 1px 5px rgba(0,0,0,0.3); }
.cta-buttons  { display: flex; justify-content: center; gap: 20px; margin-bottom: 40px; }
.btn-outline-dark { background: transparent; border: 2px solid white; color: white; text-shadow: 0 1px 3px rgba(0,0,0,0.3); box-shadow: 0 2px 10px rgba(0,0,0,0.2); }
.btn-outline-dark:hover { background: white; color: var(--text-main); text-shadow: none; }
.trust-row { display: flex; justify-content: center; gap: 24px; font-size: 0.9rem; color: white; flex-wrap: wrap; text-shadow: 0 1px 5px rgba(0,0,0,0.3); }

/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 1024px) {
    .cf-hero h1 { font-size: 2.8rem; }
    .bg-number  { font-size: 8rem; }
    .masonry-grid { grid-template-columns: repeat(2, 1fr); }
    .comp-grid { gap: 16px; }
    .comp-card { padding: 30px 20px; }
    .comp-card.highlight       { transform: scale(1.02); }
    .comp-card.highlight:hover { transform: scale(1.04); }
}

@media (max-width: 768px) {
    .cf-hero { padding: 80px 0 60px; }
    .cf-hero h1 { font-size: 2.2rem; }

    .step-row,
    .step-row:nth-child(even) { flex-direction: column; gap: 40px; margin-bottom: 80px; text-align: center; }
    .step-visual { order: -1; }
    .step-list li { justify-content: center; }
    .connector { display: none; }
    .bg-number { left: 50%; transform: translateX(-50%); top: -20px; }

    .timeline-delivery { flex-direction: column; gap: 24px; align-items: center; }
    .tl-node::after { width: 2px; height: 24px; top: 40px; left: 50%; transform: translateX(-50%); }


    .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 40px; }
    .metric-item:nth-child(2)::after { display: none; }

    .masonry-grid { grid-template-columns: 1fr; }
    .ex-large { grid-row: span 1; height: 250px; }

    .comp-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 20px;
    }
    .comp-card { min-width: 85vw; scroll-snap-align: center; }
    .comp-card.highlight       { transform: none; }
    .comp-card.highlight:hover { transform: none; }

    .cta-buttons { flex-direction: column; }
}
