/* ============================================================
   Ullua-Soft · Home — historias.css
   Filtros de funciones, etiqueta NUEVO y vista historia 9:16.
   ============================================================ */

/* Filtros por categoría: en celular se deslizan de costado, en escritorio se acomodan */
.func-filtros {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    max-width: 1320px;
    margin: -2rem auto 2.5rem;
    scroll-margin-top: 110px;
}
.func-chip {
    flex: 0 0 auto;
    background: var(--bg-2);
    border: 1px solid var(--line);
    color: var(--text-dim);
    padding: 0.6rem 1.15rem;
    border-radius: 999px;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.25s, background 0.25s, border-color 0.25s;
}
.func-chip:hover { color: var(--text); border-color: var(--text-low); }
.func-chip[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--text); }
.func-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 620px) {
    .func-filtros {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        scrollbar-width: none;
        margin: -2rem -6% 2rem;
        padding: 0 6%;
    }
    .func-filtros::-webkit-scrollbar { display: none; }
}

.features-grid .feat-block[hidden] { display: none; }

.func-nuevo {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
    background: var(--success);
    color: var(--bg);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    .func-chip { transition: none; }
}

/* Tarjetas que abren historia */
.feat-block[role="button"] { cursor: pointer; }
.feat-block[role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Vista historia 9:16 ---------- */
html.historia-abierta, html.historia-abierta body { overflow: hidden; }

.historia-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.85);
    overscroll-behavior: contain;
}
.historia-overlay[hidden] { display: none; }

.historia-frame {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    height: min(calc(90vh - 70px), 860px);
    aspect-ratio: 9 / 16;
    padding: 1.1rem 1.2rem 1.4rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--bg-2);
    color: var(--text);
    overflow: hidden;
    user-select: none;
    touch-action: pan-y;
}

.historia-progreso { display: flex; gap: 4px; }
.historia-progreso span {
    position: relative;
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: var(--line);
    overflow: hidden;
}
/* La barra del paso actual se llena con el tiempo (historias.js); las de los pasos ya vistos quedan llenas */
.historia-progreso span i {
    position: absolute;
    inset: 0;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
}
.historia-progreso span.is-done i { transform: scaleX(1); }

.historia-top { display: flex; align-items: center; gap: 0.6rem; }
/* Logo + nombre, igual que el logo de la barra de la landing */
.historia-marca {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    font-family: 'Nunito', sans-serif;
    font-size: 1.05rem;
}
.historia-marca img { height: 26px; }
.historia-top .historia-nuevo { position: static; }
.historia-pausa,
.historia-cerrar {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-dim);
    font-size: 1.1rem;
    cursor: pointer;
}
.historia-pausa { font-size: 0.95rem; }
.historia-pausa,
.historia-pausa[hidden] + .historia-cerrar { margin-left: auto; }
.historia-pausa:hover,
.historia-cerrar:hover { color: var(--text); }

#historia-titulo {
    margin: 0.4rem 0 0;
    font-size: 1.75rem;
    line-height: 1.15;
    letter-spacing: -0.01em;
}
.historia-texto {
    margin: 0;
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.45;
}

/* La captura se centra en el espacio libre bajo el texto; la pista de "ver completa"
   va debajo, para no tapar nada de la captura (la imagen se sube tal cual a Instagram). */
.historia-img {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 0 1 auto;
    min-height: 0;
    margin: auto 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}
.historia-img img {
    display: block;
    flex: 0 1 auto;
    min-height: 0;
    width: 100%;
    height: auto;
    object-fit: contain;
    object-position: top center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-3);
}
.historia-zoom {
    flex: 0 0 auto;
    color: var(--text-low);
    font-size: 0.75rem;
}
.historia-zoom::after { content: " Tocá para ver completa"; }

.historia-frame.is-cambio .historia-texto,
.historia-frame.is-cambio .historia-img img { animation: historiaEntra 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes historiaEntra {
    from { opacity: 0; transform: translateX(14px); }
    to   { opacity: 1; transform: none; }
}

.historia-flecha {
    position: absolute;
    top: 50%;
    width: 48px;
    height: 48px;
    margin-top: -24px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--bg-2);
    color: var(--text);
    cursor: pointer;
}
.historia-flecha:disabled { opacity: 0.3; cursor: default; }
.historia-prev { left: calc(50% - (min(calc(90vh - 70px), 860px) * 9 / 32) - 72px); }
.historia-next { right: calc(50% - (min(calc(90vh - 70px), 860px) * 9 / 32) - 72px); }

.historia-cta { flex: 0 0 auto; }

.historia-full {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 1rem 1rem;
    background: rgba(0, 0, 0, 0.95);
    overflow: auto;
    touch-action: pinch-zoom pan-x pan-y;
}
.historia-full[hidden] { display: none; }
.historia-full img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.historia-full-cerrar {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: var(--bg-2);
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
}

.historia-overlay button:focus-visible,
.historia-overlay a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Celular: el frame ocupa la pantalla; abajo queda la barra del CTA. Se pasa tocando los costados. */
@media (max-width: 620px) {
    .historia-overlay { gap: 0; justify-content: flex-start; background: var(--bg); }
    .historia-frame {
        width: 100%;
        height: calc(100dvh - 72px);
        aspect-ratio: auto;
        border: 0;
        border-radius: 0;
    }
    .historia-flecha { display: none; }
    .historia-cta { margin: 0.7rem 0; }
}

@media (prefers-reduced-motion: reduce) {
    .historia-overlay,
    .historia-overlay *,
    .historia-overlay *::after { animation: none !important; transition: none !important; }
}
