/**
 * single.css
 * Estilos de la entrada individual del blog (single.php).
 *
 * Depende de: global.css y blog.css (tarjetas de relacionados).
 * Prefijo .sg-* para todo lo exclusivo de esta plantilla.
 */

/* ─────────────────────────────────────────────
   HERO DEL ARTÍCULO — plano, sin degradados
   (misma razón que .blog-hero: la barra del
   header es absoluta y sólida en #0d1f3c)
───────────────────────────────────────────── */
.sg-hero {
    /* A diferencia del listado (/blog/), en las entradas el header de
       Kadence SÍ es transparente y superpuesto: el padding-top lo pone
       la regla compartida de global.css (+150px) */
    background: #0d1f3c;
    padding: var(--space-12) 0 calc(var(--space-12) + var(--space-16));
    position: relative;
}

.sg-hero::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    background: var(--color-accent);
}

.sg-hero__inner {
    position: relative;
}

.sg-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    margin-bottom: var(--space-5);
}

.sg-breadcrumb a {
    color: rgba(255, 255, 255, 0.5);
    transition: color var(--transition);
}

.sg-breadcrumb a:hover {
    color: var(--color-accent);
}

.sg-breadcrumb__sep {
    color: rgba(255, 255, 255, 0.3);
}

.sg-hero__title {
    font-family: var(--font-head);
    font-size: clamp(1.75rem, 3.6vw, 2.6rem);
    font-weight: 700;
    color: #fff;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 0;
}


/* ─────────────────────────────────────────────
   CUERPO DEL ARTÍCULO
───────────────────────────────────────────── */
.sg-main {
    background: var(--color-bg);
    padding-bottom: var(--space-16);
}

/* Rejilla: columna de lectura + lateral sticky, solapada sobre el hero */
.sg-wrap {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: var(--space-8);
    align-items: start;
    margin-top: calc(-1 * var(--space-16));
}

/* Panel blanco del artículo */
.sg-layout {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: clamp(var(--space-8), 4vw, var(--space-12));
    min-width: 0;
}

/* ─── Lateral ─── */
.sg-sidebar {
    position: sticky;
    top: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.sg-widget {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-6);
}

.sg-widget__title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-accent-dim);
    margin-bottom: var(--space-4);
}

.sg-widget__title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

/* Enlaces a calculadoras */
.sg-tool {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--color-border);
    transition: transform var(--transition);
}

.sg-tool:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.sg-tool__icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: rgba(0, 200, 150, 0.12);
    color: var(--color-accent-dim);
}

.sg-tool__label {
    flex: 1;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-navy);
    transition: color var(--transition);
}

.sg-tool__arrow {
    display: inline-flex;
    color: var(--color-muted);
    transition: transform var(--transition), color var(--transition);
}

.sg-tool:hover .sg-tool__label { color: var(--color-accent-dim); }
.sg-tool:hover .sg-tool__arrow { transform: translateX(3px); color: var(--color-accent-dim); }

/* Lo más leído */
.sg-pop {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--color-border);
}

.sg-pop:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.sg-pop__num {
    font-family: var(--font-head);
    font-size: var(--text-md);
    font-weight: 700;
    color: rgba(0, 200, 150, 0.45);
    line-height: 1.2;
}

.sg-pop__title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--transition);
}

.sg-pop:hover .sg-pop__title { color: var(--color-accent-dim); }

@media (max-width: 900px) {
    .sg-wrap {
        grid-template-columns: 1fr;
    }

    .sg-sidebar {
        position: static;
    }
}

/* Imagen destacada dentro del panel, entera sobre fondo navy */
.sg-featured {
    margin: 0 0 var(--space-8);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #0d1f3c;
}

.sg-featured__img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 8;
    object-fit: cover;
}

/* ─── Tipografía del contenido ─── */
.sg-content {
    font-size: var(--text-base);
}

.sg-content p {
    margin-bottom: var(--space-5);
    line-height: 1.8;
    max-width: none;
    color: var(--color-text);
}

.sg-content h2 {
    font-size: var(--text-xl);
    margin: var(--space-10) 0 var(--space-4);
    letter-spacing: -0.01em;
}

.sg-content h3 {
    font-size: var(--text-md);
    margin: var(--space-8) 0 var(--space-3);
}

.sg-content ul,
.sg-content ol {
    margin: 0 0 var(--space-5) var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    line-height: 1.75;
}

.sg-content li::marker {
    color: var(--color-accent-dim);
    font-weight: 600;
}

.sg-content a {
    color: var(--color-accent-dim);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: rgba(0, 158, 120, 0.35);
    text-underline-offset: 3px;
    transition: color var(--transition);
}

.sg-content a:hover {
    color: var(--color-navy);
    text-decoration-color: currentColor;
}

.sg-content strong {
    color: var(--color-navy);
}

.sg-content blockquote {
    margin: var(--space-6) 0;
    padding: var(--space-4) var(--space-6);
    border-left: 3px solid var(--color-accent);
    background: var(--color-surface);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-style: italic;
    color: var(--color-muted);
}

.sg-content blockquote p:last-child {
    margin-bottom: 0;
}

.sg-content img {
    border-radius: var(--radius-md);
    margin: var(--space-4) 0;
}

.sg-content figure {
    margin: var(--space-6) 0;
}

.sg-content figcaption {
    font-size: var(--text-xs);
    color: var(--color-muted);
    text-align: center;
    margin-top: var(--space-2);
}

/* Tablas como tarjeta: fondo blanco, borde y esquinas redondeadas,
   para que no se pierdan sobre el gris del fondo del artículo */
.sg-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    font-size: var(--text-sm);
    margin: var(--space-6) 0;
}

.sg-content th,
.sg-content td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    text-align: left;
}

.sg-content th {
    background: var(--color-navy);
    color: #fff;
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: none;
}

.sg-content tbody tr:nth-child(even) td {
    background: #FAFBFD;
}

.sg-content tbody tr:last-child td {
    border-bottom: none;
}

/* Esquinas redondeadas celda a celda (border-radius no recorta
   el contenido de una tabla de forma fiable) */
.sg-content thead th:first-child { border-top-left-radius: calc(var(--radius-md) - 1px); }
.sg-content thead th:last-child  { border-top-right-radius: calc(var(--radius-md) - 1px); }
.sg-content tbody tr:last-child td:first-child { border-bottom-left-radius: calc(var(--radius-md) - 1px); }
.sg-content tbody tr:last-child td:last-child  { border-bottom-right-radius: calc(var(--radius-md) - 1px); }

/* ─────────────────────────────────────────────
   CTA A SIMULADORES
───────────────────────────────────────────── */
.sg-cta {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    margin-top: var(--space-10);
    padding: var(--space-6);
    background: linear-gradient(135deg, rgba(0, 200, 150, 0.08), rgba(13, 31, 60, 0.04));
    border: 1px solid rgba(0, 200, 150, 0.3);
    border-radius: var(--radius-lg);
}

.sg-cta__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: rgba(0, 200, 150, 0.14);
    color: var(--color-accent-dim);
}

.sg-cta__body {
    flex: 1;
}

.sg-cta__title {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--color-navy);
    margin: 0 0 2px;
}

.sg-cta__text {
    font-size: var(--text-sm);
    color: var(--color-muted);
    margin: 0;
    max-width: none;
}

.sg-cta__btn {
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .sg-cta {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ─────────────────────────────────────────────
   RELACIONADOS
───────────────────────────────────────────── */
.sg-related {
    background: var(--color-bg-deep);
    border-top: 1px solid var(--color-border);
    padding: var(--space-14) 0 var(--space-16);
}
