/* ==========================================================================
   Vista de artículo del blog
   Complementa blog.css: layout de dos columnas, portada acotada, índice
   lateral, compartir y progreso de lectura.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Progreso de lectura
   -------------------------------------------------------------------------- */
.blog-reading-progress {
    position: fixed;
    z-index: 1001;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    pointer-events: none;
}

.blog-reading-progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(90deg, var(--primary), var(--teal));
    transition: width 0.1s linear;
}

/* --------------------------------------------------------------------------
   Cabecera
   -------------------------------------------------------------------------- */
.blog-article-headline { max-width: 60rem; }

.blog-tag-link {
    transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.blog-tag-link:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}

.blog-article-meta i { margin-right: 0.25rem; opacity: 0.75; }

/* --------------------------------------------------------------------------
   Layout de dos columnas
   -------------------------------------------------------------------------- */
.blog-article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
    gap: clamp(1.5rem, 4vw, 3.25rem);
}

.blog-article-main { min-width: 0; }

.blog-article-main .blog-article-body {
    max-width: 72ch;
    margin-left: 0;
}

/* --------------------------------------------------------------------------
   Portada: recorte con proporción fija para que nunca domine la pantalla
   -------------------------------------------------------------------------- */
.blog-article-cover {
    position: relative;
    margin: 0 0 clamp(1.5rem, 3vw, 2.25rem);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface-soft);
}

.blog-article-cover img {
    display: block;
    width: 100%;
    height: clamp(200px, 34vh, 380px);
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.blog-article-cover:hover img { transform: scale(1.02); }

.blog-article-cover figcaption {
    padding: 0.7rem 1rem;
    border-top: 1px solid var(--border);
    background: #fff;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.blog-cover-zoom {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: grid;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 12px;
    background: rgba(9, 18, 38, 0.45);
    backdrop-filter: blur(6px);
    font-size: 0.85rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.blog-article-cover:hover .blog-cover-zoom,
.blog-cover-zoom:focus-visible { opacity: 1; }

.blog-cover-zoom:hover { background: rgba(9, 18, 38, 0.7); transform: translateY(-1px); }

/* Los encabezados del cuerpo se anclan bajo el menú fijo */
.blog-article-body h2,
.blog-article-body h3 { scroll-margin-top: 110px; }

/* --------------------------------------------------------------------------
   Pie del artículo
   -------------------------------------------------------------------------- */
.blog-article-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 72ch;
    margin-top: 2.5rem;
    padding-top: 1.35rem;
    border-top: 1px solid var(--border);
}

.blog-foot-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 800;
}

.blog-foot-link:hover { color: var(--primary-dark); }
.blog-foot-link i { transition: transform 0.2s ease; }
.blog-foot-link:hover i { transform: translateX(-3px); }

/* --------------------------------------------------------------------------
   Compartir
   -------------------------------------------------------------------------- */
.blog-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.blog-share-label {
    margin-right: 0.15rem;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.blog-share-btn {
    position: relative;
    display: grid;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    font-size: 0.92rem;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.blog-share-btn:hover { transform: translateY(-2px); }
.blog-share-btn.is-whatsapp:hover { color: #fff; border-color: #25d366; background: #25d366; }
.blog-share-btn.is-facebook:hover { color: #fff; border-color: #1877f2; background: #1877f2; }
.blog-share-btn.is-x:hover { color: #fff; border-color: #0f172a; background: #0f172a; }
.blog-share-btn.is-copy:hover { color: var(--primary); border-color: rgba(50, 85, 215, 0.35); background: rgba(50, 85, 215, 0.08); }
.blog-share-btn.is-done { color: var(--green); border-color: rgba(22, 163, 74, 0.35); background: var(--green-soft); }

.blog-share-copied {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    padding: 0.28rem 0.55rem;
    color: #fff;
    border-radius: 8px;
    background: var(--ink);
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
    transform: translateX(-50%);
}

/* --------------------------------------------------------------------------
   Columna lateral
   -------------------------------------------------------------------------- */
.blog-article-aside { min-width: 0; }

.blog-aside-sticky {
    position: sticky;
    top: 104px;
    display: grid;
    gap: 1rem;
}

.blog-aside-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.75rem;
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.blog-aside-title i { color: var(--primary); font-size: 0.78rem; }

.blog-toc,
.blog-aside-card {
    padding: 1.1rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
}

.blog-toc ol {
    display: grid;
    gap: 0.15rem;
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 46vh;
    overflow-y: auto;
}

.blog-toc a {
    display: block;
    padding: 0.42rem 0.6rem;
    color: var(--muted);
    border-left: 2px solid transparent;
    border-radius: 0 8px 8px 0;
    font-size: 0.87rem;
    font-weight: 700;
    line-height: 1.4;
    transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.blog-toc a:hover { color: var(--ink); background: var(--surface-soft); }

.blog-toc a.is-active {
    color: var(--primary);
    border-left-color: var(--primary);
    background: rgba(50, 85, 215, 0.07);
}

.blog-toc li.is-sub a { padding-left: 1.35rem; font-size: 0.83rem; font-weight: 600; }

.blog-aside-author {
    display: grid;
    justify-items: start;
    gap: 0.35rem;
}

.blog-aside-author strong { color: var(--ink); font-size: 0.98rem; font-weight: 900; line-height: 1.3; }
.blog-aside-author span { color: var(--muted); font-size: 0.84rem; }
.blog-aside-author .btn { width: 100%; margin-top: 0.6rem; justify-content: center; }

/* --------------------------------------------------------------------------
   Visor de imagen y botón de volver arriba
   -------------------------------------------------------------------------- */
.blog-lightbox {
    position: fixed;
    z-index: 2000;
    inset: 0;
    display: grid;
    padding: clamp(1rem, 5vw, 3rem);
    place-items: center;
    background: rgba(6, 11, 26, 0.86);
    backdrop-filter: blur(4px);
    animation: blogFadeIn 0.2s ease both;
}

.blog-lightbox[hidden] { display: none; }

.blog-lightbox img {
    max-width: min(1100px, 100%);
    max-height: 86vh;
    border-radius: 16px;
    object-fit: contain;
}

.blog-lightbox-close {
    position: absolute;
    top: clamp(0.75rem, 3vw, 1.5rem);
    right: clamp(0.75rem, 3vw, 1.5rem);
    display: grid;
    width: 44px;
    height: 44px;
    padding: 0;
    place-items: center;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 1.05rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.blog-lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }

@keyframes blogFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.blog-to-top {
    position: fixed;
    z-index: 900;
    right: clamp(1rem, 3vw, 2rem);
    bottom: clamp(1rem, 3vw, 2rem);
    display: grid;
    width: 46px;
    height: 46px;
    padding: 0;
    place-items: center;
    color: #fff;
    border: 0;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 12px 28px rgba(50, 85, 215, 0.34);
    font-size: 0.95rem;
    cursor: pointer;
    opacity: 0;
    transform: translateY(12px);
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease, background 0.2s ease;
}

.blog-to-top.is-visible {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.blog-to-top:hover { background: var(--primary-dark); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
    .blog-article-layout { grid-template-columns: minmax(0, 1fr) 260px; }
}

@media (max-width: 991.98px) {
    .blog-article-layout { grid-template-columns: minmax(0, 1fr); }

    .blog-article-aside { order: -1; }

    .blog-aside-sticky {
        position: static;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }

    /* En móvil el índice se colapsa para no empujar el texto */
    .blog-toc ol { max-height: 200px; }

    .blog-article-main .blog-article-body,
    .blog-article-foot { max-width: none; }
}

@media (max-width: 575.98px) {
    .blog-article-cover img { height: clamp(180px, 30vh, 240px); }
    .blog-cover-zoom { opacity: 1; }
    .blog-article-foot { justify-content: flex-start; }
    .blog-to-top { width: 42px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
    .blog-article-cover img,
    .blog-share-btn,
    .blog-to-top,
    .blog-foot-link i {
        transition: none;
    }

    .blog-article-cover:hover img { transform: none; }
}

/* --------------------------------------------------------------------------
   Canales oficiales del negocio que firma el artículo
   -------------------------------------------------------------------------- */
.blog-business-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.7rem;
}

.blog-business-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.34rem 0.7rem;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1.4;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.blog-business-link i { font-size: 0.85rem; opacity: 0.85; }

.blog-business-link:hover {
    color: #fff;
    transform: translateY(-2px);
}

.blog-business-link:hover i { opacity: 1; }

.blog-business-link.is-whatsapp:hover { border-color: #25d366; background: #25d366; }
.blog-business-link.is-phone:hover { border-color: var(--primary); background: var(--primary); }
.blog-business-link.is-website:hover { border-color: var(--ink); background: var(--ink); }
.blog-business-link.is-facebook:hover { border-color: #1877f2; background: #1877f2; }
.blog-business-link.is-instagram:hover { border-color: #c13584; background: linear-gradient(45deg, #f9ce34, #ee2a7b, #6228d7); }
.blog-business-link.is-tiktok:hover { border-color: #0f172a; background: #0f172a; }
.blog-business-link.is-x:hover { border-color: #0f172a; background: #0f172a; }

/* Barra lateral: solo iconos, en cuadrado */
.blog-business-links.is-compact {
    gap: 0.35rem;
    margin-top: 0.8rem;
}

.blog-business-links.is-compact .blog-business-link {
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 11px;
}

.blog-business-links.is-compact .blog-business-link i { font-size: 0.9rem; }

@media (max-width: 575.98px) {
    .blog-business-link { font-size: 0.78rem; }
}
