/* ==========================================================================
   Single Blog Post — Ntono Digital
   Template: single.php
   Uses the native --ntono-* CSS variable system from class-theme-css.php
   ========================================================================== */

/* ─── Local aliases that map to the global design tokens ─── */
:root {
    --sp-accent:       var(--ntono-accent, #FAA916);
    --sp-danger:       var(--ntono-danger, #660708);
    --sp-bg:           var(--ntono-bg-dark, #0B090A);
    --sp-surface:      var(--ntono-surface, #161A1D);
    --sp-text:         var(--ntono-text, #E0E1DD);
    --sp-text-muted:   var(--ntono-text-soft, #B1A7A6);
    --sp-border:       rgba(255, 255, 255, 0.07);
    --sp-font-display: var(--ntono-font-display, 'Space Grotesk', sans-serif);
    --sp-font-body:    var(--ntono-font-sans, 'Inter', sans-serif);
    --sp-max-w:        1200px;
}

/* ─── Page wrapper ─── */
.ntono-single-post {
    background-color: var(--sp-bg);
    color: var(--sp-text);
    font-family: var(--sp-font-body);
    overflow-x: hidden;
}

/* ─── Ambient glow ─── */
.sp-glow {
    position: fixed;
    top: 0;
    right: 0;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle at top right, rgba(102, 7, 8, 0.12), transparent 65%);
    pointer-events: none;
    z-index: 0;
}

/* ==========================================================================
   HERO / HEADER
   ========================================================================== */
.sp-hero {
    position: relative;
    padding: 9rem 0 4rem;
    z-index: 1;
    border-bottom: 1px solid var(--sp-border);
    min-height: 60vh;
    display: flex;
    align-items: flex-end;
}

.sp-hero__bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.sp-hero__bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.4;
    mix-blend-mode: overlay;
    filter: saturate(1.2) contrast(1.1);
}

.sp-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(11, 9, 10, 0.4), var(--sp-bg) 95%);
    z-index: 1;
}

.sp-hero__content {
    max-width: var(--sp-max-w);
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 2;
    width: 100%;
}

.sp-category-badge {
    display: inline-block;
    padding: 0.25rem 0.85rem;
    border: 1px solid rgba(250, 169, 22, 0.25);
    background: rgba(250, 169, 22, 0.08);
    color: var(--sp-accent);
    font-family: var(--sp-font-body);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    border-radius: 9999px;
    margin-bottom: 2rem;
}

.sp-title {
    font-family: var(--sp-font-display);
    font-size: clamp(2.25rem, 5.5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    color: #fff;
    letter-spacing: -0.03em;
    margin-bottom: 2.5rem;
    max-width: 820px;
}

.sp-meta {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--sp-border);
}

@media (min-width: 680px) {
    .sp-meta {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.sp-author {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sp-author__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(250, 169, 22, 0.2);
    flex-shrink: 0;
}

.sp-author__avatar img { width: 100%; height: 100%; object-fit: cover; }

.sp-author__name {
    font-family: var(--sp-font-body);
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    display: block;
}

.sp-author__company {
    font-family: var(--sp-font-body);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--sp-text-muted);
    display: block;
    margin-top: 2px;
}

.sp-meta-details {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-family: var(--sp-font-body);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--sp-text-muted);
}

.sp-meta-details span + span {
    position: relative;
    padding-left: 1.2rem;
}

.sp-meta-details span + span::before {
    content: '·';
    position: absolute;
    left: 0.35rem;
    opacity: 0.4;
}

/* ==========================================================================
   CONTENT LAYOUT
   ========================================================================== */
.sp-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    max-width: var(--sp-max-w);
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 1;
}

@media (min-width: 1080px) {
    .sp-layout {
        grid-template-columns: 48px 1fr 300px;
        gap: 0 3rem;
    }
}

/* Social rail */
.sp-social-rail { display: none; }

@media (min-width: 1080px) {
    .sp-social-rail {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1.25rem;
        padding-top: 2rem;
        position: sticky;
        top: 7rem;
        align-self: start;
    }
}

.sp-social-rail__divider {
    width: 1px;
    height: 40px;
    background: var(--sp-border);
    margin: 0 auto;
}

.sp-social-rail a,
.sp-social-rail button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--sp-border);
    background: transparent;
    color: var(--sp-text-muted);
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    text-decoration: none;
}

.sp-social-rail a:hover,
.sp-social-rail button:hover {
    color: var(--sp-accent);
    border-color: rgba(250, 169, 22, 0.35);
    background: rgba(250, 169, 22, 0.06);
}

/* ─── Article ─── */
.sp-article {
    min-width: 0;
    padding-top: 3.5rem;
    padding-bottom: 6rem;
}

/* ==========================================================================
   RICH TEXT / GUTENBERG CONTENT
   ========================================================================== */
.sp-content {
    color: rgba(224, 225, 221, 0.85);
    font-family: var(--sp-font-body);
    font-size: 1.0625rem;
    line-height: 1.85;
}

.sp-content p { margin-bottom: 1.75rem; }

.sp-content h2,
.sp-content h3,
.sp-content h4 {
    font-family: var(--sp-font-display);
    color: #fff;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-top: 3.5rem;
    margin-bottom: 1.25rem;
    line-height: 1.2;
}

.sp-content h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    padding-left: 1rem;
    border-left: 3px solid var(--sp-accent);
}

.sp-content h3 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); }
.sp-content h4 { font-size: 1.1rem; color: var(--sp-text-muted); }

.sp-content a {
    color: var(--sp-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.2s;
}
.sp-content a:hover { opacity: 0.8; }

.sp-content strong { color: #fff; font-weight: 700; }

.sp-content blockquote {
    position: relative;
    margin: 3rem 0;
    padding: 2.5rem 2.5rem 2.5rem 3rem;
    background: rgba(250, 169, 22, 0.04);
    border-left: 3px solid var(--sp-accent);
    border-radius: 0 12px 12px 0;
}

.sp-content blockquote::before {
    content: '\201C';
    position: absolute;
    top: -1.5rem;
    left: 2rem;
    font-family: var(--sp-font-display);
    font-size: 6rem;
    color: var(--sp-accent);
    opacity: 0.2;
    line-height: 1;
}

.sp-content blockquote p {
    font-family: var(--sp-font-display);
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    font-style: italic;
    color: #fff;
    line-height: 1.5;
    margin-bottom: 0;
}

.sp-content ul,
.sp-content ol {
    margin: 1.75rem 0;
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.sp-content ul li {
    padding-left: 1.5rem;
    position: relative;
}

.sp-content ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.6rem;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--sp-accent);
}

.sp-content ol { counter-reset: ol-counter; }

.sp-content ol li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    counter-increment: ol-counter;
}

.sp-content ol li::before {
    content: counter(ol-counter, decimal-leading-zero);
    font-family: var(--sp-font-display);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--sp-accent);
    letter-spacing: 0.05em;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.sp-content img,
.sp-content figure img {
    border-radius: 10px;
    max-width: 100%;
    height: auto;
    margin: 2.5rem 0;
    border: 1px solid var(--sp-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.sp-content figure { margin: 2.5rem 0; }

.sp-content figcaption {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sp-text-muted);
    margin-top: 0.85rem;
    opacity: 0.7;
}

.sp-content code {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--sp-border);
    border-radius: 4px;
    padding: 0.15em 0.45em;
    color: var(--sp-accent);
    font-size: 0.875rem;
}

.sp-content pre {
    background: rgba(11, 9, 10, 0.8);
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    padding: 1.75rem;
    overflow-x: auto;
    margin: 2rem 0;
}

.sp-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: #E0E1DD;
}

.sp-content hr {
    border: none;
    border-top: 1px solid var(--sp-border);
    margin: 3rem 0;
}

/* ==========================================================================
   OVERRIDE INLINE STYLES — Callout boxes escritos para tema claro
   El editor de Gutenberg permite añadir style="background:#f0f7ff"
   directamente en bloques HTML. En el tema oscuro esos colores resultan
   ilegibles. Redirigimos su paleta al sistema Ntono con !important.
   ========================================================================== */

/* Div con fondo claro hardcodeado → fondo tintado con el acento */
.sp-content div[style*="background"] {
    background: rgba(250, 169, 22, 0.05) !important;
    border-radius: 10px !important;
    color: var(--sp-text) !important;
}

/* Borde lateral (border-left) → color acento Ntono */
.sp-content div[style*="border-left"] {
    border-left-color: var(--sp-accent) !important;
}

/* Texto en strong dentro del callout */
.sp-content div[style*="background"] strong {
    color: #fff !important;
}

/* Párrafos dentro del callout */
.sp-content div[style*="background"] p {
    color: var(--sp-text-muted) !important;
}

/* Links con fondo (botones CTA inline) → paleta Ntono */
.sp-content div[style*="background"] a[style*="background"],
.sp-content div[style*="background"] a[style*="color"] {
    background: var(--sp-accent) !important;
    color: #000 !important;
    border-radius: var(--ntono-button-radius, 9999px) !important;
    border: none !important;
    font-family: var(--sp-font-body) !important;
    transition: opacity 0.2s, transform 0.2s !important;
    text-decoration: none !important;
}

.sp-content div[style*="background"] a[style*="background"]:hover,
.sp-content div[style*="background"] a[style*="color"]:hover {
    opacity: 0.85 !important;
    transform: translateY(-1px) !important;
}

/* ==========================================================================
   POST FOOTER
   ========================================================================== */
.sp-post-footer {
    margin-top: 4rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--sp-border);
}

.sp-share-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 3rem;
}

.sp-share-label {
    font-family: var(--sp-font-body);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--sp-text-muted);
}

.sp-share-buttons { display: flex; gap: 0.75rem; }

.sp-share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--sp-border);
    background: transparent;
    color: var(--sp-text-muted);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    text-decoration: none;
}

.sp-share-btn:hover {
    color: var(--sp-accent);
    border-color: rgba(250, 169, 22, 0.3);
    background: rgba(250, 169, 22, 0.06);
}

/* Prev / Next */
.sp-post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--sp-border);
}

/* min-width:0 es crítico en CSS Grid: evita que una celda se expanda
   más allá de su columna cuando el contenido (título largo) no tiene
   puntos de quiebre naturales. Sin esto, line-clamp no tiene efecto. */
.sp-post-nav__item {
    text-decoration: none;
    padding: 1.5rem;
    min-width: 0;        /* permite que la celda se comprima en la columna */
    overflow: hidden;    /* garantía extra: nada desborda el borde redondeado */
}

.sp-post-nav__item--next { text-align: right; }

.sp-post-nav__dir {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--sp-font-body);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--sp-accent);
    margin-bottom: 0.65rem;
}

.sp-post-nav__item--next .sp-post-nav__dir { justify-content: flex-end; }

.sp-post-nav__title {
    font-family: var(--sp-font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.35;
    /* Truncado en 2 líneas */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* word-break rompe palabras sin espacios (URLs, slugs largos) */
    word-break: break-word;
    overflow-wrap: break-word;
    transition: color 0.2s;
}

.sp-post-nav__item:hover .sp-post-nav__title { color: var(--sp-accent); }

@media (max-width: 560px) {
    .sp-post-nav { grid-template-columns: 1fr; }
    .sp-post-nav__item--next { text-align: left; }
    .sp-post-nav__item--next .sp-post-nav__dir { justify-content: flex-start; }
    .sp-post-nav__title { display: none; }
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sp-sidebar { display: none; }

@media (min-width: 1080px) {
    .sp-sidebar {
        display: block;
        padding-top: 2rem;
        position: sticky;
        top: 7rem;
        align-self: start;
    }
}

.sp-author-card {
    background: rgba(22, 26, 29, 0.6);
    border: 1px solid var(--sp-border);
    border-radius: 14px;
    padding: 2rem 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.sp-author-card::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 160px;
    height: 160px;
    background: rgba(250, 169, 22, 0.06);
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
}

.sp-author-card__avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(250, 169, 22, 0.18);
    margin: 0 auto 1.25rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.sp-author-card__avatar img { width: 100%; height: 100%; object-fit: cover; }

.sp-author-card__name {
    font-family: var(--sp-font-display);
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.sp-author-card__bio {
    font-family: var(--sp-font-body);
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--sp-text-muted);
}

.sp-sidebar-widget {
    background: rgba(22, 26, 29, 0.4);
    border: 1px dashed rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 1.75rem;
    margin-bottom: 2rem;
    text-align: center;
}

.sp-sidebar-widget .material-symbols-outlined {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.15);
    display: block;
    margin-bottom: 0.75rem;
}

.sp-sidebar-widget__label {
    font-family: var(--sp-font-body);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--sp-text-muted);
}

/* ==========================================================================
   RELATED POSTS
   ========================================================================== */
.sp-related {
    max-width: var(--sp-max-w);
    margin: 0 auto;
    padding: 5rem 2rem;
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--sp-border);
}

.sp-related__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.sp-related__kicker-line {
    display: block;
    width: 2rem;
    height: 1px;
    background: var(--sp-accent);
}

.sp-related__kicker {
    font-family: var(--sp-font-body);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--sp-accent);
}

.sp-related__title {
    font-family: var(--sp-font-display);
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    margin-bottom: 3rem;
}

.sp-related__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 640px) {
    .sp-related__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
    .sp-related__grid { grid-template-columns: repeat(3, 1fr); }
}

.sp-related-card { text-decoration: none; display: block; }

.sp-related-card__thumb {
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--sp-border);
    background: var(--sp-surface);
    margin-bottom: 1.25rem;
    position: relative;
}

.sp-related-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.sp-related-card:hover .sp-related-card__thumb img { transform: scale(1.05); }

.sp-related-card__thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(22, 26, 29, 0.6);
}

.sp-related-card__thumb--empty .material-symbols-outlined {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.15);
}

.sp-related-card__cat {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: rgba(11, 9, 10, 0.82);
    backdrop-filter: blur(8px);
    padding: 0.2rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #fff;
}

.sp-related-card__title {
    font-family: var(--sp-font-display);
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.4;
    letter-spacing: -0.01em;
    transition: color 0.2s;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sp-related-card:hover .sp-related-card__title { color: var(--sp-accent); }

/* ==========================================================================
   BOTTOM CTA
   ========================================================================== */
.sp-cta {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 2rem 8rem;
    position: relative;
    z-index: 1;
}

.sp-cta__inner {
    background: rgba(22, 26, 29, 0.7);
    border: 1px solid var(--sp-border);
    border-radius: 20px;
    padding: 4rem 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(16px);
}

.sp-cta__glow {
    position: absolute;
    top: -80px;
    right: -80px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(250, 169, 22, 0.07), transparent 65%);
    border-radius: 50%;
    pointer-events: none;
}

.sp-cta__glow-2 {
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(102, 7, 8, 0.1), transparent 65%);
    border-radius: 50%;
    pointer-events: none;
}

.sp-cta__kicker {
    font-family: var(--sp-font-body);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--sp-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.sp-cta__kicker-line {
    display: block;
    width: 1.5rem;
    height: 1px;
    background: var(--sp-accent);
}

.sp-cta__title {
    font-family: var(--sp-font-display);
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 1;
}

.sp-cta__text {
    font-family: var(--sp-font-body);
    font-size: 1.05rem;
    color: var(--sp-text-muted);
    line-height: 1.65;
    max-width: 520px;
    margin: 0 auto 2.5rem;
    position: relative;
    z-index: 1;
}

.sp-cta__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--sp-accent);
    color: #000;
    font-family: var(--sp-font-body);
    font-size: 0.9rem;
    font-weight: 700;
    padding: 1rem 2.25rem;
    border-radius: var(--ntono-button-radius, 9999px);
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    position: relative;
    z-index: 1;
    letter-spacing: -0.01em;
}

.sp-cta__btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(250, 169, 22, 0.25);
}

.sp-cta__arrow { transition: transform 0.25s ease; }
.sp-cta__btn:hover .sp-cta__arrow { transform: translateX(4px); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
    .sp-hero { padding: 7rem 0 3rem; }
    .sp-hero__content { padding: 0 1.25rem; }
    .sp-layout { padding: 0 1.25rem; }
    .sp-cta__inner { padding: 3rem 1.5rem; }
    .sp-related { padding: 4rem 1.25rem; }
}

@media (max-width: 480px) {
    .sp-hero { padding-top: 6rem; }
    .sp-content { font-size: 1rem; }
    .sp-content h2 { margin-top: 2.5rem; padding-left: 0.85rem; }
}
